From c98501343b116121cdcaf9504d8368a68a4fb592 Mon Sep 17 00:00:00 2001 From: nikhil Date: Fri, 19 Apr 2024 20:36:59 +0100 Subject: [PATCH 0001/1490] f-aws_instance: support for launch time --- .../service/ec2/ec2_instance_data_source.go | 5 +++++ .../ec2/ec2_instance_data_source_test.go | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/internal/service/ec2/ec2_instance_data_source.go b/internal/service/ec2/ec2_instance_data_source.go index b27c7cbc8b0..3724f360c35 100644 --- a/internal/service/ec2/ec2_instance_data_source.go +++ b/internal/service/ec2/ec2_instance_data_source.go @@ -208,6 +208,10 @@ func DataSourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "launch_time": { + Type: schema.TypeString, + Computed: true, + }, "maintenance_options": { Type: schema.TypeList, Computed: true, @@ -479,6 +483,7 @@ func instanceDescriptionAttributes(ctx context.Context, d *schema.ResourceData, d.Set("ami", instance.ImageId) d.Set("instance_type", instanceType) d.Set("key_name", instance.KeyName) + d.Set("launch_time", instance.LaunchTime) d.Set("outpost_arn", instance.OutpostArn) d.Set("private_dns", instance.PrivateDnsName) d.Set("private_ip", instance.PrivateIpAddress) diff --git a/internal/service/ec2/ec2_instance_data_source_test.go b/internal/service/ec2/ec2_instance_data_source_test.go index 3927bbc4475..c29883d3b28 100644 --- a/internal/service/ec2/ec2_instance_data_source_test.go +++ b/internal/service/ec2/ec2_instance_data_source_test.go @@ -33,6 +33,7 @@ func TestAccEC2InstanceDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "arn", resourceName, "arn"), resource.TestCheckNoResourceAttr(datasourceName, "user_data_base64"), resource.TestCheckResourceAttr(datasourceName, "outpost_arn", ""), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), ), }, }, @@ -56,6 +57,7 @@ func TestAccEC2InstanceDataSource_tags(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), ), }, }, @@ -81,6 +83,7 @@ func TestAccEC2InstanceDataSource_azUserData(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), resource.TestCheckResourceAttrPair(datasourceName, "availability_zone", resourceName, "availability_zone"), resource.TestCheckResourceAttrPair(datasourceName, "user_data", resourceName, "user_data"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), ), }, }, @@ -103,6 +106,7 @@ func TestAccEC2InstanceDataSource_gp2IopsDevice(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "root_block_device.#", resourceName, "root_block_device.#"), resource.TestCheckResourceAttrPair(datasourceName, "root_block_device.0.volume_size", resourceName, "root_block_device.0.volume_size"), resource.TestCheckResourceAttrPair(datasourceName, "root_block_device.0.volume_type", resourceName, "root_block_device.0.volume_type"), @@ -130,6 +134,7 @@ func TestAccEC2InstanceDataSource_gp3ThroughputDevice(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "root_block_device.#", resourceName, "root_block_device.#"), resource.TestCheckResourceAttrPair(datasourceName, "root_block_device.0.volume_size", resourceName, "root_block_device.0.volume_size"), resource.TestCheckResourceAttrPair(datasourceName, "root_block_device.0.volume_type", resourceName, "root_block_device.0.volume_type"), @@ -157,6 +162,7 @@ func TestAccEC2InstanceDataSource_blockDevices(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "root_block_device.#", resourceName, "root_block_device.#"), resource.TestCheckResourceAttrPair(datasourceName, "root_block_device.0.volume_size", resourceName, "root_block_device.0.volume_size"), resource.TestCheckResourceAttrPair(datasourceName, "root_block_device.0.volume_type", resourceName, "root_block_device.0.volume_type"), @@ -220,6 +226,7 @@ func TestAccEC2InstanceDataSource_rootInstanceStore(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "ebs_block_device.#", resourceName, "ebs_block_device.#"), resource.TestCheckResourceAttrPair(datasourceName, "ebs_optimized", resourceName, "ebs_optimized"), resource.TestCheckResourceAttrPair(datasourceName, "root_block_device.#", resourceName, "root_block_device.#"), @@ -245,6 +252,7 @@ func TestAccEC2InstanceDataSource_privateIP(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "private_dns_name_options.#", resourceName, "private_dns_name_options.#"), resource.TestCheckResourceAttrPair(datasourceName, "private_dns_name_options.0.enable_resource_name_dns_aaaa_record", resourceName, "private_dns_name_options.0.enable_resource_name_dns_aaaa_record"), resource.TestCheckResourceAttrPair(datasourceName, "private_dns_name_options.0.enable_resource_name_dns_a_record", resourceName, "private_dns_name_options.0.enable_resource_name_dns_a_record"), @@ -272,6 +280,7 @@ func TestAccEC2InstanceDataSource_secondaryPrivateIPs(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "secondary_private_ips", resourceName, "secondary_private_ips"), ), }, @@ -295,6 +304,7 @@ func TestAccEC2InstanceDataSource_ipv6Addresses(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "ipv6_addresses.#", resourceName, "ipv6_address_count"), ), }, @@ -324,6 +334,7 @@ func TestAccEC2InstanceDataSource_keyPair(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "key_name", resourceName, "key_name"), ), }, @@ -347,6 +358,7 @@ func TestAccEC2InstanceDataSource_vpc(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "user_data", resourceName, "user_data"), resource.TestCheckResourceAttrPair(datasourceName, "associate_public_ip_address", resourceName, "associate_public_ip_address"), resource.TestCheckResourceAttrPair(datasourceName, "tenancy", resourceName, "tenancy"), @@ -393,6 +405,7 @@ func TestAccEC2InstanceDataSource_securityGroups(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "user_data", resourceName, "user_data"), resource.TestCheckResourceAttrPair(datasourceName, "vpc_security_group_ids.#", resourceName, "vpc_security_group_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "security_groups.#", resourceName, "security_groups.#"), @@ -418,6 +431,7 @@ func TestAccEC2InstanceDataSource_vpcSecurityGroups(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "vpc_security_group_ids.#", resourceName, "vpc_security_group_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "security_groups.#", resourceName, "security_groups.#"), ), @@ -610,6 +624,7 @@ func TestAccEC2InstanceDataSource_creditSpecification(t *testing.T) { Config: testAccInstanceDataSourceConfig_creditSpecification(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "credit_specification.#", resourceName, "credit_specification.#"), resource.TestCheckResourceAttrPair(datasourceName, "credit_specification.0.cpu_credits", resourceName, "credit_specification.0.cpu_credits"), ), @@ -681,6 +696,7 @@ func TestAccEC2InstanceDataSource_blockDeviceTags(t *testing.T) { Config: testAccInstanceDataSourceConfig_blockDeviceTags(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), ), }, }, @@ -732,6 +748,7 @@ func TestAccEC2InstanceDataSource_timeout(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "ami", resourceName, "ami"), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), resource.TestCheckResourceAttrPair(datasourceName, "instance_type", resourceName, "instance_type"), + resource.TestCheckResourceAttrSet(datasourceName, "launch_time"), resource.TestCheckResourceAttrPair(datasourceName, "arn", resourceName, "arn"), ), }, From 518e48bb6c2fdf25936cf14703375ac5f179c97a Mon Sep 17 00:00:00 2001 From: nikhil Date: Fri, 19 Apr 2024 20:39:52 +0100 Subject: [PATCH 0002/1490] f-support for network_card_index --- .changelog/37002.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/37002.txt diff --git a/.changelog/37002.txt b/.changelog/37002.txt new file mode 100644 index 00000000000..b6795a33d3a --- /dev/null +++ b/.changelog/37002.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +data-source/aws_instance: Add `launch_time` attribute +``` \ No newline at end of file From b3c5fa0f8f8755c19f63a8dea84c07a7fca8bae2 Mon Sep 17 00:00:00 2001 From: nikhil Date: Fri, 19 Apr 2024 20:41:15 +0100 Subject: [PATCH 0003/1490] f-aws_instance: support for launch time --- website/docs/d/instance.html.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/d/instance.html.markdown b/website/docs/d/instance.html.markdown index 38071202494..9b685f5eebc 100644 --- a/website/docs/d/instance.html.markdown +++ b/website/docs/d/instance.html.markdown @@ -88,6 +88,7 @@ interpolation. * `instance_type` - Type of the Instance. * `ipv6_addresses` - IPv6 addresses associated to the Instance, if applicable. **NOTE**: Unlike the IPv4 address, this doesn't change if you attach an EIP to the instance. * `key_name` - Key name of the Instance. +* `launch_time` - Time the instance was launched. * `maintenance_options` - Maintenance and recovery options for the instance. * `auto_recovery` - Automatic recovery behavior of the instance. * `metadata_options` - Metadata options of the Instance. From a29a41721e08b83e06207d27d15f50852c672c0b Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 20 Apr 2024 11:37:46 +0100 Subject: [PATCH 0004/1490] f-aws_instance: support launch time --- internal/service/ec2/ec2_instance_data_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ec2/ec2_instance_data_source.go b/internal/service/ec2/ec2_instance_data_source.go index 3724f360c35..5851a24b8b7 100644 --- a/internal/service/ec2/ec2_instance_data_source.go +++ b/internal/service/ec2/ec2_instance_data_source.go @@ -483,7 +483,7 @@ func instanceDescriptionAttributes(ctx context.Context, d *schema.ResourceData, d.Set("ami", instance.ImageId) d.Set("instance_type", instanceType) d.Set("key_name", instance.KeyName) - d.Set("launch_time", instance.LaunchTime) + d.Set("launch_time", instance.LaunchTime.Format(time.RFC3339)) d.Set("outpost_arn", instance.OutpostArn) d.Set("private_dns", instance.PrivateDnsName) d.Set("private_ip", instance.PrivateIpAddress) From 86263eb0bc5b3b7aabaf803d669ea2a273e041e8 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 20 Apr 2024 21:48:44 +0100 Subject: [PATCH 0005/1490] f-aws_ecs_account_setting_default --- .../service/ecs/account_setting_default.go | 3 +- .../ecs/account_setting_default_test.go | 48 +++++++++++++++++-- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/internal/service/ecs/account_setting_default.go b/internal/service/ecs/account_setting_default.go index e5beae7527e..b28ab4d6fc3 100644 --- a/internal/service/ecs/account_setting_default.go +++ b/internal/service/ecs/account_setting_default.go @@ -146,11 +146,12 @@ func resourceAccountSettingDefaultDelete(ctx context.Context, d *schema.Resource conn := meta.(*conns.AWSClient).ECSConn(ctx) settingName := d.Get("name").(string) + settingValue := d.Get("value").(string) log.Printf("[WARN] Disabling ECS Account Setting Default %s", settingName) input := ecs.PutAccountSettingDefaultInput{ Name: aws.String(settingName), - Value: aws.String("disabled"), + Value: aws.String(settingValue), } _, err := conn.PutAccountSettingDefaultWithContext(ctx, &input) diff --git a/internal/service/ecs/account_setting_default_test.go b/internal/service/ecs/account_setting_default_test.go index 2459c9efe7a..c1806dad125 100644 --- a/internal/service/ecs/account_setting_default_test.go +++ b/internal/service/ecs/account_setting_default_test.go @@ -23,11 +23,12 @@ func TestAccECSAccountSettingDefault_serial(t *testing.T) { t.Parallel() testCases := map[string]func(*testing.T){ - "containerInstanceLongARNFormat": testAccAccountSettingDefault_containerInstanceLongARNFormat, - "serviceLongARNFormat": testAccAccountSettingDefault_serviceLongARNFormat, - "taskLongARNFormat": testAccAccountSettingDefault_taskLongARNFormat, - "vpcTrunking": testAccAccountSettingDefault_vpcTrunking, - "containerInsights": testAccAccountSettingDefault_containerInsights, + // "containerInstanceLongARNFormat": testAccAccountSettingDefault_containerInstanceLongARNFormat, + // "serviceLongARNFormat": testAccAccountSettingDefault_serviceLongARNFormat, + // "taskLongARNFormat": testAccAccountSettingDefault_taskLongARNFormat, + // "vpcTrunking": testAccAccountSettingDefault_vpcTrunking, + // "containerInsights": testAccAccountSettingDefault_containerInsights, + "fargateTaskRetirementWaitPeriod": testAccAccountSettingDefault_fargateTaskRetirementWaitPeriod, } acctest.RunSerialTests1Level(t, testCases, 0) @@ -178,6 +179,34 @@ func testAccAccountSettingDefault_containerInsights(t *testing.T) { }) } +func testAccAccountSettingDefault_fargateTaskRetirementWaitPeriod(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_ecs_account_setting_default.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ECSServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckAccountSettingDefaultDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccAccountSettingDefaultConfig_fargateTaskRetirementWaitPeriod(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "name", "fargateTaskRetirementWaitPeriod"), + resource.TestCheckResourceAttr(resourceName, "value", "7"), + acctest.MatchResourceAttrGlobalARN(resourceName, "principal_arn", "iam", regexache.MustCompile("root")), + ), + }, + { + ResourceName: resourceName, + ImportStateId: "fargateTaskRetirementWaitPeriod", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccCheckAccountSettingDefaultDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).ECSConn(ctx) @@ -232,3 +261,12 @@ resource "aws_ecs_account_setting_default" "test" { } `, settingName) } + +func testAccAccountSettingDefaultConfig_fargateTaskRetirementWaitPeriod() string { + return fmt.Sprintf(` +resource "aws_ecs_account_setting_default" "test" { + name = "fargateTaskRetirementWaitPeriod" + value = "7" +} +`) +} From 60d13fe213ef63612bc3e4e612a9c320abc0aca3 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 20 Apr 2024 21:59:20 +0100 Subject: [PATCH 0006/1490] f-support for network_card_index --- internal/service/ecs/account_setting_default.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/service/ecs/account_setting_default.go b/internal/service/ecs/account_setting_default.go index b28ab4d6fc3..327fc4585ed 100644 --- a/internal/service/ecs/account_setting_default.go +++ b/internal/service/ecs/account_setting_default.go @@ -146,7 +146,11 @@ func resourceAccountSettingDefaultDelete(ctx context.Context, d *schema.Resource conn := meta.(*conns.AWSClient).ECSConn(ctx) settingName := d.Get("name").(string) - settingValue := d.Get("value").(string) + settingValue := "disabled" + + if settingName == "fargateTaskRetirementWaitPeriod" { + settingValue = "7" + } log.Printf("[WARN] Disabling ECS Account Setting Default %s", settingName) input := ecs.PutAccountSettingDefaultInput{ From ba64351f719eeea46aff0710a297a2f7740c2fb1 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 20 Apr 2024 22:14:49 +0100 Subject: [PATCH 0007/1490] f-aws_ecs_account_setting_default --- .changelog/37018.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/37018.txt diff --git a/.changelog/37018.txt b/.changelog/37018.txt new file mode 100644 index 00000000000..2f34b11a9ef --- /dev/null +++ b/.changelog/37018.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_ecs_account_setting_default: Add support for `fargateTaskRetirementWaitPeriod` value in `Name` argument +``` \ No newline at end of file From 60d6e3485efee38ffe14efb82e82c2fc7f0ce406 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 20 Apr 2024 22:25:52 +0100 Subject: [PATCH 0008/1490] f-support for network_card_index --- internal/service/ecs/account_setting_default.go | 1 + internal/service/ecs/account_setting_default_test.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/ecs/account_setting_default.go b/internal/service/ecs/account_setting_default.go index 327fc4585ed..d959005448c 100644 --- a/internal/service/ecs/account_setting_default.go +++ b/internal/service/ecs/account_setting_default.go @@ -148,6 +148,7 @@ func resourceAccountSettingDefaultDelete(ctx context.Context, d *schema.Resource settingName := d.Get("name").(string) settingValue := "disabled" + //Default value: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-maintenance.html#task-retirement-change if settingName == "fargateTaskRetirementWaitPeriod" { settingValue = "7" } diff --git a/internal/service/ecs/account_setting_default_test.go b/internal/service/ecs/account_setting_default_test.go index c1806dad125..894f0417a34 100644 --- a/internal/service/ecs/account_setting_default_test.go +++ b/internal/service/ecs/account_setting_default_test.go @@ -193,7 +193,7 @@ func testAccAccountSettingDefault_fargateTaskRetirementWaitPeriod(t *testing.T) Config: testAccAccountSettingDefaultConfig_fargateTaskRetirementWaitPeriod(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", "fargateTaskRetirementWaitPeriod"), - resource.TestCheckResourceAttr(resourceName, "value", "7"), + resource.TestCheckResourceAttr(resourceName, "value", "14"), acctest.MatchResourceAttrGlobalARN(resourceName, "principal_arn", "iam", regexache.MustCompile("root")), ), }, @@ -234,7 +234,7 @@ func testAccCheckAccountSettingDefaultDestroy(ctx context.Context) resource.Test } for _, value := range resp.Settings { - if aws.StringValue(value.Value) != "disabled" { + if aws.StringValue(value.Value) != "disabled" && aws.StringValue(value.Value) != "7" { switch name { case ecs.SettingNameContainerInstanceLongArnFormat: return nil @@ -266,7 +266,7 @@ func testAccAccountSettingDefaultConfig_fargateTaskRetirementWaitPeriod() string return fmt.Sprintf(` resource "aws_ecs_account_setting_default" "test" { name = "fargateTaskRetirementWaitPeriod" - value = "7" + value = "14" } `) } From e64c6822f817ca2dda37b3310125e148845808bd Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 20 Apr 2024 22:26:43 +0100 Subject: [PATCH 0009/1490] f-support for network_card_index --- internal/service/ecs/account_setting_default_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/ecs/account_setting_default_test.go b/internal/service/ecs/account_setting_default_test.go index 894f0417a34..fe9d2c961ab 100644 --- a/internal/service/ecs/account_setting_default_test.go +++ b/internal/service/ecs/account_setting_default_test.go @@ -23,11 +23,11 @@ func TestAccECSAccountSettingDefault_serial(t *testing.T) { t.Parallel() testCases := map[string]func(*testing.T){ - // "containerInstanceLongARNFormat": testAccAccountSettingDefault_containerInstanceLongARNFormat, - // "serviceLongARNFormat": testAccAccountSettingDefault_serviceLongARNFormat, - // "taskLongARNFormat": testAccAccountSettingDefault_taskLongARNFormat, - // "vpcTrunking": testAccAccountSettingDefault_vpcTrunking, - // "containerInsights": testAccAccountSettingDefault_containerInsights, + "containerInstanceLongARNFormat": testAccAccountSettingDefault_containerInstanceLongARNFormat, + "serviceLongARNFormat": testAccAccountSettingDefault_serviceLongARNFormat, + "taskLongARNFormat": testAccAccountSettingDefault_taskLongARNFormat, + "vpcTrunking": testAccAccountSettingDefault_vpcTrunking, + "containerInsights": testAccAccountSettingDefault_containerInsights, "fargateTaskRetirementWaitPeriod": testAccAccountSettingDefault_fargateTaskRetirementWaitPeriod, } From 9699a424c2cf2c179308cedf42b27d75204d9941 Mon Sep 17 00:00:00 2001 From: nikhil Date: Sat, 20 Apr 2024 22:36:15 +0100 Subject: [PATCH 0010/1490] f-aws_ecs_account_setting_default --- internal/service/ecs/account_setting_default_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/ecs/account_setting_default_test.go b/internal/service/ecs/account_setting_default_test.go index fe9d2c961ab..877c257feb1 100644 --- a/internal/service/ecs/account_setting_default_test.go +++ b/internal/service/ecs/account_setting_default_test.go @@ -182,6 +182,7 @@ func testAccAccountSettingDefault_containerInsights(t *testing.T) { func testAccAccountSettingDefault_fargateTaskRetirementWaitPeriod(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_ecs_account_setting_default.test" + settingName := ecs.SettingNameFargateTaskRetirementWaitPeriod resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -190,7 +191,7 @@ func testAccAccountSettingDefault_fargateTaskRetirementWaitPeriod(t *testing.T) CheckDestroy: testAccCheckAccountSettingDefaultDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccAccountSettingDefaultConfig_fargateTaskRetirementWaitPeriod(), + Config: testAccAccountSettingDefaultConfig_fargateTaskRetirementWaitPeriod(settingName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", "fargateTaskRetirementWaitPeriod"), resource.TestCheckResourceAttr(resourceName, "value", "14"), @@ -262,11 +263,11 @@ resource "aws_ecs_account_setting_default" "test" { `, settingName) } -func testAccAccountSettingDefaultConfig_fargateTaskRetirementWaitPeriod() string { +func testAccAccountSettingDefaultConfig_fargateTaskRetirementWaitPeriod(settingName string) string { return fmt.Sprintf(` resource "aws_ecs_account_setting_default" "test" { - name = "fargateTaskRetirementWaitPeriod" + name = %[1]q value = "14" } -`) +`, settingName) } From a3f069be102ea80a837d2c9c51e7853acf877ee7 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Thu, 25 Apr 2024 10:20:31 -0700 Subject: [PATCH 0011/1490] Adds tests for `xray` --- internal/generate/tagstests/main.go | 4 + internal/generate/tagstests/test.go.gtpl | 169 ++++++++++++++++ internal/generate/tagstests/test.tf.gtpl | 41 +++- internal/service/xray/group_tags_gen_test.go | 190 ++++++++++++++++++ .../xray/sampling_rule_tags_gen_test.go | 190 ++++++++++++++++++ .../xray/testdata/Group/tags/main_gen.tf | 1 - .../xray/testdata/Group/tags0/main_gen.tf | 1 - .../testdata/Group/tags0_defaults/main_gen.tf | 2 - .../testdata/Group/tagsComputed1/main_gen.tf | 27 +++ .../testdata/Group/tagsComputed2/main_gen.tf | 37 ++++ .../xray/testdata/Group/tagsNull/main_gen.tf | 2 +- .../Group/tagsNull_defaults/main_gen.tf | 1 - .../testdata/Group/tags_defaults/main_gen.tf | 2 - .../testdata/SamplingRule/tags/main_gen.tf | 1 - .../testdata/SamplingRule/tags0/main_gen.tf | 1 - .../SamplingRule/tags0_defaults/main_gen.tf | 2 - .../SamplingRule/tagsComputed1/main_gen.tf | 40 ++++ .../SamplingRule/tagsComputed2/main_gen.tf | 50 +++++ .../SamplingRule/tagsNull/main_gen.tf | 2 +- .../tagsNull_defaults/main_gen.tf | 1 - .../SamplingRule/tags_defaults/main_gen.tf | 2 - 21 files changed, 748 insertions(+), 18 deletions(-) create mode 100644 internal/service/xray/testdata/Group/tagsComputed1/main_gen.tf create mode 100644 internal/service/xray/testdata/Group/tagsComputed2/main_gen.tf create mode 100644 internal/service/xray/testdata/SamplingRule/tagsComputed1/main_gen.tf create mode 100644 internal/service/xray/testdata/SamplingRule/tagsComputed2/main_gen.tf diff --git a/internal/generate/tagstests/main.go b/internal/generate/tagstests/main.go index 4eb2052e5b8..8bdbe722a49 100644 --- a/internal/generate/tagstests/main.go +++ b/internal/generate/tagstests/main.go @@ -125,6 +125,8 @@ func main() { generateTestConfig(g, testDirPath, "tags0", true, configTmplFile, configTmpl) generateTestConfig(g, testDirPath, "tagsNull", false, configTmplFile, configTmpl) generateTestConfig(g, testDirPath, "tagsNull", true, configTmplFile, configTmpl) + generateTestConfig(g, testDirPath, "tagsComputed1", false, configTmplFile, configTmpl) + generateTestConfig(g, testDirPath, "tagsComputed2", false, configTmplFile, configTmpl) } } @@ -166,6 +168,7 @@ type goImport struct { type ConfigDatum struct { Tags string WithDefaultTags bool + ComputedTag bool } //go:embed test.go.gtpl @@ -388,6 +391,7 @@ func generateTestConfig(g *common.Generator, dirPath, test string, withDefaults configData := ConfigDatum{ Tags: test, WithDefaultTags: withDefaults, + ComputedTag: (test == "tagsComputed"), } if err := tf.WriteTemplateSet(tfTemplates, configData); err != nil { g.Fatalf("error generating Terraform file %q: %s", mainPath, err) diff --git a/internal/generate/tagstests/test.go.gtpl b/internal/generate/tagstests/test.go.gtpl index af0e7237b73..6b327593e38 100644 --- a/internal/generate/tagstests/test.go.gtpl +++ b/internal/generate/tagstests/test.go.gtpl @@ -53,6 +53,8 @@ import ( sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" {{- end }} "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" {{ range .GoImports -}} @@ -1024,3 +1026,170 @@ func {{ template "testname" . }}_tags_DefaultTags_nullNonOverlappingResourceTag( }, }) } + +func {{ template "testname" . }}_tags_ComputedTag_OnCreate(t *testing.T) { + {{- template "Init" . }} + + resource.{{ if .Serialize }}Test{{ else }}ParallelTest{{ end }}(t, resource.TestCase{ + {{ template "TestCaseSetupNoProviders" . }} + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + {{- template "ExistsCheck" . -}} + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + {{- template "ImportBody" .ImportIgnore -}} + }, + }, + }) +} + +func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + {{- template "Init" . }} + + resource.{{ if .Serialize }}Test{{ else }}ParallelTest{{ end }}(t, resource.TestCase{ + {{ template "TestCaseSetupNoProviders" . }} + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + {{- template "ExistsCheck" . -}} + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + {{- template "ExistsCheck" . -}} + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + {{- template "ImportBody" .ImportIgnore -}} + }, + }, + }) +} + +func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + {{- template "Init" . }} + + resource.{{ if .Serialize }}Test{{ else }}ParallelTest{{ end }}(t, resource.TestCase{ + {{ template "TestCaseSetupNoProviders" . }} + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + {{- template "ExistsCheck" . -}} + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + {{- template "ExistsCheck" . -}} + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + {{- template "ImportBody" .ImportIgnore -}} + }, + }, + }) +} diff --git a/internal/generate/tagstests/test.tf.gtpl b/internal/generate/tagstests/test.tf.gtpl index 0b19ccea3a5..141bdfa7347 100644 --- a/internal/generate/tagstests/test.tf.gtpl +++ b/internal/generate/tagstests/test.tf.gtpl @@ -9,6 +9,15 @@ tags = { (var.tagKey1) = null } +{{- else if eq . "tagsComputed1"}} + tags = { + (var.unknownTagKey) = null_resource.test.id + } +{{- else if eq . "tagsComputed2"}} + tags = { + (var.unknownTagKey) = null_resource.test.id + (var.knownTagKey) = var.knownTagValue + } {{- end -}} {{ end -}} @@ -21,9 +30,18 @@ provider "aws" { {{ end }} +{{- if or (eq .Tags "tagsComputed1") (eq .Tags "tagsComputed2") -}} +provider "null" {} + +{{ end -}} + {{- block "body" .Tags }} Missing block "body" in template {{ end }} +{{ if or (eq .Tags "tagsComputed1") (eq .Tags "tagsComputed2") -}} +resource "null_resource" "test" {} + +{{ end -}} variable "rName" { type = string @@ -40,11 +58,30 @@ variable "tagKey1" { type = string nullable = false } -{{- end }} +{{ else if eq .Tags "tagsComputed1" }} +variable "unknownTagKey" { + type = string + nullable = false +} +{{ else if eq .Tags "tagsComputed2" }} +variable "unknownTagKey" { + type = string + nullable = false +} + +variable "knownTagKey" { + type = string + nullable = false +} +variable "knownTagValue" { + type = string + nullable = false +} +{{- end }} {{ if .WithDefaultTags -}} variable "provider_tags" { type = map(string) nullable = false } -{{ end -}} +{{- end }} diff --git a/internal/service/xray/group_tags_gen_test.go b/internal/service/xray/group_tags_gen_test.go index bd350c7c1d1..f24871484d6 100644 --- a/internal/service/xray/group_tags_gen_test.go +++ b/internal/service/xray/group_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1063,3 +1065,191 @@ func TestAccXRayGroup_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing. }, }) } + +func TestAccXRayGroup_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v types.Group + resourceName := "aws_xray_group.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.XRayServiceID), + CheckDestroy: testAccCheckGroupDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Group/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckGroupExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Group/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccXRayGroup_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v types.Group + resourceName := "aws_xray_group.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.XRayServiceID), + CheckDestroy: testAccCheckGroupDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Group/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckGroupExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Group/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckGroupExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Group/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccXRayGroup_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v types.Group + resourceName := "aws_xray_group.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.XRayServiceID), + CheckDestroy: testAccCheckGroupDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Group/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckGroupExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Group/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckGroupExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Group/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/xray/sampling_rule_tags_gen_test.go b/internal/service/xray/sampling_rule_tags_gen_test.go index 7fdca1e406e..beb832966e8 100644 --- a/internal/service/xray/sampling_rule_tags_gen_test.go +++ b/internal/service/xray/sampling_rule_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1063,3 +1065,191 @@ func TestAccXRaySamplingRule_tags_DefaultTags_nullNonOverlappingResourceTag(t *t }, }) } + +func TestAccXRaySamplingRule_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v types.SamplingRule + resourceName := "aws_xray_sampling_rule.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.XRayServiceID), + CheckDestroy: testAccCheckSamplingRuleDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSamplingRuleExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccXRaySamplingRule_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v types.SamplingRule + resourceName := "aws_xray_sampling_rule.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.XRayServiceID), + CheckDestroy: testAccCheckSamplingRuleDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSamplingRuleExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSamplingRuleExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccXRaySamplingRule_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v types.SamplingRule + resourceName := "aws_xray_sampling_rule.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.XRayServiceID), + CheckDestroy: testAccCheckSamplingRuleDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSamplingRuleExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSamplingRuleExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/xray/testdata/Group/tags/main_gen.tf b/internal/service/xray/testdata/Group/tags/main_gen.tf index 4e9615d31e1..3d3cf014f7c 100644 --- a/internal/service/xray/testdata/Group/tags/main_gen.tf +++ b/internal/service/xray/testdata/Group/tags/main_gen.tf @@ -8,7 +8,6 @@ resource "aws_xray_group" "test" { tags = var.tags } - variable "rName" { type = string nullable = false diff --git a/internal/service/xray/testdata/Group/tags0/main_gen.tf b/internal/service/xray/testdata/Group/tags0/main_gen.tf index b6dbac279f6..19460961417 100644 --- a/internal/service/xray/testdata/Group/tags0/main_gen.tf +++ b/internal/service/xray/testdata/Group/tags0/main_gen.tf @@ -7,7 +7,6 @@ resource "aws_xray_group" "test" { } - variable "rName" { type = string nullable = false diff --git a/internal/service/xray/testdata/Group/tags0_defaults/main_gen.tf b/internal/service/xray/testdata/Group/tags0_defaults/main_gen.tf index 19de02b6d67..21e1e7ea71b 100644 --- a/internal/service/xray/testdata/Group/tags0_defaults/main_gen.tf +++ b/internal/service/xray/testdata/Group/tags0_defaults/main_gen.tf @@ -13,13 +13,11 @@ resource "aws_xray_group" "test" { } - variable "rName" { type = string nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/xray/testdata/Group/tagsComputed1/main_gen.tf b/internal/service/xray/testdata/Group/tagsComputed1/main_gen.tf new file mode 100644 index 00000000000..230445464ac --- /dev/null +++ b/internal/service/xray/testdata/Group/tagsComputed1/main_gen.tf @@ -0,0 +1,27 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_xray_group" "test" { + group_name = var.rName + filter_expression = "responsetime > 5" + + tags = { + (var.unknownTagKey) = null_resource.test.id + } +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + + diff --git a/internal/service/xray/testdata/Group/tagsComputed2/main_gen.tf b/internal/service/xray/testdata/Group/tagsComputed2/main_gen.tf new file mode 100644 index 00000000000..f1e6fe9dd1f --- /dev/null +++ b/internal/service/xray/testdata/Group/tagsComputed2/main_gen.tf @@ -0,0 +1,37 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_xray_group" "test" { + group_name = var.rName + filter_expression = "responsetime > 5" + + tags = { + (var.unknownTagKey) = null_resource.test.id + (var.knownTagKey) = var.knownTagValue + } +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + +variable "knownTagKey" { + type = string + nullable = false +} + +variable "knownTagValue" { + type = string + nullable = false +} + diff --git a/internal/service/xray/testdata/Group/tagsNull/main_gen.tf b/internal/service/xray/testdata/Group/tagsNull/main_gen.tf index a29ea33b2db..b3146577765 100644 --- a/internal/service/xray/testdata/Group/tagsNull/main_gen.tf +++ b/internal/service/xray/testdata/Group/tagsNull/main_gen.tf @@ -10,7 +10,6 @@ resource "aws_xray_group" "test" { } } - variable "rName" { type = string nullable = false @@ -21,3 +20,4 @@ variable "tagKey1" { nullable = false } + diff --git a/internal/service/xray/testdata/Group/tagsNull_defaults/main_gen.tf b/internal/service/xray/testdata/Group/tagsNull_defaults/main_gen.tf index 28c43093b17..5bc05a4a7de 100644 --- a/internal/service/xray/testdata/Group/tagsNull_defaults/main_gen.tf +++ b/internal/service/xray/testdata/Group/tagsNull_defaults/main_gen.tf @@ -16,7 +16,6 @@ resource "aws_xray_group" "test" { } } - variable "rName" { type = string nullable = false diff --git a/internal/service/xray/testdata/Group/tags_defaults/main_gen.tf b/internal/service/xray/testdata/Group/tags_defaults/main_gen.tf index fd575725db3..d8d0cb0de30 100644 --- a/internal/service/xray/testdata/Group/tags_defaults/main_gen.tf +++ b/internal/service/xray/testdata/Group/tags_defaults/main_gen.tf @@ -14,7 +14,6 @@ resource "aws_xray_group" "test" { tags = var.tags } - variable "rName" { type = string nullable = false @@ -25,7 +24,6 @@ variable "tags" { nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/xray/testdata/SamplingRule/tags/main_gen.tf b/internal/service/xray/testdata/SamplingRule/tags/main_gen.tf index 9739f9ef20f..46ebe663ecb 100644 --- a/internal/service/xray/testdata/SamplingRule/tags/main_gen.tf +++ b/internal/service/xray/testdata/SamplingRule/tags/main_gen.tf @@ -21,7 +21,6 @@ resource "aws_xray_sampling_rule" "test" { tags = var.tags } - variable "rName" { type = string nullable = false diff --git a/internal/service/xray/testdata/SamplingRule/tags0/main_gen.tf b/internal/service/xray/testdata/SamplingRule/tags0/main_gen.tf index 8f068cb2ed3..dcdfe963de3 100644 --- a/internal/service/xray/testdata/SamplingRule/tags0/main_gen.tf +++ b/internal/service/xray/testdata/SamplingRule/tags0/main_gen.tf @@ -20,7 +20,6 @@ resource "aws_xray_sampling_rule" "test" { } - variable "rName" { type = string nullable = false diff --git a/internal/service/xray/testdata/SamplingRule/tags0_defaults/main_gen.tf b/internal/service/xray/testdata/SamplingRule/tags0_defaults/main_gen.tf index 6c0b88eaf95..79a1dfe8b28 100644 --- a/internal/service/xray/testdata/SamplingRule/tags0_defaults/main_gen.tf +++ b/internal/service/xray/testdata/SamplingRule/tags0_defaults/main_gen.tf @@ -26,13 +26,11 @@ resource "aws_xray_sampling_rule" "test" { } - variable "rName" { type = string nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/xray/testdata/SamplingRule/tagsComputed1/main_gen.tf b/internal/service/xray/testdata/SamplingRule/tagsComputed1/main_gen.tf new file mode 100644 index 00000000000..7a8c26aa5b1 --- /dev/null +++ b/internal/service/xray/testdata/SamplingRule/tagsComputed1/main_gen.tf @@ -0,0 +1,40 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_xray_sampling_rule" "test" { + rule_name = var.rName + priority = 5 + reservoir_size = 10 + url_path = "*" + host = "*" + http_method = "GET" + service_type = "*" + service_name = "*" + fixed_rate = 0.3 + resource_arn = "*" + version = 1 + + attributes = { + Hello = "World" + } + + tags = { + (var.unknownTagKey) = null_resource.test.id + } +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + + diff --git a/internal/service/xray/testdata/SamplingRule/tagsComputed2/main_gen.tf b/internal/service/xray/testdata/SamplingRule/tagsComputed2/main_gen.tf new file mode 100644 index 00000000000..4daf2783fb9 --- /dev/null +++ b/internal/service/xray/testdata/SamplingRule/tagsComputed2/main_gen.tf @@ -0,0 +1,50 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_xray_sampling_rule" "test" { + rule_name = var.rName + priority = 5 + reservoir_size = 10 + url_path = "*" + host = "*" + http_method = "GET" + service_type = "*" + service_name = "*" + fixed_rate = 0.3 + resource_arn = "*" + version = 1 + + attributes = { + Hello = "World" + } + + tags = { + (var.unknownTagKey) = null_resource.test.id + (var.knownTagKey) = var.knownTagValue + } +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + +variable "knownTagKey" { + type = string + nullable = false +} + +variable "knownTagValue" { + type = string + nullable = false +} + diff --git a/internal/service/xray/testdata/SamplingRule/tagsNull/main_gen.tf b/internal/service/xray/testdata/SamplingRule/tagsNull/main_gen.tf index 00a8f33c9cd..e84f4bb15ca 100644 --- a/internal/service/xray/testdata/SamplingRule/tagsNull/main_gen.tf +++ b/internal/service/xray/testdata/SamplingRule/tagsNull/main_gen.tf @@ -23,7 +23,6 @@ resource "aws_xray_sampling_rule" "test" { } } - variable "rName" { type = string nullable = false @@ -34,3 +33,4 @@ variable "tagKey1" { nullable = false } + diff --git a/internal/service/xray/testdata/SamplingRule/tagsNull_defaults/main_gen.tf b/internal/service/xray/testdata/SamplingRule/tagsNull_defaults/main_gen.tf index 078fc42758d..6f2ae56a93f 100644 --- a/internal/service/xray/testdata/SamplingRule/tagsNull_defaults/main_gen.tf +++ b/internal/service/xray/testdata/SamplingRule/tagsNull_defaults/main_gen.tf @@ -29,7 +29,6 @@ resource "aws_xray_sampling_rule" "test" { } } - variable "rName" { type = string nullable = false diff --git a/internal/service/xray/testdata/SamplingRule/tags_defaults/main_gen.tf b/internal/service/xray/testdata/SamplingRule/tags_defaults/main_gen.tf index 3c7ee89376c..e12d4b723c6 100644 --- a/internal/service/xray/testdata/SamplingRule/tags_defaults/main_gen.tf +++ b/internal/service/xray/testdata/SamplingRule/tags_defaults/main_gen.tf @@ -27,7 +27,6 @@ resource "aws_xray_sampling_rule" "test" { tags = var.tags } - variable "rName" { type = string nullable = false @@ -38,7 +37,6 @@ variable "tags" { nullable = false } - variable "provider_tags" { type = map(string) nullable = false From 7b93cdff544830a20fee347090d70921cf4ed399 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Thu, 25 Apr 2024 10:33:01 -0700 Subject: [PATCH 0012/1490] Adds tests for `accessanalyzer` --- .../accessanalyzer/analyzer_tags_gen_test.go | 190 ++++++++++++++++++ .../testdata/Analyzer/tags/main_gen.tf | 1 - .../testdata/Analyzer/tags0/main_gen.tf | 1 - .../Analyzer/tags0_defaults/main_gen.tf | 2 - .../Analyzer/tagsComputed1/main_gen.tf | 26 +++ .../Analyzer/tagsComputed2/main_gen.tf | 36 ++++ .../testdata/Analyzer/tagsNull/main_gen.tf | 2 +- .../Analyzer/tagsNull_defaults/main_gen.tf | 1 - .../Analyzer/tags_defaults/main_gen.tf | 2 - .../tagsNull_defaults/main_gen.tf | 1 - 10 files changed, 253 insertions(+), 9 deletions(-) create mode 100644 internal/service/accessanalyzer/testdata/Analyzer/tagsComputed1/main_gen.tf create mode 100644 internal/service/accessanalyzer/testdata/Analyzer/tagsComputed2/main_gen.tf diff --git a/internal/service/accessanalyzer/analyzer_tags_gen_test.go b/internal/service/accessanalyzer/analyzer_tags_gen_test.go index 82eb66123d5..9e4efb3fd8e 100644 --- a/internal/service/accessanalyzer/analyzer_tags_gen_test.go +++ b/internal/service/accessanalyzer/analyzer_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1082,3 +1084,191 @@ func testAccAccessAnalyzerAnalyzer_tags_DefaultTags_nullNonOverlappingResourceTa }, }) } + +func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v types.AnalyzerSummary + resourceName := "aws_accessanalyzer_analyzer.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.AccessAnalyzerServiceID), + CheckDestroy: testAccCheckAnalyzerDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAnalyzerExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v types.AnalyzerSummary + resourceName := "aws_accessanalyzer_analyzer.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.AccessAnalyzerServiceID), + CheckDestroy: testAccCheckAnalyzerDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAnalyzerExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAnalyzerExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v types.AnalyzerSummary + resourceName := "aws_accessanalyzer_analyzer.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.AccessAnalyzerServiceID), + CheckDestroy: testAccCheckAnalyzerDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAnalyzerExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAnalyzerExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/accessanalyzer/testdata/Analyzer/tags/main_gen.tf b/internal/service/accessanalyzer/testdata/Analyzer/tags/main_gen.tf index dbddbbc17a2..d10aba046b3 100644 --- a/internal/service/accessanalyzer/testdata/Analyzer/tags/main_gen.tf +++ b/internal/service/accessanalyzer/testdata/Analyzer/tags/main_gen.tf @@ -7,7 +7,6 @@ resource "aws_accessanalyzer_analyzer" "test" { tags = var.tags } - variable "rName" { type = string nullable = false diff --git a/internal/service/accessanalyzer/testdata/Analyzer/tags0/main_gen.tf b/internal/service/accessanalyzer/testdata/Analyzer/tags0/main_gen.tf index 3c6f4e334dc..8746f65c9b1 100644 --- a/internal/service/accessanalyzer/testdata/Analyzer/tags0/main_gen.tf +++ b/internal/service/accessanalyzer/testdata/Analyzer/tags0/main_gen.tf @@ -6,7 +6,6 @@ resource "aws_accessanalyzer_analyzer" "test" { } - variable "rName" { type = string nullable = false diff --git a/internal/service/accessanalyzer/testdata/Analyzer/tags0_defaults/main_gen.tf b/internal/service/accessanalyzer/testdata/Analyzer/tags0_defaults/main_gen.tf index e672bd4700f..7ca505c32f3 100644 --- a/internal/service/accessanalyzer/testdata/Analyzer/tags0_defaults/main_gen.tf +++ b/internal/service/accessanalyzer/testdata/Analyzer/tags0_defaults/main_gen.tf @@ -12,13 +12,11 @@ resource "aws_accessanalyzer_analyzer" "test" { } - variable "rName" { type = string nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/accessanalyzer/testdata/Analyzer/tagsComputed1/main_gen.tf b/internal/service/accessanalyzer/testdata/Analyzer/tagsComputed1/main_gen.tf new file mode 100644 index 00000000000..379ddcf07bb --- /dev/null +++ b/internal/service/accessanalyzer/testdata/Analyzer/tagsComputed1/main_gen.tf @@ -0,0 +1,26 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_accessanalyzer_analyzer" "test" { + analyzer_name = var.rName + + tags = { + (var.unknownTagKey) = null_resource.test.id + } +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + + diff --git a/internal/service/accessanalyzer/testdata/Analyzer/tagsComputed2/main_gen.tf b/internal/service/accessanalyzer/testdata/Analyzer/tagsComputed2/main_gen.tf new file mode 100644 index 00000000000..eddedddfe5b --- /dev/null +++ b/internal/service/accessanalyzer/testdata/Analyzer/tagsComputed2/main_gen.tf @@ -0,0 +1,36 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_accessanalyzer_analyzer" "test" { + analyzer_name = var.rName + + tags = { + (var.unknownTagKey) = null_resource.test.id + (var.knownTagKey) = var.knownTagValue + } +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + +variable "knownTagKey" { + type = string + nullable = false +} + +variable "knownTagValue" { + type = string + nullable = false +} + diff --git a/internal/service/accessanalyzer/testdata/Analyzer/tagsNull/main_gen.tf b/internal/service/accessanalyzer/testdata/Analyzer/tagsNull/main_gen.tf index 2c698c04093..e9137d0dd60 100644 --- a/internal/service/accessanalyzer/testdata/Analyzer/tagsNull/main_gen.tf +++ b/internal/service/accessanalyzer/testdata/Analyzer/tagsNull/main_gen.tf @@ -9,7 +9,6 @@ resource "aws_accessanalyzer_analyzer" "test" { } } - variable "rName" { type = string nullable = false @@ -20,3 +19,4 @@ variable "tagKey1" { nullable = false } + diff --git a/internal/service/accessanalyzer/testdata/Analyzer/tagsNull_defaults/main_gen.tf b/internal/service/accessanalyzer/testdata/Analyzer/tagsNull_defaults/main_gen.tf index 07d6f122971..7642ee27efd 100644 --- a/internal/service/accessanalyzer/testdata/Analyzer/tagsNull_defaults/main_gen.tf +++ b/internal/service/accessanalyzer/testdata/Analyzer/tagsNull_defaults/main_gen.tf @@ -15,7 +15,6 @@ resource "aws_accessanalyzer_analyzer" "test" { } } - variable "rName" { type = string nullable = false diff --git a/internal/service/accessanalyzer/testdata/Analyzer/tags_defaults/main_gen.tf b/internal/service/accessanalyzer/testdata/Analyzer/tags_defaults/main_gen.tf index 81fd630c8da..7aabcae0afd 100644 --- a/internal/service/accessanalyzer/testdata/Analyzer/tags_defaults/main_gen.tf +++ b/internal/service/accessanalyzer/testdata/Analyzer/tags_defaults/main_gen.tf @@ -13,7 +13,6 @@ resource "aws_accessanalyzer_analyzer" "test" { tags = var.tags } - variable "rName" { type = string nullable = false @@ -24,7 +23,6 @@ variable "tags" { nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/batch/testdata/SchedulingPolicy/tagsNull_defaults/main_gen.tf b/internal/service/batch/testdata/SchedulingPolicy/tagsNull_defaults/main_gen.tf index b4b9e8e159f..1c919028e06 100644 --- a/internal/service/batch/testdata/SchedulingPolicy/tagsNull_defaults/main_gen.tf +++ b/internal/service/batch/testdata/SchedulingPolicy/tagsNull_defaults/main_gen.tf @@ -20,7 +20,6 @@ resource "aws_batch_scheduling_policy" "test" { } } - variable "rName" { type = string nullable = false From 9652c1f8da122c066e5cb6a135e21cb31aa2e8c6 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Thu, 25 Apr 2024 10:38:31 -0700 Subject: [PATCH 0013/1490] Adds tests for `acmpca` --- .../certificate_authority_tags_gen_test.go | 199 ++++++++++++++++++ .../CertificateAuthority/tags/main_gen.tf | 1 - .../CertificateAuthority/tags0/main_gen.tf | 1 - .../tags0_defaults/main_gen.tf | 2 - .../tagsComputed1/main_gen.tf | 36 ++++ .../tagsComputed2/main_gen.tf | 46 ++++ .../CertificateAuthority/tagsNull/main_gen.tf | 2 +- .../tagsNull_defaults/main_gen.tf | 1 - .../tags_defaults/main_gen.tf | 2 - 9 files changed, 282 insertions(+), 8 deletions(-) create mode 100644 internal/service/acmpca/testdata/CertificateAuthority/tagsComputed1/main_gen.tf create mode 100644 internal/service/acmpca/testdata/CertificateAuthority/tagsComputed2/main_gen.tf diff --git a/internal/service/acmpca/certificate_authority_tags_gen_test.go b/internal/service/acmpca/certificate_authority_tags_gen_test.go index bced886dfe0..31d9edb77a8 100644 --- a/internal/service/acmpca/certificate_authority_tags_gen_test.go +++ b/internal/service/acmpca/certificate_authority_tags_gen_test.go @@ -8,6 +8,8 @@ import ( "github.com/aws/aws-sdk-go-v2/service/acmpca/types" "github.com/hashicorp/terraform-plugin-testing/config" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1140,3 +1142,200 @@ func TestAccACMPCACertificateAuthority_tags_DefaultTags_nullNonOverlappingResour }, }) } + +func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v types.CertificateAuthority + resourceName := "aws_acmpca_certificate_authority.test" + rName := acctest.RandomDomainName() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ACMPCAServiceID), + CheckDestroy: testAccCheckCertificateAuthorityDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "permanent_deletion_time_in_days", + }, + }, + }, + }) +} + +func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v types.CertificateAuthority + resourceName := "aws_acmpca_certificate_authority.test" + rName := acctest.RandomDomainName() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ACMPCAServiceID), + CheckDestroy: testAccCheckCertificateAuthorityDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "permanent_deletion_time_in_days", + }, + }, + }, + }) +} + +func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v types.CertificateAuthority + resourceName := "aws_acmpca_certificate_authority.test" + rName := acctest.RandomDomainName() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ACMPCAServiceID), + CheckDestroy: testAccCheckCertificateAuthorityDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "permanent_deletion_time_in_days", + }, + }, + }, + }) +} diff --git a/internal/service/acmpca/testdata/CertificateAuthority/tags/main_gen.tf b/internal/service/acmpca/testdata/CertificateAuthority/tags/main_gen.tf index 63420cc1b91..8c2cea67e13 100644 --- a/internal/service/acmpca/testdata/CertificateAuthority/tags/main_gen.tf +++ b/internal/service/acmpca/testdata/CertificateAuthority/tags/main_gen.tf @@ -17,7 +17,6 @@ resource "aws_acmpca_certificate_authority" "test" { tags = var.tags } - variable "rName" { type = string nullable = false diff --git a/internal/service/acmpca/testdata/CertificateAuthority/tags0/main_gen.tf b/internal/service/acmpca/testdata/CertificateAuthority/tags0/main_gen.tf index 1e476270021..24e1844eabb 100644 --- a/internal/service/acmpca/testdata/CertificateAuthority/tags0/main_gen.tf +++ b/internal/service/acmpca/testdata/CertificateAuthority/tags0/main_gen.tf @@ -16,7 +16,6 @@ resource "aws_acmpca_certificate_authority" "test" { } - variable "rName" { type = string nullable = false diff --git a/internal/service/acmpca/testdata/CertificateAuthority/tags0_defaults/main_gen.tf b/internal/service/acmpca/testdata/CertificateAuthority/tags0_defaults/main_gen.tf index 007cf6e5233..bebefc83311 100644 --- a/internal/service/acmpca/testdata/CertificateAuthority/tags0_defaults/main_gen.tf +++ b/internal/service/acmpca/testdata/CertificateAuthority/tags0_defaults/main_gen.tf @@ -22,13 +22,11 @@ resource "aws_acmpca_certificate_authority" "test" { } - variable "rName" { type = string nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/acmpca/testdata/CertificateAuthority/tagsComputed1/main_gen.tf b/internal/service/acmpca/testdata/CertificateAuthority/tagsComputed1/main_gen.tf new file mode 100644 index 00000000000..f5e52ff7a4a --- /dev/null +++ b/internal/service/acmpca/testdata/CertificateAuthority/tagsComputed1/main_gen.tf @@ -0,0 +1,36 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_acmpca_certificate_authority" "test" { + permanent_deletion_time_in_days = 7 + usage_mode = "SHORT_LIVED_CERTIFICATE" + + certificate_authority_configuration { + key_algorithm = "RSA_4096" + signing_algorithm = "SHA512WITHRSA" + + subject { + common_name = var.rName + } + } + + tags = { + (var.unknownTagKey) = null_resource.test.id + } +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + + diff --git a/internal/service/acmpca/testdata/CertificateAuthority/tagsComputed2/main_gen.tf b/internal/service/acmpca/testdata/CertificateAuthority/tagsComputed2/main_gen.tf new file mode 100644 index 00000000000..0784bf7324d --- /dev/null +++ b/internal/service/acmpca/testdata/CertificateAuthority/tagsComputed2/main_gen.tf @@ -0,0 +1,46 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_acmpca_certificate_authority" "test" { + permanent_deletion_time_in_days = 7 + usage_mode = "SHORT_LIVED_CERTIFICATE" + + certificate_authority_configuration { + key_algorithm = "RSA_4096" + signing_algorithm = "SHA512WITHRSA" + + subject { + common_name = var.rName + } + } + + tags = { + (var.unknownTagKey) = null_resource.test.id + (var.knownTagKey) = var.knownTagValue + } +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + +variable "knownTagKey" { + type = string + nullable = false +} + +variable "knownTagValue" { + type = string + nullable = false +} + diff --git a/internal/service/acmpca/testdata/CertificateAuthority/tagsNull/main_gen.tf b/internal/service/acmpca/testdata/CertificateAuthority/tagsNull/main_gen.tf index 705e1b1ada8..78c9fb26dca 100644 --- a/internal/service/acmpca/testdata/CertificateAuthority/tagsNull/main_gen.tf +++ b/internal/service/acmpca/testdata/CertificateAuthority/tagsNull/main_gen.tf @@ -19,7 +19,6 @@ resource "aws_acmpca_certificate_authority" "test" { } } - variable "rName" { type = string nullable = false @@ -30,3 +29,4 @@ variable "tagKey1" { nullable = false } + diff --git a/internal/service/acmpca/testdata/CertificateAuthority/tagsNull_defaults/main_gen.tf b/internal/service/acmpca/testdata/CertificateAuthority/tagsNull_defaults/main_gen.tf index 16224034d81..5f53fda4d2d 100644 --- a/internal/service/acmpca/testdata/CertificateAuthority/tagsNull_defaults/main_gen.tf +++ b/internal/service/acmpca/testdata/CertificateAuthority/tagsNull_defaults/main_gen.tf @@ -25,7 +25,6 @@ resource "aws_acmpca_certificate_authority" "test" { } } - variable "rName" { type = string nullable = false diff --git a/internal/service/acmpca/testdata/CertificateAuthority/tags_defaults/main_gen.tf b/internal/service/acmpca/testdata/CertificateAuthority/tags_defaults/main_gen.tf index ae3513d3bd9..996a864c226 100644 --- a/internal/service/acmpca/testdata/CertificateAuthority/tags_defaults/main_gen.tf +++ b/internal/service/acmpca/testdata/CertificateAuthority/tags_defaults/main_gen.tf @@ -23,7 +23,6 @@ resource "aws_acmpca_certificate_authority" "test" { tags = var.tags } - variable "rName" { type = string nullable = false @@ -34,7 +33,6 @@ variable "tags" { nullable = false } - variable "provider_tags" { type = map(string) nullable = false From 4435575a8a3c2e8d2c3145b8d1914dd756603fdf Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Thu, 25 Apr 2024 11:08:30 -0700 Subject: [PATCH 0014/1490] Adds tests for `batch` --- internal/generate/tagstests/test.go.gtpl | 6 +- .../compute_environment_tags_gen_test.go | 190 +++++++++++++++++ .../batch/job_definition_tags_gen_test.go | 199 ++++++++++++++++++ .../service/batch/job_queue_tags_gen_test.go | 190 +++++++++++++++++ .../batch/scheduling_policy_tags_gen_test.go | 190 +++++++++++++++++ .../ComputeEnvironment/tags/main_gen.tf | 1 - .../ComputeEnvironment/tags0/main_gen.tf | 1 - .../tags0_defaults/main_gen.tf | 2 - .../tagsComputed1/main_gen.tf | 85 ++++++++ .../tagsComputed2/main_gen.tf | 95 +++++++++ .../ComputeEnvironment/tagsNull/main_gen.tf | 2 +- .../tagsNull_defaults/main_gen.tf | 1 - .../tags_defaults/main_gen.tf | 2 - .../testdata/JobDefinition/tags/main_gen.tf | 1 - .../testdata/JobDefinition/tags0/main_gen.tf | 1 - .../JobDefinition/tags0_defaults/main_gen.tf | 2 - .../JobDefinition/tagsComputed1/main_gen.tf | 33 +++ .../JobDefinition/tagsComputed2/main_gen.tf | 43 ++++ .../JobDefinition/tagsNull/main_gen.tf | 2 +- .../tagsNull_defaults/main_gen.tf | 1 - .../JobDefinition/tags_defaults/main_gen.tf | 2 - .../batch/testdata/JobQueue/tags/main_gen.tf | 1 - .../batch/testdata/JobQueue/tags0/main_gen.tf | 1 - .../JobQueue/tags0_defaults/main_gen.tf | 2 - .../JobQueue/tagsComputed1/main_gen.tf | 93 ++++++++ .../JobQueue/tagsComputed2/main_gen.tf | 103 +++++++++ .../testdata/JobQueue/tagsNull/main_gen.tf | 2 +- .../JobQueue/tagsNull_defaults/main_gen.tf | 1 - .../JobQueue/tags_defaults/main_gen.tf | 2 - .../SchedulingPolicy/tags/main_gen.tf | 1 - .../SchedulingPolicy/tags0/main_gen.tf | 1 - .../tags0_defaults/main_gen.tf | 2 - .../tagsComputed1/main_gen.tf | 31 +++ .../tagsComputed2/main_gen.tf | 41 ++++ .../SchedulingPolicy/tagsNull/main_gen.tf | 2 +- .../tags_defaults/main_gen.tf | 2 - 36 files changed, 1300 insertions(+), 34 deletions(-) create mode 100644 internal/service/batch/testdata/ComputeEnvironment/tagsComputed1/main_gen.tf create mode 100644 internal/service/batch/testdata/ComputeEnvironment/tagsComputed2/main_gen.tf create mode 100644 internal/service/batch/testdata/JobDefinition/tagsComputed1/main_gen.tf create mode 100644 internal/service/batch/testdata/JobDefinition/tagsComputed2/main_gen.tf create mode 100644 internal/service/batch/testdata/JobQueue/tagsComputed1/main_gen.tf create mode 100644 internal/service/batch/testdata/JobQueue/tagsComputed2/main_gen.tf create mode 100644 internal/service/batch/testdata/SchedulingPolicy/tagsComputed1/main_gen.tf create mode 100644 internal/service/batch/testdata/SchedulingPolicy/tagsComputed2/main_gen.tf diff --git a/internal/generate/tagstests/test.go.gtpl b/internal/generate/tagstests/test.go.gtpl index 6b327593e38..daa240b1edf 100644 --- a/internal/generate/tagstests/test.go.gtpl +++ b/internal/generate/tagstests/test.go.gtpl @@ -1048,7 +1048,7 @@ func {{ template "testname" . }}_tags_ComputedTag_OnCreate(t *testing.T) { ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags"){{ if eq .Implementation "framework" }}.AtMapKey("computedkey1"){{ end}}), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1110,7 +1110,7 @@ func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags"){{ if eq .Implementation "framework" }}.AtMapKey("computedkey1"){{ end}}), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1171,7 +1171,7 @@ func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Replace(t *testing.T) ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags"){{ if eq .Implementation "framework" }}.AtMapKey("key1"){{ end}}), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/batch/compute_environment_tags_gen_test.go b/internal/service/batch/compute_environment_tags_gen_test.go index 8ad2c7febb5..09d24cddc63 100644 --- a/internal/service/batch/compute_environment_tags_gen_test.go +++ b/internal/service/batch/compute_environment_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1063,3 +1065,191 @@ func TestAccBatchComputeEnvironment_tags_DefaultTags_nullNonOverlappingResourceT }, }) } + +func TestAccBatchComputeEnvironment_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v batch.ComputeEnvironmentDetail + resourceName := "aws_batch_compute_environment.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckComputeEnvironmentDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v batch.ComputeEnvironmentDetail + resourceName := "aws_batch_compute_environment.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckComputeEnvironmentDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v batch.ComputeEnvironmentDetail + resourceName := "aws_batch_compute_environment.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckComputeEnvironmentDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/batch/job_definition_tags_gen_test.go b/internal/service/batch/job_definition_tags_gen_test.go index 21ce0f1adcd..d503ff53736 100644 --- a/internal/service/batch/job_definition_tags_gen_test.go +++ b/internal/service/batch/job_definition_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1141,3 +1143,200 @@ func TestAccBatchJobDefinition_tags_DefaultTags_nullNonOverlappingResourceTag(t }, }) } + +func TestAccBatchJobDefinition_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v batch.JobDefinition + resourceName := "aws_batch_job_definition.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckJobDefinitionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckJobDefinitionExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "deregister_on_new_revision", + }, + }, + }, + }) +} + +func TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v batch.JobDefinition + resourceName := "aws_batch_job_definition.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckJobDefinitionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckJobDefinitionExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckJobDefinitionExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "deregister_on_new_revision", + }, + }, + }, + }) +} + +func TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v batch.JobDefinition + resourceName := "aws_batch_job_definition.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckJobDefinitionDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckJobDefinitionExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckJobDefinitionExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "deregister_on_new_revision", + }, + }, + }, + }) +} diff --git a/internal/service/batch/job_queue_tags_gen_test.go b/internal/service/batch/job_queue_tags_gen_test.go index f50c3ed1306..6ae9bcc57a7 100644 --- a/internal/service/batch/job_queue_tags_gen_test.go +++ b/internal/service/batch/job_queue_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1069,3 +1071,191 @@ func TestAccBatchJobQueue_tags_DefaultTags_nullNonOverlappingResourceTag(t *test }, }) } + +func TestAccBatchJobQueue_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v batch.JobQueueDetail + resourceName := "aws_batch_job_queue.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckJobQueueDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckJobQueueExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags").AtMapKey("computedkey1")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v batch.JobQueueDetail + resourceName := "aws_batch_job_queue.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckJobQueueDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckJobQueueExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckJobQueueExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags").AtMapKey("computedkey1")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v batch.JobQueueDetail + resourceName := "aws_batch_job_queue.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckJobQueueDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckJobQueueExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckJobQueueExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags").AtMapKey("key1")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/batch/scheduling_policy_tags_gen_test.go b/internal/service/batch/scheduling_policy_tags_gen_test.go index 856050e6949..ae20d95fda2 100644 --- a/internal/service/batch/scheduling_policy_tags_gen_test.go +++ b/internal/service/batch/scheduling_policy_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1063,3 +1065,191 @@ func TestAccBatchSchedulingPolicy_tags_DefaultTags_nullNonOverlappingResourceTag }, }) } + +func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v batch.SchedulingPolicyDetail + resourceName := "aws_batch_scheduling_policy.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckSchedulingPolicyDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v batch.SchedulingPolicyDetail + resourceName := "aws_batch_scheduling_policy.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckSchedulingPolicyDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v batch.SchedulingPolicyDetail + resourceName := "aws_batch_scheduling_policy.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.BatchServiceID), + CheckDestroy: testAccCheckSchedulingPolicyDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/batch/testdata/ComputeEnvironment/tags/main_gen.tf b/internal/service/batch/testdata/ComputeEnvironment/tags/main_gen.tf index 1d427a980d2..16216a18ac1 100644 --- a/internal/service/batch/testdata/ComputeEnvironment/tags/main_gen.tf +++ b/internal/service/batch/testdata/ComputeEnvironment/tags/main_gen.tf @@ -66,7 +66,6 @@ resource "aws_iam_instance_profile" "ecs_instance" { role = aws_iam_role_policy_attachment.ecs_instance.role } - variable "rName" { type = string nullable = false diff --git a/internal/service/batch/testdata/ComputeEnvironment/tags0/main_gen.tf b/internal/service/batch/testdata/ComputeEnvironment/tags0/main_gen.tf index 0221ddc5313..4eaac10ccd0 100644 --- a/internal/service/batch/testdata/ComputeEnvironment/tags0/main_gen.tf +++ b/internal/service/batch/testdata/ComputeEnvironment/tags0/main_gen.tf @@ -65,7 +65,6 @@ resource "aws_iam_instance_profile" "ecs_instance" { role = aws_iam_role_policy_attachment.ecs_instance.role } - variable "rName" { type = string nullable = false diff --git a/internal/service/batch/testdata/ComputeEnvironment/tags0_defaults/main_gen.tf b/internal/service/batch/testdata/ComputeEnvironment/tags0_defaults/main_gen.tf index 19fbfef6e45..0ccd76e3643 100644 --- a/internal/service/batch/testdata/ComputeEnvironment/tags0_defaults/main_gen.tf +++ b/internal/service/batch/testdata/ComputeEnvironment/tags0_defaults/main_gen.tf @@ -71,13 +71,11 @@ resource "aws_iam_instance_profile" "ecs_instance" { role = aws_iam_role_policy_attachment.ecs_instance.role } - variable "rName" { type = string nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/batch/testdata/ComputeEnvironment/tagsComputed1/main_gen.tf b/internal/service/batch/testdata/ComputeEnvironment/tagsComputed1/main_gen.tf new file mode 100644 index 00000000000..00d16aee37e --- /dev/null +++ b/internal/service/batch/testdata/ComputeEnvironment/tagsComputed1/main_gen.tf @@ -0,0 +1,85 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_batch_compute_environment" "test" { + compute_environment_name = var.rName + service_role = aws_iam_role.batch_service.arn + type = "UNMANAGED" + + tags = { + (var.unknownTagKey) = null_resource.test.id + } + + depends_on = [aws_iam_role_policy_attachment.batch_service] +} + +data "aws_partition" "current" {} + +resource "aws_iam_role" "batch_service" { + name = "${var.rName}-batch-service" + + assume_role_policy = < Date: Thu, 25 Apr 2024 11:33:46 -0700 Subject: [PATCH 0015/1490] Adds tests for `iam` --- .../iam/instance_profile_tags_gen_test.go | 190 +++++++++++++++++ .../openid_connect_provider_tags_gen_test.go | 187 ++++++++++++++++ internal/service/iam/policy_tags_gen_test.go | 190 +++++++++++++++++ internal/service/iam/role_tags_gen_test.go | 190 +++++++++++++++++ .../iam/service_linked_role_tags_gen_test.go | 187 ++++++++++++++++ .../testdata/InstanceProfile/tags/main_gen.tf | 1 - .../InstanceProfile/tags0/main_gen.tf | 1 - .../tags0_defaults/main_gen.tf | 2 - .../InstanceProfile/tagsComputed1/main_gen.tf | 50 +++++ .../InstanceProfile/tagsComputed2/main_gen.tf | 60 ++++++ .../InstanceProfile/tagsNull/main_gen.tf | 2 +- .../tagsNull_defaults/main_gen.tf | 1 - .../InstanceProfile/tags_defaults/main_gen.tf | 2 - .../OpenIDConnectProvider/tags/main_gen.tf | 1 - .../OpenIDConnectProvider/tags0/main_gen.tf | 1 - .../tags0_defaults/main_gen.tf | 2 - .../tagsComputed1/main_gen.tf | 32 +++ .../tagsComputed2/main_gen.tf | 42 ++++ .../tagsNull/main_gen.tf | 2 +- .../tagsNull_defaults/main_gen.tf | 1 - .../tags_defaults/main_gen.tf | 2 - .../iam/testdata/Policy/tags/main_gen.tf | 1 - .../iam/testdata/Policy/tags0/main_gen.tf | 1 - .../Policy/tags0_defaults/main_gen.tf | 2 - .../testdata/Policy/tagsComputed1/main_gen.tf | 45 ++++ .../testdata/Policy/tagsComputed2/main_gen.tf | 55 +++++ .../iam/testdata/Policy/tagsNull/main_gen.tf | 2 +- .../Policy/tagsNull_defaults/main_gen.tf | 1 - .../testdata/Policy/tags_defaults/main_gen.tf | 2 - .../iam/testdata/Role/tags/main_gen.tf | 1 - .../iam/testdata/Role/tags0/main_gen.tf | 1 - .../testdata/Role/tags0_defaults/main_gen.tf | 2 - .../testdata/Role/tagsComputed1/main_gen.tf | 40 ++++ .../testdata/Role/tagsComputed2/main_gen.tf | 50 +++++ .../iam/testdata/Role/tagsNull/main_gen.tf | 2 +- .../Role/tagsNull_defaults/main_gen.tf | 1 - .../testdata/Role/tags_defaults/main_gen.tf | 2 - .../ServiceLinkedRole/tags/main_gen.tf | 1 - .../ServiceLinkedRole/tags0/main_gen.tf | 1 - .../tags0_defaults/main_gen.tf | 2 - .../tagsComputed1/main_gen.tf | 27 +++ .../tagsComputed2/main_gen.tf | 37 ++++ .../ServiceLinkedRole/tagsNull/main_gen.tf | 2 +- .../tagsNull_defaults/main_gen.tf | 1 - .../tags_defaults/main_gen.tf | 2 - .../iam/testdata/User/tags/main_gen.tf | 1 - .../iam/testdata/User/tags0/main_gen.tf | 1 - .../testdata/User/tags0_defaults/main_gen.tf | 2 - .../testdata/User/tagsComputed1/main_gen.tf | 26 +++ .../testdata/User/tagsComputed2/main_gen.tf | 36 ++++ .../iam/testdata/User/tagsNull/main_gen.tf | 2 +- .../User/tagsNull_defaults/main_gen.tf | 1 - .../testdata/User/tags_defaults/main_gen.tf | 2 - .../VirtualMFADevice/tags/main_gen.tf | 1 - .../VirtualMFADevice/tags0/main_gen.tf | 1 - .../tags0_defaults/main_gen.tf | 2 - .../tagsComputed1/main_gen.tf | 26 +++ .../tagsComputed2/main_gen.tf | 36 ++++ .../VirtualMFADevice/tagsNull/main_gen.tf | 2 +- .../tagsNull_defaults/main_gen.tf | 1 - .../tags_defaults/main_gen.tf | 2 - internal/service/iam/user_tags_gen_test.go | 199 ++++++++++++++++++ .../iam/virtual_mfa_device_tags_gen_test.go | 199 ++++++++++++++++++ .../Portfolio/tagsNull_defaults/main_gen.tf | 1 - 64 files changed, 1911 insertions(+), 57 deletions(-) create mode 100644 internal/service/iam/testdata/InstanceProfile/tagsComputed1/main_gen.tf create mode 100644 internal/service/iam/testdata/InstanceProfile/tagsComputed2/main_gen.tf create mode 100644 internal/service/iam/testdata/OpenIDConnectProvider/tagsComputed1/main_gen.tf create mode 100644 internal/service/iam/testdata/OpenIDConnectProvider/tagsComputed2/main_gen.tf create mode 100644 internal/service/iam/testdata/Policy/tagsComputed1/main_gen.tf create mode 100644 internal/service/iam/testdata/Policy/tagsComputed2/main_gen.tf create mode 100644 internal/service/iam/testdata/Role/tagsComputed1/main_gen.tf create mode 100644 internal/service/iam/testdata/Role/tagsComputed2/main_gen.tf create mode 100644 internal/service/iam/testdata/ServiceLinkedRole/tagsComputed1/main_gen.tf create mode 100644 internal/service/iam/testdata/ServiceLinkedRole/tagsComputed2/main_gen.tf create mode 100644 internal/service/iam/testdata/User/tagsComputed1/main_gen.tf create mode 100644 internal/service/iam/testdata/User/tagsComputed2/main_gen.tf create mode 100644 internal/service/iam/testdata/VirtualMFADevice/tagsComputed1/main_gen.tf create mode 100644 internal/service/iam/testdata/VirtualMFADevice/tagsComputed2/main_gen.tf diff --git a/internal/service/iam/instance_profile_tags_gen_test.go b/internal/service/iam/instance_profile_tags_gen_test.go index 3d0c57d29fb..91d469a7174 100644 --- a/internal/service/iam/instance_profile_tags_gen_test.go +++ b/internal/service/iam/instance_profile_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1063,3 +1065,191 @@ func TestAccIAMInstanceProfile_tags_DefaultTags_nullNonOverlappingResourceTag(t }, }) } + +func TestAccIAMInstanceProfile_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v types.InstanceProfile + resourceName := "aws_iam_instance_profile.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckInstanceProfileDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckInstanceProfileExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccIAMInstanceProfile_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v types.InstanceProfile + resourceName := "aws_iam_instance_profile.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckInstanceProfileDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckInstanceProfileExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckInstanceProfileExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccIAMInstanceProfile_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v types.InstanceProfile + resourceName := "aws_iam_instance_profile.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckInstanceProfileDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckInstanceProfileExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckInstanceProfileExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/iam/openid_connect_provider_tags_gen_test.go b/internal/service/iam/openid_connect_provider_tags_gen_test.go index 5c84bb718dc..799df86dfa1 100644 --- a/internal/service/iam/openid_connect_provider_tags_gen_test.go +++ b/internal/service/iam/openid_connect_provider_tags_gen_test.go @@ -8,6 +8,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1048,3 +1050,188 @@ func TestAccIAMOpenIDConnectProvider_tags_DefaultTags_nullNonOverlappingResource }, }) } + +func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_iam_openid_connect_provider.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckOpenIDConnectProviderDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckOpenIDConnectProviderExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_iam_openid_connect_provider.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckOpenIDConnectProviderDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckOpenIDConnectProviderExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckOpenIDConnectProviderExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_iam_openid_connect_provider.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckOpenIDConnectProviderDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckOpenIDConnectProviderExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckOpenIDConnectProviderExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/iam/policy_tags_gen_test.go b/internal/service/iam/policy_tags_gen_test.go index a7cd2095a59..e9288002237 100644 --- a/internal/service/iam/policy_tags_gen_test.go +++ b/internal/service/iam/policy_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1063,3 +1065,191 @@ func TestAccIAMPolicy_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing. }, }) } + +func TestAccIAMPolicy_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v types.Policy + resourceName := "aws_iam_policy.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckPolicyDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Policy/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPolicyExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Policy/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccIAMPolicy_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v types.Policy + resourceName := "aws_iam_policy.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckPolicyDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Policy/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPolicyExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Policy/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPolicyExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Policy/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccIAMPolicy_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v types.Policy + resourceName := "aws_iam_policy.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckPolicyDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Policy/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPolicyExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Policy/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPolicyExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Policy/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/iam/role_tags_gen_test.go b/internal/service/iam/role_tags_gen_test.go index 7a853272ba2..4b85173ab1d 100644 --- a/internal/service/iam/role_tags_gen_test.go +++ b/internal/service/iam/role_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1063,3 +1065,191 @@ func TestAccIAMRole_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) }, }) } + +func TestAccIAMRole_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v types.Role + resourceName := "aws_iam_role.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckRoleDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Role/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckRoleExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Role/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccIAMRole_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v types.Role + resourceName := "aws_iam_role.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckRoleDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Role/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckRoleExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Role/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckRoleExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Role/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccIAMRole_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v types.Role + resourceName := "aws_iam_role.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckRoleDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Role/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckRoleExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Role/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckRoleExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Role/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/iam/service_linked_role_tags_gen_test.go b/internal/service/iam/service_linked_role_tags_gen_test.go index 06b1880a572..66c7725033d 100644 --- a/internal/service/iam/service_linked_role_tags_gen_test.go +++ b/internal/service/iam/service_linked_role_tags_gen_test.go @@ -8,6 +8,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1048,3 +1050,188 @@ func TestAccIAMServiceLinkedRole_tags_DefaultTags_nullNonOverlappingResourceTag( }, }) } + +func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_iam_service_linked_role.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckServiceLinkedRoleDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckServiceLinkedRoleExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_iam_service_linked_role.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckServiceLinkedRoleDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckServiceLinkedRoleExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckServiceLinkedRoleExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_iam_service_linked_role.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + CheckDestroy: testAccCheckServiceLinkedRoleDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckServiceLinkedRoleExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckServiceLinkedRoleExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/iam/testdata/InstanceProfile/tags/main_gen.tf b/internal/service/iam/testdata/InstanceProfile/tags/main_gen.tf index 3987ae5bc1c..00c5003934b 100644 --- a/internal/service/iam/testdata/InstanceProfile/tags/main_gen.tf +++ b/internal/service/iam/testdata/InstanceProfile/tags/main_gen.tf @@ -31,7 +31,6 @@ resource "aws_iam_role" "test" { EOF } - variable "rName" { type = string nullable = false diff --git a/internal/service/iam/testdata/InstanceProfile/tags0/main_gen.tf b/internal/service/iam/testdata/InstanceProfile/tags0/main_gen.tf index 2dac9dd9285..6ebad05b623 100644 --- a/internal/service/iam/testdata/InstanceProfile/tags0/main_gen.tf +++ b/internal/service/iam/testdata/InstanceProfile/tags0/main_gen.tf @@ -30,7 +30,6 @@ resource "aws_iam_role" "test" { EOF } - variable "rName" { type = string nullable = false diff --git a/internal/service/iam/testdata/InstanceProfile/tags0_defaults/main_gen.tf b/internal/service/iam/testdata/InstanceProfile/tags0_defaults/main_gen.tf index c4e8a93fa3f..89020ac51cc 100644 --- a/internal/service/iam/testdata/InstanceProfile/tags0_defaults/main_gen.tf +++ b/internal/service/iam/testdata/InstanceProfile/tags0_defaults/main_gen.tf @@ -36,13 +36,11 @@ resource "aws_iam_role" "test" { EOF } - variable "rName" { type = string nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/iam/testdata/InstanceProfile/tagsComputed1/main_gen.tf b/internal/service/iam/testdata/InstanceProfile/tagsComputed1/main_gen.tf new file mode 100644 index 00000000000..bfe15393b02 --- /dev/null +++ b/internal/service/iam/testdata/InstanceProfile/tagsComputed1/main_gen.tf @@ -0,0 +1,50 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_iam_instance_profile" "test" { + name = var.rName + role = aws_iam_role.test.name + + tags = { + (var.unknownTagKey) = null_resource.test.id + } +} + +resource "aws_iam_role" "test" { + name = "${var.rName}-role" + + assume_role_policy = < Date: Thu, 25 Apr 2024 13:49:38 -0700 Subject: [PATCH 0016/1490] Adds tests for `servicecatalog` --- .../servicecatalog/portfolio_tags_gen_test.go | 190 +++++++++++++++++ .../servicecatalog/product_tags_gen_test.go | 196 +++++++++++++++++ .../provisioned_product_tags_test.go | 199 ++++++++++++++++++ .../testdata/Portfolio/tags/main_gen.tf | 1 - .../testdata/Portfolio/tags0/main_gen.tf | 1 - .../Portfolio/tags0_defaults/main_gen.tf | 2 - .../Portfolio/tagsComputed1/main_gen.tf | 28 +++ .../Portfolio/tagsComputed2/main_gen.tf | 38 ++++ .../testdata/Portfolio/tagsNull/main_gen.tf | 2 +- .../Portfolio/tags_defaults/main_gen.tf | 2 - .../testdata/Product/tags/main_gen.tf | 1 - .../testdata/Product/tags0/main_gen.tf | 1 - .../Product/tags0_defaults/main_gen.tf | 2 - .../Product/tagsComputed1/main_gen.tf | 72 +++++++ .../Product/tagsComputed2/main_gen.tf | 82 ++++++++ .../testdata/Product/tagsNull/main_gen.tf | 2 +- .../Product/tagsNull_defaults/main_gen.tf | 1 - .../Product/tags_defaults/main_gen.tf | 2 - .../ProvisionedProduct/tags/main_gen.tf | 1 - .../ProvisionedProduct/tags0/main_gen.tf | 1 - .../tags0_defaults/main_gen.tf | 2 - .../tagsComputed1/main_gen.tf | 119 +++++++++++ .../tagsComputed2/main_gen.tf | 129 ++++++++++++ .../ProvisionedProduct/tagsNull/main_gen.tf | 2 +- .../tagsNull_defaults/main_gen.tf | 1 - .../tags_defaults/main_gen.tf | 2 - 26 files changed, 1056 insertions(+), 23 deletions(-) create mode 100644 internal/service/servicecatalog/testdata/Portfolio/tagsComputed1/main_gen.tf create mode 100644 internal/service/servicecatalog/testdata/Portfolio/tagsComputed2/main_gen.tf create mode 100644 internal/service/servicecatalog/testdata/Product/tagsComputed1/main_gen.tf create mode 100644 internal/service/servicecatalog/testdata/Product/tagsComputed2/main_gen.tf create mode 100644 internal/service/servicecatalog/testdata/ProvisionedProduct/tagsComputed1/main_gen.tf create mode 100644 internal/service/servicecatalog/testdata/ProvisionedProduct/tagsComputed2/main_gen.tf diff --git a/internal/service/servicecatalog/portfolio_tags_gen_test.go b/internal/service/servicecatalog/portfolio_tags_gen_test.go index 6fdb23fd371..f6727a839b1 100644 --- a/internal/service/servicecatalog/portfolio_tags_gen_test.go +++ b/internal/service/servicecatalog/portfolio_tags_gen_test.go @@ -9,6 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1071,3 +1073,191 @@ func TestAccServiceCatalogPortfolio_tags_DefaultTags_nullNonOverlappingResourceT }, }) } + +func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.DescribePortfolioOutput + resourceName := "aws_servicecatalog_portfolio.test" + rName := sdkacctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + CheckDestroy: testAccCheckPortfolioDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckPortfolioExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/internal/service/servicecatalog/product_tags_gen_test.go b/internal/service/servicecatalog/product_tags_gen_test.go index 0f224c0a904..fc1c635ee6c 100644 --- a/internal/service/servicecatalog/product_tags_gen_test.go +++ b/internal/service/servicecatalog/product_tags_gen_test.go @@ -8,6 +8,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1134,3 +1136,197 @@ func TestAccServiceCatalogProduct_tags_DefaultTags_nullNonOverlappingResourceTag }, }) } + +func TestAccServiceCatalogProduct_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Product/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Product/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Product/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Product/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Product/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProduct_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_servicecatalog_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + CheckDestroy: testAccCheckProductDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Product/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Product/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProductExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/Product/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "provisioning_artifact_parameters.0.disable_template_validation", + }, + }, + }, + }) +} diff --git a/internal/service/servicecatalog/provisioned_product_tags_test.go b/internal/service/servicecatalog/provisioned_product_tags_test.go index dcbb2da55d6..ef5e219a578 100644 --- a/internal/service/servicecatalog/provisioned_product_tags_test.go +++ b/internal/service/servicecatalog/provisioned_product_tags_test.go @@ -10,6 +10,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/config" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -1153,3 +1155,200 @@ func TestAccServiceCatalogProvisionedProduct_tags_DefaultTags_nullNonOverlapping }, }) } + +func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnCreate(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnUpdate_Add(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tagsComputed2/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("computedkey1"), + "knownTagKey": config.StringVariable("key1"), + "knownTagValue": config.StringVariable("value1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} + +func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { + ctx := acctest.Context(t) + var v servicecatalog.ProvisionedProductDetail + resourceName := "aws_servicecatalog_provisioned_product.test" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.ServiceCatalogServiceID), + CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), + Steps: []resource.TestStep{ + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tags/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "tags": config.MapVariable(map[string]config.Variable{ + "key1": config.StringVariable("value1"), + }), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckProvisionedProductExists(ctx, resourceName, &v), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tagsComputed1/"), + ConfigVariables: config.Variables{ + "rName": config.StringVariable(rName), + "unknownTagKey": config.StringVariable("key1"), + }, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "accept_language", "ignore_errors", "provisioning_artifact_name", "provisioning_parameters", "retain_physical_resources", + }, + }, + }, + }) +} diff --git a/internal/service/servicecatalog/testdata/Portfolio/tags/main_gen.tf b/internal/service/servicecatalog/testdata/Portfolio/tags/main_gen.tf index 789bdd0b9a2..b5de545bc2e 100644 --- a/internal/service/servicecatalog/testdata/Portfolio/tags/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Portfolio/tags/main_gen.tf @@ -9,7 +9,6 @@ resource "aws_servicecatalog_portfolio" "test" { tags = var.tags } - variable "rName" { type = string nullable = false diff --git a/internal/service/servicecatalog/testdata/Portfolio/tags0/main_gen.tf b/internal/service/servicecatalog/testdata/Portfolio/tags0/main_gen.tf index 08eb335c8ff..69c6bc31d42 100644 --- a/internal/service/servicecatalog/testdata/Portfolio/tags0/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Portfolio/tags0/main_gen.tf @@ -8,7 +8,6 @@ resource "aws_servicecatalog_portfolio" "test" { } - variable "rName" { type = string nullable = false diff --git a/internal/service/servicecatalog/testdata/Portfolio/tags0_defaults/main_gen.tf b/internal/service/servicecatalog/testdata/Portfolio/tags0_defaults/main_gen.tf index 97a41179c90..27f376aa692 100644 --- a/internal/service/servicecatalog/testdata/Portfolio/tags0_defaults/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Portfolio/tags0_defaults/main_gen.tf @@ -14,13 +14,11 @@ resource "aws_servicecatalog_portfolio" "test" { } - variable "rName" { type = string nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/servicecatalog/testdata/Portfolio/tagsComputed1/main_gen.tf b/internal/service/servicecatalog/testdata/Portfolio/tagsComputed1/main_gen.tf new file mode 100644 index 00000000000..ce62e1f676e --- /dev/null +++ b/internal/service/servicecatalog/testdata/Portfolio/tagsComputed1/main_gen.tf @@ -0,0 +1,28 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_servicecatalog_portfolio" "test" { + name = var.rName + description = "test-b" + provider_name = "test-c" + + tags = { + (var.unknownTagKey) = null_resource.test.id + } +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + + diff --git a/internal/service/servicecatalog/testdata/Portfolio/tagsComputed2/main_gen.tf b/internal/service/servicecatalog/testdata/Portfolio/tagsComputed2/main_gen.tf new file mode 100644 index 00000000000..5009096195c --- /dev/null +++ b/internal/service/servicecatalog/testdata/Portfolio/tagsComputed2/main_gen.tf @@ -0,0 +1,38 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_servicecatalog_portfolio" "test" { + name = var.rName + description = "test-b" + provider_name = "test-c" + + tags = { + (var.unknownTagKey) = null_resource.test.id + (var.knownTagKey) = var.knownTagValue + } +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + +variable "knownTagKey" { + type = string + nullable = false +} + +variable "knownTagValue" { + type = string + nullable = false +} + diff --git a/internal/service/servicecatalog/testdata/Portfolio/tagsNull/main_gen.tf b/internal/service/servicecatalog/testdata/Portfolio/tagsNull/main_gen.tf index 1ec5a9326d9..ce0afe07b1a 100644 --- a/internal/service/servicecatalog/testdata/Portfolio/tagsNull/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Portfolio/tagsNull/main_gen.tf @@ -11,7 +11,6 @@ resource "aws_servicecatalog_portfolio" "test" { } } - variable "rName" { type = string nullable = false @@ -22,3 +21,4 @@ variable "tagKey1" { nullable = false } + diff --git a/internal/service/servicecatalog/testdata/Portfolio/tags_defaults/main_gen.tf b/internal/service/servicecatalog/testdata/Portfolio/tags_defaults/main_gen.tf index 483eb868cf2..5a632ca3544 100644 --- a/internal/service/servicecatalog/testdata/Portfolio/tags_defaults/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Portfolio/tags_defaults/main_gen.tf @@ -15,7 +15,6 @@ resource "aws_servicecatalog_portfolio" "test" { tags = var.tags } - variable "rName" { type = string nullable = false @@ -26,7 +25,6 @@ variable "tags" { nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/servicecatalog/testdata/Product/tags/main_gen.tf b/internal/service/servicecatalog/testdata/Product/tags/main_gen.tf index 049071240bf..a1c25eeb664 100644 --- a/internal/service/servicecatalog/testdata/Product/tags/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Product/tags/main_gen.tf @@ -53,7 +53,6 @@ resource "aws_s3_object" "test" { data "aws_partition" "current" {} - variable "rName" { type = string nullable = false diff --git a/internal/service/servicecatalog/testdata/Product/tags0/main_gen.tf b/internal/service/servicecatalog/testdata/Product/tags0/main_gen.tf index 67beb3ee7ce..ee52995565a 100644 --- a/internal/service/servicecatalog/testdata/Product/tags0/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Product/tags0/main_gen.tf @@ -52,7 +52,6 @@ resource "aws_s3_object" "test" { data "aws_partition" "current" {} - variable "rName" { type = string nullable = false diff --git a/internal/service/servicecatalog/testdata/Product/tags0_defaults/main_gen.tf b/internal/service/servicecatalog/testdata/Product/tags0_defaults/main_gen.tf index ab4e9547707..2e068351b7c 100644 --- a/internal/service/servicecatalog/testdata/Product/tags0_defaults/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Product/tags0_defaults/main_gen.tf @@ -58,13 +58,11 @@ resource "aws_s3_object" "test" { data "aws_partition" "current" {} - variable "rName" { type = string nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/servicecatalog/testdata/Product/tagsComputed1/main_gen.tf b/internal/service/servicecatalog/testdata/Product/tagsComputed1/main_gen.tf new file mode 100644 index 00000000000..ab6520eba97 --- /dev/null +++ b/internal/service/servicecatalog/testdata/Product/tagsComputed1/main_gen.tf @@ -0,0 +1,72 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_servicecatalog_product" "test" { + description = var.rName + distributor = "distributör" + name = var.rName + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" + + provisioning_artifact_parameters { + description = "artefaktbeskrivning" + disable_template_validation = true + name = var.rName + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" + type = "CLOUD_FORMATION_TEMPLATE" + } + + tags = { + (var.unknownTagKey) = null_resource.test.id + } +} + +resource "aws_s3_bucket" "test" { + bucket = var.rName + force_destroy = true +} + +resource "aws_s3_object" "test" { + bucket = aws_s3_bucket.test.id + key = "${var.rName}.json" + + content = jsonencode({ + AWSTemplateFormatVersion = "2010-09-09" + + Resources = { + MyVPC = { + Type = "AWS::EC2::VPC" + Properties = { + CidrBlock = "10.1.0.0/16" + } + } + } + + Outputs = { + VpcID = { + Description = "VPC ID" + Value = { + Ref = "MyVPC" + } + } + } + }) +} + +data "aws_partition" "current" {} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + + diff --git a/internal/service/servicecatalog/testdata/Product/tagsComputed2/main_gen.tf b/internal/service/servicecatalog/testdata/Product/tagsComputed2/main_gen.tf new file mode 100644 index 00000000000..65d397ccb9a --- /dev/null +++ b/internal/service/servicecatalog/testdata/Product/tagsComputed2/main_gen.tf @@ -0,0 +1,82 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_servicecatalog_product" "test" { + description = var.rName + distributor = "distributör" + name = var.rName + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" + + provisioning_artifact_parameters { + description = "artefaktbeskrivning" + disable_template_validation = true + name = var.rName + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" + type = "CLOUD_FORMATION_TEMPLATE" + } + + tags = { + (var.unknownTagKey) = null_resource.test.id + (var.knownTagKey) = var.knownTagValue + } +} + +resource "aws_s3_bucket" "test" { + bucket = var.rName + force_destroy = true +} + +resource "aws_s3_object" "test" { + bucket = aws_s3_bucket.test.id + key = "${var.rName}.json" + + content = jsonencode({ + AWSTemplateFormatVersion = "2010-09-09" + + Resources = { + MyVPC = { + Type = "AWS::EC2::VPC" + Properties = { + CidrBlock = "10.1.0.0/16" + } + } + } + + Outputs = { + VpcID = { + Description = "VPC ID" + Value = { + Ref = "MyVPC" + } + } + } + }) +} + +data "aws_partition" "current" {} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + +variable "knownTagKey" { + type = string + nullable = false +} + +variable "knownTagValue" { + type = string + nullable = false +} + diff --git a/internal/service/servicecatalog/testdata/Product/tagsNull/main_gen.tf b/internal/service/servicecatalog/testdata/Product/tagsNull/main_gen.tf index 6154e3f209e..d001eabcb44 100644 --- a/internal/service/servicecatalog/testdata/Product/tagsNull/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Product/tagsNull/main_gen.tf @@ -55,7 +55,6 @@ resource "aws_s3_object" "test" { data "aws_partition" "current" {} - variable "rName" { type = string nullable = false @@ -66,3 +65,4 @@ variable "tagKey1" { nullable = false } + diff --git a/internal/service/servicecatalog/testdata/Product/tagsNull_defaults/main_gen.tf b/internal/service/servicecatalog/testdata/Product/tagsNull_defaults/main_gen.tf index cdce5baa6ec..553bc3955a4 100644 --- a/internal/service/servicecatalog/testdata/Product/tagsNull_defaults/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Product/tagsNull_defaults/main_gen.tf @@ -61,7 +61,6 @@ resource "aws_s3_object" "test" { data "aws_partition" "current" {} - variable "rName" { type = string nullable = false diff --git a/internal/service/servicecatalog/testdata/Product/tags_defaults/main_gen.tf b/internal/service/servicecatalog/testdata/Product/tags_defaults/main_gen.tf index 471b94e2940..875db282c2a 100644 --- a/internal/service/servicecatalog/testdata/Product/tags_defaults/main_gen.tf +++ b/internal/service/servicecatalog/testdata/Product/tags_defaults/main_gen.tf @@ -59,7 +59,6 @@ resource "aws_s3_object" "test" { data "aws_partition" "current" {} - variable "rName" { type = string nullable = false @@ -70,7 +69,6 @@ variable "tags" { nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/servicecatalog/testdata/ProvisionedProduct/tags/main_gen.tf b/internal/service/servicecatalog/testdata/ProvisionedProduct/tags/main_gen.tf index 1cc8329f444..af7e02d93ba 100644 --- a/internal/service/servicecatalog/testdata/ProvisionedProduct/tags/main_gen.tf +++ b/internal/service/servicecatalog/testdata/ProvisionedProduct/tags/main_gen.tf @@ -100,7 +100,6 @@ data "aws_servicecatalog_launch_paths" "test" { product_id = aws_servicecatalog_product_portfolio_association.test.product_id } - variable "rName" { type = string nullable = false diff --git a/internal/service/servicecatalog/testdata/ProvisionedProduct/tags0/main_gen.tf b/internal/service/servicecatalog/testdata/ProvisionedProduct/tags0/main_gen.tf index 0975df6166a..044eb31f613 100644 --- a/internal/service/servicecatalog/testdata/ProvisionedProduct/tags0/main_gen.tf +++ b/internal/service/servicecatalog/testdata/ProvisionedProduct/tags0/main_gen.tf @@ -99,7 +99,6 @@ data "aws_servicecatalog_launch_paths" "test" { product_id = aws_servicecatalog_product_portfolio_association.test.product_id } - variable "rName" { type = string nullable = false diff --git a/internal/service/servicecatalog/testdata/ProvisionedProduct/tags0_defaults/main_gen.tf b/internal/service/servicecatalog/testdata/ProvisionedProduct/tags0_defaults/main_gen.tf index 3a1de9bbc3d..45d58faa3dd 100644 --- a/internal/service/servicecatalog/testdata/ProvisionedProduct/tags0_defaults/main_gen.tf +++ b/internal/service/servicecatalog/testdata/ProvisionedProduct/tags0_defaults/main_gen.tf @@ -105,13 +105,11 @@ data "aws_servicecatalog_launch_paths" "test" { product_id = aws_servicecatalog_product_portfolio_association.test.product_id } - variable "rName" { type = string nullable = false } - variable "provider_tags" { type = map(string) nullable = false diff --git a/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsComputed1/main_gen.tf b/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsComputed1/main_gen.tf new file mode 100644 index 00000000000..df83099f64a --- /dev/null +++ b/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsComputed1/main_gen.tf @@ -0,0 +1,119 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_servicecatalog_provisioned_product" "test" { + name = var.rName + product_id = aws_servicecatalog_constraint.test.product_id + provisioning_artifact_name = var.rName + path_id = data.aws_servicecatalog_launch_paths.test.summaries[0].path_id + + provisioning_parameters { + key = "BucketName" + value = "${var.rName}-dest" + } + + tags = { + (var.unknownTagKey) = null_resource.test.id + } +} + +resource "aws_s3_bucket" "test" { + bucket = var.rName + force_destroy = true +} + +resource "aws_s3_object" "test" { + bucket = aws_s3_bucket.test.id + key = "${var.rName}.json" + + content = jsonencode({ + AWSTemplateFormatVersion = "2010-09-09" + + Parameters = { + BucketName = { + Type = "String" + } + } + + Resources = { + MyS3Bucket = { + Type = "AWS::S3::Bucket" + Properties = { + BucketName = { Ref = "BucketName" } + } + } + } + }) +} + +resource "aws_servicecatalog_product" "test" { + description = var.rName + distributor = "distributör" + name = var.rName + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" + + provisioning_artifact_parameters { + description = "artefaktbeskrivning" + disable_template_validation = true + name = var.rName + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" + type = "CLOUD_FORMATION_TEMPLATE" + } +} + +resource "aws_servicecatalog_portfolio" "test" { + name = var.rName + description = var.rName + provider_name = var.rName +} + +resource "aws_servicecatalog_constraint" "test" { + description = var.rName + portfolio_id = aws_servicecatalog_product_portfolio_association.test.portfolio_id + product_id = aws_servicecatalog_product_portfolio_association.test.product_id + type = "RESOURCE_UPDATE" + + parameters = jsonencode({ + Version = "2.0" + Properties = { + TagUpdateOnProvisionedProduct = "ALLOWED" + } + }) +} + +resource "aws_servicecatalog_product_portfolio_association" "test" { + portfolio_id = aws_servicecatalog_principal_portfolio_association.test.portfolio_id + product_id = aws_servicecatalog_product.test.id +} + +data "aws_caller_identity" "current" {} + +data "aws_iam_session_context" "current" { + arn = data.aws_caller_identity.current.arn +} + +resource "aws_servicecatalog_principal_portfolio_association" "test" { + portfolio_id = aws_servicecatalog_portfolio.test.id + principal_arn = data.aws_iam_session_context.current.issuer_arn # unfortunately, you cannot get launch_path for arbitrary role - only caller +} + +data "aws_servicecatalog_launch_paths" "test" { + product_id = aws_servicecatalog_product_portfolio_association.test.product_id +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + + diff --git a/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsComputed2/main_gen.tf b/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsComputed2/main_gen.tf new file mode 100644 index 00000000000..4d25fd41a01 --- /dev/null +++ b/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsComputed2/main_gen.tf @@ -0,0 +1,129 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +provider "null" {} + +resource "aws_servicecatalog_provisioned_product" "test" { + name = var.rName + product_id = aws_servicecatalog_constraint.test.product_id + provisioning_artifact_name = var.rName + path_id = data.aws_servicecatalog_launch_paths.test.summaries[0].path_id + + provisioning_parameters { + key = "BucketName" + value = "${var.rName}-dest" + } + + tags = { + (var.unknownTagKey) = null_resource.test.id + (var.knownTagKey) = var.knownTagValue + } +} + +resource "aws_s3_bucket" "test" { + bucket = var.rName + force_destroy = true +} + +resource "aws_s3_object" "test" { + bucket = aws_s3_bucket.test.id + key = "${var.rName}.json" + + content = jsonencode({ + AWSTemplateFormatVersion = "2010-09-09" + + Parameters = { + BucketName = { + Type = "String" + } + } + + Resources = { + MyS3Bucket = { + Type = "AWS::S3::Bucket" + Properties = { + BucketName = { Ref = "BucketName" } + } + } + } + }) +} + +resource "aws_servicecatalog_product" "test" { + description = var.rName + distributor = "distributör" + name = var.rName + owner = "ägare" + type = "CLOUD_FORMATION_TEMPLATE" + + provisioning_artifact_parameters { + description = "artefaktbeskrivning" + disable_template_validation = true + name = var.rName + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" + type = "CLOUD_FORMATION_TEMPLATE" + } +} + +resource "aws_servicecatalog_portfolio" "test" { + name = var.rName + description = var.rName + provider_name = var.rName +} + +resource "aws_servicecatalog_constraint" "test" { + description = var.rName + portfolio_id = aws_servicecatalog_product_portfolio_association.test.portfolio_id + product_id = aws_servicecatalog_product_portfolio_association.test.product_id + type = "RESOURCE_UPDATE" + + parameters = jsonencode({ + Version = "2.0" + Properties = { + TagUpdateOnProvisionedProduct = "ALLOWED" + } + }) +} + +resource "aws_servicecatalog_product_portfolio_association" "test" { + portfolio_id = aws_servicecatalog_principal_portfolio_association.test.portfolio_id + product_id = aws_servicecatalog_product.test.id +} + +data "aws_caller_identity" "current" {} + +data "aws_iam_session_context" "current" { + arn = data.aws_caller_identity.current.arn +} + +resource "aws_servicecatalog_principal_portfolio_association" "test" { + portfolio_id = aws_servicecatalog_portfolio.test.id + principal_arn = data.aws_iam_session_context.current.issuer_arn # unfortunately, you cannot get launch_path for arbitrary role - only caller +} + +data "aws_servicecatalog_launch_paths" "test" { + product_id = aws_servicecatalog_product_portfolio_association.test.product_id +} + +resource "null_resource" "test" {} + +variable "rName" { + type = string + nullable = false +} + +variable "unknownTagKey" { + type = string + nullable = false +} + +variable "knownTagKey" { + type = string + nullable = false +} + +variable "knownTagValue" { + type = string + nullable = false +} + diff --git a/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsNull/main_gen.tf b/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsNull/main_gen.tf index 12805d494dd..b5edbe70b64 100644 --- a/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsNull/main_gen.tf +++ b/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsNull/main_gen.tf @@ -102,7 +102,6 @@ data "aws_servicecatalog_launch_paths" "test" { product_id = aws_servicecatalog_product_portfolio_association.test.product_id } - variable "rName" { type = string nullable = false @@ -113,3 +112,4 @@ variable "tagKey1" { nullable = false } + diff --git a/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsNull_defaults/main_gen.tf b/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsNull_defaults/main_gen.tf index cca45e61ea4..20e723ae178 100644 --- a/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsNull_defaults/main_gen.tf +++ b/internal/service/servicecatalog/testdata/ProvisionedProduct/tagsNull_defaults/main_gen.tf @@ -108,7 +108,6 @@ data "aws_servicecatalog_launch_paths" "test" { product_id = aws_servicecatalog_product_portfolio_association.test.product_id } - variable "rName" { type = string nullable = false diff --git a/internal/service/servicecatalog/testdata/ProvisionedProduct/tags_defaults/main_gen.tf b/internal/service/servicecatalog/testdata/ProvisionedProduct/tags_defaults/main_gen.tf index a69718d3409..de53e358956 100644 --- a/internal/service/servicecatalog/testdata/ProvisionedProduct/tags_defaults/main_gen.tf +++ b/internal/service/servicecatalog/testdata/ProvisionedProduct/tags_defaults/main_gen.tf @@ -106,7 +106,6 @@ data "aws_servicecatalog_launch_paths" "test" { product_id = aws_servicecatalog_product_portfolio_association.test.product_id } - variable "rName" { type = string nullable = false @@ -117,7 +116,6 @@ variable "tags" { nullable = false } - variable "provider_tags" { type = map(string) nullable = false From 506aaf0261976a5314d764f7e48766862a570ac0 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Thu, 2 May 2024 14:25:53 -0700 Subject: [PATCH 0017/1490] Adds computed tag tests to serial tests --- internal/generate/tagstests/test.go.gtpl | 3 +++ internal/service/accessanalyzer/analyzer_tags_gen_test.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/internal/generate/tagstests/test.go.gtpl b/internal/generate/tagstests/test.go.gtpl index daa240b1edf..1754e61f73f 100644 --- a/internal/generate/tagstests/test.go.gtpl +++ b/internal/generate/tagstests/test.go.gtpl @@ -80,6 +80,9 @@ func {{ template "testname" . }}_tagsSerial(t *testing.T) { t.Run("DefaultTags_emptyResourceTag", {{ template "testname" . }}_tags_DefaultTags_emptyResourceTag) t.Run("DefaultTags_nullOverlappingResourceTag", {{ template "testname" . }}_tags_DefaultTags_nullOverlappingResourceTag) t.Run("DefaultTags_nullNonOverlappingResourceTag", {{ template "testname" . }}_tags_DefaultTags_nullNonOverlappingResourceTag) + t.Run("ComputedTag_OnCreate", {{ template "testname" . }}_tags_ComputedTag_OnCreate) + t.Run("ComputedTag_OnUpdate_Add", {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Add) + t.Run("ComputedTag_OnUpdate_Replace", {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Replace) } {{ end }} diff --git a/internal/service/accessanalyzer/analyzer_tags_gen_test.go b/internal/service/accessanalyzer/analyzer_tags_gen_test.go index 9e4efb3fd8e..0a30d8e3f0e 100644 --- a/internal/service/accessanalyzer/analyzer_tags_gen_test.go +++ b/internal/service/accessanalyzer/analyzer_tags_gen_test.go @@ -32,6 +32,9 @@ func testAccAccessAnalyzerAnalyzer_tagsSerial(t *testing.T) { t.Run("DefaultTags_emptyResourceTag", testAccAccessAnalyzerAnalyzer_tags_DefaultTags_emptyResourceTag) t.Run("DefaultTags_nullOverlappingResourceTag", testAccAccessAnalyzerAnalyzer_tags_DefaultTags_nullOverlappingResourceTag) t.Run("DefaultTags_nullNonOverlappingResourceTag", testAccAccessAnalyzerAnalyzer_tags_DefaultTags_nullNonOverlappingResourceTag) + t.Run("ComputedTag_OnCreate", testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnCreate) + t.Run("ComputedTag_OnUpdate_Add", testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Add) + t.Run("ComputedTag_OnUpdate_Replace", testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Replace) } func testAccAccessAnalyzerAnalyzer_tags(t *testing.T) { From fedbfc1127a616f5602f9b26fc37c4ea6e0fe1f0 Mon Sep 17 00:00:00 2001 From: Alex Wilcox Date: Tue, 6 Feb 2024 23:49:27 +0000 Subject: [PATCH 0018/1490] Add minified json to policy data source --- .../service/iam/policy_document_data_source.go | 14 ++++++++++++++ .../iam/policy_document_data_source_test.go | 12 ++++++++++++ .../python/d/iam_policy_document.html.markdown | 1 + 3 files changed, 27 insertions(+) diff --git a/internal/service/iam/policy_document_data_source.go b/internal/service/iam/policy_document_data_source.go index 1740aa0c034..4a3e8defbc9 100644 --- a/internal/service/iam/policy_document_data_source.go +++ b/internal/service/iam/policy_document_data_source.go @@ -64,6 +64,10 @@ func dataSourcePolicyDocument() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "minified_json": { + Type: schema.TypeString, + Computed: true, + }, // https://github.com/hashicorp/terraform-provider-aws/issues/31637. "override_json": { Type: schema.TypeString, @@ -309,6 +313,16 @@ func dataSourcePolicyDocumentRead(ctx context.Context, d *schema.ResourceData, m jsonString := string(jsonDoc) d.Set("json", jsonString) + + jsonMinDoc, err := json.Marshal(mergedDoc) + if err != nil { + // should never happen if the above code is correct + return sdkdiag.AppendErrorf(diags, "writing IAM Policy Document: formatting JSON: %s", err) + } + jsonMinString := string(jsonMinDoc) + + d.Set("minified_json", jsonMinString) + d.SetId(strconv.Itoa(create.StringHashcode(jsonString))) return diags diff --git a/internal/service/iam/policy_document_data_source_test.go b/internal/service/iam/policy_document_data_source_test.go index 11a8c71c253..9881e6df270 100644 --- a/internal/service/iam/policy_document_data_source_test.go +++ b/internal/service/iam/policy_document_data_source_test.go @@ -31,6 +31,14 @@ func TestAccIAMPolicyDocumentDataSource_basic(t *testing.T) { ), ), }, + { + Config: testAccPolicyDocumentDataSourceConfig_basic, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("data.aws_iam_policy_document.test", "minified_json", + testAccPolicyDocumentExpectedJSONMinified(), + ), + ), + }, }, }) } @@ -589,6 +597,10 @@ func testAccPolicyDocumentExpectedJSON() string { }`, acctest.Partition()) } +func testAccPolicyDocumentExpectedJSONMinified() string { + return fmt.Sprintf(`{"Version":"2012-10-17","Id":"policy_id","Statement":[{"Sid":"1","Effect":"Allow","Action":["s3:ListAllMyBuckets","s3:GetBucketLocation"],"Resource":"arn:%[1]s:s3:::*"},{"Effect":"Allow","Action":"s3:ListBucket","Resource":"arn:%[1]s:s3:::foo","NotPrincipal":{"AWS":"arn:blahblah:example"},"Condition":{"StringLike":{"s3:prefix":["home/","","home/${aws:username}/"]}}},{"Effect":"Allow","Action":"s3:*","Resource":["arn:%[1]s:s3:::foo/home/${aws:username}/*","arn:%[1]s:s3:::foo/home/${aws:username}"],"Principal":{"AWS":"arn:blahblah:example"}},{"Effect":"Deny","NotAction":"s3:*","NotResource":"arn:%[1]s:s3:::*"},{"Effect":"Allow","Action":"kinesis:*","Principal":{"AWS":"*"}},{"Effect":"Allow","Action":"firehose:*","Principal":"*"}]}`, acctest.Partition()) +} + const testAccPolicyDocumentDataSourceConfig_singleConditionValue = ` data "aws_iam_policy_document" "test" { statement { diff --git a/website/docs/cdktf/python/d/iam_policy_document.html.markdown b/website/docs/cdktf/python/d/iam_policy_document.html.markdown index 3882bf79c0b..78c3b369312 100644 --- a/website/docs/cdktf/python/d/iam_policy_document.html.markdown +++ b/website/docs/cdktf/python/d/iam_policy_document.html.markdown @@ -566,5 +566,6 @@ The following arguments are required: This data source exports the following attributes in addition to the arguments above: * `json` - Standard JSON policy document rendered based on the arguments above. +* `minified_json` - Minified JSON policy document rendered based on the arguments above. \ No newline at end of file From 15d9a0ec381702adeda534013f321657ad2ba304 Mon Sep 17 00:00:00 2001 From: Daniel Rieske Date: Wed, 8 May 2024 16:00:05 +0200 Subject: [PATCH 0019/1490] fix: nill check on notification_property --- internal/service/glue/job.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/internal/service/glue/job.go b/internal/service/glue/job.go index 65431b22cc7..77722d5edae 100644 --- a/internal/service/glue/job.go +++ b/internal/service/glue/job.go @@ -235,8 +235,8 @@ func resourceJobCreate(ctx context.Context, d *schema.ResourceData, meta interfa input.NonOverridableArguments = flex.ExpandStringMap(v.(map[string]interface{})) } - if v, ok := d.GetOk("notification_property"); ok { - input.NotificationProperty = expandNotificationProperty(v.([]interface{})) + if v, ok := d.GetOk("notification_property"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + input.NotificationProperty = expandNotificationProperty(v.([]interface{})[0].(map[string]interface{})) } if v, ok := d.GetOk("number_of_workers"); ok { @@ -363,8 +363,8 @@ func resourceJobUpdate(ctx context.Context, d *schema.ResourceData, meta interfa jobUpdate.NonOverridableArguments = flex.ExpandStringMap(kv.(map[string]interface{})) } - if v, ok := d.GetOk("notification_property"); ok { - jobUpdate.NotificationProperty = expandNotificationProperty(v.([]interface{})) + if v, ok := d.GetOk("notification_property"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + jobUpdate.NotificationProperty = expandNotificationProperty(v.([]interface{})[0].(map[string]interface{})) } if v, ok := d.GetOk("number_of_workers"); ok { @@ -451,11 +451,15 @@ func expandJobCommand(l []interface{}) *glue.JobCommand { return jobCommand } -func expandNotificationProperty(l []interface{}) *glue.NotificationProperty { - m := l[0].(map[string]interface{}) +func expandNotificationProperty(tfMap map[string]interface{}) *glue.NotificationProperty { + if tfMap == nil { + return nil + } + + notificationProperty := &glue.NotificationProperty{} - notificationProperty := &glue.NotificationProperty{ - NotifyDelayAfter: aws.Int64(int64(m["notify_delay_after"].(int))), + if v, ok := tfMap["notify_delay_after"].(int); ok && v != 0 { + notificationProperty.NotifyDelayAfter = aws.Int64(int64(v)) } return notificationProperty From 9eb9ae68b1f46ae4eaace153c4ded24c5d92cb7d Mon Sep 17 00:00:00 2001 From: Daniel Rieske Date: Wed, 8 May 2024 19:01:01 +0200 Subject: [PATCH 0020/1490] chore: added changelog --- .changelog/37347.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/37347.txt diff --git a/.changelog/37347.txt b/.changelog/37347.txt new file mode 100644 index 00000000000..89c3a2f9728 --- /dev/null +++ b/.changelog/37347.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_glue_job: Fix `interface conversion: interface {} is nil, not map[string]interface {}` panic when `notify_delay_after` is empty (`null`) +``` \ No newline at end of file From 30c4ce8c41d067f42d039c27ce6974e35cb439a1 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 8 May 2024 15:03:56 -0400 Subject: [PATCH 0021/1490] Add tool to display AWS SDK for Go v1 vs. v2 retry delays. --- tools/awssdkretries/go.mod | 13 +++++++++++ tools/awssdkretries/go.sum | 18 ++++++++++++++++ tools/awssdkretries/main.go | 43 +++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 tools/awssdkretries/go.mod create mode 100644 tools/awssdkretries/go.sum create mode 100644 tools/awssdkretries/main.go diff --git a/tools/awssdkretries/go.mod b/tools/awssdkretries/go.mod new file mode 100644 index 00000000000..368c772da58 --- /dev/null +++ b/tools/awssdkretries/go.mod @@ -0,0 +1,13 @@ +module github.com/hashicorp/terraform-provider-aws/tools/awssdkretries + +go 1.22.2 + +require ( + github.com/aws/aws-sdk-go v1.52.3 + github.com/aws/aws-sdk-go-v2 v1.26.1 +) + +require ( + github.com/aws/smithy-go v1.20.2 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect +) diff --git a/tools/awssdkretries/go.sum b/tools/awssdkretries/go.sum new file mode 100644 index 00000000000..1639f6adb4a --- /dev/null +++ b/tools/awssdkretries/go.sum @@ -0,0 +1,18 @@ +github.com/aws/aws-sdk-go v1.52.3 h1:BNPJmHOXNoM/iBWJKrvaQvJOweRcp3KLpzdb65CfQwU= +github.com/aws/aws-sdk-go v1.52.3/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= +github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= +github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= +github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/tools/awssdkretries/main.go b/tools/awssdkretries/main.go new file mode 100644 index 00000000000..469bcdef7a8 --- /dev/null +++ b/tools/awssdkretries/main.go @@ -0,0 +1,43 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package main + +import ( + "fmt" + "net/http" + "time" + + "github.com/aws/aws-sdk-go-v2/aws/retry" + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/request" +) + +func main() { + maxBackoff := 300 * time.Second + maxRetries := 25 + v2 := retry.NewExponentialJitterBackoff(maxBackoff) + v1 := client.DefaultRetryer{ + NumMaxRetries: maxRetries, + MinRetryDelay: client.DefaultRetryerMinRetryDelay, + MinThrottleDelay: client.DefaultRetryerMinThrottleDelay, + MaxRetryDelay: maxBackoff, + MaxThrottleDelay: client.DefaultRetryerMaxThrottleDelay, + } + + err := awserr.New("ThrottlingException", "Rate exceeded", nil) + req := request.Request{ + Error: err, + HTTPResponse: &http.Response{ + StatusCode: 400, + }, + } + for i := 0; i < maxRetries; i++ { + d1 := v1.RetryRules(&req) + req.RetryCount++ + d2, _ := v2.BackoffDelay(i, err) + + fmt.Printf("%d v1: %s, v2: %s\n", i, d1.String(), d2.String()) + } +} From ffe2fc231a0bd0c2b58ef4649661d66ca61ca20c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 8 May 2024 15:06:46 -0400 Subject: [PATCH 0022/1490] Use 'maxBackoff' for 'MaxThrottleDelay'. --- tools/awssdkretries/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/awssdkretries/main.go b/tools/awssdkretries/main.go index 469bcdef7a8..d61599e3e04 100644 --- a/tools/awssdkretries/main.go +++ b/tools/awssdkretries/main.go @@ -23,7 +23,7 @@ func main() { MinRetryDelay: client.DefaultRetryerMinRetryDelay, MinThrottleDelay: client.DefaultRetryerMinThrottleDelay, MaxRetryDelay: maxBackoff, - MaxThrottleDelay: client.DefaultRetryerMaxThrottleDelay, + MaxThrottleDelay: maxBackoff, } err := awserr.New("ThrottlingException", "Rate exceeded", nil) From 93d762cf24b26a00638e026967dc5fc1efec367f Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 8 May 2024 15:07:28 -0400 Subject: [PATCH 0023/1490] Use default where possible. --- tools/awssdkretries/main.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/awssdkretries/main.go b/tools/awssdkretries/main.go index d61599e3e04..f9b78d7a65d 100644 --- a/tools/awssdkretries/main.go +++ b/tools/awssdkretries/main.go @@ -20,8 +20,6 @@ func main() { v2 := retry.NewExponentialJitterBackoff(maxBackoff) v1 := client.DefaultRetryer{ NumMaxRetries: maxRetries, - MinRetryDelay: client.DefaultRetryerMinRetryDelay, - MinThrottleDelay: client.DefaultRetryerMinThrottleDelay, MaxRetryDelay: maxBackoff, MaxThrottleDelay: maxBackoff, } From adc152873e6a0ad345d2946ad1f5315b59fab5db Mon Sep 17 00:00:00 2001 From: Daniel Rieske Date: Thu, 9 May 2024 00:25:24 +0200 Subject: [PATCH 0024/1490] feat: added budgets alerts --- internal/service/budgets/budget.go | 10 +- internal/service/budgets/budget_action.go | 60 ++--- .../service/budgets/budget_action_test.go | 215 ++++++++++++++---- .../service/budgets/budget_data_source.go | 14 +- .../budgets/budget_data_source_test.go | 5 + internal/service/budgets/budget_test.go | 89 ++++++++ internal/service/budgets/generate.go | 1 + .../service/budgets/service_package_gen.go | 6 + internal/service/budgets/tags_gen.go | 146 ++++++++++++ website/docs/r/budgets_budget.html.markdown | 7 + .../r/budgets_budget_action.html.markdown | 7 + 11 files changed, 486 insertions(+), 74 deletions(-) create mode 100644 internal/service/budgets/tags_gen.go diff --git a/internal/service/budgets/budget.go b/internal/service/budgets/budget.go index 1f5eee7aac2..ce34d261ccb 100644 --- a/internal/service/budgets/budget.go +++ b/internal/service/budgets/budget.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" + tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" "github.com/hashicorp/terraform-provider-aws/names" @@ -33,6 +34,7 @@ import ( ) // @SDKResource("aws_budgets_budget") +// @Tags(identifierAttribute="arn") func ResourceBudget() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceBudgetCreate, @@ -272,6 +274,8 @@ func ResourceBudget() *schema.Resource { }, ConflictsWith: []string{"limit_amount", "limit_unit"}, }, + names.AttrTags: tftags.TagsSchema(), + names.AttrTagsAll: tftags.TagsSchemaComputed(), "time_period_end": { Type: schema.TypeString, Optional: true, @@ -290,6 +294,7 @@ func ResourceBudget() *schema.Resource { ValidateDiagFunc: enum.Validate[awstypes.TimeUnit](), }, }, + CustomizeDiff: verify.SetTagsDiff, } } @@ -313,8 +318,9 @@ func resourceBudgetCreate(ctx context.Context, d *schema.ResourceData, meta inte } _, err = conn.CreateBudget(ctx, &budgets.CreateBudgetInput{ - AccountId: aws.String(accountID), - Budget: budget, + AccountId: aws.String(accountID), + Budget: budget, + ResourceTags: getTagsIn(ctx), }) if err != nil { diff --git a/internal/service/budgets/budget_action.go b/internal/service/budgets/budget_action.go index 0d26f5fa871..043b5a6f3fb 100644 --- a/internal/service/budgets/budget_action.go +++ b/internal/service/budgets/budget_action.go @@ -24,12 +24,14 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" + tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_budgets_budget_action") +// @Tags(identifierAttribute="arn") func ResourceBudgetAction() *schema.Resource { return &schema.Resource{ CreateWithoutTimeout: resourceBudgetActionCreate, @@ -221,7 +223,10 @@ func ResourceBudgetAction() *schema.Resource { }, }, }, + names.AttrTags: tftags.TagsSchema(), + names.AttrTagsAll: tftags.TagsSchemaComputed(), }, + CustomizeDiff: verify.SetTagsDiff, } } @@ -243,6 +248,7 @@ func resourceBudgetActionCreate(ctx context.Context, d *schema.ResourceData, met ExecutionRoleArn: aws.String(d.Get("execution_role_arn").(string)), NotificationType: awstypes.NotificationType(d.Get("notification_type").(string)), Subscribers: expandBudgetActionSubscriber(d.Get("subscriber").(*schema.Set)), + ResourceTags: getTagsIn(ctx), } outputRaw, err := tfresource.RetryWhenIsA[*awstypes.AccessDeniedException](ctx, propagationTimeout, func() (interface{}, error) { @@ -324,40 +330,42 @@ func resourceBudgetActionUpdate(ctx context.Context, d *schema.ResourceData, met return sdkdiag.AppendFromErr(diags, err) } - input := &budgets.UpdateBudgetActionInput{ - AccountId: aws.String(accountID), - ActionId: aws.String(actionID), - BudgetName: aws.String(budgetName), - } + if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll) { + input := &budgets.UpdateBudgetActionInput{ + AccountId: aws.String(accountID), + ActionId: aws.String(actionID), + BudgetName: aws.String(budgetName), + } - if d.HasChange("action_threshold") { - input.ActionThreshold = expandBudgetActionActionThreshold(d.Get("action_threshold").([]interface{})) - } + if d.HasChange("action_threshold") { + input.ActionThreshold = expandBudgetActionActionThreshold(d.Get("action_threshold").([]interface{})) + } - if d.HasChange("approval_model") { - input.ApprovalModel = awstypes.ApprovalModel(d.Get("approval_model").(string)) - } + if d.HasChange("approval_model") { + input.ApprovalModel = awstypes.ApprovalModel(d.Get("approval_model").(string)) + } - if d.HasChange("definition") { - input.Definition = expandBudgetActionActionDefinition(d.Get("definition").([]interface{})) - } + if d.HasChange("definition") { + input.Definition = expandBudgetActionActionDefinition(d.Get("definition").([]interface{})) + } - if d.HasChange("execution_role_arn") { - input.ExecutionRoleArn = aws.String(d.Get("execution_role_arn").(string)) - } + if d.HasChange("execution_role_arn") { + input.ExecutionRoleArn = aws.String(d.Get("execution_role_arn").(string)) + } - if d.HasChange("notification_type") { - input.NotificationType = awstypes.NotificationType(d.Get("notification_type").(string)) - } + if d.HasChange("notification_type") { + input.NotificationType = awstypes.NotificationType(d.Get("notification_type").(string)) + } - if d.HasChange("subscriber") { - input.Subscribers = expandBudgetActionSubscriber(d.Get("subscriber").(*schema.Set)) - } + if d.HasChange("subscriber") { + input.Subscribers = expandBudgetActionSubscriber(d.Get("subscriber").(*schema.Set)) + } - _, err = conn.UpdateBudgetAction(ctx, input) + _, err = conn.UpdateBudgetAction(ctx, input) - if err != nil { - return sdkdiag.AppendErrorf(diags, "updating Budget Action (%s): %s", d.Id(), err) + if err != nil { + return sdkdiag.AppendErrorf(diags, "updating Budget Action (%s): %s", d.Id(), err) + } } return append(diags, resourceBudgetActionRead(ctx, d, meta)...) diff --git a/internal/service/budgets/budget_action_test.go b/internal/service/budgets/budget_action_test.go index 4e2f1ec8a1f..6f2ef65f35c 100644 --- a/internal/service/budgets/budget_action_test.go +++ b/internal/service/budgets/budget_action_test.go @@ -152,6 +152,54 @@ func TestAccBudgetsBudgetAction_triggeredManual(t *testing.T) { }) } +func TestAccBudgetsBudgetAction_tags(t *testing.T) { + ctx := acctest.Context(t) + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_budgets_budget_action.test" + var conf awstypes.Action + + const thresholdValue = "1000000000" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); acctest.PreCheckPartitionHasService(t, names.BudgetsEndpointID) }, + ErrorCheck: acctest.ErrorCheck(t, names.BudgetsServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckBudgetActionDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccBudgetActionConfig_tags1(rName, string(awstypes.ApprovalModelManual), thresholdValue, "key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccBudgetActionExists(ctx, resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccBudgetActionConfig_tags2(rName, string(awstypes.ApprovalModelManual), thresholdValue, "key1", "value1updated", "key2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccBudgetActionExists(ctx, resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + { + Config: testAccBudgetActionConfig_tags1(rName, string(awstypes.ApprovalModelManual), thresholdValue, "key2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccBudgetActionExists(ctx, resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + }, + }) +} + func TestAccBudgetsBudgetAction_disappears(t *testing.T) { ctx := acctest.Context(t) rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -243,8 +291,68 @@ func testAccCheckBudgetActionDestroy(ctx context.Context) resource.TestCheckFunc } } -func testAccBudgetActionConfig_basic(rName, approvalModel, thresholdValue string) string { +func testAccBudgetActionConfig_base(rName string) string { return fmt.Sprintf(` +resource "aws_budgets_budget" "test" { + name = %[1]q + budget_type = "USAGE" + limit_amount = "1.0" + limit_unit = "dollars" + time_period_start = "2006-01-02_15:04" + time_unit = "MONTHLY" +} + +resource "aws_iam_policy" "test" { + name = %[1]q + description = "My test policy" + + policy = < 0 { + return tags + } + } + + return nil +} + +// setTagsOut sets budgets service tags in Context. +func setTagsOut(ctx context.Context, tags []awstypes.ResourceTag) { + if inContext, ok := tftags.FromContext(ctx); ok { + inContext.TagsOut = option.Some(KeyValueTags(ctx, tags)) + } +} + +// updateTags updates budgets service tags. +// The identifier is typically the Amazon Resource Name (ARN), although +// it may also be a different identifier depending on the service. +func updateTags(ctx context.Context, conn *budgets.Client, identifier string, oldTagsMap, newTagsMap any, optFns ...func(*budgets.Options)) error { + oldTags := tftags.New(ctx, oldTagsMap) + newTags := tftags.New(ctx, newTagsMap) + + ctx = tflog.SetField(ctx, logging.KeyResourceId, identifier) + + removedTags := oldTags.Removed(newTags) + removedTags = removedTags.IgnoreSystem(names.Budgets) + if len(removedTags) > 0 { + input := &budgets.UntagResourceInput{ + ResourceARN: aws.String(identifier), + ResourceTagKeys: removedTags.Keys(), + } + + _, err := conn.UntagResource(ctx, input, optFns...) + + if err != nil { + return fmt.Errorf("untagging resource (%s): %w", identifier, err) + } + } + + updatedTags := oldTags.Updated(newTags) + updatedTags = updatedTags.IgnoreSystem(names.Budgets) + if len(updatedTags) > 0 { + input := &budgets.TagResourceInput{ + ResourceARN: aws.String(identifier), + ResourceTags: Tags(updatedTags), + } + + _, err := conn.TagResource(ctx, input, optFns...) + + if err != nil { + return fmt.Errorf("tagging resource (%s): %w", identifier, err) + } + } + + return nil +} + +// UpdateTags updates budgets service tags. +// It is called from outside this package. +func (p *servicePackage) UpdateTags(ctx context.Context, meta any, identifier string, oldTags, newTags any) error { + return updateTags(ctx, meta.(*conns.AWSClient).BudgetsClient(ctx), identifier, oldTags, newTags) +} diff --git a/website/docs/r/budgets_budget.html.markdown b/website/docs/r/budgets_budget.html.markdown index 332522a2cdd..ab049f3a136 100644 --- a/website/docs/r/budgets_budget.html.markdown +++ b/website/docs/r/budgets_budget.html.markdown @@ -36,6 +36,11 @@ resource "aws_budgets_budget" "ec2" { notification_type = "FORECASTED" subscriber_email_addresses = ["test@example.com"] } + + tags = { + Tag1 = "Value1" + Tag2 = "Value2" + } } ``` @@ -187,6 +192,7 @@ This argument supports the following arguments: * `time_unit` - (Required) The length of time until a budget resets the actual and forecasted spend. Valid values: `MONTHLY`, `QUARTERLY`, `ANNUALLY`, and `DAILY`. * `notification` - (Optional) Object containing [Budget Notifications](#budget-notification). Can be used multiple times to define more than one budget notification. * `planned_limit` - (Optional) Object containing [Planned Budget Limits](#planned-budget-limits). Can be used multiple times to plan more than one budget limit. See [PlannedBudgetLimits](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Budget.html#awscostmanagement-Type-budgets_Budget-PlannedBudgetLimits) documentation. +* `tags` - Tags to apply to the domain. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attribute Reference @@ -194,6 +200,7 @@ This resource exports the following attributes in addition to the arguments abov * `id` - id of resource. * `arn` - The ARN of the budget. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). ### Auto Adjust Data diff --git a/website/docs/r/budgets_budget_action.html.markdown b/website/docs/r/budgets_budget_action.html.markdown index 93c07598a42..4fb9d6d35b0 100644 --- a/website/docs/r/budgets_budget_action.html.markdown +++ b/website/docs/r/budgets_budget_action.html.markdown @@ -36,6 +36,11 @@ resource "aws_budgets_budget_action" "example" { address = "example@example.example" subscription_type = "EMAIL" } + + tags = { + Tag1 = "Value1" + Tag2 = "Value2" + } } data "aws_iam_policy_document" "example" { @@ -95,6 +100,7 @@ This resource supports the following arguments: * `execution_role_arn` - (Required) The role passed for action execution and reversion. Roles and actions must be in the same account. * `notification_type` - (Required) The type of a notification. Valid values are `ACTUAL` or `FORECASTED`. * `subscriber` - (Required) A list of subscribers. See [Subscriber](#subscriber). +* `tags` - Tags to apply to the domain. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### Action Threshold @@ -138,6 +144,7 @@ This resource exports the following attributes in addition to the arguments abov * `id` - ID of resource. * `arn` - The ARN of the budget action. * `status` - The status of the budget action. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). ## Timeouts From 0a406826bcb2be51d549cc26261090f51bd7b80a Mon Sep 17 00:00:00 2001 From: Daniel Rieske Date: Thu, 9 May 2024 00:36:34 +0200 Subject: [PATCH 0025/1490] chore: added changelog --- .changelog/37361.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .changelog/37361.txt diff --git a/.changelog/37361.txt b/.changelog/37361.txt new file mode 100644 index 00000000000..540da735168 --- /dev/null +++ b/.changelog/37361.txt @@ -0,0 +1,11 @@ +```release-note:enhancement +resource/aws_budgets_budget: Add `tags` argument +``` + +```release-note:enhancement +resource/aws_budgets_budget_action: Add `tags` argument +``` + +```release-note:enhancement +data-source/aws_budgets_budget: Add `tags` argument +``` \ No newline at end of file From f74318347719faa3f76942f987dac884d45dc8d2 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 11:19:51 -0400 Subject: [PATCH 0026/1490] Add AWS SDK for Go v1 compatible Backoff. --- tools/awssdkretries/main.go | 60 ++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/tools/awssdkretries/main.go b/tools/awssdkretries/main.go index f9b78d7a65d..849ac8d1e9e 100644 --- a/tools/awssdkretries/main.go +++ b/tools/awssdkretries/main.go @@ -5,7 +5,10 @@ package main import ( "fmt" + "math" + "math/rand" "net/http" + "sync" "time" "github.com/aws/aws-sdk-go-v2/aws/retry" @@ -23,6 +26,9 @@ func main() { MaxRetryDelay: maxBackoff, MaxThrottleDelay: maxBackoff, } + v2compat := &compat{ + MaxRetryDelay: maxBackoff, + } err := awserr.New("ThrottlingException", "Rate exceeded", nil) req := request.Request{ @@ -35,7 +41,59 @@ func main() { d1 := v1.RetryRules(&req) req.RetryCount++ d2, _ := v2.BackoffDelay(i, err) + d2compat, _ := v2compat.BackoffDelay(i, err) - fmt.Printf("%d v1: %s, v2: %s\n", i, d1.String(), d2.String()) + fmt.Printf("%d v1: %s, v2: %s v2compat: %s\n", i, d1.String(), d2.String(), d2compat.String()) } } + +type compat struct { + MaxRetryDelay time.Duration +} + +// AWS SDK for Go v1 compatible Backoff. +// See https://github.com/aws/aws-sdk-go/blob/e7dfa8a81550571e247af1ed63a698f9f43a4d51/aws/client/default_retryer.go#L78. +func (c *compat) BackoffDelay(attempt int, err error) (time.Duration, error) { + minDelay := 30 * time.Millisecond + maxDelay := c.MaxRetryDelay + var delay time.Duration + + // Logic to cap the retry count based on the minDelay provided + actualRetryCount := int(math.Log2(float64(minDelay))) + 1 + if actualRetryCount < 63-attempt { + delay = time.Duration(1< maxDelay { + delay = getJitterDelay(maxDelay / 2) + } + } else { + delay = getJitterDelay(maxDelay / 2) + } + + return delay, nil +} + +func getJitterDelay(duration time.Duration) time.Duration { + return time.Duration(SeededRand.Int63n(int64(duration)) + int64(duration)) +} + +// lockedSource is a thread-safe implementation of rand.Source +type lockedSource struct { + lk sync.Mutex + src rand.Source +} + +func (r *lockedSource) Int63() (n int64) { + r.lk.Lock() + n = r.src.Int63() + r.lk.Unlock() + return +} + +func (r *lockedSource) Seed(seed int64) { + r.lk.Lock() + r.src.Seed(seed) + r.lk.Unlock() +} + +// SeededRand is a new RNG using a thread safe implementation of rand.Source +var SeededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) From 97da4124255d0f957c0fb4ae3335106c1d62db51 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 13:33:03 -0400 Subject: [PATCH 0027/1490] Run 'go get github.com/hashicorp/aws-sdk-go-base/v2@d88efef867ba8d45c1532d25cf078c405ac2ab9c && go mod tidy'. --- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index f314cddbba2..ef85b06f429 100644 --- a/go.mod +++ b/go.mod @@ -181,7 +181,7 @@ require ( github.com/gertd/go-pluralize v0.2.1 github.com/google/go-cmp v0.6.0 github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 - github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52 + github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52.0.20240509160613-d88efef867ba github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53 github.com/hashicorp/awspolicyequivalence v1.6.0 github.com/hashicorp/cli v1.1.6 @@ -276,12 +276,12 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/zclconf/go-cty v1.14.3 // indirect - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0 // indirect - go.opentelemetry.io/otel v1.25.0 // indirect - go.opentelemetry.io/otel/metric v1.25.0 // indirect - go.opentelemetry.io/otel/trace v1.25.0 // indirect + go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0 // indirect + go.opentelemetry.io/otel v1.26.0 // indirect + go.opentelemetry.io/otel/metric v1.26.0 // indirect + go.opentelemetry.io/otel/trace v1.26.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.24.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect diff --git a/go.sum b/go.sum index a838ef7ca80..d4ea9960043 100644 --- a/go.sum +++ b/go.sum @@ -444,8 +444,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 h1:N2V/ooY+BPQwwN3qPRIztByR8mWN6IqgULqVzGoUlog= github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0/go.mod h1:HAmscHyzSOfB1Dr16KLc177KNbn83wscnZC+N7WyaM8= -github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52 h1:bKvTdvF3jNgDt4rHDk55BxYnyofFVJhXHMj+RBRUmc0= -github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52/go.mod h1:YlwqmXqrK6MNTtW1cCjPFkoc3plCT939B+Yjmq+/DBc= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52.0.20240509160613-d88efef867ba h1:fJDkfWDVRPcMBi8jNIcRZ579e8yM82daBWS99OOYgsE= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52.0.20240509160613-d88efef867ba/go.mod h1:nvpXIeF0ANfZ7sMssXKSSR3pyXfksajxoC2tl4jjN08= github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53 h1:hrcewXLBw48wZc6fe7blETM94eTwzTouQ4zWqQvjVwU= github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53/go.mod h1:458CK33gIkH+FvTU2aZcJy2IANdsE3USy1NAUhK/uFg= github.com/hashicorp/awspolicyequivalence v1.6.0 h1:7aadmkalbc5ewStC6g3rljx1iNvP4QyAhg2KsHx8bU8= @@ -613,14 +613,14 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0 h1:0zXBsTKPsly2MlyLYyra1GuL23fsY5RMsi6E2ZOe988= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0/go.mod h1:Tztzncf+ezyOCjXz8zRjVL2agqyBxhymGnK6rqgoY5c= -go.opentelemetry.io/otel v1.25.0 h1:gldB5FfhRl7OJQbUHt/8s0a7cE8fbsPAtdpRaApKy4k= -go.opentelemetry.io/otel v1.25.0/go.mod h1:Wa2ds5NOXEMkCmUou1WA7ZBfLTHWIsp034OVD7AO+Vg= -go.opentelemetry.io/otel/metric v1.25.0 h1:LUKbS7ArpFL/I2jJHdJcqMGxkRdxpPHE0VU/D4NuEwA= -go.opentelemetry.io/otel/metric v1.25.0/go.mod h1:rkDLUSd2lC5lq2dFNrX9LGAbINP5B7WBkC78RXCpH5s= -go.opentelemetry.io/otel/trace v1.25.0 h1:tqukZGLwQYRIFtSQM2u2+yfMVTgGVeqRLPUYx1Dq6RM= -go.opentelemetry.io/otel/trace v1.25.0/go.mod h1:hCCs70XM/ljO+BeQkyFnbK28SBIJ/Emuha+ccrCRT7I= +go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0 h1:FGMfzzxfkNkw+gvKJOeT8dSmBjgrSFh+ClLl+OMKPno= +go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0/go.mod h1:hmHUXiKhyxbIhuNfG5ZTySq9HqqxJFNxaFOfXXvoMmQ= +go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= +go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= +go.opentelemetry.io/otel/metric v1.26.0 h1:7S39CLuY5Jgg9CrnA9HHiEjGMF/X2VHvoXGgSllRz30= +go.opentelemetry.io/otel/metric v1.26.0/go.mod h1:SY+rHOI4cEawI9a7N1A4nIg/nTQXe1ccCNWYOJUrpX4= +go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= +go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= @@ -634,8 +634,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 027573c8b147ee9946f70dfb4728400ef3214aba Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 14:09:27 -0400 Subject: [PATCH 0028/1490] Remove 'tools/awssdkretries'. --- tools/awssdkretries/go.mod | 13 ----- tools/awssdkretries/go.sum | 18 ------- tools/awssdkretries/main.go | 99 ------------------------------------- 3 files changed, 130 deletions(-) delete mode 100644 tools/awssdkretries/go.mod delete mode 100644 tools/awssdkretries/go.sum delete mode 100644 tools/awssdkretries/main.go diff --git a/tools/awssdkretries/go.mod b/tools/awssdkretries/go.mod deleted file mode 100644 index 368c772da58..00000000000 --- a/tools/awssdkretries/go.mod +++ /dev/null @@ -1,13 +0,0 @@ -module github.com/hashicorp/terraform-provider-aws/tools/awssdkretries - -go 1.22.2 - -require ( - github.com/aws/aws-sdk-go v1.52.3 - github.com/aws/aws-sdk-go-v2 v1.26.1 -) - -require ( - github.com/aws/smithy-go v1.20.2 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect -) diff --git a/tools/awssdkretries/go.sum b/tools/awssdkretries/go.sum deleted file mode 100644 index 1639f6adb4a..00000000000 --- a/tools/awssdkretries/go.sum +++ /dev/null @@ -1,18 +0,0 @@ -github.com/aws/aws-sdk-go v1.52.3 h1:BNPJmHOXNoM/iBWJKrvaQvJOweRcp3KLpzdb65CfQwU= -github.com/aws/aws-sdk-go v1.52.3/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= -github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= -github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= -github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= -github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/tools/awssdkretries/main.go b/tools/awssdkretries/main.go deleted file mode 100644 index 849ac8d1e9e..00000000000 --- a/tools/awssdkretries/main.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package main - -import ( - "fmt" - "math" - "math/rand" - "net/http" - "sync" - "time" - - "github.com/aws/aws-sdk-go-v2/aws/retry" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/request" -) - -func main() { - maxBackoff := 300 * time.Second - maxRetries := 25 - v2 := retry.NewExponentialJitterBackoff(maxBackoff) - v1 := client.DefaultRetryer{ - NumMaxRetries: maxRetries, - MaxRetryDelay: maxBackoff, - MaxThrottleDelay: maxBackoff, - } - v2compat := &compat{ - MaxRetryDelay: maxBackoff, - } - - err := awserr.New("ThrottlingException", "Rate exceeded", nil) - req := request.Request{ - Error: err, - HTTPResponse: &http.Response{ - StatusCode: 400, - }, - } - for i := 0; i < maxRetries; i++ { - d1 := v1.RetryRules(&req) - req.RetryCount++ - d2, _ := v2.BackoffDelay(i, err) - d2compat, _ := v2compat.BackoffDelay(i, err) - - fmt.Printf("%d v1: %s, v2: %s v2compat: %s\n", i, d1.String(), d2.String(), d2compat.String()) - } -} - -type compat struct { - MaxRetryDelay time.Duration -} - -// AWS SDK for Go v1 compatible Backoff. -// See https://github.com/aws/aws-sdk-go/blob/e7dfa8a81550571e247af1ed63a698f9f43a4d51/aws/client/default_retryer.go#L78. -func (c *compat) BackoffDelay(attempt int, err error) (time.Duration, error) { - minDelay := 30 * time.Millisecond - maxDelay := c.MaxRetryDelay - var delay time.Duration - - // Logic to cap the retry count based on the minDelay provided - actualRetryCount := int(math.Log2(float64(minDelay))) + 1 - if actualRetryCount < 63-attempt { - delay = time.Duration(1< maxDelay { - delay = getJitterDelay(maxDelay / 2) - } - } else { - delay = getJitterDelay(maxDelay / 2) - } - - return delay, nil -} - -func getJitterDelay(duration time.Duration) time.Duration { - return time.Duration(SeededRand.Int63n(int64(duration)) + int64(duration)) -} - -// lockedSource is a thread-safe implementation of rand.Source -type lockedSource struct { - lk sync.Mutex - src rand.Source -} - -func (r *lockedSource) Int63() (n int64) { - r.lk.Lock() - n = r.src.Int63() - r.lk.Unlock() - return -} - -func (r *lockedSource) Seed(seed int64) { - r.lk.Lock() - r.src.Seed(seed) - r.lk.Unlock() -} - -// SeededRand is a new RNG using a thread safe implementation of rand.Source -var SeededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) From 7963687a7b3897012024c7a62d417a26a6068609 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 14:10:05 -0400 Subject: [PATCH 0029/1490] Add AWS SDK for Go v1 compatible Backoff. --- internal/conns/backoff_delayer.go | 75 ++++++++++++++++++++++++++ internal/conns/backoff_delayer_test.go | 47 ++++++++++++++++ internal/conns/config.go | 6 ++- 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 internal/conns/backoff_delayer.go create mode 100644 internal/conns/backoff_delayer_test.go diff --git a/internal/conns/backoff_delayer.go b/internal/conns/backoff_delayer.go new file mode 100644 index 00000000000..de40284d936 --- /dev/null +++ b/internal/conns/backoff_delayer.go @@ -0,0 +1,75 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package conns + +import ( + "math" + "math/rand" + "time" +) + +// AWS SDK for Go v1 compatible Backoff. +// See https://github.com/aws/aws-sdk-go/blob/e7dfa8a81550571e247af1ed63a698f9f43a4d51/aws/client/default_retryer.go#L78. + +type v1CompatibleBackoff struct { + maxRetryDelay time.Duration +} + +// AWS SDK for Go v1 compatible Backoff. +// See https://github.com/aws/aws-sdk-go/blob/e7dfa8a81550571e247af1ed63a698f9f43a4d51/aws/client/default_retryer.go#L78. +func (c *v1CompatibleBackoff) BackoffDelay(attempt int, err error) (time.Duration, error) { + minDelay := 30 * time.Millisecond + maxDelay := c.maxRetryDelay + var delay time.Duration + + // Logic to cap the retry count based on the minDelay provided. + actualRetryCount := int(math.Log2(float64(minDelay))) + 1 + if actualRetryCount < 63-attempt { + delay = time.Duration(1< maxDelay { + delay = getJitterDelay(maxDelay / 2) + } + } else { + delay = getJitterDelay(maxDelay / 2) + } + + return delay, nil +} + +func getJitterDelay(duration time.Duration) time.Duration { + return time.Duration(seededRand.Int63n(int64(duration)) + int64(duration)) +} + +// lockedSource is a thread-safe implementation of rand.Source. +type lockedSource struct { + src rand.Source +} + +func (r *lockedSource) Int63() (n int64) { + r.lock() + n = r.src.Int63() + r.unlock() + return +} + +func (r *lockedSource) Seed(seed int64) { + r.lock() + r.src.Seed(seed) + r.unlock() +} + +func (r *lockedSource) key() string { + return "backoff-rand-source" +} + +func (r *lockedSource) lock() { + GlobalMutexKV.Lock(r.key()) +} + +func (r *lockedSource) unlock() { + GlobalMutexKV.Unlock(r.key()) +} + +// seededRand is a new RNG using a thread safe implementation of rand.Source. +var seededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) diff --git a/internal/conns/backoff_delayer_test.go b/internal/conns/backoff_delayer_test.go new file mode 100644 index 00000000000..4d4dd3586dc --- /dev/null +++ b/internal/conns/backoff_delayer_test.go @@ -0,0 +1,47 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package conns + +import ( + "net/http" + "testing" + "time" + + "github.com/aws/aws-sdk-go-v2/aws/retry" + "github.com/aws/aws-sdk-go/aws/awserr" + awsclient "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/request" +) + +func TestBackoffDelayer(t *testing.T) { + t.Parallel() + + maxBackoff := 300 * time.Second + maxRetries := 25 + v2 := retry.NewExponentialJitterBackoff(maxBackoff) + v1 := awsclient.DefaultRetryer{ + NumMaxRetries: maxRetries, + MaxRetryDelay: maxBackoff, + MaxThrottleDelay: maxBackoff, + } + v2compat := &v1CompatibleBackoff{ + maxRetryDelay: maxBackoff, + } + + err := awserr.New("ThrottlingException", "Rate exceeded", nil) + req := request.Request{ + Error: err, + HTTPResponse: &http.Response{ + StatusCode: 400, + }, + } + for i := 0; i < maxRetries; i++ { + d1 := v1.RetryRules(&req) + req.RetryCount++ + d2, _ := v2.BackoffDelay(i, err) + d2compat, _ := v2compat.BackoffDelay(i, err) + + t.Logf("%d v1: %s, v2: %s v2compat: %s\n", i, d1.String(), d2.String(), d2compat.String()) + } +} diff --git a/internal/conns/config.go b/internal/conns/config.go index 7e5d33e094f..d8e96106e05 100644 --- a/internal/conns/config.go +++ b/internal/conns/config.go @@ -70,6 +70,9 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS ctx, logger := logging.NewTfLogger(ctx) + const ( + maxBackoff = 300 * time.Second // AWS SDK for Go v1 DefaultRetryerMaxRetryDelay: https://github.com/aws/aws-sdk-go/blob/9f6e3bb9f523aef97fa1cd5c5f8ba8ecf212e44e/aws/client/default_retryer.go#L48-L49. + ) awsbaseConfig := awsbase.Config{ AccessKey: c.AccessKey, AllowedAccountIds: c.AllowedAccountIds, @@ -81,6 +84,7 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS }, }, AssumeRoleWithWebIdentity: c.AssumeRoleWithWebIdentity, + Backoff: &v1CompatibleBackoff{maxRetryDelay: maxBackoff}, CallerDocumentationURL: "https://registry.terraform.io/providers/hashicorp/aws", CallerName: "Terraform AWS Provider", EC2MetadataServiceEnableState: c.EC2MetadataServiceEnableState, @@ -92,7 +96,7 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS HTTPSProxy: c.HTTPSProxy, HTTPProxyMode: awsbase.HTTPProxyModeLegacy, Logger: logger, - MaxBackoff: 300 * time.Second, // AWS SDK for Go v1 DefaultRetryerMaxRetryDelay: https://github.com/aws/aws-sdk-go/blob/9f6e3bb9f523aef97fa1cd5c5f8ba8ecf212e44e/aws/client/default_retryer.go#L48-L49. + MaxBackoff: maxBackoff, MaxRetries: c.MaxRetries, NoProxy: c.NoProxy, Profile: c.Profile, From 7cc2c26bcf24607305e33db795d017250e87d8ff Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 14:26:50 -0400 Subject: [PATCH 0030/1490] Larger minimum delay for throttling errors. --- internal/conns/backoff_delayer.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/conns/backoff_delayer.go b/internal/conns/backoff_delayer.go index de40284d936..d1f5331c3ee 100644 --- a/internal/conns/backoff_delayer.go +++ b/internal/conns/backoff_delayer.go @@ -7,6 +7,8 @@ import ( "math" "math/rand" "time" + + "github.com/aws/aws-sdk-go-v2/aws/retry" ) // AWS SDK for Go v1 compatible Backoff. @@ -19,7 +21,16 @@ type v1CompatibleBackoff struct { // AWS SDK for Go v1 compatible Backoff. // See https://github.com/aws/aws-sdk-go/blob/e7dfa8a81550571e247af1ed63a698f9f43a4d51/aws/client/default_retryer.go#L78. func (c *v1CompatibleBackoff) BackoffDelay(attempt int, err error) (time.Duration, error) { - minDelay := 30 * time.Millisecond + const ( + defaultMinRetryDelay = 30 * time.Millisecond + defaultMinThrottleDelay = 500 * time.Millisecond + ) + minDelay := defaultMinRetryDelay + + if retry.IsErrorThrottles(retry.DefaultThrottles).IsErrorThrottle(err).Bool() { + minDelay = defaultMinThrottleDelay + } + maxDelay := c.maxRetryDelay var delay time.Duration From 0c4d0dea3fce0bd6fc8f3f41fedd019e89b74e97 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:42 -0400 Subject: [PATCH 0031/1490] ci: Prefer constant for string literal "region" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 6c7a9b78477..d61935c7b2b 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1165,3 +1165,13 @@ rules: - pattern: '"values"' severity: ERROR fix: "names.AttrValues" + - id: literal-region-string-constant + languages: [go] + message: Use the constant `names.AttrRegion` for the string literal "region" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"region"' + severity: ERROR + fix: "names.AttrRegion" From 87cfe0559644d44e93dd8bb98f37604e6efedfb9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:42 -0400 Subject: [PATCH 0032/1490] names: Add constant for string literal "region" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index e3d240ec7ec..e70b7e2232f 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -38,6 +38,7 @@ const ( AttrPort = "port" AttrPreferredMaintenanceWindow = "preferred_maintenance_window" AttrProtocol = "protocol" + AttrRegion = "region" AttrResourceARN = "resource_arn" AttrRoleARN = "role_arn" AttrSecurityGroupIDs = "security_group_ids" From f7149c0f5c4d55ff06d7032632aa1c103eea530a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:42 -0400 Subject: [PATCH 0033/1490] accessanalyzer: Use constant for region strings --- internal/service/accessanalyzer/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/accessanalyzer/service_endpoints_gen_test.go b/internal/service/accessanalyzer/service_endpoints_gen_test.go index a317f057c91..85a86e5e4f0 100644 --- a/internal/service/accessanalyzer/service_endpoints_gen_test.go +++ b/internal/service/accessanalyzer/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From b22918b3b319293ee0065b14ebc1c6e835ce7c7c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:42 -0400 Subject: [PATCH 0034/1490] account: Use constant for region strings --- internal/service/account/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/account/service_endpoints_gen_test.go b/internal/service/account/service_endpoints_gen_test.go index 3986c42b054..d94b7c8597e 100644 --- a/internal/service/account/service_endpoints_gen_test.go +++ b/internal/service/account/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 9a15d45a18b06a168f68c254076cdf6ad5b4bf50 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:43 -0400 Subject: [PATCH 0035/1490] acm: Use constant for region strings --- internal/service/acm/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/acm/service_endpoints_gen_test.go b/internal/service/acm/service_endpoints_gen_test.go index 0fe461b6ee4..3e721badd5a 100644 --- a/internal/service/acm/service_endpoints_gen_test.go +++ b/internal/service/acm/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 192b1c644eac3277b9867809e00c62b9dda88abd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:43 -0400 Subject: [PATCH 0036/1490] acmpca: Use constant for region strings --- internal/service/acmpca/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/acmpca/service_endpoints_gen_test.go b/internal/service/acmpca/service_endpoints_gen_test.go index 80976b29c9b..cfcf5f74938 100644 --- a/internal/service/acmpca/service_endpoints_gen_test.go +++ b/internal/service/acmpca/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 2b5431616126f628adfc4b9440463e40ee2882e7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:43 -0400 Subject: [PATCH 0037/1490] amp: Use constant for region strings --- internal/service/amp/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/amp/service_endpoints_gen_test.go b/internal/service/amp/service_endpoints_gen_test.go index bb0ebcf34d0..fc2ebb4a65a 100644 --- a/internal/service/amp/service_endpoints_gen_test.go +++ b/internal/service/amp/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -490,7 +491,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 1c0167b43a736d4f391d5eac70da8685da50ebc9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:43 -0400 Subject: [PATCH 0038/1490] amplify: Use constant for region strings --- internal/service/amplify/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/amplify/service_endpoints_gen_test.go b/internal/service/amplify/service_endpoints_gen_test.go index 478f26ce0cd..59811532f4c 100644 --- a/internal/service/amplify/service_endpoints_gen_test.go +++ b/internal/service/amplify/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 38233dea1cbd0e8ce54b970653ee90352ec0556b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:43 -0400 Subject: [PATCH 0039/1490] apigateway: Use constant for region strings --- internal/service/apigateway/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/apigateway/service_endpoints_gen_test.go b/internal/service/apigateway/service_endpoints_gen_test.go index 91c50a698e9..9460206f647 100644 --- a/internal/service/apigateway/service_endpoints_gen_test.go +++ b/internal/service/apigateway/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 3bc0c7340bd34df42af4d125f8653b3a57a5ddc6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:43 -0400 Subject: [PATCH 0040/1490] apigatewayv2: Use constant for region strings --- internal/service/apigatewayv2/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/apigatewayv2/service_endpoints_gen_test.go b/internal/service/apigatewayv2/service_endpoints_gen_test.go index 1823385c726..c9cb26f38b1 100644 --- a/internal/service/apigatewayv2/service_endpoints_gen_test.go +++ b/internal/service/apigatewayv2/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From db4e4f01300c2ae7f3ed2efae1a8e8817631dd55 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:44 -0400 Subject: [PATCH 0041/1490] appautoscaling: Use constant for region strings --- internal/service/appautoscaling/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/appautoscaling/service_endpoints_gen_test.go b/internal/service/appautoscaling/service_endpoints_gen_test.go index eefe8e41241..936a02de200 100644 --- a/internal/service/appautoscaling/service_endpoints_gen_test.go +++ b/internal/service/appautoscaling/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -404,7 +405,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 76016293eb1085e65670249f071eb0b9b8e417e1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:44 -0400 Subject: [PATCH 0042/1490] appconfig: Use constant for region strings --- internal/service/appconfig/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/appconfig/service_endpoints_gen_test.go b/internal/service/appconfig/service_endpoints_gen_test.go index 6f94e38d2ab..9416ba9c4a0 100644 --- a/internal/service/appconfig/service_endpoints_gen_test.go +++ b/internal/service/appconfig/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 2e4678e87a769ee92024c262d125c117d9f496d9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:44 -0400 Subject: [PATCH 0043/1490] appfabric: Use constant for region strings --- internal/service/appfabric/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/appfabric/service_endpoints_gen_test.go b/internal/service/appfabric/service_endpoints_gen_test.go index 046c92c52a2..45135210d33 100644 --- a/internal/service/appfabric/service_endpoints_gen_test.go +++ b/internal/service/appfabric/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 10ea22b943cdcf1048adb644effe8b362a02fa7a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:44 -0400 Subject: [PATCH 0044/1490] appflow: Use constant for region strings --- internal/service/appflow/connector_profile.go | 6 +++--- internal/service/appflow/service_endpoints_gen_test.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/appflow/connector_profile.go b/internal/service/appflow/connector_profile.go index b2634f26389..bc40f73eabd 100644 --- a/internal/service/appflow/connector_profile.go +++ b/internal/service/appflow/connector_profile.go @@ -1321,7 +1321,7 @@ func resourceConnectorProfile() *schema.Resource { validation.StringMatch(regexache.MustCompile(`^$|com.amazonaws.vpce.[\w/!:@#.\-]+`), "must be a valid AWS VPC endpoint address"), ), }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.All( @@ -2166,7 +2166,7 @@ func expandSnowflakeConnectorProfileProperties(m map[string]interface{}) *types. properties.PrivateLinkServiceName = aws.String(v) } - if v, ok := m["region"].(string); ok && v != "" { + if v, ok := m[names.AttrRegion].(string); ok && v != "" { properties.Region = aws.String(v) } @@ -2373,7 +2373,7 @@ func flattenSnowflakeConnectorProfileProperties(properties *types.SnowflakeConne } if properties.Region != nil { - m["region"] = aws.ToString(properties.Region) + m[names.AttrRegion] = aws.ToString(properties.Region) } m["stage"] = aws.ToString(properties.Stage) diff --git a/internal/service/appflow/service_endpoints_gen_test.go b/internal/service/appflow/service_endpoints_gen_test.go index 4f926f62412..35cf8f9f1ce 100644 --- a/internal/service/appflow/service_endpoints_gen_test.go +++ b/internal/service/appflow/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 037a364f49c42c1c43948409915bcd7fcb6a3ccc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:44 -0400 Subject: [PATCH 0045/1490] appintegrations: Use constant for region strings --- internal/service/appintegrations/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/appintegrations/service_endpoints_gen_test.go b/internal/service/appintegrations/service_endpoints_gen_test.go index e1403de0d01..4df183dc331 100644 --- a/internal/service/appintegrations/service_endpoints_gen_test.go +++ b/internal/service/appintegrations/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 3868cb22eac922567cff2431787cb5a675afb2a6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:45 -0400 Subject: [PATCH 0046/1490] applicationinsights: Use constant for region strings --- .../service/applicationinsights/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/applicationinsights/service_endpoints_gen_test.go b/internal/service/applicationinsights/service_endpoints_gen_test.go index 874e2a78fee..04a63ee256d 100644 --- a/internal/service/applicationinsights/service_endpoints_gen_test.go +++ b/internal/service/applicationinsights/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d0cd787dd98b4f3e55c8ce4dcf98cf4aa0388bb7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:45 -0400 Subject: [PATCH 0047/1490] appmesh: Use constant for region strings --- internal/service/appmesh/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/appmesh/service_endpoints_gen_test.go b/internal/service/appmesh/service_endpoints_gen_test.go index df9812c4362..96892b33693 100644 --- a/internal/service/appmesh/service_endpoints_gen_test.go +++ b/internal/service/appmesh/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 1d2519f075a85725264bf35552712e6cdd433829 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:45 -0400 Subject: [PATCH 0048/1490] apprunner: Use constant for region strings --- internal/service/apprunner/hosted_zone_id_data_source.go | 2 +- internal/service/apprunner/service_endpoints_gen_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/apprunner/hosted_zone_id_data_source.go b/internal/service/apprunner/hosted_zone_id_data_source.go index b67d18d0765..88a214439c9 100644 --- a/internal/service/apprunner/hosted_zone_id_data_source.go +++ b/internal/service/apprunner/hosted_zone_id_data_source.go @@ -48,7 +48,7 @@ func (d *hostedZoneIDDataSource) Schema(ctx context.Context, request datasource. response.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ names.AttrID: framework.IDAttribute(), - "region": schema.StringAttribute{ + names.AttrRegion: schema.StringAttribute{ Optional: true, Computed: true, }, diff --git a/internal/service/apprunner/service_endpoints_gen_test.go b/internal/service/apprunner/service_endpoints_gen_test.go index 9827ea611d6..b96ff597799 100644 --- a/internal/service/apprunner/service_endpoints_gen_test.go +++ b/internal/service/apprunner/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From fd2583689a77b8ca8cdb506b05025c486889ab3e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:45 -0400 Subject: [PATCH 0049/1490] appstream: Use constant for region strings --- internal/service/appstream/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/appstream/service_endpoints_gen_test.go b/internal/service/appstream/service_endpoints_gen_test.go index d9aa97466d3..013eb77fc52 100644 --- a/internal/service/appstream/service_endpoints_gen_test.go +++ b/internal/service/appstream/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 5387f02d60d5bdcaa003896403fc45d3b18f4cb1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:45 -0400 Subject: [PATCH 0050/1490] appsync: Use constant for region strings --- internal/service/appsync/datasource.go | 30 +++++++++---------- .../appsync/service_endpoints_gen_test.go | 3 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/internal/service/appsync/datasource.go b/internal/service/appsync/datasource.go index 8053564a62a..77bcd582016 100644 --- a/internal/service/appsync/datasource.go +++ b/internal/service/appsync/datasource.go @@ -76,7 +76,7 @@ func ResourceDataSource() *schema.Resource { }, }, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, Computed: true, @@ -107,7 +107,7 @@ func ResourceDataSource() *schema.Resource { Type: schema.TypeString, Required: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, Computed: true, @@ -202,7 +202,7 @@ func ResourceDataSource() *schema.Resource { Type: schema.TypeString, Required: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, Computed: true, @@ -241,7 +241,7 @@ func ResourceDataSource() *schema.Resource { Type: schema.TypeString, Required: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, Computed: true, @@ -524,7 +524,7 @@ func expandDynamoDBDataSourceConfig(l []interface{}, currentRegion string) *apps TableName: aws.String(configured["table_name"].(string)), } - if v, ok := configured["region"]; ok && v.(string) != "" { + if v, ok := configured[names.AttrRegion]; ok && v.(string) != "" { result.AwsRegion = aws.String(v.(string)) } @@ -573,8 +573,8 @@ func flattenDynamoDBDataSourceConfig(config *appsync.DynamodbDataSourceConfig) [ } result := map[string]interface{}{ - "region": aws.StringValue(config.AwsRegion), - "table_name": aws.StringValue(config.TableName), + names.AttrRegion: aws.StringValue(config.AwsRegion), + "table_name": aws.StringValue(config.TableName), } if config.UseCallerCredentials != nil { @@ -626,7 +626,7 @@ func expandElasticsearchDataSourceConfig(l []interface{}, currentRegion string) Endpoint: aws.String(configured["endpoint"].(string)), } - if v, ok := configured["region"]; ok && v.(string) != "" { + if v, ok := configured[names.AttrRegion]; ok && v.(string) != "" { result.AwsRegion = aws.String(v.(string)) } @@ -645,7 +645,7 @@ func expandOpenSearchServiceDataSourceConfig(l []interface{}, currentRegion stri Endpoint: aws.String(configured["endpoint"].(string)), } - if v, ok := configured["region"]; ok && v.(string) != "" { + if v, ok := configured[names.AttrRegion]; ok && v.(string) != "" { result.AwsRegion = aws.String(v.(string)) } @@ -658,8 +658,8 @@ func flattenElasticsearchDataSourceConfig(config *appsync.ElasticsearchDataSourc } result := map[string]interface{}{ - "endpoint": aws.StringValue(config.Endpoint), - "region": aws.StringValue(config.AwsRegion), + "endpoint": aws.StringValue(config.Endpoint), + names.AttrRegion: aws.StringValue(config.AwsRegion), } return []map[string]interface{}{result} @@ -671,8 +671,8 @@ func flattenOpenSearchServiceDataSourceConfig(config *appsync.OpenSearchServiceD } result := map[string]interface{}{ - "endpoint": aws.StringValue(config.Endpoint), - "region": aws.StringValue(config.AwsRegion), + "endpoint": aws.StringValue(config.Endpoint), + names.AttrRegion: aws.StringValue(config.AwsRegion), } return []map[string]interface{}{result} @@ -870,7 +870,7 @@ func testAccDataSourceConfig_expandRDSHTTPEndpoint(l []interface{}, currentRegio AwsRegion: aws.String(currentRegion), } - if v, ok := configured["region"]; ok && v.(string) != "" { + if v, ok := configured[names.AttrRegion]; ok && v.(string) != "" { result.AwsRegion = aws.String(v.(string)) } @@ -901,7 +901,7 @@ func flattenRDSHTTPEndpointConfig(config *appsync.RdsHttpEndpointConfig) []map[s result := map[string]interface{}{} if config.AwsRegion != nil { - result["region"] = aws.StringValue(config.AwsRegion) + result[names.AttrRegion] = aws.StringValue(config.AwsRegion) } if config.AwsSecretStoreArn != nil { diff --git a/internal/service/appsync/service_endpoints_gen_test.go b/internal/service/appsync/service_endpoints_gen_test.go index 0b88fc469ac..57f5bf72fcd 100644 --- a/internal/service/appsync/service_endpoints_gen_test.go +++ b/internal/service/appsync/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 81b16648dd8dd653c97626f6d5f2aea0505e4c1f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:46 -0400 Subject: [PATCH 0051/1490] athena: Use constant for region strings --- internal/service/athena/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/athena/service_endpoints_gen_test.go b/internal/service/athena/service_endpoints_gen_test.go index 12a30433a9a..2965c3f132b 100644 --- a/internal/service/athena/service_endpoints_gen_test.go +++ b/internal/service/athena/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e8279f91ee5471da6b985e2dc86002e163bc5a17 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:46 -0400 Subject: [PATCH 0052/1490] auditmanager: Use constant for region strings --- internal/service/auditmanager/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/auditmanager/service_endpoints_gen_test.go b/internal/service/auditmanager/service_endpoints_gen_test.go index bf10732d5e8..7d02c3be603 100644 --- a/internal/service/auditmanager/service_endpoints_gen_test.go +++ b/internal/service/auditmanager/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d13a6fcd7cd47e61e0a7e11b10658e508818e56b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:46 -0400 Subject: [PATCH 0053/1490] autoscaling: Use constant for region strings --- internal/service/autoscaling/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/autoscaling/service_endpoints_gen_test.go b/internal/service/autoscaling/service_endpoints_gen_test.go index 4fbf987c813..6669ab7b7f5 100644 --- a/internal/service/autoscaling/service_endpoints_gen_test.go +++ b/internal/service/autoscaling/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e2cb000923584e945041a78b7d6cc124b14155a6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:46 -0400 Subject: [PATCH 0054/1490] autoscalingplans: Use constant for region strings --- .../service/autoscalingplans/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/autoscalingplans/service_endpoints_gen_test.go b/internal/service/autoscalingplans/service_endpoints_gen_test.go index 8427915a532..5c5348d0ac9 100644 --- a/internal/service/autoscalingplans/service_endpoints_gen_test.go +++ b/internal/service/autoscalingplans/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 73bfb570cfa1a6d367a4f02f758ee5c14cf60e3a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:46 -0400 Subject: [PATCH 0055/1490] backup: Use constant for region strings --- internal/service/backup/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/backup/service_endpoints_gen_test.go b/internal/service/backup/service_endpoints_gen_test.go index 43feffd6bb1..90fcb4eb0e5 100644 --- a/internal/service/backup/service_endpoints_gen_test.go +++ b/internal/service/backup/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 09d04a4e79106a4f1ef9dad8852b8b6a1fd3ee1c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:47 -0400 Subject: [PATCH 0056/1490] batch: Use constant for region strings --- internal/service/batch/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/batch/service_endpoints_gen_test.go b/internal/service/batch/service_endpoints_gen_test.go index 6859b93b210..b9b5a307d06 100644 --- a/internal/service/batch/service_endpoints_gen_test.go +++ b/internal/service/batch/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -362,7 +363,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From da589fc8ebada89933e298801cb2b8180097db12 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:47 -0400 Subject: [PATCH 0057/1490] bcmdataexports: Use constant for region strings --- internal/service/bcmdataexports/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/bcmdataexports/service_endpoints_gen_test.go b/internal/service/bcmdataexports/service_endpoints_gen_test.go index 9ac5e5f1288..0afe7b712de 100644 --- a/internal/service/bcmdataexports/service_endpoints_gen_test.go +++ b/internal/service/bcmdataexports/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 8f084f47b14724f407338674b42286018dc3bdb0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:47 -0400 Subject: [PATCH 0058/1490] bedrock: Use constant for region strings --- internal/service/bedrock/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/bedrock/service_endpoints_gen_test.go b/internal/service/bedrock/service_endpoints_gen_test.go index 04f14acf6fe..53949b03d2b 100644 --- a/internal/service/bedrock/service_endpoints_gen_test.go +++ b/internal/service/bedrock/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From f737c0776914e3608bf22431cbec99e4f17134f9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:47 -0400 Subject: [PATCH 0059/1490] bedrockagent: Use constant for region strings --- internal/service/bedrockagent/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/bedrockagent/service_endpoints_gen_test.go b/internal/service/bedrockagent/service_endpoints_gen_test.go index 76c67edf9f5..c03c6d6d4bb 100644 --- a/internal/service/bedrockagent/service_endpoints_gen_test.go +++ b/internal/service/bedrockagent/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e471454b8eecd6ea5cc5c1d1c628419e80a8a08b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:47 -0400 Subject: [PATCH 0060/1490] budgets: Use constant for region strings --- internal/service/budgets/budget_action.go | 6 +++--- internal/service/budgets/service_endpoints_gen_test.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/budgets/budget_action.go b/internal/service/budgets/budget_action.go index 4382e825578..8957f71378f 100644 --- a/internal/service/budgets/budget_action.go +++ b/internal/service/budgets/budget_action.go @@ -176,7 +176,7 @@ func ResourceBudgetAction() *schema.Resource { MaxItems: 100, Elem: &schema.Schema{Type: schema.TypeString}, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Required: true, }, @@ -545,7 +545,7 @@ func expandBudgetActionActionSSMActionDefinition(l []interface{}) *awstypes.SsmA config.ActionSubType = awstypes.ActionSubType(v) } - if v, ok := m["region"].(string); ok && v != "" { + if v, ok := m[names.AttrRegion].(string); ok && v != "" { config.Region = aws.String(v) } @@ -659,7 +659,7 @@ func flattenBudgetActionSSMActionDefinition(lt *awstypes.SsmActionDefinition) [] attrs := map[string]interface{}{ "action_sub_type": string(lt.ActionSubType), "instance_ids": flex.FlattenStringValueSet(lt.InstanceIds), - "region": aws.ToString(lt.Region), + names.AttrRegion: aws.ToString(lt.Region), } return []map[string]interface{}{attrs} diff --git a/internal/service/budgets/service_endpoints_gen_test.go b/internal/service/budgets/service_endpoints_gen_test.go index ce9567a474d..71ddc084900 100644 --- a/internal/service/budgets/service_endpoints_gen_test.go +++ b/internal/service/budgets/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -337,7 +338,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From f34c4496e4c9ff3b9c67784d9db4216e718cfe5a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:48 -0400 Subject: [PATCH 0061/1490] ce: Use constant for region strings --- internal/service/ce/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ce/service_endpoints_gen_test.go b/internal/service/ce/service_endpoints_gen_test.go index dd33d66552c..dfec92cdefb 100644 --- a/internal/service/ce/service_endpoints_gen_test.go +++ b/internal/service/ce/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 8076eaa72152b21ec632c9277c13a8b2ac0f9cec Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:48 -0400 Subject: [PATCH 0062/1490] chatbot: Use constant for region strings --- internal/service/chatbot/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/chatbot/service_endpoints_gen_test.go b/internal/service/chatbot/service_endpoints_gen_test.go index 10f4fd6b2ef..5bfcb6747f2 100644 --- a/internal/service/chatbot/service_endpoints_gen_test.go +++ b/internal/service/chatbot/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From f26589e30c6310b4aa2d46400f39fa495e85be9a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:48 -0400 Subject: [PATCH 0063/1490] chime: Use constant for region strings --- internal/service/chime/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/chime/service_endpoints_gen_test.go b/internal/service/chime/service_endpoints_gen_test.go index 366dde7099c..d8f01622aec 100644 --- a/internal/service/chime/service_endpoints_gen_test.go +++ b/internal/service/chime/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 1d48ddfb3a7ed68622808c1e6f988e8d6e58e250 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:49 -0400 Subject: [PATCH 0064/1490] chimesdkmediapipelines: Use constant for region strings --- .../chimesdkmediapipelines/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go b/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go index a3ab82435a7..d684392f6b5 100644 --- a/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go +++ b/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From fa115caf01b2c496aeb273dfd44247aa2056ca4c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:49 -0400 Subject: [PATCH 0065/1490] chimesdkvoice: Use constant for region strings --- internal/service/chimesdkvoice/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/chimesdkvoice/service_endpoints_gen_test.go b/internal/service/chimesdkvoice/service_endpoints_gen_test.go index 55d2b42447c..2452b366bbd 100644 --- a/internal/service/chimesdkvoice/service_endpoints_gen_test.go +++ b/internal/service/chimesdkvoice/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From be671f293076fef7a9e41385dc5e94260f2f96a3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:49 -0400 Subject: [PATCH 0066/1490] cleanrooms: Use constant for region strings --- internal/service/cleanrooms/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/cleanrooms/service_endpoints_gen_test.go b/internal/service/cleanrooms/service_endpoints_gen_test.go index 8faff46db2a..aaafbecb4e9 100644 --- a/internal/service/cleanrooms/service_endpoints_gen_test.go +++ b/internal/service/cleanrooms/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6729f34ea5ec5b0d2e7ebab9f04d1b94abb5bd51 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:49 -0400 Subject: [PATCH 0067/1490] cloud9: Use constant for region strings --- internal/service/cloud9/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/cloud9/service_endpoints_gen_test.go b/internal/service/cloud9/service_endpoints_gen_test.go index bca41962693..c4fcd299c2e 100644 --- a/internal/service/cloud9/service_endpoints_gen_test.go +++ b/internal/service/cloud9/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 58068033d6089e47067e3bfb9e12a5ae0c9d322d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:49 -0400 Subject: [PATCH 0068/1490] cloudcontrol: Use constant for region strings --- internal/service/cloudcontrol/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/cloudcontrol/service_endpoints_gen_test.go b/internal/service/cloudcontrol/service_endpoints_gen_test.go index 869e8d62c0b..3fd57993099 100644 --- a/internal/service/cloudcontrol/service_endpoints_gen_test.go +++ b/internal/service/cloudcontrol/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From a8a99a86e265a9b86f7379e328ca482a9aae4b3f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:50 -0400 Subject: [PATCH 0069/1490] cloudformation: Use constant for region strings --- .../service/cloudformation/service_endpoints_gen_test.go | 3 ++- internal/service/cloudformation/stack_set_instance.go | 6 +++--- internal/service/cloudformation/stack_set_instance_test.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/service/cloudformation/service_endpoints_gen_test.go b/internal/service/cloudformation/service_endpoints_gen_test.go index 21c5dc21daf..a4f7705af07 100644 --- a/internal/service/cloudformation/service_endpoints_gen_test.go +++ b/internal/service/cloudformation/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -337,7 +338,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } diff --git a/internal/service/cloudformation/stack_set_instance.go b/internal/service/cloudformation/stack_set_instance.go index f34cc7136fb..a7edde6fbfa 100644 --- a/internal/service/cloudformation/stack_set_instance.go +++ b/internal/service/cloudformation/stack_set_instance.go @@ -144,7 +144,7 @@ func resourceStackSetInstance() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, Computed: true, @@ -196,7 +196,7 @@ func resourceStackSetInstanceCreate(ctx context.Context, d *schema.ResourceData, conn := meta.(*conns.AWSClient).CloudFormationClient(ctx) region := meta.(*conns.AWSClient).Region - if v, ok := d.GetOk("region"); ok { + if v, ok := d.GetOk(names.AttrRegion); ok { region = v.(string) } @@ -314,7 +314,7 @@ func resourceStackSetInstanceRead(ctx context.Context, d *schema.ResourceData, m } stackSetName, accountOrOrgID, region := parts[0], parts[1], parts[2] - d.Set("region", region) + d.Set(names.AttrRegion, region) d.Set("stack_set_name", stackSetName) callAs := d.Get("call_as").(string) diff --git a/internal/service/cloudformation/stack_set_instance_test.go b/internal/service/cloudformation/stack_set_instance_test.go index fb6d2a85cdd..55c4d373aed 100644 --- a/internal/service/cloudformation/stack_set_instance_test.go +++ b/internal/service/cloudformation/stack_set_instance_test.go @@ -46,7 +46,7 @@ func TestAccCloudFormationStackSetInstance_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "operation_preferences.#", "0"), resource.TestCheckResourceAttr(resourceName, "organizational_unit_id", ""), resource.TestCheckResourceAttr(resourceName, "parameter_overrides.%", "0"), - resource.TestCheckResourceAttr(resourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(resourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttr(resourceName, "retain_stack", "false"), resource.TestCheckResourceAttrSet(resourceName, "stack_id"), resource.TestCheckResourceAttr(resourceName, "stack_instance_summaries.#", "0"), From 1aa0e9c2ff2353b85eda56e832ce2c56872b3f99 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:50 -0400 Subject: [PATCH 0070/1490] cloudfront: Use constant for region strings --- .../cloudfront/log_delivery_canonical_user_id_data_source.go | 4 ++-- internal/service/cloudfront/service_endpoints_gen_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/cloudfront/log_delivery_canonical_user_id_data_source.go b/internal/service/cloudfront/log_delivery_canonical_user_id_data_source.go index 0bb14df0120..7223a6c1df8 100644 --- a/internal/service/cloudfront/log_delivery_canonical_user_id_data_source.go +++ b/internal/service/cloudfront/log_delivery_canonical_user_id_data_source.go @@ -26,7 +26,7 @@ func dataSourceLogDeliveryCanonicalUserID() *schema.Resource { ReadWithoutTimeout: dataSourceLogDeliveryCanonicalUserIDRead, Schema: map[string]*schema.Schema{ - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -39,7 +39,7 @@ func dataSourceLogDeliveryCanonicalUserIDRead(ctx context.Context, d *schema.Res canonicalId := defaultLogDeliveryCanonicalUserID region := meta.(*conns.AWSClient).Region - if v, ok := d.GetOk("region"); ok { + if v, ok := d.GetOk(names.AttrRegion); ok { region = v.(string) } diff --git a/internal/service/cloudfront/service_endpoints_gen_test.go b/internal/service/cloudfront/service_endpoints_gen_test.go index 5f329fc7e4c..e39f345b9ba 100644 --- a/internal/service/cloudfront/service_endpoints_gen_test.go +++ b/internal/service/cloudfront/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From c1d188e789dc138dd85050b62a5a9675d21174ff Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:50 -0400 Subject: [PATCH 0071/1490] cloudhsmv2: Use constant for region strings --- internal/service/cloudhsmv2/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/cloudhsmv2/service_endpoints_gen_test.go b/internal/service/cloudhsmv2/service_endpoints_gen_test.go index cba5ec62a63..211865da535 100644 --- a/internal/service/cloudhsmv2/service_endpoints_gen_test.go +++ b/internal/service/cloudhsmv2/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 85bbc54689ff887146547306f35e8e36f9d6264e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:50 -0400 Subject: [PATCH 0072/1490] cloudsearch: Use constant for region strings --- internal/service/cloudsearch/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/cloudsearch/service_endpoints_gen_test.go b/internal/service/cloudsearch/service_endpoints_gen_test.go index 77b6ae94a78..ea16fc8416e 100644 --- a/internal/service/cloudsearch/service_endpoints_gen_test.go +++ b/internal/service/cloudsearch/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e7942ceedee0040cb8c365c3ae48b228264fb72a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:51 -0400 Subject: [PATCH 0073/1490] cloudtrail: Use constant for region strings --- internal/service/cloudtrail/service_account_data_source.go | 4 ++-- internal/service/cloudtrail/service_endpoints_gen_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/cloudtrail/service_account_data_source.go b/internal/service/cloudtrail/service_account_data_source.go index fa01fe2e1fd..23b10f49b9d 100644 --- a/internal/service/cloudtrail/service_account_data_source.go +++ b/internal/service/cloudtrail/service_account_data_source.go @@ -64,7 +64,7 @@ func dataSourceServiceAccount() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -76,7 +76,7 @@ func dataSourceServiceAccountRead(ctx context.Context, d *schema.ResourceData, m var diags diag.Diagnostics region := meta.(*conns.AWSClient).Region - if v, ok := d.GetOk("region"); ok { + if v, ok := d.GetOk(names.AttrRegion); ok { region = v.(string) } diff --git a/internal/service/cloudtrail/service_endpoints_gen_test.go b/internal/service/cloudtrail/service_endpoints_gen_test.go index 9c87c7d6460..2ab19824513 100644 --- a/internal/service/cloudtrail/service_endpoints_gen_test.go +++ b/internal/service/cloudtrail/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 11b3c786546eec5bbfa17fdb66eea6235401ac8b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:51 -0400 Subject: [PATCH 0074/1490] cloudwatch: Use constant for region strings --- internal/service/cloudwatch/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/cloudwatch/service_endpoints_gen_test.go b/internal/service/cloudwatch/service_endpoints_gen_test.go index a0019293d43..e086ce1a7c2 100644 --- a/internal/service/cloudwatch/service_endpoints_gen_test.go +++ b/internal/service/cloudwatch/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e6fe478b36cffe465c10026aa0549f62d1c535fd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:51 -0400 Subject: [PATCH 0075/1490] codeartifact: Use constant for region strings --- internal/service/codeartifact/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/codeartifact/service_endpoints_gen_test.go b/internal/service/codeartifact/service_endpoints_gen_test.go index 162963ceb67..3698f16e6ce 100644 --- a/internal/service/codeartifact/service_endpoints_gen_test.go +++ b/internal/service/codeartifact/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 72e71d054af9e76ead3eb05ff0e4ccf59e66ceee Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:51 -0400 Subject: [PATCH 0076/1490] codebuild: Use constant for region strings --- internal/service/codebuild/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/codebuild/service_endpoints_gen_test.go b/internal/service/codebuild/service_endpoints_gen_test.go index a84948c9305..74bddf1c47e 100644 --- a/internal/service/codebuild/service_endpoints_gen_test.go +++ b/internal/service/codebuild/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From c9bdc8b277c4d095b256ace0873a8b50ceac1f6e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:51 -0400 Subject: [PATCH 0077/1490] codecommit: Use constant for region strings --- internal/service/codecommit/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/codecommit/service_endpoints_gen_test.go b/internal/service/codecommit/service_endpoints_gen_test.go index 77cc4601ecb..bb7ee5ea915 100644 --- a/internal/service/codecommit/service_endpoints_gen_test.go +++ b/internal/service/codecommit/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6e1a0c83dc264928ffca99fbdc0aa73f7601be15 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:52 -0400 Subject: [PATCH 0078/1490] codeguruprofiler: Use constant for region strings --- .../service/codeguruprofiler/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/codeguruprofiler/service_endpoints_gen_test.go b/internal/service/codeguruprofiler/service_endpoints_gen_test.go index df07265939b..988092d99fa 100644 --- a/internal/service/codeguruprofiler/service_endpoints_gen_test.go +++ b/internal/service/codeguruprofiler/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 3432bbf0d05727113fdcf2748359a0a74aef09f7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:52 -0400 Subject: [PATCH 0079/1490] codegurureviewer: Use constant for region strings --- .../service/codegurureviewer/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/codegurureviewer/service_endpoints_gen_test.go b/internal/service/codegurureviewer/service_endpoints_gen_test.go index 35174d357f8..633c70f73e9 100644 --- a/internal/service/codegurureviewer/service_endpoints_gen_test.go +++ b/internal/service/codegurureviewer/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -338,7 +339,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From b6ff01a52d2882cf9e01b3ef060358aa42917f38 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:52 -0400 Subject: [PATCH 0080/1490] codepipeline: Use constant for region strings --- internal/service/codepipeline/codepipeline.go | 12 ++++++------ .../codepipeline/service_endpoints_gen_test.go | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/service/codepipeline/codepipeline.go b/internal/service/codepipeline/codepipeline.go index 4a360ad18ff..c2e21963d2e 100644 --- a/internal/service/codepipeline/codepipeline.go +++ b/internal/service/codepipeline/codepipeline.go @@ -82,7 +82,7 @@ func resourcePipeline() *schema.Resource { Type: schema.TypeString, Required: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -182,7 +182,7 @@ func resourcePipeline() *schema.Resource { Required: true, ValidateDiagFunc: pipelineValidateActionProvider, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, Computed: true, @@ -750,7 +750,7 @@ func expandArtifactStores(tfList []interface{}) map[string]types.ArtifactStore { var region string - if v, ok := tfMap["region"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrRegion].(string); ok && v != "" { region = v } @@ -863,7 +863,7 @@ func expandActionDeclaration(tfMap map[string]interface{}) *types.ActionDeclarat apiObject.ActionTypeId.Provider = aws.String(v) } - if v, ok := tfMap["region"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrRegion].(string); ok && v != "" { apiObject.Region = aws.String(v) } @@ -1245,7 +1245,7 @@ func flattenArtifactStores(apiObjects map[string]types.ArtifactStore) []interfac for region, apiObject := range apiObjects { tfMap := flattenArtifactStore(&apiObject) - tfMap["region"] = region + tfMap[names.AttrRegion] = region tfList = append(tfList, tfMap) } @@ -1344,7 +1344,7 @@ func flattenActionDeclaration(d *schema.ResourceData, i, j int, apiObject types. } if v := apiObject.Region; v != nil { - tfMap["region"] = aws.ToString(v) + tfMap[names.AttrRegion] = aws.ToString(v) } if v := apiObject.RoleArn; v != nil { diff --git a/internal/service/codepipeline/service_endpoints_gen_test.go b/internal/service/codepipeline/service_endpoints_gen_test.go index 835523dc0c4..5eb8b8287c6 100644 --- a/internal/service/codepipeline/service_endpoints_gen_test.go +++ b/internal/service/codepipeline/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 4548bf34f54c6ea19236887bdadc250ad74c2cb8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:52 -0400 Subject: [PATCH 0081/1490] codestarconnections: Use constant for region strings --- .../service/codestarconnections/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/codestarconnections/service_endpoints_gen_test.go b/internal/service/codestarconnections/service_endpoints_gen_test.go index 2c2ebcf78e8..f510a514d3f 100644 --- a/internal/service/codestarconnections/service_endpoints_gen_test.go +++ b/internal/service/codestarconnections/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 83eb006e4d3cc7d9e39d030b04fab66757239de6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:53 -0400 Subject: [PATCH 0082/1490] codestarnotifications: Use constant for region strings --- .../codestarnotifications/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/codestarnotifications/service_endpoints_gen_test.go b/internal/service/codestarnotifications/service_endpoints_gen_test.go index 020a086b654..c6fe12a3b0f 100644 --- a/internal/service/codestarnotifications/service_endpoints_gen_test.go +++ b/internal/service/codestarnotifications/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 286dba4443adcbb94e212a915e063230945e90ee Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:53 -0400 Subject: [PATCH 0083/1490] cognitoidentity: Use constant for region strings --- internal/service/cognitoidentity/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/cognitoidentity/service_endpoints_gen_test.go b/internal/service/cognitoidentity/service_endpoints_gen_test.go index f6868d2815d..46ed709b445 100644 --- a/internal/service/cognitoidentity/service_endpoints_gen_test.go +++ b/internal/service/cognitoidentity/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -337,7 +338,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From ea32def0e0e5bc658e494b476137fea96adbd5b4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:53 -0400 Subject: [PATCH 0084/1490] cognitoidp: Use constant for region strings --- internal/service/cognitoidp/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/cognitoidp/service_endpoints_gen_test.go b/internal/service/cognitoidp/service_endpoints_gen_test.go index 9182c9938bd..e24ca82a0c1 100644 --- a/internal/service/cognitoidp/service_endpoints_gen_test.go +++ b/internal/service/cognitoidp/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -404,7 +405,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 46d50b80a6bed67bef72cb083b41cd626bc8dc1a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:53 -0400 Subject: [PATCH 0085/1490] comprehend: Use constant for region strings --- internal/service/comprehend/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/comprehend/service_endpoints_gen_test.go b/internal/service/comprehend/service_endpoints_gen_test.go index d8f35b5ec6a..2f71810f66c 100644 --- a/internal/service/comprehend/service_endpoints_gen_test.go +++ b/internal/service/comprehend/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6309fd1cfc5016723033166c0c8ea0f850e595d7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:53 -0400 Subject: [PATCH 0086/1490] computeoptimizer: Use constant for region strings --- .../service/computeoptimizer/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/computeoptimizer/service_endpoints_gen_test.go b/internal/service/computeoptimizer/service_endpoints_gen_test.go index d0d7c0f88e3..4a9a0e29330 100644 --- a/internal/service/computeoptimizer/service_endpoints_gen_test.go +++ b/internal/service/computeoptimizer/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 62a1e1fd1c920420133ff0207ac46a3b1011f572 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:54 -0400 Subject: [PATCH 0087/1490] configservice: Use constant for region strings --- internal/service/configservice/aggregate_authorization.go | 6 +++--- .../service/configservice/aggregate_authorization_test.go | 6 +++--- .../service/configservice/service_endpoints_gen_test.go | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/service/configservice/aggregate_authorization.go b/internal/service/configservice/aggregate_authorization.go index 3790e30afec..84a516bcce6 100644 --- a/internal/service/configservice/aggregate_authorization.go +++ b/internal/service/configservice/aggregate_authorization.go @@ -47,7 +47,7 @@ func resourceAggregateAuthorization() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -64,7 +64,7 @@ func resourceAggregateAuthorizationCreate(ctx context.Context, d *schema.Resourc var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ConfigServiceClient(ctx) - accountID, region := d.Get(names.AttrAccountID).(string), d.Get("region").(string) + accountID, region := d.Get(names.AttrAccountID).(string), d.Get(names.AttrRegion).(string) id := aggregateAuthorizationCreateResourceID(accountID, region) input := &configservice.PutAggregationAuthorizationInput{ AuthorizedAccountId: aws.String(accountID), @@ -106,7 +106,7 @@ func resourceAggregateAuthorizationRead(ctx context.Context, d *schema.ResourceD d.Set(names.AttrAccountID, aggregationAuthorization.AuthorizedAccountId) d.Set(names.AttrARN, aggregationAuthorization.AggregationAuthorizationArn) - d.Set("region", aggregationAuthorization.AuthorizedAwsRegion) + d.Set(names.AttrRegion, aggregationAuthorization.AuthorizedAwsRegion) return diags } diff --git a/internal/service/configservice/aggregate_authorization_test.go b/internal/service/configservice/aggregate_authorization_test.go index 5ce7364198f..5096f61fda8 100644 --- a/internal/service/configservice/aggregate_authorization_test.go +++ b/internal/service/configservice/aggregate_authorization_test.go @@ -37,7 +37,7 @@ func TestAccConfigServiceAggregateAuthorization_basic(t *testing.T) { testAccCheckAggregateAuthorizationExists(ctx, resourceName, &aa), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, names.AttrAccountID, accountID), - resource.TestCheckResourceAttr(resourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(resourceName, names.AttrRegion, acctest.Region()), ), }, { @@ -128,7 +128,7 @@ func testAccCheckAggregateAuthorizationExists(ctx context.Context, n string, v * conn := acctest.Provider.Meta().(*conns.AWSClient).ConfigServiceClient(ctx) - output, err := tfconfig.FindAggregateAuthorizationByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrAccountID], rs.Primary.Attributes["region"]) + output, err := tfconfig.FindAggregateAuthorizationByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrAccountID], rs.Primary.Attributes[names.AttrRegion]) if err != nil { return err @@ -149,7 +149,7 @@ func testAccCheckAggregateAuthorizationDestroy(ctx context.Context) resource.Tes continue } - _, err := tfconfig.FindAggregateAuthorizationByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrAccountID], rs.Primary.Attributes["region"]) + _, err := tfconfig.FindAggregateAuthorizationByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrAccountID], rs.Primary.Attributes[names.AttrRegion]) if tfresource.NotFound(err) { continue diff --git a/internal/service/configservice/service_endpoints_gen_test.go b/internal/service/configservice/service_endpoints_gen_test.go index bf966bacf08..08a560f0723 100644 --- a/internal/service/configservice/service_endpoints_gen_test.go +++ b/internal/service/configservice/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 84be32151ac53c931a6f8f4d06773a9a411dcd26 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:54 -0400 Subject: [PATCH 0088/1490] connect: Use constant for region strings --- internal/service/connect/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/connect/service_endpoints_gen_test.go b/internal/service/connect/service_endpoints_gen_test.go index d231e1c89aa..72e6da3f7b1 100644 --- a/internal/service/connect/service_endpoints_gen_test.go +++ b/internal/service/connect/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 723fcb0bc10ba888f2d562fd05cf228ceb57a368 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:54 -0400 Subject: [PATCH 0089/1490] connectcases: Use constant for region strings --- internal/service/connectcases/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/connectcases/service_endpoints_gen_test.go b/internal/service/connectcases/service_endpoints_gen_test.go index 4b6a342eb1a..030ffef03d4 100644 --- a/internal/service/connectcases/service_endpoints_gen_test.go +++ b/internal/service/connectcases/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 4f560bd6186f27b5025d721f6f3f8eb3392a41f1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:54 -0400 Subject: [PATCH 0090/1490] controltower: Use constant for region strings --- internal/service/controltower/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/controltower/service_endpoints_gen_test.go b/internal/service/controltower/service_endpoints_gen_test.go index 9db45432ad3..e04f3b92291 100644 --- a/internal/service/controltower/service_endpoints_gen_test.go +++ b/internal/service/controltower/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From a2b4f7fa31c1f419125bac95d23897971a81f69a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:54 -0400 Subject: [PATCH 0091/1490] costoptimizationhub: Use constant for region strings --- .../service/costoptimizationhub/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/costoptimizationhub/service_endpoints_gen_test.go b/internal/service/costoptimizationhub/service_endpoints_gen_test.go index d06e5c74a42..07ca7ffbf1e 100644 --- a/internal/service/costoptimizationhub/service_endpoints_gen_test.go +++ b/internal/service/costoptimizationhub/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d8ddedad812a531bc2ac1b9a97d8d5e8371b0935 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:55 -0400 Subject: [PATCH 0092/1490] cur: Use constant for region strings --- internal/service/cur/report_definition_test.go | 14 +++++++------- internal/service/cur/service_endpoints_gen_test.go | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/service/cur/report_definition_test.go b/internal/service/cur/report_definition_test.go index 6c48234cc1b..ee681acd42e 100644 --- a/internal/service/cur/report_definition_test.go +++ b/internal/service/cur/report_definition_test.go @@ -45,7 +45,7 @@ func testAccReportDefinition_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), resource.TestCheckResourceAttr(resourceName, "s3_prefix", ""), - resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, "region"), + resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, names.AttrRegion), resource.TestCheckResourceAttr(resourceName, "additional_artifacts.#", "2"), ), }, @@ -66,7 +66,7 @@ func testAccReportDefinition_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), resource.TestCheckResourceAttr(resourceName, "s3_prefix", "test"), - resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, "region"), + resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, names.AttrRegion), resource.TestCheckResourceAttr(resourceName, "additional_artifacts.#", "2"), ), }, @@ -104,7 +104,7 @@ func testAccReportDefinition_textOrCSV(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), resource.TestCheckResourceAttr(resourceName, "s3_prefix", bucketPrefix), - resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, "region"), + resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, names.AttrRegion), resource.TestCheckResourceAttr(resourceName, "additional_artifacts.#", "2"), resource.TestCheckResourceAttr(resourceName, "refresh_closed_reports", "false"), resource.TestCheckResourceAttr(resourceName, "report_versioning", reportVersioning), @@ -149,7 +149,7 @@ func testAccReportDefinition_parquet(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), resource.TestCheckResourceAttr(resourceName, "s3_prefix", bucketPrefix), - resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, "region"), + resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, names.AttrRegion), resource.TestCheckResourceAttr(resourceName, "refresh_closed_reports", "false"), resource.TestCheckResourceAttr(resourceName, "report_versioning", reportVersioning), ), @@ -193,7 +193,7 @@ func testAccReportDefinition_athena(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), resource.TestCheckResourceAttr(resourceName, "s3_prefix", bucketPrefix), - resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, "region"), + resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, names.AttrRegion), resource.TestCheckResourceAttr(resourceName, "additional_artifacts.#", "1"), resource.TestCheckResourceAttr(resourceName, "refresh_closed_reports", "false"), resource.TestCheckResourceAttr(resourceName, "report_versioning", reportVersioning), @@ -238,7 +238,7 @@ func testAccReportDefinition_refresh(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), resource.TestCheckResourceAttr(resourceName, "s3_prefix", bucketPrefix), - resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, "region"), + resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, names.AttrRegion), resource.TestCheckResourceAttr(resourceName, "additional_artifacts.#", "2"), resource.TestCheckResourceAttr(resourceName, "refresh_closed_reports", "true"), resource.TestCheckResourceAttr(resourceName, "report_versioning", reportVersioning), @@ -283,7 +283,7 @@ func testAccReportDefinition_overwrite(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), resource.TestCheckResourceAttr(resourceName, "s3_prefix", ""), - resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, "region"), + resource.TestCheckResourceAttrPair(resourceName, "s3_region", s3BucketResourceName, names.AttrRegion), resource.TestCheckResourceAttr(resourceName, "additional_artifacts.#", "2"), resource.TestCheckResourceAttr(resourceName, "refresh_closed_reports", "false"), resource.TestCheckResourceAttr(resourceName, "report_versioning", reportVersioning), diff --git a/internal/service/cur/service_endpoints_gen_test.go b/internal/service/cur/service_endpoints_gen_test.go index 3aaaf4dc3b4..2153627527b 100644 --- a/internal/service/cur/service_endpoints_gen_test.go +++ b/internal/service/cur/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 48e5195756cf7265d900bc4849ac91b31a36f333 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:55 -0400 Subject: [PATCH 0093/1490] customerprofiles: Use constant for region strings --- .../service/customerprofiles/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/customerprofiles/service_endpoints_gen_test.go b/internal/service/customerprofiles/service_endpoints_gen_test.go index 0e416b7a171..879bee38969 100644 --- a/internal/service/customerprofiles/service_endpoints_gen_test.go +++ b/internal/service/customerprofiles/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From aefb3187e20c3dc31847f4380b0ace2bd8bea269 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:55 -0400 Subject: [PATCH 0094/1490] dataexchange: Use constant for region strings --- internal/service/dataexchange/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/dataexchange/service_endpoints_gen_test.go b/internal/service/dataexchange/service_endpoints_gen_test.go index 218709aca19..793b9f35c78 100644 --- a/internal/service/dataexchange/service_endpoints_gen_test.go +++ b/internal/service/dataexchange/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 45fa3088e86fd1ac5d03ae21d586a8ac09a99206 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:55 -0400 Subject: [PATCH 0095/1490] datapipeline: Use constant for region strings --- internal/service/datapipeline/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/datapipeline/service_endpoints_gen_test.go b/internal/service/datapipeline/service_endpoints_gen_test.go index c109dd8f063..a4f1dd864a9 100644 --- a/internal/service/datapipeline/service_endpoints_gen_test.go +++ b/internal/service/datapipeline/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From ac0468500c5db837d39d73a2d261b4f7882318b7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:55 -0400 Subject: [PATCH 0096/1490] datasync: Use constant for region strings --- internal/service/datasync/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/datasync/service_endpoints_gen_test.go b/internal/service/datasync/service_endpoints_gen_test.go index 5ec6ed2fa01..5b88f2babba 100644 --- a/internal/service/datasync/service_endpoints_gen_test.go +++ b/internal/service/datasync/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6ae82bfd49482946ed14eb52753f50813ac25d30 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:56 -0400 Subject: [PATCH 0097/1490] datazone: Use constant for region strings --- internal/service/datazone/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/datazone/service_endpoints_gen_test.go b/internal/service/datazone/service_endpoints_gen_test.go index 5c48a8471b4..77b8c986189 100644 --- a/internal/service/datazone/service_endpoints_gen_test.go +++ b/internal/service/datazone/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 2294215e1d5ecc383879bd01dec1bb617b7bc202 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:56 -0400 Subject: [PATCH 0098/1490] dax: Use constant for region strings --- internal/service/dax/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/dax/service_endpoints_gen_test.go b/internal/service/dax/service_endpoints_gen_test.go index c0826e933ba..ea604054d27 100644 --- a/internal/service/dax/service_endpoints_gen_test.go +++ b/internal/service/dax/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 58f195f2b087eb886ac88aa6beaabeea634b60f7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:56 -0400 Subject: [PATCH 0099/1490] deploy: Use constant for region strings --- internal/service/deploy/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/deploy/service_endpoints_gen_test.go b/internal/service/deploy/service_endpoints_gen_test.go index b7fd0c2443d..7830da4dc0e 100644 --- a/internal/service/deploy/service_endpoints_gen_test.go +++ b/internal/service/deploy/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 2722f5b504f05401a5573fae99c9fffcef3a56e9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:56 -0400 Subject: [PATCH 0100/1490] detective: Use constant for region strings --- internal/service/detective/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/detective/service_endpoints_gen_test.go b/internal/service/detective/service_endpoints_gen_test.go index d6c57dd3294..578e807e61e 100644 --- a/internal/service/detective/service_endpoints_gen_test.go +++ b/internal/service/detective/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From c5c70d84f7635b78b883bada29082473eab4427e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:56 -0400 Subject: [PATCH 0101/1490] devicefarm: Use constant for region strings --- internal/service/devicefarm/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/devicefarm/service_endpoints_gen_test.go b/internal/service/devicefarm/service_endpoints_gen_test.go index b8da6015991..00f54c2239e 100644 --- a/internal/service/devicefarm/service_endpoints_gen_test.go +++ b/internal/service/devicefarm/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 9165429de0023cc289958ab6c6f4200ad12dcca7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:56 -0400 Subject: [PATCH 0102/1490] devopsguru: Use constant for region strings --- internal/service/devopsguru/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/devopsguru/service_endpoints_gen_test.go b/internal/service/devopsguru/service_endpoints_gen_test.go index 37eb21a271d..d7244325320 100644 --- a/internal/service/devopsguru/service_endpoints_gen_test.go +++ b/internal/service/devopsguru/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 0348e079d4c4702bccd4a4c5ac4e9ebac3aa49f9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:57 -0400 Subject: [PATCH 0103/1490] directconnect: Use constant for region strings --- internal/service/directconnect/hosted_connection.go | 4 ++-- internal/service/directconnect/service_endpoints_gen_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/directconnect/hosted_connection.go b/internal/service/directconnect/hosted_connection.go index 2db1cfc67b6..7866e2c20d9 100644 --- a/internal/service/directconnect/hosted_connection.go +++ b/internal/service/directconnect/hosted_connection.go @@ -82,7 +82,7 @@ func ResourceHostedConnection() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -154,7 +154,7 @@ func resourceHostedConnectionRead(ctx context.Context, d *schema.ResourceData, m d.Set("owner_account_id", connection.OwnerAccount) d.Set("partner_name", connection.PartnerName) d.Set("provider_name", connection.ProviderName) - d.Set("region", connection.Region) + d.Set(names.AttrRegion, connection.Region) d.Set(names.AttrState, connection.ConnectionState) d.Set("vlan", connection.Vlan) diff --git a/internal/service/directconnect/service_endpoints_gen_test.go b/internal/service/directconnect/service_endpoints_gen_test.go index 21350619e5f..59311cb0e75 100644 --- a/internal/service/directconnect/service_endpoints_gen_test.go +++ b/internal/service/directconnect/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 4e02080c67184bf33b0a36196871f9065827990f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:57 -0400 Subject: [PATCH 0104/1490] dlm: Use constant for region strings --- internal/service/dlm/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/dlm/service_endpoints_gen_test.go b/internal/service/dlm/service_endpoints_gen_test.go index e1c2ff1a5cc..3137593f7b3 100644 --- a/internal/service/dlm/service_endpoints_gen_test.go +++ b/internal/service/dlm/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 11a5bf41ecbc03df4b5c53fa724a6070489dd058 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:57 -0400 Subject: [PATCH 0105/1490] dms: Use constant for region strings --- internal/service/dms/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/dms/service_endpoints_gen_test.go b/internal/service/dms/service_endpoints_gen_test.go index c92045975ba..bc133d4f9c9 100644 --- a/internal/service/dms/service_endpoints_gen_test.go +++ b/internal/service/dms/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -480,7 +481,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 73ae3ab4dcb2a54cd0e5daf63107ccad865be389 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:57 -0400 Subject: [PATCH 0106/1490] docdb: Use constant for region strings --- internal/service/docdb/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/docdb/service_endpoints_gen_test.go b/internal/service/docdb/service_endpoints_gen_test.go index 92379c3bed8..594a1b1c29e 100644 --- a/internal/service/docdb/service_endpoints_gen_test.go +++ b/internal/service/docdb/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From c47a194d38af89a1fadfbf747f5a3ebf6359e65a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:57 -0400 Subject: [PATCH 0107/1490] docdbelastic: Use constant for region strings --- internal/service/docdbelastic/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/docdbelastic/service_endpoints_gen_test.go b/internal/service/docdbelastic/service_endpoints_gen_test.go index cab7b927e1b..187931b02b3 100644 --- a/internal/service/docdbelastic/service_endpoints_gen_test.go +++ b/internal/service/docdbelastic/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From ab646626ca44121e4265e71e5a4b5e4023cce388 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:57 -0400 Subject: [PATCH 0108/1490] ds: Use constant for region strings --- internal/service/ds/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ds/service_endpoints_gen_test.go b/internal/service/ds/service_endpoints_gen_test.go index 41b1ba9dbf5..29ea39cc506 100644 --- a/internal/service/ds/service_endpoints_gen_test.go +++ b/internal/service/ds/service_endpoints_gen_test.go @@ -27,6 +27,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -441,7 +442,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From fafde3f8f78f72da822e830cd5449f40b8f23541 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:57 -0400 Subject: [PATCH 0109/1490] dynamodb: Use constant for region strings --- internal/service/dynamodb/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/dynamodb/service_endpoints_gen_test.go b/internal/service/dynamodb/service_endpoints_gen_test.go index 43a7d59e91d..2d897c86677 100644 --- a/internal/service/dynamodb/service_endpoints_gen_test.go +++ b/internal/service/dynamodb/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -471,7 +472,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 23507bb2eacdfdf3d723b312068a0d8a56aa048d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:58 -0400 Subject: [PATCH 0110/1490] ec2: Use constant for region strings --- .../service/ec2/ec2_availability_zone_data_source.go | 4 ++-- .../ec2/ec2_availability_zone_data_source_test.go | 12 ++++++------ internal/service/ec2/service_endpoints_gen_test.go | 3 ++- .../ec2/vpc_peering_connection_data_source.go | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/internal/service/ec2/ec2_availability_zone_data_source.go b/internal/service/ec2/ec2_availability_zone_data_source.go index 6e216de4bdb..4c6e8cfb667 100644 --- a/internal/service/ec2/ec2_availability_zone_data_source.go +++ b/internal/service/ec2/ec2_availability_zone_data_source.go @@ -62,7 +62,7 @@ func DataSourceAvailabilityZone() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -139,7 +139,7 @@ func dataSourceAvailabilityZoneRead(ctx context.Context, d *schema.ResourceData, d.Set("opt_in_status", az.OptInStatus) d.Set("parent_zone_id", az.ParentZoneId) d.Set("parent_zone_name", az.ParentZoneName) - d.Set("region", az.RegionName) + d.Set(names.AttrRegion, az.RegionName) d.Set(names.AttrState, az.State) d.Set("zone_id", az.ZoneId) d.Set("zone_type", az.ZoneType) diff --git a/internal/service/ec2/ec2_availability_zone_data_source_test.go b/internal/service/ec2/ec2_availability_zone_data_source_test.go index 96665ceff1e..75f1fa8d273 100644 --- a/internal/service/ec2/ec2_availability_zone_data_source_test.go +++ b/internal/service/ec2/ec2_availability_zone_data_source_test.go @@ -38,7 +38,7 @@ func TestAccEC2AvailabilityZoneDataSource_allAvailabilityZones(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "opt_in_status", ec2.AvailabilityZoneOptInStatusOptInNotRequired), resource.TestCheckResourceAttr(dataSourceName, "parent_zone_id", ""), resource.TestCheckResourceAttr(dataSourceName, "parent_zone_name", ""), - resource.TestCheckResourceAttr(dataSourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttrPair(dataSourceName, "zone_id", availabilityZonesDataSourceName, "zone_ids.0"), resource.TestCheckResourceAttr(dataSourceName, "zone_type", "availability-zone"), ), @@ -67,7 +67,7 @@ func TestAccEC2AvailabilityZoneDataSource_filter(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "opt_in_status", ec2.AvailabilityZoneOptInStatusOptInNotRequired), resource.TestCheckResourceAttr(dataSourceName, "parent_zone_id", ""), resource.TestCheckResourceAttr(dataSourceName, "parent_zone_name", ""), - resource.TestCheckResourceAttr(dataSourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttrPair(dataSourceName, "zone_id", availabilityZonesDataSourceName, "zone_ids.0"), resource.TestCheckResourceAttr(dataSourceName, "zone_type", "availability-zone"), ), @@ -96,7 +96,7 @@ func TestAccEC2AvailabilityZoneDataSource_localZone(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "opt_in_status", ec2.AvailabilityZoneOptInStatusOptedIn), resource.TestCheckResourceAttrSet(dataSourceName, "parent_zone_id"), resource.TestCheckResourceAttrSet(dataSourceName, "parent_zone_name"), - resource.TestCheckResourceAttr(dataSourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttrPair(dataSourceName, "zone_id", availabilityZonesDataSourceName, "zone_ids.0"), resource.TestCheckResourceAttr(dataSourceName, "zone_type", "local-zone"), ), @@ -125,7 +125,7 @@ func TestAccEC2AvailabilityZoneDataSource_name(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "opt_in_status", ec2.AvailabilityZoneOptInStatusOptInNotRequired), resource.TestCheckResourceAttr(dataSourceName, "parent_zone_id", ""), resource.TestCheckResourceAttr(dataSourceName, "parent_zone_name", ""), - resource.TestCheckResourceAttr(dataSourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttrPair(dataSourceName, "zone_id", availabilityZonesDataSourceName, "zone_ids.0"), resource.TestCheckResourceAttr(dataSourceName, "zone_type", "availability-zone"), ), @@ -154,7 +154,7 @@ func TestAccEC2AvailabilityZoneDataSource_wavelengthZone(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "opt_in_status", ec2.AvailabilityZoneOptInStatusOptedIn), resource.TestCheckResourceAttrSet(dataSourceName, "parent_zone_id"), resource.TestCheckResourceAttrSet(dataSourceName, "parent_zone_name"), - resource.TestCheckResourceAttr(dataSourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttrPair(dataSourceName, "zone_id", availabilityZonesDataSourceName, "zone_ids.0"), resource.TestCheckResourceAttr(dataSourceName, "zone_type", "wavelength-zone"), ), @@ -183,7 +183,7 @@ func TestAccEC2AvailabilityZoneDataSource_zoneID(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "opt_in_status", ec2.AvailabilityZoneOptInStatusOptInNotRequired), resource.TestCheckResourceAttr(dataSourceName, "parent_zone_id", ""), resource.TestCheckResourceAttr(dataSourceName, "parent_zone_name", ""), - resource.TestCheckResourceAttr(dataSourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttrPair(dataSourceName, "zone_id", availabilityZonesDataSourceName, "zone_ids.0"), resource.TestCheckResourceAttr(dataSourceName, "zone_type", "availability-zone"), ), diff --git a/internal/service/ec2/service_endpoints_gen_test.go b/internal/service/ec2/service_endpoints_gen_test.go index a12034dbca2..221ba485921 100644 --- a/internal/service/ec2/service_endpoints_gen_test.go +++ b/internal/service/ec2/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -362,7 +363,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } diff --git a/internal/service/ec2/vpc_peering_connection_data_source.go b/internal/service/ec2/vpc_peering_connection_data_source.go index 21f6e8deee0..318a4ad51f1 100644 --- a/internal/service/ec2/vpc_peering_connection_data_source.go +++ b/internal/service/ec2/vpc_peering_connection_data_source.go @@ -117,7 +117,7 @@ func DataSourceVPCPeeringConnection() *schema.Resource { Optional: true, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, Computed: true, @@ -211,7 +211,7 @@ func dataSourceVPCPeeringConnectionRead(ctx context.Context, d *schema.ResourceD return sdkdiag.AppendErrorf(diags, "setting ipv6_cidr_block_set: %s", err) } - d.Set("region", vpcPeeringConnection.RequesterVpcInfo.Region) + d.Set(names.AttrRegion, vpcPeeringConnection.RequesterVpcInfo.Region) d.Set("peer_vpc_id", vpcPeeringConnection.AccepterVpcInfo.VpcId) d.Set("peer_owner_id", vpcPeeringConnection.AccepterVpcInfo.OwnerId) d.Set("peer_cidr_block", vpcPeeringConnection.AccepterVpcInfo.CidrBlock) From 48f06aa8b714beedc32d2087f15dced4b93bd46b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:58 -0400 Subject: [PATCH 0111/1490] ecr: Use constant for region strings --- internal/service/ecr/replication_configuration.go | 9 +++++---- internal/service/ecr/service_endpoints_gen_test.go | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/service/ecr/replication_configuration.go b/internal/service/ecr/replication_configuration.go index 41adebfb7cd..b6dacf9a8cc 100644 --- a/internal/service/ecr/replication_configuration.go +++ b/internal/service/ecr/replication_configuration.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_ecr_replication_configuration", name="Replication Configuration") @@ -54,7 +55,7 @@ func resourceReplicationConfiguration() *schema.Resource { MaxItems: 25, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "region": { + names.AttrRegion: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidRegionName, @@ -249,7 +250,7 @@ func expandReplicationConfigurationReplicationConfigurationRulesDestinations(dat for _, dest := range data { ec := dest.(map[string]interface{}) config := types.ReplicationDestination{ - Region: aws.String(ec["region"].(string)), + Region: aws.String(ec[names.AttrRegion].(string)), RegistryId: aws.String(ec["registry_id"].(string)), } @@ -267,8 +268,8 @@ func flattenReplicationConfigurationReplicationConfigurationRulesDestinations(ec for _, apiObject := range ec { tfMap := map[string]interface{}{ - "region": aws.ToString(apiObject.Region), - "registry_id": aws.ToString(apiObject.RegistryId), + names.AttrRegion: aws.ToString(apiObject.Region), + "registry_id": aws.ToString(apiObject.RegistryId), } tfList = append(tfList, tfMap) diff --git a/internal/service/ecr/service_endpoints_gen_test.go b/internal/service/ecr/service_endpoints_gen_test.go index 88afce39b22..5ae37bde777 100644 --- a/internal/service/ecr/service_endpoints_gen_test.go +++ b/internal/service/ecr/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From ce5003ebbb05af9c21f9133670bf6e7b46b55857 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:58 -0400 Subject: [PATCH 0112/1490] ecrpublic: Use constant for region strings --- internal/service/ecrpublic/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ecrpublic/service_endpoints_gen_test.go b/internal/service/ecrpublic/service_endpoints_gen_test.go index dbd9e96d3fc..87ed4817f67 100644 --- a/internal/service/ecrpublic/service_endpoints_gen_test.go +++ b/internal/service/ecrpublic/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 909e150444e4ab15d856ace92f05b01352fc1b80 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:58 -0400 Subject: [PATCH 0113/1490] ecs: Use constant for region strings --- internal/service/ecs/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ecs/service_endpoints_gen_test.go b/internal/service/ecs/service_endpoints_gen_test.go index 998bf3cd48a..7484a244f23 100644 --- a/internal/service/ecs/service_endpoints_gen_test.go +++ b/internal/service/ecs/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -362,7 +363,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 4021a3566cfeee9395106ae7ed5df8e8affcd03f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:58 -0400 Subject: [PATCH 0114/1490] efs: Use constant for region strings --- internal/service/efs/replication_configuration.go | 6 +++--- internal/service/efs/service_endpoints_gen_test.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/efs/replication_configuration.go b/internal/service/efs/replication_configuration.go index 3cbb6055d83..1e9affbe84e 100644 --- a/internal/service/efs/replication_configuration.go +++ b/internal/service/efs/replication_configuration.go @@ -67,7 +67,7 @@ func ResourceReplicationConfiguration() *schema.Resource { Optional: true, ForceNew: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, Computed: true, @@ -337,7 +337,7 @@ func expandDestinationToCreate(tfMap map[string]interface{}) *efs.DestinationToC apiObject.KmsKeyId = aws.String(v) } - if v, ok := tfMap["region"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrRegion].(string); ok && v != "" { apiObject.Region = aws.String(v) } @@ -386,7 +386,7 @@ func flattenDestination(apiObject *efs.Destination) map[string]interface{} { } if v := apiObject.Region; v != nil { - tfMap["region"] = aws.StringValue(v) + tfMap[names.AttrRegion] = aws.StringValue(v) } if v := apiObject.Status; v != nil { diff --git a/internal/service/efs/service_endpoints_gen_test.go b/internal/service/efs/service_endpoints_gen_test.go index 3ad4de69e00..110e78d6c84 100644 --- a/internal/service/efs/service_endpoints_gen_test.go +++ b/internal/service/efs/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 238fff906a3951e5bb5e633e888f44b02390ca47 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:58 -0400 Subject: [PATCH 0115/1490] eks: Use constant for region strings --- internal/service/eks/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/eks/service_endpoints_gen_test.go b/internal/service/eks/service_endpoints_gen_test.go index a7e95bfae46..e4efbc5a73b 100644 --- a/internal/service/eks/service_endpoints_gen_test.go +++ b/internal/service/eks/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From b2dd35d18f4e19c6bede23ac70eba8d6b014c8f0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:58 -0400 Subject: [PATCH 0116/1490] elasticache: Use constant for region strings --- internal/service/elasticache/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/elasticache/service_endpoints_gen_test.go b/internal/service/elasticache/service_endpoints_gen_test.go index f3678757376..363079af74d 100644 --- a/internal/service/elasticache/service_endpoints_gen_test.go +++ b/internal/service/elasticache/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -362,7 +363,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 8b2ec57b1d93ca309544994688c0f40bed171550 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:59 -0400 Subject: [PATCH 0117/1490] elasticbeanstalk: Use constant for region strings --- .../service/elasticbeanstalk/hosted_zone_data_source.go | 7 ++++--- .../service/elasticbeanstalk/service_endpoints_gen_test.go | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/service/elasticbeanstalk/hosted_zone_data_source.go b/internal/service/elasticbeanstalk/hosted_zone_data_source.go index 9bb9620ffec..e6b5490f243 100644 --- a/internal/service/elasticbeanstalk/hosted_zone_data_source.go +++ b/internal/service/elasticbeanstalk/hosted_zone_data_source.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // See https://docs.aws.amazon.com/general/latest/gr/elasticbeanstalk.html @@ -50,7 +51,7 @@ func DataSourceHostedZone() *schema.Resource { ReadWithoutTimeout: dataSourceHostedZoneRead, Schema: map[string]*schema.Schema{ - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -61,7 +62,7 @@ func DataSourceHostedZone() *schema.Resource { func dataSourceHostedZoneRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics region := meta.(*conns.AWSClient).Region - if v, ok := d.GetOk("region"); ok { + if v, ok := d.GetOk(names.AttrRegion); ok { region = v.(string) } @@ -72,6 +73,6 @@ func dataSourceHostedZoneRead(ctx context.Context, d *schema.ResourceData, meta } d.SetId(zoneID) - d.Set("region", region) + d.Set(names.AttrRegion, region) return diags } diff --git a/internal/service/elasticbeanstalk/service_endpoints_gen_test.go b/internal/service/elasticbeanstalk/service_endpoints_gen_test.go index a5b9c182225..b07003fd31e 100644 --- a/internal/service/elasticbeanstalk/service_endpoints_gen_test.go +++ b/internal/service/elasticbeanstalk/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 99c996da60144d971ad60f9050d37da024275cfb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:59 -0400 Subject: [PATCH 0118/1490] elasticsearch: Use constant for region strings --- internal/service/elasticsearch/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/elasticsearch/service_endpoints_gen_test.go b/internal/service/elasticsearch/service_endpoints_gen_test.go index 4ceab70a907..893ad1fb95d 100644 --- a/internal/service/elasticsearch/service_endpoints_gen_test.go +++ b/internal/service/elasticsearch/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -480,7 +481,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 5756b2b1057e86faa3cb9a4e281bf96c6ff60e28 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:59 -0400 Subject: [PATCH 0119/1490] elastictranscoder: Use constant for region strings --- .../service/elastictranscoder/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/elastictranscoder/service_endpoints_gen_test.go b/internal/service/elastictranscoder/service_endpoints_gen_test.go index 2d66a1d8909..d57f9921ecc 100644 --- a/internal/service/elastictranscoder/service_endpoints_gen_test.go +++ b/internal/service/elastictranscoder/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 814bc95dfd66652d00a7895624ef10a8a3148998 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:59 -0400 Subject: [PATCH 0120/1490] elb: Use constant for region strings --- internal/service/elb/hosted_zone_id_data_source.go | 5 +++-- internal/service/elb/service_account_data_source.go | 4 ++-- internal/service/elb/service_endpoints_gen_test.go | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/service/elb/hosted_zone_id_data_source.go b/internal/service/elb/hosted_zone_id_data_source.go index 96226dabb14..e78d6e03f4b 100644 --- a/internal/service/elb/hosted_zone_id_data_source.go +++ b/internal/service/elb/hosted_zone_id_data_source.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // See https://docs.aws.amazon.com/general/latest/gr/elb.html#elb_region @@ -57,7 +58,7 @@ func DataSourceHostedZoneID() *schema.Resource { ReadWithoutTimeout: dataSourceHostedZoneIDRead, Schema: map[string]*schema.Schema{ - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -68,7 +69,7 @@ func DataSourceHostedZoneID() *schema.Resource { func dataSourceHostedZoneIDRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics region := meta.(*conns.AWSClient).Region - if v, ok := d.GetOk("region"); ok { + if v, ok := d.GetOk(names.AttrRegion); ok { region = v.(string) } diff --git a/internal/service/elb/service_account_data_source.go b/internal/service/elb/service_account_data_source.go index 6f15d0cafa5..2fcbe067740 100644 --- a/internal/service/elb/service_account_data_source.go +++ b/internal/service/elb/service_account_data_source.go @@ -54,7 +54,7 @@ func DataSourceServiceAccount() *schema.Resource { ReadWithoutTimeout: dataSourceServiceAccountRead, Schema: map[string]*schema.Schema{ - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -69,7 +69,7 @@ func DataSourceServiceAccount() *schema.Resource { func dataSourceServiceAccountRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics region := meta.(*conns.AWSClient).Region - if v, ok := d.GetOk("region"); ok { + if v, ok := d.GetOk(names.AttrRegion); ok { region = v.(string) } diff --git a/internal/service/elb/service_endpoints_gen_test.go b/internal/service/elb/service_endpoints_gen_test.go index b965e52dfad..0f4388aa0fb 100644 --- a/internal/service/elb/service_endpoints_gen_test.go +++ b/internal/service/elb/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -404,7 +405,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From c310f95297b961f3ebcdbf1258910de84f4b3f59 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:59 -0400 Subject: [PATCH 0121/1490] elbv2: Use constant for region strings --- internal/service/elbv2/hosted_zone_id_data_source.go | 5 +++-- internal/service/elbv2/service_endpoints_gen_test.go | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/service/elbv2/hosted_zone_id_data_source.go b/internal/service/elbv2/hosted_zone_id_data_source.go index 8b4c53668b7..147dcb3a6b8 100644 --- a/internal/service/elbv2/hosted_zone_id_data_source.go +++ b/internal/service/elbv2/hosted_zone_id_data_source.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // See https://docs.aws.amazon.com/general/latest/gr/elb.html#elb_region @@ -98,7 +99,7 @@ func DataSourceHostedZoneID() *schema.Resource { ReadWithoutTimeout: dataSourceHostedZoneIDRead, Schema: map[string]*schema.Schema{ - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidRegionName, @@ -116,7 +117,7 @@ func DataSourceHostedZoneID() *schema.Resource { func dataSourceHostedZoneIDRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics region := meta.(*conns.AWSClient).Region - if v, ok := d.GetOk("region"); ok { + if v, ok := d.GetOk(names.AttrRegion); ok { region = v.(string) } diff --git a/internal/service/elbv2/service_endpoints_gen_test.go b/internal/service/elbv2/service_endpoints_gen_test.go index f24f3fd0ee7..326997febc7 100644 --- a/internal/service/elbv2/service_endpoints_gen_test.go +++ b/internal/service/elbv2/service_endpoints_gen_test.go @@ -27,6 +27,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -441,7 +442,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From bce89a8cfc135fe9b42ee7b84304f1a8b9b60a17 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:59 -0400 Subject: [PATCH 0122/1490] emr: Use constant for region strings --- internal/service/emr/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/emr/service_endpoints_gen_test.go b/internal/service/emr/service_endpoints_gen_test.go index dcba946907e..7d82c2cb7b3 100644 --- a/internal/service/emr/service_endpoints_gen_test.go +++ b/internal/service/emr/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -362,7 +363,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From ccb7d05ade4496dde5b693e80d48ffb678866ec6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:37:59 -0400 Subject: [PATCH 0123/1490] emrcontainers: Use constant for region strings --- internal/service/emrcontainers/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/emrcontainers/service_endpoints_gen_test.go b/internal/service/emrcontainers/service_endpoints_gen_test.go index 9e4d7eb3cda..9bb3b531ca8 100644 --- a/internal/service/emrcontainers/service_endpoints_gen_test.go +++ b/internal/service/emrcontainers/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e51e07889f7792857b662943f956a0e479d73fe0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:00 -0400 Subject: [PATCH 0124/1490] emrserverless: Use constant for region strings --- internal/service/emrserverless/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/emrserverless/service_endpoints_gen_test.go b/internal/service/emrserverless/service_endpoints_gen_test.go index 0979f951e7b..4899847f1b8 100644 --- a/internal/service/emrserverless/service_endpoints_gen_test.go +++ b/internal/service/emrserverless/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From b7c846c98945f78d25c351f69aa0dd4d2cd9ca17 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:00 -0400 Subject: [PATCH 0125/1490] events: Use constant for region strings --- internal/service/events/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/events/service_endpoints_gen_test.go b/internal/service/events/service_endpoints_gen_test.go index eb4bdfeefb8..7cfc39f574b 100644 --- a/internal/service/events/service_endpoints_gen_test.go +++ b/internal/service/events/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -490,7 +491,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From a7bdeb992019df4971366f9b9dc5185ff6e8171b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:00 -0400 Subject: [PATCH 0126/1490] evidently: Use constant for region strings --- internal/service/evidently/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/evidently/service_endpoints_gen_test.go b/internal/service/evidently/service_endpoints_gen_test.go index a21fab7084a..7e46408c6b3 100644 --- a/internal/service/evidently/service_endpoints_gen_test.go +++ b/internal/service/evidently/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 98ae462fd3cf1ddaae8938786f64256e8c25a155 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:00 -0400 Subject: [PATCH 0127/1490] finspace: Use constant for region strings --- internal/service/finspace/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/finspace/service_endpoints_gen_test.go b/internal/service/finspace/service_endpoints_gen_test.go index 5a084437427..c13b22b076c 100644 --- a/internal/service/finspace/service_endpoints_gen_test.go +++ b/internal/service/finspace/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6d097b4e6984970229c59f44f0a61c41d85abbb5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:00 -0400 Subject: [PATCH 0128/1490] firehose: Use constant for region strings --- internal/service/firehose/delivery_stream.go | 6 +++--- internal/service/firehose/service_endpoints_gen_test.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index fa0247b7483..13ec823c29f 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -665,7 +665,7 @@ func resourceDeliveryStream() *schema.Resource { Type: schema.TypeString, Required: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, Computed: true, @@ -2209,7 +2209,7 @@ func expandSchemaConfiguration(l []interface{}) *types.SchemaConfiguration { if v, ok := m["catalog_id"].(string); ok && v != "" { config.CatalogId = aws.String(v) } - if v, ok := m["region"].(string); ok && v != "" { + if v, ok := m[names.AttrRegion].(string); ok && v != "" { config.Region = aws.String(v) } @@ -3697,7 +3697,7 @@ func flattenSchemaConfiguration(sc *types.SchemaConfiguration) []map[string]inte m := map[string]interface{}{ "catalog_id": aws.ToString(sc.CatalogId), names.AttrDatabaseName: aws.ToString(sc.DatabaseName), - "region": aws.ToString(sc.Region), + names.AttrRegion: aws.ToString(sc.Region), names.AttrRoleARN: aws.ToString(sc.RoleARN), "table_name": aws.ToString(sc.TableName), "version_id": aws.ToString(sc.VersionId), diff --git a/internal/service/firehose/service_endpoints_gen_test.go b/internal/service/firehose/service_endpoints_gen_test.go index f2c8a77ed5c..0640a2bcc35 100644 --- a/internal/service/firehose/service_endpoints_gen_test.go +++ b/internal/service/firehose/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From cd00d5be41e77bcade01210be78dafa9bb0aeb2e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:00 -0400 Subject: [PATCH 0129/1490] fis: Use constant for region strings --- internal/service/fis/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/fis/service_endpoints_gen_test.go b/internal/service/fis/service_endpoints_gen_test.go index 2d0b51ef6e6..64d5b785a26 100644 --- a/internal/service/fis/service_endpoints_gen_test.go +++ b/internal/service/fis/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 40eb80454da65edd83b96a2175a81b20b47b20b6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:00 -0400 Subject: [PATCH 0130/1490] fms: Use constant for region strings --- internal/service/fms/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/fms/service_endpoints_gen_test.go b/internal/service/fms/service_endpoints_gen_test.go index 82993045010..421a66d699d 100644 --- a/internal/service/fms/service_endpoints_gen_test.go +++ b/internal/service/fms/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -337,7 +338,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From ec83790a23d695e6257eab108cbc0cb2a3a947fb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:01 -0400 Subject: [PATCH 0131/1490] fsx: Use constant for region strings --- internal/service/fsx/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/fsx/service_endpoints_gen_test.go b/internal/service/fsx/service_endpoints_gen_test.go index 2c77b0b4e65..3cc1697bcda 100644 --- a/internal/service/fsx/service_endpoints_gen_test.go +++ b/internal/service/fsx/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From aa14650fcc5f4282a30daa3349807a637f9f443e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:01 -0400 Subject: [PATCH 0132/1490] gamelift: Use constant for region strings --- internal/service/gamelift/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/gamelift/service_endpoints_gen_test.go b/internal/service/gamelift/service_endpoints_gen_test.go index 77c6fd1b71e..e59e09f6b0d 100644 --- a/internal/service/gamelift/service_endpoints_gen_test.go +++ b/internal/service/gamelift/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 41a706180ad62ee2a6191731a36deed131c3f597 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:01 -0400 Subject: [PATCH 0133/1490] glacier: Use constant for region strings --- internal/service/glacier/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/glacier/service_endpoints_gen_test.go b/internal/service/glacier/service_endpoints_gen_test.go index 0d26d078de5..ca0f2c31c7b 100644 --- a/internal/service/glacier/service_endpoints_gen_test.go +++ b/internal/service/glacier/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 5c355861a0b75ddcd64157f4b7454770cdec2e6f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:01 -0400 Subject: [PATCH 0134/1490] globalaccelerator: Use constant for region strings --- internal/service/globalaccelerator/cross_account_attachment.go | 2 +- .../service/globalaccelerator/service_endpoints_gen_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/globalaccelerator/cross_account_attachment.go b/internal/service/globalaccelerator/cross_account_attachment.go index 21d97227ced..dbeaa5d05a1 100644 --- a/internal/service/globalaccelerator/cross_account_attachment.go +++ b/internal/service/globalaccelerator/cross_account_attachment.go @@ -82,7 +82,7 @@ func (r *crossAccountAttachmentResource) Schema(ctx context.Context, request res "endpoint_id": schema.StringAttribute{ Optional: true, }, - "region": schema.StringAttribute{ + names.AttrRegion: schema.StringAttribute{ Optional: true, }, }, diff --git a/internal/service/globalaccelerator/service_endpoints_gen_test.go b/internal/service/globalaccelerator/service_endpoints_gen_test.go index 0d337e6ad70..1139bb68b69 100644 --- a/internal/service/globalaccelerator/service_endpoints_gen_test.go +++ b/internal/service/globalaccelerator/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 124e91189e5557dfe041af9f7d2c4649341800cd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:01 -0400 Subject: [PATCH 0135/1490] glue: Use constant for region strings --- internal/service/glue/catalog_database.go | 6 +++--- internal/service/glue/catalog_table.go | 6 +++--- internal/service/glue/catalog_table_data_source.go | 2 +- internal/service/glue/service_endpoints_gen_test.go | 3 ++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/service/glue/catalog_database.go b/internal/service/glue/catalog_database.go index bf0936f746c..8dba03078be 100644 --- a/internal/service/glue/catalog_database.go +++ b/internal/service/glue/catalog_database.go @@ -139,7 +139,7 @@ func ResourceCatalogDatabase() *schema.Resource { Type: schema.TypeString, Required: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -376,7 +376,7 @@ func expandDatabaseTargetDatabase(tfMap map[string]interface{}) *glue.DatabaseId apiObject.DatabaseName = aws.String(v) } - if v, ok := tfMap["region"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrRegion].(string); ok && v != "" { apiObject.Region = aws.String(v) } @@ -417,7 +417,7 @@ func flattenDatabaseTargetDatabase(apiObject *glue.DatabaseIdentifier) map[strin } if v := apiObject.Region; v != nil { - tfMap["region"] = aws.StringValue(v) + tfMap[names.AttrRegion] = aws.StringValue(v) } return tfMap diff --git a/internal/service/glue/catalog_table.go b/internal/service/glue/catalog_table.go index 980fad72d78..aaa7a7acf2b 100644 --- a/internal/service/glue/catalog_table.go +++ b/internal/service/glue/catalog_table.go @@ -343,7 +343,7 @@ func ResourceCatalogTable() *schema.Resource { Type: schema.TypeString, Required: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -1124,7 +1124,7 @@ func expandTableTargetTable(tfMap map[string]interface{}) *glue.TableIdentifier apiObject.Name = aws.String(v) } - if v, ok := tfMap["region"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrRegion].(string); ok && v != "" { apiObject.Region = aws.String(v) } @@ -1151,7 +1151,7 @@ func flattenTableTargetTable(apiObject *glue.TableIdentifier) map[string]interfa } if v := apiObject.Region; v != nil { - tfMap["region"] = aws.StringValue(v) + tfMap[names.AttrRegion] = aws.StringValue(v) } return tfMap diff --git a/internal/service/glue/catalog_table_data_source.go b/internal/service/glue/catalog_table_data_source.go index c58dbf2b396..20bcb35d97a 100644 --- a/internal/service/glue/catalog_table_data_source.go +++ b/internal/service/glue/catalog_table_data_source.go @@ -300,7 +300,7 @@ func DataSourceCatalogTable() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/glue/service_endpoints_gen_test.go b/internal/service/glue/service_endpoints_gen_test.go index 57edd99f8a9..ccd468a4c11 100644 --- a/internal/service/glue/service_endpoints_gen_test.go +++ b/internal/service/glue/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 92da4b57f21976bc70efe138b7ec3b05383737d3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:01 -0400 Subject: [PATCH 0136/1490] grafana: Use constant for region strings --- internal/service/grafana/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/grafana/service_endpoints_gen_test.go b/internal/service/grafana/service_endpoints_gen_test.go index 4d54d52af91..5e97c93f7a1 100644 --- a/internal/service/grafana/service_endpoints_gen_test.go +++ b/internal/service/grafana/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -480,7 +481,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From f91e3c0c1b4a9566a679261d97cd08873e5655a0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:01 -0400 Subject: [PATCH 0137/1490] greengrass: Use constant for region strings --- internal/service/greengrass/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/greengrass/service_endpoints_gen_test.go b/internal/service/greengrass/service_endpoints_gen_test.go index 8e84448ecee..126ee400e5c 100644 --- a/internal/service/greengrass/service_endpoints_gen_test.go +++ b/internal/service/greengrass/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 595032142c27d8e92de3168ccfd8457fc81eaefe Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:02 -0400 Subject: [PATCH 0138/1490] groundstation: Use constant for region strings --- internal/service/groundstation/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/groundstation/service_endpoints_gen_test.go b/internal/service/groundstation/service_endpoints_gen_test.go index 957dc0a1007..460d4e93e5c 100644 --- a/internal/service/groundstation/service_endpoints_gen_test.go +++ b/internal/service/groundstation/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From a1cdde1972de8f0bf94ddfe73562fa96afaa3444 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:02 -0400 Subject: [PATCH 0139/1490] guardduty: Use constant for region strings --- internal/service/guardduty/filter_test.go | 4 ++-- internal/service/guardduty/service_endpoints_gen_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/guardduty/filter_test.go b/internal/service/guardduty/filter_test.go index 123f7378c70..cdad0832927 100644 --- a/internal/service/guardduty/filter_test.go +++ b/internal/service/guardduty/filter_test.go @@ -55,7 +55,7 @@ func testAccFilter_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "finding_criteria.#", "1"), resource.TestCheckResourceAttr(resourceName, "finding_criteria.0.criterion.#", "3"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ - "field": "region", + "field": names.AttrRegion, "equals.#": "1", "equals.0": acctest.Region(), }), @@ -126,7 +126,7 @@ func testAccFilter_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "finding_criteria.#", "1"), resource.TestCheckResourceAttr(resourceName, "finding_criteria.0.criterion.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ - "field": "region", + "field": names.AttrRegion, "equals.#": "1", "equals.0": acctest.Region(), }), diff --git a/internal/service/guardduty/service_endpoints_gen_test.go b/internal/service/guardduty/service_endpoints_gen_test.go index 6eab5517d6e..d0775ea1542 100644 --- a/internal/service/guardduty/service_endpoints_gen_test.go +++ b/internal/service/guardduty/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From dae563132f90d1f93e74119f88131063916eccb3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:02 -0400 Subject: [PATCH 0140/1490] healthlake: Use constant for region strings --- internal/service/healthlake/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/healthlake/service_endpoints_gen_test.go b/internal/service/healthlake/service_endpoints_gen_test.go index caf7b363855..1d864e17967 100644 --- a/internal/service/healthlake/service_endpoints_gen_test.go +++ b/internal/service/healthlake/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 30a20fed699c73151b8795dfe80569c11399d618 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:02 -0400 Subject: [PATCH 0141/1490] iam: Use constant for region strings --- internal/service/iam/role_data_source.go | 4 ++-- internal/service/iam/service_endpoints_gen_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/iam/role_data_source.go b/internal/service/iam/role_data_source.go index 8d9d21f2882..ff5dbbe1f0d 100644 --- a/internal/service/iam/role_data_source.go +++ b/internal/service/iam/role_data_source.go @@ -61,7 +61,7 @@ func dataSourceRole() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -132,7 +132,7 @@ func flattenRoleLastUsed(apiObject *awstypes.RoleLastUsed) []interface{} { } tfMap := map[string]interface{}{ - "region": aws.ToString(apiObject.Region), + names.AttrRegion: aws.ToString(apiObject.Region), } if apiObject.LastUsedDate != nil { diff --git a/internal/service/iam/service_endpoints_gen_test.go b/internal/service/iam/service_endpoints_gen_test.go index 5c3d49e00de..0aad82c9863 100644 --- a/internal/service/iam/service_endpoints_gen_test.go +++ b/internal/service/iam/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -471,7 +472,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 7a0ef7c2c1cc61b3f87cde6ddb58793bf277f436 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:02 -0400 Subject: [PATCH 0142/1490] identitystore: Use constant for region strings --- internal/service/identitystore/flex.go | 4 ++-- internal/service/identitystore/service_endpoints_gen_test.go | 3 ++- internal/service/identitystore/user.go | 4 ++-- internal/service/identitystore/user_data_source.go | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/service/identitystore/flex.go b/internal/service/identitystore/flex.go index 2f975ba9f8b..cae599f1755 100644 --- a/internal/service/identitystore/flex.go +++ b/internal/service/identitystore/flex.go @@ -36,7 +36,7 @@ func flattenAddress(apiObject *types.Address) map[string]interface{} { m["primary"] = apiObject.Primary if v := apiObject.Region; v != nil { - m["region"] = aws.ToString(v) + m[names.AttrRegion] = aws.ToString(v) } if v := apiObject.StreetAddress; v != nil { @@ -75,7 +75,7 @@ func expandAddress(tfMap map[string]interface{}) *types.Address { a.Primary = tfMap["primary"].(bool) - if v, ok := tfMap["region"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrRegion].(string); ok && v != "" { a.Region = aws.String(v) } diff --git a/internal/service/identitystore/service_endpoints_gen_test.go b/internal/service/identitystore/service_endpoints_gen_test.go index 67ee12e60c5..2140bfc089a 100644 --- a/internal/service/identitystore/service_endpoints_gen_test.go +++ b/internal/service/identitystore/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -337,7 +338,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } diff --git a/internal/service/identitystore/user.go b/internal/service/identitystore/user.go index a78e2c1f698..a9ca20b1a31 100644 --- a/internal/service/identitystore/user.go +++ b/internal/service/identitystore/user.go @@ -69,7 +69,7 @@ func ResourceUser() *schema.Resource { Optional: true, Default: false, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 1024)), @@ -506,7 +506,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf m["primary"] = address.Primary if v := address.Region; v != nil { - m["region"] = v + m[names.AttrRegion] = v } if v := address.StreetAddress; v != nil { diff --git a/internal/service/identitystore/user_data_source.go b/internal/service/identitystore/user_data_source.go index f97f8e1ce72..6eec34742db 100644 --- a/internal/service/identitystore/user_data_source.go +++ b/internal/service/identitystore/user_data_source.go @@ -52,7 +52,7 @@ func DataSourceUser() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, From f0608ef499eaafd58939b05d45b3d3462ec51f97 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:02 -0400 Subject: [PATCH 0143/1490] imagebuilder: Use constant for region strings --- .../service/imagebuilder/distribution_configuration.go | 6 +++--- .../distribution_configuration_data_source.go | 2 +- internal/service/imagebuilder/image.go | 8 ++++---- internal/service/imagebuilder/image_data_source.go | 4 ++-- .../service/imagebuilder/service_endpoints_gen_test.go | 3 ++- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/internal/service/imagebuilder/distribution_configuration.go b/internal/service/imagebuilder/distribution_configuration.go index c2e8f41c8b8..78be9a69f70 100644 --- a/internal/service/imagebuilder/distribution_configuration.go +++ b/internal/service/imagebuilder/distribution_configuration.go @@ -270,7 +270,7 @@ func ResourceDistributionConfiguration() *schema.Resource { ValidateFunc: verify.ValidARN, }, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(0, 1024), @@ -524,7 +524,7 @@ func expandDistribution(tfMap map[string]interface{}) *imagebuilder.Distribution apiObject.LicenseConfigurationArns = flex.ExpandStringSet(v) } - if v, ok := tfMap["region"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrRegion].(string); ok && v != "" { apiObject.Region = aws.String(v) } @@ -824,7 +824,7 @@ func flattenDistribution(apiObject *imagebuilder.Distribution) map[string]interf } if v := apiObject.Region; v != nil { - tfMap["region"] = aws.StringValue(v) + tfMap[names.AttrRegion] = aws.StringValue(v) } return tfMap diff --git a/internal/service/imagebuilder/distribution_configuration_data_source.go b/internal/service/imagebuilder/distribution_configuration_data_source.go index 7a721874df3..690cf5d4219 100644 --- a/internal/service/imagebuilder/distribution_configuration_data_source.go +++ b/internal/service/imagebuilder/distribution_configuration_data_source.go @@ -223,7 +223,7 @@ func DataSourceDistributionConfiguration() *schema.Resource { Type: schema.TypeString, }, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/imagebuilder/image.go b/internal/service/imagebuilder/image.go index 5eb837ee6c5..30f16cdeec1 100644 --- a/internal/service/imagebuilder/image.go +++ b/internal/service/imagebuilder/image.go @@ -181,7 +181,7 @@ func ResourceImage() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -198,7 +198,7 @@ func ResourceImage() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -476,7 +476,7 @@ func flattenAMI(apiObject *imagebuilder.Ami) map[string]interface{} { } if v := apiObject.Region; v != nil { - tfMap["region"] = aws.StringValue(v) + tfMap[names.AttrRegion] = aws.StringValue(v) } return tfMap @@ -512,7 +512,7 @@ func flattenContainer(apiObject *imagebuilder.Container) map[string]interface{} } if v := apiObject.Region; v != nil { - tfMap["region"] = aws.StringValue(v) + tfMap[names.AttrRegion] = aws.StringValue(v) } return tfMap diff --git a/internal/service/imagebuilder/image_data_source.go b/internal/service/imagebuilder/image_data_source.go index 0c6529da019..3bc6604beac 100644 --- a/internal/service/imagebuilder/image_data_source.go +++ b/internal/service/imagebuilder/image_data_source.go @@ -137,7 +137,7 @@ func DataSourceImage() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -154,7 +154,7 @@ func DataSourceImage() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/imagebuilder/service_endpoints_gen_test.go b/internal/service/imagebuilder/service_endpoints_gen_test.go index 26797384e42..1652375e1fd 100644 --- a/internal/service/imagebuilder/service_endpoints_gen_test.go +++ b/internal/service/imagebuilder/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -327,7 +328,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 4b41fbb6645da81d5ed196167f6ed561b98ca0aa Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:03 -0400 Subject: [PATCH 0144/1490] inspector: Use constant for region strings --- internal/service/inspector/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/inspector/service_endpoints_gen_test.go b/internal/service/inspector/service_endpoints_gen_test.go index 321d0410429..87930ae696e 100644 --- a/internal/service/inspector/service_endpoints_gen_test.go +++ b/internal/service/inspector/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 57e17659cf3f717bc6a531523d3e00f95a7bfc45 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:03 -0400 Subject: [PATCH 0145/1490] inspector2: Use constant for region strings --- internal/service/inspector2/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/inspector2/service_endpoints_gen_test.go b/internal/service/inspector2/service_endpoints_gen_test.go index c1bfc7eb43f..9c7542f123e 100644 --- a/internal/service/inspector2/service_endpoints_gen_test.go +++ b/internal/service/inspector2/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 187f03ea57b147b7f1ca8d71efe48386efa82e8b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:03 -0400 Subject: [PATCH 0146/1490] internetmonitor: Use constant for region strings --- internal/service/internetmonitor/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/internetmonitor/service_endpoints_gen_test.go b/internal/service/internetmonitor/service_endpoints_gen_test.go index 22750840b55..27e208f2837 100644 --- a/internal/service/internetmonitor/service_endpoints_gen_test.go +++ b/internal/service/internetmonitor/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From c4053f3a2b41fea7c31e5e3ae378e73476ebad5d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:03 -0400 Subject: [PATCH 0147/1490] iot: Use constant for region strings --- internal/service/iot/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/iot/service_endpoints_gen_test.go b/internal/service/iot/service_endpoints_gen_test.go index 0c958436ba0..9d5bf421ee0 100644 --- a/internal/service/iot/service_endpoints_gen_test.go +++ b/internal/service/iot/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 056a72262d156c76ead66c96a1efd72aa0671774 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:03 -0400 Subject: [PATCH 0148/1490] iotanalytics: Use constant for region strings --- internal/service/iotanalytics/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/iotanalytics/service_endpoints_gen_test.go b/internal/service/iotanalytics/service_endpoints_gen_test.go index 2743e400524..a564c9d76d6 100644 --- a/internal/service/iotanalytics/service_endpoints_gen_test.go +++ b/internal/service/iotanalytics/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6782e83cf9f1a18edd7cfcab24c16557b7651ec2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:03 -0400 Subject: [PATCH 0149/1490] iotevents: Use constant for region strings --- internal/service/iotevents/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/iotevents/service_endpoints_gen_test.go b/internal/service/iotevents/service_endpoints_gen_test.go index 345b206ff48..ae0c602e267 100644 --- a/internal/service/iotevents/service_endpoints_gen_test.go +++ b/internal/service/iotevents/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From c4233a34868f92d238e64e50204f24a1431cb30d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:03 -0400 Subject: [PATCH 0150/1490] ivs: Use constant for region strings --- internal/service/ivs/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ivs/service_endpoints_gen_test.go b/internal/service/ivs/service_endpoints_gen_test.go index 5269c77408d..e5a8eafe34f 100644 --- a/internal/service/ivs/service_endpoints_gen_test.go +++ b/internal/service/ivs/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 66431de2b0cea8d69ba651211b55de82cfe29142 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:03 -0400 Subject: [PATCH 0151/1490] ivschat: Use constant for region strings --- internal/service/ivschat/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ivschat/service_endpoints_gen_test.go b/internal/service/ivschat/service_endpoints_gen_test.go index a80c8066f6e..27aa8fca237 100644 --- a/internal/service/ivschat/service_endpoints_gen_test.go +++ b/internal/service/ivschat/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 09f99cdea9ca02eef97593a5fff6029a44d06ef8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:04 -0400 Subject: [PATCH 0152/1490] kafka: Use constant for region strings --- internal/service/kafka/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/kafka/service_endpoints_gen_test.go b/internal/service/kafka/service_endpoints_gen_test.go index 1d01990f950..af53d92ee11 100644 --- a/internal/service/kafka/service_endpoints_gen_test.go +++ b/internal/service/kafka/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From c28fb084eec78ea34f15684d8aa75f7e5f6a651d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:04 -0400 Subject: [PATCH 0153/1490] kafkaconnect: Use constant for region strings --- internal/service/kafkaconnect/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/kafkaconnect/service_endpoints_gen_test.go b/internal/service/kafkaconnect/service_endpoints_gen_test.go index 7c77938fa1a..3626023a0ab 100644 --- a/internal/service/kafkaconnect/service_endpoints_gen_test.go +++ b/internal/service/kafkaconnect/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 723a6808a2acdac3a525bfac0fa4cc6d2df79681 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:04 -0400 Subject: [PATCH 0154/1490] kendra: Use constant for region strings --- internal/service/kendra/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/kendra/service_endpoints_gen_test.go b/internal/service/kendra/service_endpoints_gen_test.go index f15c0a70c23..c4e7f11658d 100644 --- a/internal/service/kendra/service_endpoints_gen_test.go +++ b/internal/service/kendra/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e25710c220387734ddb57611181bc62ecd650fac Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:04 -0400 Subject: [PATCH 0155/1490] keyspaces: Use constant for region strings --- internal/service/keyspaces/service_endpoints_gen_test.go | 3 ++- internal/service/keyspaces/table_test.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/keyspaces/service_endpoints_gen_test.go b/internal/service/keyspaces/service_endpoints_gen_test.go index 5e1147b7003..a5586e5385e 100644 --- a/internal/service/keyspaces/service_endpoints_gen_test.go +++ b/internal/service/keyspaces/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } diff --git a/internal/service/keyspaces/table_test.go b/internal/service/keyspaces/table_test.go index e12c6a7c38a..b917df2ef1d 100644 --- a/internal/service/keyspaces/table_test.go +++ b/internal/service/keyspaces/table_test.go @@ -202,7 +202,7 @@ func TestAccKeyspacesTable_multipleColumns(t *testing.T) { "order_by": "ASC", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "schema_definition.0.clustering_key.*", map[string]string{ - names.AttrName: "region", + names.AttrName: names.AttrRegion, "order_by": "DESC", }), resource.TestCheckResourceAttr(resourceName, "schema_definition.0.column.#", "11"), @@ -215,7 +215,7 @@ func TestAccKeyspacesTable_multipleColumns(t *testing.T) { names.AttrType: "text", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "schema_definition.0.column.*", map[string]string{ - names.AttrName: "region", + names.AttrName: names.AttrRegion, names.AttrType: "text", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "schema_definition.0.column.*", map[string]string{ From df32ee154c8be58185c53e8c3ef576b6ca3e8f02 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:04 -0400 Subject: [PATCH 0156/1490] kinesis: Use constant for region strings --- internal/service/kinesis/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/kinesis/service_endpoints_gen_test.go b/internal/service/kinesis/service_endpoints_gen_test.go index 807a358f053..d2ab586f647 100644 --- a/internal/service/kinesis/service_endpoints_gen_test.go +++ b/internal/service/kinesis/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 8cdcd889dc75f384236f0c0e0c726ed62efa47b7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:04 -0400 Subject: [PATCH 0157/1490] kinesisanalytics: Use constant for region strings --- .../service/kinesisanalytics/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/kinesisanalytics/service_endpoints_gen_test.go b/internal/service/kinesisanalytics/service_endpoints_gen_test.go index f60edfd86b7..02aa2d37a65 100644 --- a/internal/service/kinesisanalytics/service_endpoints_gen_test.go +++ b/internal/service/kinesisanalytics/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 79af28be7b89b9e3e4bc41bd7dd6e049a389a377 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:04 -0400 Subject: [PATCH 0158/1490] kinesisanalyticsv2: Use constant for region strings --- .../service/kinesisanalyticsv2/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go b/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go index 443339b8f2d..c87d95b5da4 100644 --- a/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go +++ b/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d81409b86b4cd0fc96497a87b2311a4040c23a34 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:05 -0400 Subject: [PATCH 0159/1490] kinesisvideo: Use constant for region strings --- internal/service/kinesisvideo/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/kinesisvideo/service_endpoints_gen_test.go b/internal/service/kinesisvideo/service_endpoints_gen_test.go index e6d7c76981c..e8da41dc690 100644 --- a/internal/service/kinesisvideo/service_endpoints_gen_test.go +++ b/internal/service/kinesisvideo/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 631e3f03cd2fa64e55ec09594998cc778fabd58d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:05 -0400 Subject: [PATCH 0160/1490] kms: Use constant for region strings --- internal/service/kms/key_data_source.go | 6 +++--- internal/service/kms/service_endpoints_gen_test.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/kms/key_data_source.go b/internal/service/kms/key_data_source.go index 145a8bcb697..c840a3c5a7e 100644 --- a/internal/service/kms/key_data_source.go +++ b/internal/service/kms/key_data_source.go @@ -111,7 +111,7 @@ func dataSourceKey() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -127,7 +127,7 @@ func dataSourceKey() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -257,7 +257,7 @@ func flattenMultiRegionKey(apiObject *awstypes.MultiRegionKey) map[string]interf } if v := apiObject.Region; v != nil { - tfMap["region"] = aws.ToString(v) + tfMap[names.AttrRegion] = aws.ToString(v) } return tfMap diff --git a/internal/service/kms/service_endpoints_gen_test.go b/internal/service/kms/service_endpoints_gen_test.go index 92a8b1680d8..4ceb04aaf47 100644 --- a/internal/service/kms/service_endpoints_gen_test.go +++ b/internal/service/kms/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From f3dffd799ef925de27060da0bf15394937c0e29d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:05 -0400 Subject: [PATCH 0161/1490] lakeformation: Use constant for region strings --- internal/service/lakeformation/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/lakeformation/service_endpoints_gen_test.go b/internal/service/lakeformation/service_endpoints_gen_test.go index 784f5610477..eac536b226c 100644 --- a/internal/service/lakeformation/service_endpoints_gen_test.go +++ b/internal/service/lakeformation/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6ca49acf0e6d1ce2c9ebab338714715aeafcb38b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:05 -0400 Subject: [PATCH 0162/1490] lambda: Use constant for region strings --- internal/service/lambda/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/lambda/service_endpoints_gen_test.go b/internal/service/lambda/service_endpoints_gen_test.go index bd2037ee202..6c8479517b2 100644 --- a/internal/service/lambda/service_endpoints_gen_test.go +++ b/internal/service/lambda/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From ab6efba80f9bfa54b55c3d5c6ec1bbcaefb3b780 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:05 -0400 Subject: [PATCH 0163/1490] launchwizard: Use constant for region strings --- internal/service/launchwizard/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/launchwizard/service_endpoints_gen_test.go b/internal/service/launchwizard/service_endpoints_gen_test.go index e8facf1edf5..316e3cec417 100644 --- a/internal/service/launchwizard/service_endpoints_gen_test.go +++ b/internal/service/launchwizard/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d19465ba0f4d4b27312a88149182fcee86954c4f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:05 -0400 Subject: [PATCH 0164/1490] lexmodels: Use constant for region strings --- internal/service/lexmodels/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/lexmodels/service_endpoints_gen_test.go b/internal/service/lexmodels/service_endpoints_gen_test.go index 76f67da32e0..2eb06ea47e2 100644 --- a/internal/service/lexmodels/service_endpoints_gen_test.go +++ b/internal/service/lexmodels/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -564,7 +565,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 2edab0aa19fae42219a7022e183c7b2aa631cb0a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:05 -0400 Subject: [PATCH 0165/1490] lexv2models: Use constant for region strings --- internal/service/lexv2models/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/lexv2models/service_endpoints_gen_test.go b/internal/service/lexv2models/service_endpoints_gen_test.go index 7b3a1d66486..10e13c775b3 100644 --- a/internal/service/lexv2models/service_endpoints_gen_test.go +++ b/internal/service/lexv2models/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 5f09754453cb1a2b8fd85472c89cc021e058dbfa Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:06 -0400 Subject: [PATCH 0166/1490] licensemanager: Use constant for region strings --- internal/service/licensemanager/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/licensemanager/service_endpoints_gen_test.go b/internal/service/licensemanager/service_endpoints_gen_test.go index ff6e6d1ec5c..bb378dd4958 100644 --- a/internal/service/licensemanager/service_endpoints_gen_test.go +++ b/internal/service/licensemanager/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From b66cb5f337b9937c0be0a8c60056f1c76a0e91c0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:06 -0400 Subject: [PATCH 0167/1490] lightsail: Use constant for region strings --- internal/service/lightsail/bucket.go | 4 ++-- internal/service/lightsail/bucket_test.go | 2 +- internal/service/lightsail/service_endpoints_gen_test.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/lightsail/bucket.go b/internal/service/lightsail/bucket.go index f5a31a51da4..0515ff8f281 100644 --- a/internal/service/lightsail/bucket.go +++ b/internal/service/lightsail/bucket.go @@ -63,7 +63,7 @@ func ResourceBucket() *schema.Resource { Required: true, ForceNew: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -134,7 +134,7 @@ func resourceBucketRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("bundle_id", out.BundleId) d.Set(names.AttrCreatedAt, out.CreatedAt.Format(time.RFC3339)) d.Set(names.AttrName, out.Name) - d.Set("region", out.Location.RegionName) + d.Set(names.AttrRegion, out.Location.RegionName) d.Set("support_code", out.SupportCode) d.Set("url", out.Url) diff --git a/internal/service/lightsail/bucket_test.go b/internal/service/lightsail/bucket_test.go index 55e5c8fba60..703daecdc5a 100644 --- a/internal/service/lightsail/bucket_test.go +++ b/internal/service/lightsail/bucket_test.go @@ -47,7 +47,7 @@ func TestAccLightsailBucket_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "bundle_id", "small_1_0"), resource.TestCheckResourceAttrSet(resourceName, names.AttrCreatedAt), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "region"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrRegion), resource.TestCheckResourceAttrSet(resourceName, "support_code"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttrSet(resourceName, "url"), diff --git a/internal/service/lightsail/service_endpoints_gen_test.go b/internal/service/lightsail/service_endpoints_gen_test.go index 56761f1b761..dad8a9e0806 100644 --- a/internal/service/lightsail/service_endpoints_gen_test.go +++ b/internal/service/lightsail/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From dd12bf1d1d3362912fac88047a551115a97daf09 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:06 -0400 Subject: [PATCH 0168/1490] location: Use constant for region strings --- internal/service/location/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/location/service_endpoints_gen_test.go b/internal/service/location/service_endpoints_gen_test.go index 8f505e6d9b7..1e0fe517166 100644 --- a/internal/service/location/service_endpoints_gen_test.go +++ b/internal/service/location/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -404,7 +405,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 11f8ea2ab72d02029d88e90a4c94fadc4513b1e5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:06 -0400 Subject: [PATCH 0169/1490] logs: Use constant for region strings --- internal/service/logs/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/logs/service_endpoints_gen_test.go b/internal/service/logs/service_endpoints_gen_test.go index 8a2caa442b8..c1f1891489a 100644 --- a/internal/service/logs/service_endpoints_gen_test.go +++ b/internal/service/logs/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -490,7 +491,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d3654bba789d4c52894b604676a8486d4a22e402 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:06 -0400 Subject: [PATCH 0170/1490] lookoutmetrics: Use constant for region strings --- internal/service/lookoutmetrics/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/lookoutmetrics/service_endpoints_gen_test.go b/internal/service/lookoutmetrics/service_endpoints_gen_test.go index c8a55694e03..e48ef8bcf0b 100644 --- a/internal/service/lookoutmetrics/service_endpoints_gen_test.go +++ b/internal/service/lookoutmetrics/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From facac8a29e6e617c4adb55b7137227e585049133 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:06 -0400 Subject: [PATCH 0171/1490] m2: Use constant for region strings --- internal/service/m2/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/m2/service_endpoints_gen_test.go b/internal/service/m2/service_endpoints_gen_test.go index e7e3b1a9e88..36623b63717 100644 --- a/internal/service/m2/service_endpoints_gen_test.go +++ b/internal/service/m2/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 4156f7ebbe8b22b5b6bc70c27dae76f20a4b6698 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:06 -0400 Subject: [PATCH 0172/1490] macie2: Use constant for region strings --- .../service/macie2/findings_filter_test.go | 22 +++++++++---------- .../macie2/service_endpoints_gen_test.go | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/internal/service/macie2/findings_filter_test.go b/internal/service/macie2/findings_filter_test.go index 0298765bdf9..079db839d46 100644 --- a/internal/service/macie2/findings_filter_test.go +++ b/internal/service/macie2/findings_filter_test.go @@ -154,10 +154,10 @@ func testAccFindingsFilter_complete(t *testing.T) { acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, "terraform-"), resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionArchive), - resource.TestCheckResourceAttr(resourceName, "finding_criteria.0.criterion.0.field", "region"), + resource.TestCheckResourceAttr(resourceName, "finding_criteria.0.criterion.0.field", names.AttrRegion), resource.TestCheckResourceAttrPair(resourceName, "finding_criteria.0.criterion.0.eq.0", dataSourceRegion, names.AttrName), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ - "field": "region", + "field": names.AttrRegion, "eq.#": "1", "eq.0": acctest.Region(), }), @@ -176,10 +176,10 @@ func testAccFindingsFilter_complete(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "macie2", regexache.MustCompile(`findings-filter/.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, descriptionUpdated), resource.TestCheckResourceAttr(resourceName, "position", "1"), - resource.TestCheckResourceAttr(resourceName, "finding_criteria.0.criterion.0.field", "region"), + resource.TestCheckResourceAttr(resourceName, "finding_criteria.0.criterion.0.field", names.AttrRegion), resource.TestCheckResourceAttrPair(resourceName, "finding_criteria.0.criterion.0.eq.0", dataSourceRegion, names.AttrName), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ - "field": "region", + "field": names.AttrRegion, "eq.#": "1", "eq.0": acctest.Region(), }), @@ -195,10 +195,10 @@ func testAccFindingsFilter_complete(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "macie2", regexache.MustCompile(`findings-filter/.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, descriptionUpdated), resource.TestCheckResourceAttr(resourceName, "position", "1"), - resource.TestCheckResourceAttr(resourceName, "finding_criteria.0.criterion.0.field", "region"), + resource.TestCheckResourceAttr(resourceName, "finding_criteria.0.criterion.0.field", names.AttrRegion), resource.TestCheckResourceAttrPair(resourceName, "finding_criteria.0.criterion.0.eq.0", dataSourceRegion, names.AttrName), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ - "field": "region", + "field": names.AttrRegion, "eq.#": "1", "eq.0": acctest.Region(), }), @@ -238,7 +238,7 @@ func testAccFindingsFilter_WithDate(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionArchive), resource.TestCheckTypeSetElemAttrPair(resourceName, "finding_criteria.0.criterion.*.eq.*", dataSourceRegion, names.AttrName), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ - "field": "region", + "field": names.AttrRegion, "eq.#": "1", "eq.0": acctest.Region(), }), @@ -259,7 +259,7 @@ func testAccFindingsFilter_WithDate(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "position", "1"), resource.TestCheckTypeSetElemAttrPair(resourceName, "finding_criteria.0.criterion.*.eq.*", dataSourceRegion, names.AttrName), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ - "field": "region", + "field": names.AttrRegion, "eq.#": "1", "eq.0": acctest.Region(), }), @@ -318,7 +318,7 @@ func testAccFindingsFilter_WithNumber(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, "position", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ - "field": "region", + "field": names.AttrRegion, "eq.#": "1", "eq.0": acctest.Region(), }), @@ -337,7 +337,7 @@ func testAccFindingsFilter_WithNumber(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "finding_criteria.#", "1"), resource.TestCheckResourceAttr(resourceName, "finding_criteria.0.criterion.#", "3"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ - "field": "region", + "field": names.AttrRegion, "eq.#": "1", "eq.0": acctest.Region(), }), @@ -389,7 +389,7 @@ func testAccFindingsFilter_withTags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "position", "1"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ - "field": "region", + "field": names.AttrRegion, "eq.#": "1", "eq.0": acctest.Region(), }), diff --git a/internal/service/macie2/service_endpoints_gen_test.go b/internal/service/macie2/service_endpoints_gen_test.go index 007d956049c..c3ac7c68af1 100644 --- a/internal/service/macie2/service_endpoints_gen_test.go +++ b/internal/service/macie2/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 38b6f0b95401c2906cf101c9fd7fadbf5adf70d7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:07 -0400 Subject: [PATCH 0173/1490] mediaconnect: Use constant for region strings --- internal/service/mediaconnect/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/mediaconnect/service_endpoints_gen_test.go b/internal/service/mediaconnect/service_endpoints_gen_test.go index 4e3b82bf578..5f432b54203 100644 --- a/internal/service/mediaconnect/service_endpoints_gen_test.go +++ b/internal/service/mediaconnect/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 1262065785ece00748005ffff3293a22e37c25da Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:07 -0400 Subject: [PATCH 0174/1490] mediaconvert: Use constant for region strings --- internal/service/mediaconvert/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/mediaconvert/service_endpoints_gen_test.go b/internal/service/mediaconvert/service_endpoints_gen_test.go index 3064a91b9e2..c7c74303678 100644 --- a/internal/service/mediaconvert/service_endpoints_gen_test.go +++ b/internal/service/mediaconvert/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 98ea393dc78eadf6dbebf921fd8e19f523f2887c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:07 -0400 Subject: [PATCH 0175/1490] medialive: Use constant for region strings --- internal/service/medialive/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/medialive/service_endpoints_gen_test.go b/internal/service/medialive/service_endpoints_gen_test.go index 0bd9760b7f9..9ace61c22ec 100644 --- a/internal/service/medialive/service_endpoints_gen_test.go +++ b/internal/service/medialive/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 46615977fd1ebb2809862645f912a1d42cb0b0e6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:07 -0400 Subject: [PATCH 0176/1490] mediapackage: Use constant for region strings --- internal/service/mediapackage/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/mediapackage/service_endpoints_gen_test.go b/internal/service/mediapackage/service_endpoints_gen_test.go index 64b68a1566e..445c8dd80a8 100644 --- a/internal/service/mediapackage/service_endpoints_gen_test.go +++ b/internal/service/mediapackage/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From b5eabdca00e1ff387fc12fad8d32e2c0ddf72900 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:07 -0400 Subject: [PATCH 0177/1490] mediapackagev2: Use constant for region strings --- internal/service/mediapackagev2/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/mediapackagev2/service_endpoints_gen_test.go b/internal/service/mediapackagev2/service_endpoints_gen_test.go index ee255e47a77..cc5976ac2b8 100644 --- a/internal/service/mediapackagev2/service_endpoints_gen_test.go +++ b/internal/service/mediapackagev2/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 4acd29a6bcd3c026f56b14ebbd3fc7240e8bc19e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:07 -0400 Subject: [PATCH 0178/1490] mediastore: Use constant for region strings --- internal/service/mediastore/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/mediastore/service_endpoints_gen_test.go b/internal/service/mediastore/service_endpoints_gen_test.go index 81dff06bcb9..23a79ade2c9 100644 --- a/internal/service/mediastore/service_endpoints_gen_test.go +++ b/internal/service/mediastore/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6928f614254808ab2f7836440954df710e05ea18 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:07 -0400 Subject: [PATCH 0179/1490] memorydb: Use constant for region strings --- internal/service/memorydb/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/memorydb/service_endpoints_gen_test.go b/internal/service/memorydb/service_endpoints_gen_test.go index b9d796fecf9..7c000b8908a 100644 --- a/internal/service/memorydb/service_endpoints_gen_test.go +++ b/internal/service/memorydb/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 79ee1938ae7e73fdbbe0e0e51b529517fbd60adb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:07 -0400 Subject: [PATCH 0180/1490] meta: Use constant for region strings --- internal/service/meta/arn_data_source.go | 2 +- internal/service/meta/arn_data_source_test.go | 4 ++-- internal/service/meta/service_data_source.go | 2 +- internal/service/meta/service_data_source_test.go | 9 +++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/service/meta/arn_data_source.go b/internal/service/meta/arn_data_source.go index d784423508f..c3a320f69b1 100644 --- a/internal/service/meta/arn_data_source.go +++ b/internal/service/meta/arn_data_source.go @@ -51,7 +51,7 @@ func (d *dataSourceARN) Schema(ctx context.Context, req datasource.SchemaRequest "partition": schema.StringAttribute{ Computed: true, }, - "region": schema.StringAttribute{ + names.AttrRegion: schema.StringAttribute{ Computed: true, }, "resource": schema.StringAttribute{ diff --git a/internal/service/meta/arn_data_source_test.go b/internal/service/meta/arn_data_source_test.go index e170defbd0d..4b7f4a2dbfd 100644 --- a/internal/service/meta/arn_data_source_test.go +++ b/internal/service/meta/arn_data_source_test.go @@ -29,7 +29,7 @@ func TestAccMetaARNDataSource_basic(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "account", "123456789012"), resource.TestCheckResourceAttr(dataSourceName, names.AttrID, arn), resource.TestCheckResourceAttr(dataSourceName, "partition", "aws"), - resource.TestCheckResourceAttr(dataSourceName, "region", "eu-west-1"), // lintignore:AWSAT003 + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, "eu-west-1"), // lintignore:AWSAT003 resource.TestCheckResourceAttr(dataSourceName, "resource", "db:mysql-db"), resource.TestCheckResourceAttr(dataSourceName, "service", "rds"), ), @@ -54,7 +54,7 @@ func TestAccMetaARNDataSource_s3Bucket(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "account", ""), resource.TestCheckResourceAttr(dataSourceName, names.AttrID, arn), resource.TestCheckResourceAttr(dataSourceName, "partition", "aws"), - resource.TestCheckResourceAttr(dataSourceName, "region", ""), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, ""), resource.TestCheckResourceAttr(dataSourceName, "resource", "my_corporate_bucket/Development/*"), resource.TestCheckResourceAttr(dataSourceName, "service", "s3"), ), diff --git a/internal/service/meta/service_data_source.go b/internal/service/meta/service_data_source.go index a0f3bd53376..12f9f077173 100644 --- a/internal/service/meta/service_data_source.go +++ b/internal/service/meta/service_data_source.go @@ -49,7 +49,7 @@ func (d *dataSourceService) Schema(ctx context.Context, req datasource.SchemaReq "partition": schema.StringAttribute{ Computed: true, }, - "region": schema.StringAttribute{ + names.AttrRegion: schema.StringAttribute{ Optional: true, Computed: true, }, diff --git a/internal/service/meta/service_data_source_test.go b/internal/service/meta/service_data_source_test.go index db95a0f5fa1..fbb5e72327d 100644 --- a/internal/service/meta/service_data_source_test.go +++ b/internal/service/meta/service_data_source_test.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-aws/internal/acctest" tfmeta "github.com/hashicorp/terraform-provider-aws/internal/service/meta" + "github.com/hashicorp/terraform-provider-aws/names" ) func TestAccMetaService_basic(t *testing.T) { @@ -32,7 +33,7 @@ func TestAccMetaService_basic(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "dns_name", fmt.Sprintf("%s.%s.%s", ec2.EndpointsID, acctest.Region(), "amazonaws.com")), resource.TestCheckResourceAttr(dataSourceName, "partition", acctest.Partition()), resource.TestCheckResourceAttr(dataSourceName, "reverse_dns_prefix", "com.amazonaws"), - resource.TestCheckResourceAttr(dataSourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttr(dataSourceName, "reverse_dns_name", fmt.Sprintf("%s.%s.%s", "com.amazonaws", acctest.Region(), ec2.EndpointsID)), resource.TestCheckResourceAttr(dataSourceName, "service_id", ec2.EndpointsID), resource.TestCheckResourceAttr(dataSourceName, "supported", "true"), @@ -54,7 +55,7 @@ func TestAccMetaService_byReverseDNSName(t *testing.T) { { Config: testAccServiceDataSourceConfig_byReverseDNSName(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "region", endpoints.CnNorth1RegionID), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, endpoints.CnNorth1RegionID), resource.TestCheckResourceAttr(dataSourceName, "reverse_dns_name", fmt.Sprintf("%s.%s.%s", "cn.com.amazonaws", endpoints.CnNorth1RegionID, s3.EndpointsID)), resource.TestCheckResourceAttr(dataSourceName, "reverse_dns_prefix", "cn.com.amazonaws"), resource.TestCheckResourceAttr(dataSourceName, "service_id", s3.EndpointsID), @@ -77,7 +78,7 @@ func TestAccMetaService_byDNSName(t *testing.T) { { Config: testAccServiceDataSourceConfig_byDNSName(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "region", endpoints.UsEast1RegionID), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, endpoints.UsEast1RegionID), resource.TestCheckResourceAttr(dataSourceName, "reverse_dns_name", fmt.Sprintf("%s.%s.%s", "com.amazonaws", endpoints.UsEast1RegionID, rds.EndpointsID)), resource.TestCheckResourceAttr(dataSourceName, "reverse_dns_prefix", "com.amazonaws"), resource.TestCheckResourceAttr(dataSourceName, "service_id", rds.EndpointsID), @@ -124,7 +125,7 @@ func TestAccMetaService_unsupported(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "dns_name", fmt.Sprintf("%s.%s.%s", waf.EndpointsID, endpoints.UsGovWest1RegionID, "amazonaws.com")), resource.TestCheckResourceAttr(dataSourceName, "partition", endpoints.AwsUsGovPartitionID), resource.TestCheckResourceAttr(dataSourceName, "reverse_dns_prefix", "com.amazonaws"), - resource.TestCheckResourceAttr(dataSourceName, "region", endpoints.UsGovWest1RegionID), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, endpoints.UsGovWest1RegionID), resource.TestCheckResourceAttr(dataSourceName, "reverse_dns_name", fmt.Sprintf("%s.%s.%s", "com.amazonaws", endpoints.UsGovWest1RegionID, waf.EndpointsID)), resource.TestCheckResourceAttr(dataSourceName, "service_id", waf.EndpointsID), resource.TestCheckResourceAttr(dataSourceName, "supported", "false"), From c28773be977273a3b6c2012a3c5cf487c4f44cd9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:08 -0400 Subject: [PATCH 0181/1490] mq: Use constant for region strings --- internal/service/mq/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/mq/service_endpoints_gen_test.go b/internal/service/mq/service_endpoints_gen_test.go index c2cc9388735..ebf95054e8f 100644 --- a/internal/service/mq/service_endpoints_gen_test.go +++ b/internal/service/mq/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From bc8a1067e2be490e1fee3e01019ee1e62533ae9c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:08 -0400 Subject: [PATCH 0182/1490] neptune: Use constant for region strings --- internal/service/neptune/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/neptune/service_endpoints_gen_test.go b/internal/service/neptune/service_endpoints_gen_test.go index 84ca5cbd5f4..9cc41fd4f77 100644 --- a/internal/service/neptune/service_endpoints_gen_test.go +++ b/internal/service/neptune/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 24b379707bc43f2cda2d32bbe8985264918c026e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:08 -0400 Subject: [PATCH 0183/1490] networkfirewall: Use constant for region strings --- internal/service/networkfirewall/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/networkfirewall/service_endpoints_gen_test.go b/internal/service/networkfirewall/service_endpoints_gen_test.go index c29e27dfc5b..6df2ad30d5e 100644 --- a/internal/service/networkfirewall/service_endpoints_gen_test.go +++ b/internal/service/networkfirewall/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 072abc7aa78099162499b3f206b2acf0929bb2aa Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:08 -0400 Subject: [PATCH 0184/1490] networkmanager: Use constant for region strings --- .../core_network_policy_document_data_source.go | 4 ++-- internal/service/networkmanager/service_endpoints_gen_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/networkmanager/core_network_policy_document_data_source.go b/internal/service/networkmanager/core_network_policy_document_data_source.go index 5573c8c0570..c7cb4b5af5e 100644 --- a/internal/service/networkmanager/core_network_policy_document_data_source.go +++ b/internal/service/networkmanager/core_network_policy_document_data_source.go @@ -70,7 +70,7 @@ func DataSourceCoreNetworkPolicyDocument() *schema.Resource { "tag-value", "tag-exists", "resource-id", - "region", + names.AttrRegion, "attachment-type", }, false), }, @@ -504,7 +504,7 @@ func expandDataCoreNetworkPolicyAttachmentPoliciesConditions(tfList []interface{ return nil, fmt.Errorf("Conditions %s: You must set \"key\", \"operator\", and \"value\" if type = \"tag-value\".", strconv.Itoa(i)) } } - if t == "region" || t == "resource-id" || t == "account-id" { + if t == names.AttrRegion || t == "resource-id" || t == "account-id" { if k[names.AttrKey] || !k["operator"] || !k[names.AttrValue] { return nil, fmt.Errorf("Conditions %s: You must set \"value\" and \"operator\" and cannot set \"key\" if type = \"region\", \"resource-id\", or \"account-id\".", strconv.Itoa(i)) } diff --git a/internal/service/networkmanager/service_endpoints_gen_test.go b/internal/service/networkmanager/service_endpoints_gen_test.go index b6a90f8f43c..78aa3e757e3 100644 --- a/internal/service/networkmanager/service_endpoints_gen_test.go +++ b/internal/service/networkmanager/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From b7998d5fa5232f34bbdddb83e10139596a539787 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:08 -0400 Subject: [PATCH 0185/1490] oam: Use constant for region strings --- internal/service/oam/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/oam/service_endpoints_gen_test.go b/internal/service/oam/service_endpoints_gen_test.go index 313018dc449..ff6f4fce908 100644 --- a/internal/service/oam/service_endpoints_gen_test.go +++ b/internal/service/oam/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 45c0188df4e144e1c66d33c8db75972cfe1493d9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:08 -0400 Subject: [PATCH 0186/1490] opensearch: Use constant for region strings --- internal/service/opensearch/outbound_connection.go | 6 +++--- internal/service/opensearch/service_endpoints_gen_test.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/opensearch/outbound_connection.go b/internal/service/opensearch/outbound_connection.go index e769a866bb0..6525d43a9b1 100644 --- a/internal/service/opensearch/outbound_connection.go +++ b/internal/service/opensearch/outbound_connection.go @@ -41,7 +41,7 @@ func ResourceOutboundConnection() *schema.Resource { Required: true, ForceNew: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -353,7 +353,7 @@ func expandOutboundConnectionDomainInfo(vOptions []interface{}) *opensearchservi AWSDomainInformation: &opensearchservice.AWSDomainInformation{ DomainName: aws.String(mOptions[names.AttrDomainName].(string)), OwnerId: aws.String(mOptions[names.AttrOwnerID].(string)), - Region: aws.String(mOptions["region"].(string)), + Region: aws.String(mOptions[names.AttrRegion].(string)), }, } } @@ -365,7 +365,7 @@ func flattenOutboundConnectionDomainInfo(domainInfo *opensearchservice.DomainInf return []interface{}{map[string]interface{}{ names.AttrOwnerID: aws.StringValue(domainInfo.AWSDomainInformation.OwnerId), names.AttrDomainName: aws.StringValue(domainInfo.AWSDomainInformation.DomainName), - "region": aws.StringValue(domainInfo.AWSDomainInformation.Region), + names.AttrRegion: aws.StringValue(domainInfo.AWSDomainInformation.Region), }} } diff --git a/internal/service/opensearch/service_endpoints_gen_test.go b/internal/service/opensearch/service_endpoints_gen_test.go index 4878543630f..fd010cec78b 100644 --- a/internal/service/opensearch/service_endpoints_gen_test.go +++ b/internal/service/opensearch/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -404,7 +405,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 9aba1c816582ade4b82ba7a73d2a4d2913ca6ae8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:08 -0400 Subject: [PATCH 0187/1490] opensearchserverless: Use constant for region strings --- .../service/opensearchserverless/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/opensearchserverless/service_endpoints_gen_test.go b/internal/service/opensearchserverless/service_endpoints_gen_test.go index 012eecbe79e..21c3bef2105 100644 --- a/internal/service/opensearchserverless/service_endpoints_gen_test.go +++ b/internal/service/opensearchserverless/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d97e32ae033e6fedbec2fe2dc9afae9559689d83 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:09 -0400 Subject: [PATCH 0188/1490] opsworks: Use constant for region strings --- .../service/opsworks/service_endpoints_gen_test.go | 3 ++- internal/service/opsworks/stack.go | 6 +++--- internal/service/opsworks/stack_test.go | 10 +++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/internal/service/opsworks/service_endpoints_gen_test.go b/internal/service/opsworks/service_endpoints_gen_test.go index 38565789f39..05d5185e765 100644 --- a/internal/service/opsworks/service_endpoints_gen_test.go +++ b/internal/service/opsworks/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } diff --git a/internal/service/opsworks/stack.go b/internal/service/opsworks/stack.go index 81540521e4b..928518c3d3c 100644 --- a/internal/service/opsworks/stack.go +++ b/internal/service/opsworks/stack.go @@ -162,7 +162,7 @@ func ResourceStack() *schema.Resource { Type: schema.TypeString, Required: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, ForceNew: true, Required: true, @@ -206,7 +206,7 @@ func resourceStackCreate(ctx context.Context, d *schema.ResourceData, meta inter conn := meta.(*conns.AWSClient).OpsWorksConn(ctx) name := d.Get(names.AttrName).(string) - region := d.Get("region").(string) + region := d.Get(names.AttrRegion).(string) input := &opsworks.CreateStackInput{ ChefConfiguration: &opsworks.ChefConfiguration{ ManageBerkshelf: aws.Bool(d.Get("manage_berkshelf").(bool)), @@ -398,7 +398,7 @@ func resourceStackRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set("default_subnet_id", stack.DefaultSubnetId) d.Set("hostname_theme", stack.HostnameTheme) d.Set(names.AttrName, stack.Name) - d.Set("region", stack.Region) + d.Set(names.AttrRegion, stack.Region) d.Set("service_role_arn", stack.ServiceRoleArn) d.Set("use_custom_cookbooks", stack.UseCustomCookbooks) d.Set("use_opsworks_security_groups", stack.UseOpsworksSecurityGroups) diff --git a/internal/service/opsworks/stack_test.go b/internal/service/opsworks/stack_test.go index dcdfc7cfb8b..8fad9e93968 100644 --- a/internal/service/opsworks/stack_test.go +++ b/internal/service/opsworks/stack_test.go @@ -59,7 +59,7 @@ func TestAccOpsWorksStack_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "hostname_theme", "Layer_Dependent"), resource.TestCheckResourceAttr(resourceName, "manage_berkshelf", "false"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(resourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttrSet(resourceName, "service_role_arn"), resource.TestCheckResourceAttr(resourceName, "stack_endpoint", acctest.Region()), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -269,7 +269,7 @@ func TestAccOpsWorksStack_tagsAlternateRegion(t *testing.T) { return nil }), - resource.TestCheckResourceAttr(resourceName, "region", acctest.AlternateRegion()), + resource.TestCheckResourceAttr(resourceName, names.AttrRegion, acctest.AlternateRegion()), // "In this case, the actual API endpoint of the stack is in us-east-1." resource.TestCheckResourceAttr(resourceName, "stack_endpoint", endpoints.UsEast1RegionID), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -345,7 +345,7 @@ func TestAccOpsWorksStack_allAttributes(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "hostname_theme", "Baked_Goods"), resource.TestCheckResourceAttr(resourceName, "manage_berkshelf", "false"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(resourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttrSet(resourceName, "service_role_arn"), resource.TestCheckResourceAttr(resourceName, "stack_endpoint", acctest.Region()), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -389,7 +389,7 @@ func TestAccOpsWorksStack_allAttributes(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "hostname_theme", "Scottish_Islands"), resource.TestCheckResourceAttr(resourceName, "manage_berkshelf", "false"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(resourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttrSet(resourceName, "service_role_arn"), resource.TestCheckResourceAttr(resourceName, "stack_endpoint", acctest.Region()), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -425,7 +425,7 @@ func TestAccOpsWorksStack_allAttributes(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "hostname_theme", "Scottish_Islands"), resource.TestCheckResourceAttr(resourceName, "manage_berkshelf", "false"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "region", acctest.Region()), + resource.TestCheckResourceAttr(resourceName, names.AttrRegion, acctest.Region()), resource.TestCheckResourceAttrSet(resourceName, "service_role_arn"), resource.TestCheckResourceAttr(resourceName, "stack_endpoint", acctest.Region()), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), From bd0627d6aadf7db15ebb5310a78287649c2bb47d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:09 -0400 Subject: [PATCH 0189/1490] organizations: Use constant for region strings --- internal/service/organizations/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/organizations/service_endpoints_gen_test.go b/internal/service/organizations/service_endpoints_gen_test.go index 7e25db02bb4..0ffa11658cb 100644 --- a/internal/service/organizations/service_endpoints_gen_test.go +++ b/internal/service/organizations/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 0dd22578bc2189f2937977c104cd216f8eccc81a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:09 -0400 Subject: [PATCH 0190/1490] osis: Use constant for region strings --- internal/service/osis/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/osis/service_endpoints_gen_test.go b/internal/service/osis/service_endpoints_gen_test.go index 464175001d2..c85633088a7 100644 --- a/internal/service/osis/service_endpoints_gen_test.go +++ b/internal/service/osis/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e96fc103f213caeb58b164437cf3c8213715bd1e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:09 -0400 Subject: [PATCH 0191/1490] outposts: Use constant for region strings --- internal/service/outposts/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/outposts/service_endpoints_gen_test.go b/internal/service/outposts/service_endpoints_gen_test.go index a587cee9ef2..bcf74df0887 100644 --- a/internal/service/outposts/service_endpoints_gen_test.go +++ b/internal/service/outposts/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 01fe6f46116f182c2f67d92ec469113b26e96e8f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:09 -0400 Subject: [PATCH 0192/1490] pcaconnectorad: Use constant for region strings --- internal/service/pcaconnectorad/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/pcaconnectorad/service_endpoints_gen_test.go b/internal/service/pcaconnectorad/service_endpoints_gen_test.go index e98c9457afa..9e17e83eb33 100644 --- a/internal/service/pcaconnectorad/service_endpoints_gen_test.go +++ b/internal/service/pcaconnectorad/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 42eb89d1bb56c9e6e05c10a180f5bf7552de97d6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:09 -0400 Subject: [PATCH 0193/1490] pinpoint: Use constant for region strings --- internal/service/pinpoint/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/pinpoint/service_endpoints_gen_test.go b/internal/service/pinpoint/service_endpoints_gen_test.go index 0128d19d2d3..68542db537b 100644 --- a/internal/service/pinpoint/service_endpoints_gen_test.go +++ b/internal/service/pinpoint/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6b4123339e480eb32644216de7b21029378f620a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:09 -0400 Subject: [PATCH 0194/1490] pipes: Use constant for region strings --- internal/service/pipes/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/pipes/service_endpoints_gen_test.go b/internal/service/pipes/service_endpoints_gen_test.go index b6a0505f8ee..5234d793b3f 100644 --- a/internal/service/pipes/service_endpoints_gen_test.go +++ b/internal/service/pipes/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 66400ea69c1da6aa7a9a44c8e50780b2c86fb513 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:10 -0400 Subject: [PATCH 0195/1490] polly: Use constant for region strings --- internal/service/polly/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/polly/service_endpoints_gen_test.go b/internal/service/polly/service_endpoints_gen_test.go index e3b744be287..6da7c97d310 100644 --- a/internal/service/polly/service_endpoints_gen_test.go +++ b/internal/service/polly/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 78070a3ee674138f1e66b40a69e1bdaac5d68547 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:10 -0400 Subject: [PATCH 0196/1490] pricing: Use constant for region strings --- internal/service/pricing/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/pricing/service_endpoints_gen_test.go b/internal/service/pricing/service_endpoints_gen_test.go index d8c4df7531d..97d3fdac3ea 100644 --- a/internal/service/pricing/service_endpoints_gen_test.go +++ b/internal/service/pricing/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 3c258d75b402193bff3a991d4b017b1baa7bd4ad Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:10 -0400 Subject: [PATCH 0197/1490] qbusiness: Use constant for region strings --- internal/service/qbusiness/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/qbusiness/service_endpoints_gen_test.go b/internal/service/qbusiness/service_endpoints_gen_test.go index a7b3a2c3796..0fb6a387f6a 100644 --- a/internal/service/qbusiness/service_endpoints_gen_test.go +++ b/internal/service/qbusiness/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 87f4be89a01544a62a1756a291a141bdab60c942 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:10 -0400 Subject: [PATCH 0198/1490] qldb: Use constant for region strings --- internal/service/qldb/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/qldb/service_endpoints_gen_test.go b/internal/service/qldb/service_endpoints_gen_test.go index 51dc93ffcfd..0330c2031ad 100644 --- a/internal/service/qldb/service_endpoints_gen_test.go +++ b/internal/service/qldb/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From a7a5a39b0639b992daf34f26a1f11ce67eb56f7e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:10 -0400 Subject: [PATCH 0199/1490] quicksight: Use constant for region strings --- internal/service/quicksight/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/quicksight/service_endpoints_gen_test.go b/internal/service/quicksight/service_endpoints_gen_test.go index c0c4d4d05de..fa7810404b0 100644 --- a/internal/service/quicksight/service_endpoints_gen_test.go +++ b/internal/service/quicksight/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -328,7 +329,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d33d16b5a460d4cf4bd3d07d8708a0884f7262a0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:10 -0400 Subject: [PATCH 0200/1490] ram: Use constant for region strings --- internal/service/ram/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ram/service_endpoints_gen_test.go b/internal/service/ram/service_endpoints_gen_test.go index 1d74241914a..93302e6c24c 100644 --- a/internal/service/ram/service_endpoints_gen_test.go +++ b/internal/service/ram/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From a710d4e7f983fb77f5701e5da077938a516a207c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:10 -0400 Subject: [PATCH 0201/1490] rbin: Use constant for region strings --- internal/service/rbin/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/rbin/service_endpoints_gen_test.go b/internal/service/rbin/service_endpoints_gen_test.go index dacf349edd7..0e8265757cc 100644 --- a/internal/service/rbin/service_endpoints_gen_test.go +++ b/internal/service/rbin/service_endpoints_gen_test.go @@ -27,6 +27,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -417,7 +418,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 129f1ba433d7604ea6acd306f899f62275cd82ca Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:10 -0400 Subject: [PATCH 0202/1490] rds: Use constant for region strings --- internal/service/rds/consts.go | 6 ++++-- internal/service/rds/instance_test.go | 2 +- internal/service/rds/service_endpoints_gen_test.go | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/service/rds/consts.go b/internal/service/rds/consts.go index f82011905f9..1d3d708af96 100644 --- a/internal/service/rds/consts.go +++ b/internal/service/rds/consts.go @@ -5,6 +5,8 @@ package rds import ( "time" + + "github.com/hashicorp/terraform-provider-aws/names" ) const ( @@ -270,13 +272,13 @@ func TimeoutAction_Values() []string { const ( backupTargetOutposts = "outposts" - backupTargetRegion = "region" + backupTargetRegion = names.AttrRegion ) func backupTarget_Values() []string { return []string{ backupTargetOutposts, - backupTargetRegion, + names.AttrRegion, } } diff --git a/internal/service/rds/instance_test.go b/internal/service/rds/instance_test.go index e892263fc36..6366d319e85 100644 --- a/internal/service/rds/instance_test.go +++ b/internal/service/rds/instance_test.go @@ -59,7 +59,7 @@ func TestAccRDSInstance_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrAutoMinorVersionUpgrade, "true"), resource.TestCheckResourceAttrSet(resourceName, names.AttrAvailabilityZone), resource.TestCheckResourceAttr(resourceName, "backup_retention_period", "0"), - resource.TestCheckResourceAttr(resourceName, "backup_target", "region"), + resource.TestCheckResourceAttr(resourceName, "backup_target", names.AttrRegion), resource.TestCheckResourceAttrSet(resourceName, "backup_window"), resource.TestCheckResourceAttrSet(resourceName, "ca_cert_identifier"), resource.TestCheckResourceAttr(resourceName, "copy_tags_to_snapshot", "false"), diff --git a/internal/service/rds/service_endpoints_gen_test.go b/internal/service/rds/service_endpoints_gen_test.go index 818f1a97eaa..7d05e7fb02a 100644 --- a/internal/service/rds/service_endpoints_gen_test.go +++ b/internal/service/rds/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -362,7 +363,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From a95698e061a2b9c35e942ff9ca638cecaa1fa8eb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:11 -0400 Subject: [PATCH 0203/1490] redshift: Use constant for region strings --- internal/service/redshift/service_account_data_source.go | 4 ++-- internal/service/redshift/service_endpoints_gen_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/redshift/service_account_data_source.go b/internal/service/redshift/service_account_data_source.go index 35ba757d405..f71763d808d 100644 --- a/internal/service/redshift/service_account_data_source.go +++ b/internal/service/redshift/service_account_data_source.go @@ -54,7 +54,7 @@ func dataSourceServiceAccount() *schema.Resource { ReadWithoutTimeout: dataSourceServiceAccountRead, Schema: map[string]*schema.Schema{ - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -71,7 +71,7 @@ func dataSourceServiceAccount() *schema.Resource { func dataSourceServiceAccountRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics region := meta.(*conns.AWSClient).Region - if v, ok := d.GetOk("region"); ok { + if v, ok := d.GetOk(names.AttrRegion); ok { region = v.(string) } diff --git a/internal/service/redshift/service_endpoints_gen_test.go b/internal/service/redshift/service_endpoints_gen_test.go index 4a18552f40f..6af348852bc 100644 --- a/internal/service/redshift/service_endpoints_gen_test.go +++ b/internal/service/redshift/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -362,7 +363,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 58ff4b7d504d1b5168dd7901c4ea50e965ab2789 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:11 -0400 Subject: [PATCH 0204/1490] redshiftdata: Use constant for region strings --- internal/service/redshiftdata/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/redshiftdata/service_endpoints_gen_test.go b/internal/service/redshiftdata/service_endpoints_gen_test.go index c00c73c1f24..79ba840c617 100644 --- a/internal/service/redshiftdata/service_endpoints_gen_test.go +++ b/internal/service/redshiftdata/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -416,7 +417,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 67fbde55ec5593d7f5e09794d9f186483c866201 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:11 -0400 Subject: [PATCH 0205/1490] redshiftserverless: Use constant for region strings --- .../service/redshiftserverless/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/redshiftserverless/service_endpoints_gen_test.go b/internal/service/redshiftserverless/service_endpoints_gen_test.go index 962bde08d86..c6461a03ad1 100644 --- a/internal/service/redshiftserverless/service_endpoints_gen_test.go +++ b/internal/service/redshiftserverless/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -362,7 +363,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 65c14eb92adc630449756b88fe2cf43166b31a57 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:11 -0400 Subject: [PATCH 0206/1490] rekognition: Use constant for region strings --- internal/service/rekognition/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/rekognition/service_endpoints_gen_test.go b/internal/service/rekognition/service_endpoints_gen_test.go index c0ad3eb0a4b..fe1790a21c7 100644 --- a/internal/service/rekognition/service_endpoints_gen_test.go +++ b/internal/service/rekognition/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6534553a6dfcbea1db011b9276bb6321fb13f811 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:11 -0400 Subject: [PATCH 0207/1490] resourceexplorer2: Use constant for region strings --- .../service/resourceexplorer2/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/resourceexplorer2/service_endpoints_gen_test.go b/internal/service/resourceexplorer2/service_endpoints_gen_test.go index 3a2661d0c77..b4b9522325b 100644 --- a/internal/service/resourceexplorer2/service_endpoints_gen_test.go +++ b/internal/service/resourceexplorer2/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 80df1dadca2b96dbd84d4a7d80e5e0ec2b607687 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:11 -0400 Subject: [PATCH 0208/1490] resourcegroups: Use constant for region strings --- internal/service/resourcegroups/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/resourcegroups/service_endpoints_gen_test.go b/internal/service/resourcegroups/service_endpoints_gen_test.go index ba94080932b..cf9507abee3 100644 --- a/internal/service/resourcegroups/service_endpoints_gen_test.go +++ b/internal/service/resourcegroups/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 80e11c3998ebf5a52f3ac3f7a4256cd4c1fe8d22 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:11 -0400 Subject: [PATCH 0209/1490] resourcegroupstaggingapi: Use constant for region strings --- .../resourcegroupstaggingapi/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go b/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go index f83cf44cf39..3451de73ad6 100644 --- a/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go +++ b/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 02cc8d3fa60997a601600b2662508c28ab6a9beb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:12 -0400 Subject: [PATCH 0210/1490] rolesanywhere: Use constant for region strings --- internal/service/rolesanywhere/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/rolesanywhere/service_endpoints_gen_test.go b/internal/service/rolesanywhere/service_endpoints_gen_test.go index b15468b5b69..2b14b5e20cd 100644 --- a/internal/service/rolesanywhere/service_endpoints_gen_test.go +++ b/internal/service/rolesanywhere/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 84d6e6e5ded6571595392f16c059cef74fcdf44e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:12 -0400 Subject: [PATCH 0211/1490] route53: Use constant for region strings --- internal/service/route53/record.go | 8 ++++---- .../route53/service_endpoints_gen_test.go | 3 ++- .../traffic_policy_document_data_source.go | 16 ++++++++-------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/internal/service/route53/record.go b/internal/service/route53/record.go index 0aac6b7b637..c46f2480be2 100644 --- a/internal/service/route53/record.go +++ b/internal/service/route53/record.go @@ -239,7 +239,7 @@ func ResourceRecord() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "region": { + names.AttrRegion: { Type: schema.TypeString, Required: true, }, @@ -479,7 +479,7 @@ func resourceRecordRead(ctx context.Context, d *schema.ResourceData, meta interf if record.Region != nil { v := []map[string]interface{}{{ - "region": aws.StringValue(record.Region), + names.AttrRegion: aws.StringValue(record.Region), }} if err := d.Set("latency_routing_policy", v); err != nil { return sdkdiag.AppendErrorf(diags, "setting latency_routing_policy: %s", err) @@ -603,7 +603,7 @@ func resourceRecordUpdate(ctx context.Context, d *schema.ResourceData, meta inte if o, ok := v.([]interface{}); ok { if len(o) == 1 { if v, ok := o[0].(map[string]interface{}); ok { - oldRec.Region = aws.String(v["region"].(string)) + oldRec.Region = aws.String(v[names.AttrRegion].(string)) } } } @@ -953,7 +953,7 @@ func expandResourceRecordSet(d *schema.ResourceData, zoneName string) *route53.R records := v.([]interface{}) latency := records[0].(map[string]interface{}) - rec.Region = aws.String(latency["region"].(string)) + rec.Region = aws.String(latency[names.AttrRegion].(string)) } if v, ok := d.GetOk("multivalue_answer_routing_policy"); ok { diff --git a/internal/service/route53/service_endpoints_gen_test.go b/internal/service/route53/service_endpoints_gen_test.go index 68d5290f796..e3a6c251034 100644 --- a/internal/service/route53/service_endpoints_gen_test.go +++ b/internal/service/route53/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } diff --git a/internal/service/route53/traffic_policy_document_data_source.go b/internal/service/route53/traffic_policy_document_data_source.go index dbc4482f0cd..63c164ed045 100644 --- a/internal/service/route53/traffic_policy_document_data_source.go +++ b/internal/service/route53/traffic_policy_document_data_source.go @@ -35,7 +35,7 @@ func DataSourceTrafficPolicyDocument() *schema.Resource { Optional: true, ValidateFunc: validation.StringInSlice(TrafficPolicyDocEndpointType_values(), false), }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -186,7 +186,7 @@ func DataSourceTrafficPolicyDocument() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -197,7 +197,7 @@ func DataSourceTrafficPolicyDocument() *schema.Resource { }, }, }, - "region": { + names.AttrRegion: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -214,7 +214,7 @@ func DataSourceTrafficPolicyDocument() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -309,7 +309,7 @@ func expandDataTrafficPolicyEndpointDoc(tfMap map[string]interface{}) *TrafficPo if v, ok := tfMap[names.AttrType]; ok && v.(string) != "" { apiObject.Type = v.(string) } - if v, ok := tfMap["region"]; ok && v.(string) != "" { + if v, ok := tfMap[names.AttrRegion]; ok && v.(string) != "" { apiObject.Region = v.(string) } if v, ok := tfMap[names.AttrValue]; ok && v.(string) != "" { @@ -365,7 +365,7 @@ func expandDataTrafficPolicyRuleDoc(tfMap map[string]interface{}) *TrafficPolicy if v, ok := tfMap["geo_proximity_location"]; ok && len(v.(*schema.Set).List()) > 0 { apiObject.GeoProximityLocations = expandDataTrafficPolicyProximitiesDoc(v.(*schema.Set).List()) } - if v, ok := tfMap["region"]; ok && len(v.(*schema.Set).List()) > 0 { + if v, ok := tfMap[names.AttrRegion]; ok && len(v.(*schema.Set).List()) > 0 { apiObject.Regions = expandDataTrafficPolicyRegionsDoc(v.(*schema.Set).List()) } if v, ok := tfMap["items"]; ok && len(v.(*schema.Set).List()) > 0 { @@ -494,7 +494,7 @@ func expandDataTrafficPolicyProximityDoc(tfMap map[string]interface{}) *TrafficP if v, ok := tfMap["rule_reference"]; ok && v.(string) != "" { apiObject.RuleReference = v.(string) } - if v, ok := tfMap["region"]; ok && v.(string) != "" { + if v, ok := tfMap[names.AttrRegion]; ok && v.(string) != "" { apiObject.Region = v.(string) } if v, ok := tfMap["latitude"]; ok && v.(string) != "" { @@ -551,7 +551,7 @@ func expandDataTrafficPolicyRegionDoc(tfMap map[string]interface{}) *TrafficPoli if v, ok := tfMap["rule_reference"]; ok && v.(string) != "" { apiObject.RuleReference = v.(string) } - if v, ok := tfMap["region"]; ok && v.(string) != "" { + if v, ok := tfMap[names.AttrRegion]; ok && v.(string) != "" { apiObject.Region = v.(string) } if v, ok := tfMap["evaluate_target_health"]; ok && v.(bool) { From b5d7032c9b97d1541de6648491832d26e46cb704 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:12 -0400 Subject: [PATCH 0212/1490] route53domains: Use constant for region strings --- internal/service/route53domains/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/route53domains/service_endpoints_gen_test.go b/internal/service/route53domains/service_endpoints_gen_test.go index 000b4cce065..d27c620543e 100644 --- a/internal/service/route53domains/service_endpoints_gen_test.go +++ b/internal/service/route53domains/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d2108cb1951763e747d2207891876d98440eceee Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:12 -0400 Subject: [PATCH 0213/1490] route53recoverycontrolconfig: Use constant for region strings --- internal/service/route53recoverycontrolconfig/cluster.go | 4 ++-- .../service_endpoints_gen_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/route53recoverycontrolconfig/cluster.go b/internal/service/route53recoverycontrolconfig/cluster.go index 233f095014e..174ded11e64 100644 --- a/internal/service/route53recoverycontrolconfig/cluster.go +++ b/internal/service/route53recoverycontrolconfig/cluster.go @@ -42,7 +42,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -187,7 +187,7 @@ func flattenClusterEndpoint(ce *r53rcc.ClusterEndpoint) map[string]interface{} { } if v := ce.Region; v != nil { - tfMap["region"] = aws.StringValue(v) + tfMap[names.AttrRegion] = aws.StringValue(v) } return tfMap diff --git a/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go b/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go index 66439cd8907..c200232efe5 100644 --- a/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go +++ b/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 0e2a034511176217896d6e9294a0044a29596c6b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:12 -0400 Subject: [PATCH 0214/1490] route53recoveryreadiness: Use constant for region strings --- .../route53recoveryreadiness/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go b/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go index 5ebdcb44e8d..ab0ca949576 100644 --- a/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go +++ b/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -327,7 +328,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 563bdb427fa214bb1635877d2d29a6aae17c04c6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:12 -0400 Subject: [PATCH 0215/1490] route53resolver: Use constant for region strings --- internal/service/route53resolver/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/route53resolver/service_endpoints_gen_test.go b/internal/service/route53resolver/service_endpoints_gen_test.go index 407a012bc32..59fed173093 100644 --- a/internal/service/route53resolver/service_endpoints_gen_test.go +++ b/internal/service/route53resolver/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 41d72ce7baf82516733dc7c44fd13402cc00366b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:12 -0400 Subject: [PATCH 0216/1490] rum: Use constant for region strings --- internal/service/rum/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/rum/service_endpoints_gen_test.go b/internal/service/rum/service_endpoints_gen_test.go index be5903e638c..f01cff7f8e7 100644 --- a/internal/service/rum/service_endpoints_gen_test.go +++ b/internal/service/rum/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -404,7 +405,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 4913a2c5c437dcb1c9decf23f1f96d6fd4013709 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:13 -0400 Subject: [PATCH 0217/1490] s3: Use constant for region strings --- internal/service/s3/bucket.go | 4 ++-- internal/service/s3/bucket_data_source.go | 4 ++-- internal/service/s3/bucket_data_source_test.go | 2 +- internal/service/s3/bucket_test.go | 2 +- internal/service/s3/service_endpoints_gen_test.go | 3 ++- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index 48e4b3fc8b1..6f89ca79b18 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -396,7 +396,7 @@ func resourceBucket() *schema.Resource { return json }, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -1125,7 +1125,7 @@ func resourceBucketRead(ctx context.Context, d *schema.ResourceData, meta interf return sdkdiag.AppendErrorf(diags, "reading S3 Bucket (%s) location: %s", d.Id(), err) } - d.Set("region", region) + d.Set(names.AttrRegion, region) d.Set("bucket_regional_domain_name", bucketRegionalDomainName(d.Id(), region)) hostedZoneID, err := hostedZoneIDForRegion(region) diff --git a/internal/service/s3/bucket_data_source.go b/internal/service/s3/bucket_data_source.go index db0de019e18..b20a4d8ef67 100644 --- a/internal/service/s3/bucket_data_source.go +++ b/internal/service/s3/bucket_data_source.go @@ -43,7 +43,7 @@ func dataSourceBucket() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -100,7 +100,7 @@ func dataSourceBucketRead(ctx context.Context, d *schema.ResourceData, meta inte } else { log.Printf("[WARN] HostedZoneIDForRegion: %s", err) } - d.Set("region", region) + d.Set(names.AttrRegion, region) if _, err := findBucketWebsite(ctx, conn, bucket, ""); err == nil { endpoint, domain := bucketWebsiteEndpointAndDomain(bucket, region) d.Set("website_domain", domain) diff --git a/internal/service/s3/bucket_data_source_test.go b/internal/service/s3/bucket_data_source_test.go index ef6929d7d13..c27f7ed4a90 100644 --- a/internal/service/s3/bucket_data_source_test.go +++ b/internal/service/s3/bucket_data_source_test.go @@ -31,7 +31,7 @@ func TestAccS3BucketDataSource_basic(t *testing.T) { Config: testAccBucketDataSourceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttr(dataSourceName, "region", region), + resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, region), testAccCheckBucketDomainName(ctx, dataSourceName, "bucket_domain_name", rName), resource.TestCheckResourceAttr(dataSourceName, "bucket_regional_domain_name", testAccBucketRegionalDomainName(rName, region)), resource.TestCheckResourceAttr(dataSourceName, "hosted_zone_id", hostedZoneID), diff --git a/internal/service/s3/bucket_test.go b/internal/service/s3/bucket_test.go index d33abe93fb1..7f4b979f5f8 100644 --- a/internal/service/s3/bucket_test.go +++ b/internal/service/s3/bucket_test.go @@ -86,7 +86,7 @@ func TestAccS3Bucket_Basic_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "object_lock_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "object_lock_enabled", "false"), resource.TestCheckResourceAttr(resourceName, names.AttrPolicy, ""), - resource.TestCheckResourceAttr(resourceName, "region", region), + resource.TestCheckResourceAttr(resourceName, names.AttrRegion, region), resource.TestCheckResourceAttr(resourceName, "replication_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "request_payer", "BucketOwner"), resource.TestCheckResourceAttr(resourceName, "server_side_encryption_configuration.#", "1"), diff --git a/internal/service/s3/service_endpoints_gen_test.go b/internal/service/s3/service_endpoints_gen_test.go index 3377a4d463a..e18b2507a7c 100644 --- a/internal/service/s3/service_endpoints_gen_test.go +++ b/internal/service/s3/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -564,7 +565,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 86363d70c8aeec29e9bc72e8c59bd2ef3006201c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:13 -0400 Subject: [PATCH 0218/1490] s3control: Use constant for region strings --- .../service/s3control/multi_region_access_point.go | 10 +++++----- .../s3control/multi_region_access_point_data_source.go | 2 +- .../s3control/multi_region_access_point_test.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/s3control/multi_region_access_point.go b/internal/service/s3control/multi_region_access_point.go index 4095e0a956e..c8157a624d7 100644 --- a/internal/service/s3control/multi_region_access_point.go +++ b/internal/service/s3control/multi_region_access_point.go @@ -107,7 +107,7 @@ func resourceMultiRegionAccessPoint() *schema.Resource { }, }, }, - "region": { + names.AttrRegion: { Type: schema.TypeSet, Required: true, ForceNew: true, @@ -128,7 +128,7 @@ func resourceMultiRegionAccessPoint() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidAccountID, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, @@ -396,7 +396,7 @@ func expandCreateMultiRegionAccessPointInput_(tfMap map[string]interface{}) *typ apiObject.PublicAccessBlock = expandPublicAccessBlockConfiguration(v[0].(map[string]interface{})) } - if v, ok := tfMap["region"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := tfMap[names.AttrRegion].(*schema.Set); ok && v.Len() > 0 { apiObject.Regions = expandRegions(v.List()) } @@ -489,7 +489,7 @@ func flattenMultiRegionAccessPointReport(apiObject *types.MultiRegionAccessPoint } if v := apiObject.Regions; v != nil { - tfMap["region"] = flattenRegionReports(v) + tfMap[names.AttrRegion] = flattenRegionReports(v) } return tfMap @@ -533,7 +533,7 @@ func flattenRegionReport(apiObject types.RegionReport) map[string]interface{} { } if v := apiObject.Region; v != nil { - tfMap["region"] = aws.ToString(v) + tfMap[names.AttrRegion] = aws.ToString(v) } return tfMap diff --git a/internal/service/s3control/multi_region_access_point_data_source.go b/internal/service/s3control/multi_region_access_point_data_source.go index dac67a55521..3df5b3d9562 100644 --- a/internal/service/s3control/multi_region_access_point_data_source.go +++ b/internal/service/s3control/multi_region_access_point_data_source.go @@ -86,7 +86,7 @@ func dataSourceMultiRegionAccessPoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/s3control/multi_region_access_point_test.go b/internal/service/s3control/multi_region_access_point_test.go index 32f73fe3f41..5a305e5d7d6 100644 --- a/internal/service/s3control/multi_region_access_point_test.go +++ b/internal/service/s3control/multi_region_access_point_test.go @@ -53,7 +53,7 @@ func TestAccS3ControlMultiRegionAccessPoint_basic(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "details.0.region.*", map[string]string{ names.AttrBucket: bucketName, "bucket_account_id": acctest.AccountID(), - "region": acctest.Region(), + names.AttrRegion: acctest.Region(), }), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, string(types.MultiRegionAccessPointStatusReady)), ), From cabf7a0292e04c1334fa0a0194569180bf4e670c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:13 -0400 Subject: [PATCH 0219/1490] s3outposts: Use constant for region strings --- internal/service/s3outposts/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/s3outposts/service_endpoints_gen_test.go b/internal/service/s3outposts/service_endpoints_gen_test.go index b448f966d04..33c6c0c1b6d 100644 --- a/internal/service/s3outposts/service_endpoints_gen_test.go +++ b/internal/service/s3outposts/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From ff86940b5e82dcbf2964ea5dee57aa3b75979a3e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:13 -0400 Subject: [PATCH 0220/1490] sagemaker: Use constant for region strings --- internal/service/sagemaker/prebuilt_ecr_image_data_source.go | 5 +++-- internal/service/sagemaker/service_endpoints_gen_test.go | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/service/sagemaker/prebuilt_ecr_image_data_source.go b/internal/service/sagemaker/prebuilt_ecr_image_data_source.go index 072764e310c..99a508344c2 100644 --- a/internal/service/sagemaker/prebuilt_ecr_image_data_source.go +++ b/internal/service/sagemaker/prebuilt_ecr_image_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) const ( @@ -398,7 +399,7 @@ func DataSourcePrebuiltECRImage() *schema.Resource { Default: "1", }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Optional: true, }, @@ -419,7 +420,7 @@ func DataSourcePrebuiltECRImage() *schema.Resource { func dataSourcePrebuiltECRImageRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics region := meta.(*conns.AWSClient).Region - if v, ok := d.GetOk("region"); ok { + if v, ok := d.GetOk(names.AttrRegion); ok { region = v.(string) } diff --git a/internal/service/sagemaker/service_endpoints_gen_test.go b/internal/service/sagemaker/service_endpoints_gen_test.go index a8b1eeda6e2..14f832ae689 100644 --- a/internal/service/sagemaker/service_endpoints_gen_test.go +++ b/internal/service/sagemaker/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From ca927309fcaa5db802f987270fe4f67142b565db Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:13 -0400 Subject: [PATCH 0221/1490] scheduler: Use constant for region strings --- internal/service/scheduler/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/scheduler/service_endpoints_gen_test.go b/internal/service/scheduler/service_endpoints_gen_test.go index fd778e3d4cf..6d8b7717dce 100644 --- a/internal/service/scheduler/service_endpoints_gen_test.go +++ b/internal/service/scheduler/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 4c1cf12236b549ec911a10dd0994ce9091403b5f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:13 -0400 Subject: [PATCH 0222/1490] schemas: Use constant for region strings --- internal/service/schemas/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/schemas/service_endpoints_gen_test.go b/internal/service/schemas/service_endpoints_gen_test.go index 27a523e4e33..ef161cd9721 100644 --- a/internal/service/schemas/service_endpoints_gen_test.go +++ b/internal/service/schemas/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From f2c220c1495b7e03af12b3d86c5ae9ae154f47d6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:13 -0400 Subject: [PATCH 0223/1490] secretsmanager: Use constant for region strings --- internal/service/secretsmanager/secret.go | 8 ++++---- .../service/secretsmanager/service_endpoints_gen_test.go | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/service/secretsmanager/secret.go b/internal/service/secretsmanager/secret.go index 75782f114fe..a9ee99265ed 100644 --- a/internal/service/secretsmanager/secret.go +++ b/internal/service/secretsmanager/secret.go @@ -113,7 +113,7 @@ func resourceSecret() *schema.Resource { buf.WriteString(fmt.Sprintf("%s-", v)) } - if v, ok := m["region"].(string); ok { + if v, ok := m[names.AttrRegion].(string); ok { buf.WriteString(fmt.Sprintf("%s-", v)) } @@ -130,7 +130,7 @@ func resourceSecret() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Required: true, }, @@ -517,7 +517,7 @@ func expandReplicaRegionType(tfMap map[string]interface{}) *types.ReplicaRegionT apiObject.KmsKeyId = aws.String(v) } - if v, ok := tfMap["region"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrRegion].(string); ok && v != "" { apiObject.Region = aws.String(v) } @@ -568,7 +568,7 @@ func flattenReplicationStatusType(apiObject types.ReplicationStatusType) map[str } if v := apiObject.Region; v != nil { - tfMap["region"] = aws.ToString(v) + tfMap[names.AttrRegion] = aws.ToString(v) } if v := apiObject.StatusMessage; v != nil { diff --git a/internal/service/secretsmanager/service_endpoints_gen_test.go b/internal/service/secretsmanager/service_endpoints_gen_test.go index 4e2abdef23c..b19695e445e 100644 --- a/internal/service/secretsmanager/service_endpoints_gen_test.go +++ b/internal/service/secretsmanager/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d78fcb6223ac2ed31b7a7e08ea0eaa9aed425bee Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:14 -0400 Subject: [PATCH 0224/1490] securityhub: Use constant for region strings --- internal/service/securityhub/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/securityhub/service_endpoints_gen_test.go b/internal/service/securityhub/service_endpoints_gen_test.go index ea7ed1cc64f..a1a56b3429f 100644 --- a/internal/service/securityhub/service_endpoints_gen_test.go +++ b/internal/service/securityhub/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 72338f8e8d8d32fa97eb3b5134ba8238ee388a74 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:14 -0400 Subject: [PATCH 0225/1490] securitylake: Use constant for region strings --- internal/service/securitylake/data_lake.go | 2 +- internal/service/securitylake/service_endpoints_gen_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/securitylake/data_lake.go b/internal/service/securitylake/data_lake.go index 07a66b85c2f..d1e5ca71a24 100644 --- a/internal/service/securitylake/data_lake.go +++ b/internal/service/securitylake/data_lake.go @@ -103,7 +103,7 @@ func (r *dataLakeResource) Schema(ctx context.Context, request resource.SchemaRe listplanmodifier.UseStateForUnknown(), }, }, - "region": schema.StringAttribute{ + names.AttrRegion: schema.StringAttribute{ Required: true, }, }, diff --git a/internal/service/securitylake/service_endpoints_gen_test.go b/internal/service/securitylake/service_endpoints_gen_test.go index a126763fe01..bc7de5cda41 100644 --- a/internal/service/securitylake/service_endpoints_gen_test.go +++ b/internal/service/securitylake/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 2c4d65e92d309dd93f0e94b1911600412ca4528b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:14 -0400 Subject: [PATCH 0226/1490] serverlessrepo: Use constant for region strings --- internal/service/serverlessrepo/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/serverlessrepo/service_endpoints_gen_test.go b/internal/service/serverlessrepo/service_endpoints_gen_test.go index 61158cd5d3b..596352b35ba 100644 --- a/internal/service/serverlessrepo/service_endpoints_gen_test.go +++ b/internal/service/serverlessrepo/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -480,7 +481,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 03c5febe4a0f87cf624be83b0b3e0f7a86713411 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:14 -0400 Subject: [PATCH 0227/1490] servicecatalog: Use constant for region strings --- internal/service/servicecatalog/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/servicecatalog/service_endpoints_gen_test.go b/internal/service/servicecatalog/service_endpoints_gen_test.go index 3edfe298eeb..ab52effe752 100644 --- a/internal/service/servicecatalog/service_endpoints_gen_test.go +++ b/internal/service/servicecatalog/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From f163acb90537ba6f0601a1bdfaca974a46565a85 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:14 -0400 Subject: [PATCH 0228/1490] servicecatalogappregistry: Use constant for region strings --- .../servicecatalogappregistry/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go b/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go index 95c3f29ec02..c0729d9f85b 100644 --- a/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go +++ b/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 6fcf9ac68c1886f56795c050ba87a42a801ab484 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:14 -0400 Subject: [PATCH 0229/1490] servicediscovery: Use constant for region strings --- .../service/servicediscovery/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/servicediscovery/service_endpoints_gen_test.go b/internal/service/servicediscovery/service_endpoints_gen_test.go index 733e43b9255..39c4aa3bd45 100644 --- a/internal/service/servicediscovery/service_endpoints_gen_test.go +++ b/internal/service/servicediscovery/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 69eb34f954b886b3e78eb29ded4e89379f1779ba Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:14 -0400 Subject: [PATCH 0230/1490] servicequotas: Use constant for region strings --- .../service_endpoints_gen_test.go | 3 +- internal/service/servicequotas/template.go | 2 +- .../service/servicequotas/template_test.go | 6 ++-- .../servicequotas/templates_data_source.go | 36 +++++++++---------- .../templates_data_source_test.go | 2 +- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/internal/service/servicequotas/service_endpoints_gen_test.go b/internal/service/servicequotas/service_endpoints_gen_test.go index ee6cd8c57bc..dd49bb76650 100644 --- a/internal/service/servicequotas/service_endpoints_gen_test.go +++ b/internal/service/servicequotas/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } diff --git a/internal/service/servicequotas/template.go b/internal/service/servicequotas/template.go index 778a8c1175f..6fd074a0250 100644 --- a/internal/service/servicequotas/template.go +++ b/internal/service/servicequotas/template.go @@ -67,7 +67,7 @@ func (r *resourceTemplate) Schema(ctx context.Context, req resource.SchemaReques stringplanmodifier.UseStateForUnknown(), }, }, - "region": schema.StringAttribute{ + names.AttrRegion: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), diff --git a/internal/service/servicequotas/template_test.go b/internal/service/servicequotas/template_test.go index 8d38d4cba5c..2f6a9c409b8 100644 --- a/internal/service/servicequotas/template_test.go +++ b/internal/service/servicequotas/template_test.go @@ -56,7 +56,7 @@ func testAccTemplate_basic(t *testing.T) { Config: testAccTemplateConfig_basic(lambdaStorageQuotaCode, lambdaServiceCode, lambdaStorageValue), Check: resource.ComposeTestCheckFunc( testAccCheckTemplateExists(ctx, resourceName, &template), - resource.TestCheckResourceAttrPair(resourceName, "region", regionDataSourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrRegion, regionDataSourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "quota_code", lambdaStorageQuotaCode), resource.TestCheckResourceAttr(resourceName, "service_code", lambdaServiceCode), resource.TestCheckResourceAttr(resourceName, names.AttrValue, lambdaStorageValue), @@ -120,7 +120,7 @@ func testAccTemplate_value(t *testing.T) { Config: testAccTemplateConfig_basic(lambdaENIQuotaCode, lambdaServiceCode, lambdaENIValue), Check: resource.ComposeTestCheckFunc( testAccCheckTemplateExists(ctx, resourceName, &template), - resource.TestCheckResourceAttrPair(resourceName, "region", regionDataSourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrRegion, regionDataSourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "quota_code", lambdaENIQuotaCode), resource.TestCheckResourceAttr(resourceName, "service_code", lambdaServiceCode), resource.TestCheckResourceAttr(resourceName, names.AttrValue, lambdaENIValue), @@ -135,7 +135,7 @@ func testAccTemplate_value(t *testing.T) { Config: testAccTemplateConfig_basic(lambdaENIQuotaCode, lambdaServiceCode, lambdaENIValueUpdated), Check: resource.ComposeTestCheckFunc( testAccCheckTemplateExists(ctx, resourceName, &template), - resource.TestCheckResourceAttrPair(resourceName, "region", regionDataSourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrRegion, regionDataSourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "quota_code", lambdaENIQuotaCode), resource.TestCheckResourceAttr(resourceName, "service_code", lambdaServiceCode), resource.TestCheckResourceAttr(resourceName, names.AttrValue, lambdaENIValueUpdated), diff --git a/internal/service/servicequotas/templates_data_source.go b/internal/service/servicequotas/templates_data_source.go index a16df2fdc95..9da29543e8b 100644 --- a/internal/service/servicequotas/templates_data_source.go +++ b/internal/service/servicequotas/templates_data_source.go @@ -41,7 +41,7 @@ func (d *dataSourceTemplates) Schema(ctx context.Context, req datasource.SchemaR resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ names.AttrID: framework.IDAttribute(), - "region": schema.StringAttribute{ + names.AttrRegion: schema.StringAttribute{ Required: true, }, }, @@ -58,7 +58,7 @@ func (d *dataSourceTemplates) Schema(ctx context.Context, req datasource.SchemaR "quota_name": schema.StringAttribute{ Computed: true, }, - "region": schema.StringAttribute{ + names.AttrRegion: schema.StringAttribute{ Computed: true, }, "service_code": schema.StringAttribute{ @@ -111,14 +111,14 @@ func (d *dataSourceTemplates) Read(ctx context.Context, req datasource.ReadReque } var templatesSourceAttrTypes = map[string]attr.Type{ - "global_quota": types.BoolType, - "quota_code": types.StringType, - "quota_name": types.StringType, - "region": types.StringType, - "service_code": types.StringType, - "service_name": types.StringType, - "unit": types.StringType, - names.AttrValue: types.Float64Type, + "global_quota": types.BoolType, + "quota_code": types.StringType, + "quota_name": types.StringType, + names.AttrRegion: types.StringType, + "service_code": types.StringType, + "service_name": types.StringType, + "unit": types.StringType, + names.AttrValue: types.Float64Type, } type dataSourceTemplatesData struct { @@ -134,14 +134,14 @@ func flattenTemplates(ctx context.Context, apiObject []awstypes.ServiceQuotaIncr elems := []attr.Value{} for _, t := range apiObject { obj := map[string]attr.Value{ - "global_quota": types.BoolValue(t.GlobalQuota), - "quota_code": flex.StringToFramework(ctx, t.QuotaCode), - "quota_name": flex.StringToFramework(ctx, t.QuotaName), - "region": flex.StringToFramework(ctx, t.AwsRegion), - "service_code": flex.StringToFramework(ctx, t.ServiceCode), - "service_name": flex.StringToFramework(ctx, t.ServiceName), - "unit": flex.StringToFramework(ctx, t.Unit), - names.AttrValue: flex.Float64ToFramework(ctx, t.DesiredValue), + "global_quota": types.BoolValue(t.GlobalQuota), + "quota_code": flex.StringToFramework(ctx, t.QuotaCode), + "quota_name": flex.StringToFramework(ctx, t.QuotaName), + names.AttrRegion: flex.StringToFramework(ctx, t.AwsRegion), + "service_code": flex.StringToFramework(ctx, t.ServiceCode), + "service_name": flex.StringToFramework(ctx, t.ServiceName), + "unit": flex.StringToFramework(ctx, t.Unit), + names.AttrValue: flex.Float64ToFramework(ctx, t.DesiredValue), } objVal, d := types.ObjectValue(templatesSourceAttrTypes, obj) diags.Append(d...) diff --git a/internal/service/servicequotas/templates_data_source_test.go b/internal/service/servicequotas/templates_data_source_test.go index 66edd47bdc8..d2cbe36c8ba 100644 --- a/internal/service/servicequotas/templates_data_source_test.go +++ b/internal/service/servicequotas/templates_data_source_test.go @@ -30,7 +30,7 @@ func testAccTemplatesDataSource_basic(t *testing.T) { { Config: testAccTemplatesDataSourceConfig_basic(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(dataSourceName, "region", regionDataSourceName, names.AttrName), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrRegion, regionDataSourceName, names.AttrName), resource.TestCheckResourceAttr(dataSourceName, "templates.#", "1"), ), }, From c24ecb8eff9f826387584427bf76942fcb05a00b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:15 -0400 Subject: [PATCH 0231/1490] ses: Use constant for region strings --- internal/service/ses/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ses/service_endpoints_gen_test.go b/internal/service/ses/service_endpoints_gen_test.go index fc2484966c0..dad22756215 100644 --- a/internal/service/ses/service_endpoints_gen_test.go +++ b/internal/service/ses/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e99b0293dab62819150edcdfbea01c2cab3d64ca Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:15 -0400 Subject: [PATCH 0232/1490] sesv2: Use constant for region strings --- internal/service/sesv2/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/sesv2/service_endpoints_gen_test.go b/internal/service/sesv2/service_endpoints_gen_test.go index 588688e11fa..bb6cc14fe2a 100644 --- a/internal/service/sesv2/service_endpoints_gen_test.go +++ b/internal/service/sesv2/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From f96b8505dce8994d0940b017b123d8246ad6cd4a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:15 -0400 Subject: [PATCH 0233/1490] sfn: Use constant for region strings --- internal/service/sfn/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/sfn/service_endpoints_gen_test.go b/internal/service/sfn/service_endpoints_gen_test.go index 3e294ecb8f7..64f3a6e2a26 100644 --- a/internal/service/sfn/service_endpoints_gen_test.go +++ b/internal/service/sfn/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -404,7 +405,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From c6a4acf6403ab32ee5cec9e599002ecb1b1db902 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:15 -0400 Subject: [PATCH 0234/1490] shield: Use constant for region strings --- internal/service/shield/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/shield/service_endpoints_gen_test.go b/internal/service/shield/service_endpoints_gen_test.go index ce5b7b1a1ac..671bd991c34 100644 --- a/internal/service/shield/service_endpoints_gen_test.go +++ b/internal/service/shield/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 793713976282f7365b0162661f526de6f00077ee Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:15 -0400 Subject: [PATCH 0235/1490] signer: Use constant for region strings --- internal/service/signer/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/signer/service_endpoints_gen_test.go b/internal/service/signer/service_endpoints_gen_test.go index 82a7470a2bf..95888d1fb28 100644 --- a/internal/service/signer/service_endpoints_gen_test.go +++ b/internal/service/signer/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 2c93567b5d042907b2114f337728df8440292621 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:15 -0400 Subject: [PATCH 0236/1490] simpledb: Use constant for region strings --- internal/service/simpledb/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/simpledb/service_endpoints_gen_test.go b/internal/service/simpledb/service_endpoints_gen_test.go index 069aa274ee4..24791dc064f 100644 --- a/internal/service/simpledb/service_endpoints_gen_test.go +++ b/internal/service/simpledb/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -404,7 +405,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From ab21498dd8de1e001977abcb7b128b644e173840 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:15 -0400 Subject: [PATCH 0237/1490] sns: Use constant for region strings --- internal/service/sns/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/sns/service_endpoints_gen_test.go b/internal/service/sns/service_endpoints_gen_test.go index e5ab299860b..f6c08734529 100644 --- a/internal/service/sns/service_endpoints_gen_test.go +++ b/internal/service/sns/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 1a5dda8c612162ff7e6daa044ae59fec6641b982 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:16 -0400 Subject: [PATCH 0238/1490] sqs: Use constant for region strings --- internal/service/sqs/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/sqs/service_endpoints_gen_test.go b/internal/service/sqs/service_endpoints_gen_test.go index 8e2d93a377e..c7c4741bc66 100644 --- a/internal/service/sqs/service_endpoints_gen_test.go +++ b/internal/service/sqs/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 429833d61238430eb4cb3058a354d4e5f91d5464 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:16 -0400 Subject: [PATCH 0239/1490] ssm: Use constant for region strings --- internal/service/ssm/resource_data_sync.go | 6 +++--- internal/service/ssm/service_endpoints_gen_test.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/ssm/resource_data_sync.go b/internal/service/ssm/resource_data_sync.go index cb53ad68d48..f6008f94cd1 100644 --- a/internal/service/ssm/resource_data_sync.go +++ b/internal/service/ssm/resource_data_sync.go @@ -59,7 +59,7 @@ func ResourceResourceDataSync() *schema.Resource { Optional: true, ForceNew: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -181,7 +181,7 @@ func FindResourceDataSyncItem(ctx context.Context, conn *ssm.SSM, name string) ( func flattenResourceDataSyncS3Destination(dest *ssm.ResourceDataSyncS3Destination) []interface{} { result := make(map[string]interface{}) result[names.AttrBucketName] = aws.StringValue(dest.BucketName) - result["region"] = aws.StringValue(dest.Region) + result[names.AttrRegion] = aws.StringValue(dest.Region) result["sync_format"] = aws.StringValue(dest.SyncFormat) if dest.AWSKMSKeyARN != nil { result[names.AttrKMSKeyARN] = aws.StringValue(dest.AWSKMSKeyARN) @@ -196,7 +196,7 @@ func expandResourceDataSyncS3Destination(d *schema.ResourceData) *ssm.ResourceDa raw := d.Get("s3_destination").([]interface{})[0].(map[string]interface{}) s3dest := &ssm.ResourceDataSyncS3Destination{ BucketName: aws.String(raw[names.AttrBucketName].(string)), - Region: aws.String(raw["region"].(string)), + Region: aws.String(raw[names.AttrRegion].(string)), SyncFormat: aws.String(raw["sync_format"].(string)), } if v, ok := raw[names.AttrKMSKeyARN].(string); ok && v != "" { diff --git a/internal/service/ssm/service_endpoints_gen_test.go b/internal/service/ssm/service_endpoints_gen_test.go index 12c464c9077..54ad18bf4cf 100644 --- a/internal/service/ssm/service_endpoints_gen_test.go +++ b/internal/service/ssm/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -362,7 +363,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 3bb6714ca7b88bc5df5e4cd85da9182739ba1ccc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:16 -0400 Subject: [PATCH 0240/1490] ssmcontacts: Use constant for region strings --- internal/service/ssmcontacts/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ssmcontacts/service_endpoints_gen_test.go b/internal/service/ssmcontacts/service_endpoints_gen_test.go index 01aeac11bfd..5c414a11ce2 100644 --- a/internal/service/ssmcontacts/service_endpoints_gen_test.go +++ b/internal/service/ssmcontacts/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 75f9fe996bc643130affbe199c1394f863ab4af8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:16 -0400 Subject: [PATCH 0241/1490] ssmincidents: Use constant for region strings --- internal/service/ssmincidents/replication_set.go | 10 +++++----- .../ssmincidents/replication_set_data_source.go | 4 ++-- .../service/ssmincidents/service_endpoints_gen_test.go | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/service/ssmincidents/replication_set.go b/internal/service/ssmincidents/replication_set.go index 733279f6646..9b6e4d81084 100644 --- a/internal/service/ssmincidents/replication_set.go +++ b/internal/service/ssmincidents/replication_set.go @@ -50,7 +50,7 @@ func ResourceReplicationSet() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeSet, Required: true, Elem: &schema.Resource{ @@ -109,7 +109,7 @@ func resourceReplicationSetCreate(ctx context.Context, d *schema.ResourceData, m client := meta.(*conns.AWSClient).SSMIncidentsClient(ctx) input := &ssmincidents.CreateReplicationSetInput{ - Regions: expandRegions(d.Get("region").(*schema.Set).List()), + Regions: expandRegions(d.Get(names.AttrRegion).(*schema.Set).List()), Tags: getTagsIn(ctx), } @@ -154,7 +154,7 @@ func resourceReplicationSetRead(ctx context.Context, d *schema.ResourceData, met d.Set("created_by", replicationSet.CreatedBy) d.Set("deletion_protected", replicationSet.DeletionProtected) d.Set("last_modified_by", replicationSet.LastModifiedBy) - if err := d.Set("region", flattenRegions(replicationSet.RegionMap)); err != nil { + if err := d.Set(names.AttrRegion, flattenRegions(replicationSet.RegionMap)); err != nil { return create.DiagError(names.SSMIncidents, create.ErrActionSetting, ResNameReplicationSet, d.Id(), err) } d.Set(names.AttrStatus, replicationSet.Status) @@ -165,7 +165,7 @@ func resourceReplicationSetRead(ctx context.Context, d *schema.ResourceData, met func resourceReplicationSetUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { client := meta.(*conns.AWSClient).SSMIncidentsClient(ctx) - if d.HasChanges("region") { + if d.HasChanges(names.AttrRegion) { input := &ssmincidents.UpdateReplicationSetInput{ Arn: aws.String(d.Id()), } @@ -235,7 +235,7 @@ func regionListToRegionMap(list []interface{}) map[string]string { // updates UpdateReplicationSetInput to include any required actions // invalid updates return errors from AWS Api func updateRegionsInput(d *schema.ResourceData, input *ssmincidents.UpdateReplicationSetInput) error { - old, new := d.GetChange("region") + old, new := d.GetChange(names.AttrRegion) oldRegions := regionListToRegionMap(old.(*schema.Set).List()) newRegions := regionListToRegionMap(new.(*schema.Set).List()) diff --git a/internal/service/ssmincidents/replication_set_data_source.go b/internal/service/ssmincidents/replication_set_data_source.go index 25682128fa0..1b32431900f 100644 --- a/internal/service/ssmincidents/replication_set_data_source.go +++ b/internal/service/ssmincidents/replication_set_data_source.go @@ -24,7 +24,7 @@ func DataSourceReplicationSet() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "region": { + names.AttrRegion: { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ @@ -97,7 +97,7 @@ func dataSourceReplicationSetRead(ctx context.Context, d *schema.ResourceData, m d.Set("last_modified_by", replicationSet.LastModifiedBy) d.Set(names.AttrStatus, replicationSet.Status) - if err := d.Set("region", flattenRegions(replicationSet.RegionMap)); err != nil { + if err := d.Set(names.AttrRegion, flattenRegions(replicationSet.RegionMap)); err != nil { return create.DiagError(names.SSMIncidents, create.ErrActionSetting, ResNameReplicationSet, d.Id(), err) } diff --git a/internal/service/ssmincidents/service_endpoints_gen_test.go b/internal/service/ssmincidents/service_endpoints_gen_test.go index 587a0a52c16..32c241c8959 100644 --- a/internal/service/ssmincidents/service_endpoints_gen_test.go +++ b/internal/service/ssmincidents/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 7cf6966279bf62cb858fa38c7c85b134fb3db0c4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:16 -0400 Subject: [PATCH 0242/1490] ssmsap: Use constant for region strings --- internal/service/ssmsap/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ssmsap/service_endpoints_gen_test.go b/internal/service/ssmsap/service_endpoints_gen_test.go index a0aa09231ca..a2920555ae8 100644 --- a/internal/service/ssmsap/service_endpoints_gen_test.go +++ b/internal/service/ssmsap/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 8b0eafd347bba76388a1ef7839465d55211107aa Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:16 -0400 Subject: [PATCH 0243/1490] sso: Use constant for region strings --- internal/service/sso/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/sso/service_endpoints_gen_test.go b/internal/service/sso/service_endpoints_gen_test.go index 96b243e1588..9e3fa38d54a 100644 --- a/internal/service/sso/service_endpoints_gen_test.go +++ b/internal/service/sso/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -337,7 +338,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 915b399500e62d76f66250010427e5e8a0ea71d1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:16 -0400 Subject: [PATCH 0244/1490] ssoadmin: Use constant for region strings --- internal/service/ssoadmin/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ssoadmin/service_endpoints_gen_test.go b/internal/service/ssoadmin/service_endpoints_gen_test.go index 2691c8d38f8..431057d1c83 100644 --- a/internal/service/ssoadmin/service_endpoints_gen_test.go +++ b/internal/service/ssoadmin/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 816fa703120ecce3d6c837c95fb56033abceffbe Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:17 -0400 Subject: [PATCH 0245/1490] storagegateway: Use constant for region strings --- internal/service/storagegateway/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/storagegateway/service_endpoints_gen_test.go b/internal/service/storagegateway/service_endpoints_gen_test.go index b82c72e722c..b49f588b21f 100644 --- a/internal/service/storagegateway/service_endpoints_gen_test.go +++ b/internal/service/storagegateway/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e6d7299c647543369ece1816bdb700fae9c5a277 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:17 -0400 Subject: [PATCH 0246/1490] sts: Use constant for region strings --- internal/service/sts/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/sts/service_endpoints_gen_test.go b/internal/service/sts/service_endpoints_gen_test.go index fd599fea0ee..73408250efe 100644 --- a/internal/service/sts/service_endpoints_gen_test.go +++ b/internal/service/sts/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -471,7 +472,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 57b69ee54963dffd2235b89bcbbd683ab7cc0d4d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:17 -0400 Subject: [PATCH 0247/1490] swf: Use constant for region strings --- internal/service/swf/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/swf/service_endpoints_gen_test.go b/internal/service/swf/service_endpoints_gen_test.go index 95b4945c851..1932fe34a0b 100644 --- a/internal/service/swf/service_endpoints_gen_test.go +++ b/internal/service/swf/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -337,7 +338,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 4cd1e06f1d7176eae782e012e02e4559b7d7513c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:17 -0400 Subject: [PATCH 0248/1490] synthetics: Use constant for region strings --- internal/service/synthetics/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/synthetics/service_endpoints_gen_test.go b/internal/service/synthetics/service_endpoints_gen_test.go index 3c4196921a8..a922ddae89b 100644 --- a/internal/service/synthetics/service_endpoints_gen_test.go +++ b/internal/service/synthetics/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From a09b7664aaa017263ff8924ececd2908929df53e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:17 -0400 Subject: [PATCH 0249/1490] transcribe: Use constant for region strings --- internal/service/transcribe/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/transcribe/service_endpoints_gen_test.go b/internal/service/transcribe/service_endpoints_gen_test.go index c1223195b06..54186218565 100644 --- a/internal/service/transcribe/service_endpoints_gen_test.go +++ b/internal/service/transcribe/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -414,7 +415,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 3d9c3490eb67a978ccefcef2cbeaa327c82d157c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:17 -0400 Subject: [PATCH 0250/1490] transfer: Use constant for region strings --- internal/service/transfer/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/transfer/service_endpoints_gen_test.go b/internal/service/transfer/service_endpoints_gen_test.go index 82967d07019..3fa83904d67 100644 --- a/internal/service/transfer/service_endpoints_gen_test.go +++ b/internal/service/transfer/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -362,7 +363,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From d2c4a8bcc21a6582cb7940de2cbcc8d1ece5919b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:17 -0400 Subject: [PATCH 0251/1490] verifiedpermissions: Use constant for region strings --- .../service/verifiedpermissions/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/verifiedpermissions/service_endpoints_gen_test.go b/internal/service/verifiedpermissions/service_endpoints_gen_test.go index 747bc5d2109..d6f59700d71 100644 --- a/internal/service/verifiedpermissions/service_endpoints_gen_test.go +++ b/internal/service/verifiedpermissions/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From fa2d556ebd6f8cae4d4675811bdbfe105ab54d50 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:17 -0400 Subject: [PATCH 0252/1490] vpclattice: Use constant for region strings --- internal/service/vpclattice/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/vpclattice/service_endpoints_gen_test.go b/internal/service/vpclattice/service_endpoints_gen_test.go index 3d920ce6614..1f4554b1cd5 100644 --- a/internal/service/vpclattice/service_endpoints_gen_test.go +++ b/internal/service/vpclattice/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 0b48b83bf667e188a65cd94ecb6e600c720bf912 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:18 -0400 Subject: [PATCH 0253/1490] waf: Use constant for region strings --- internal/service/waf/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/waf/service_endpoints_gen_test.go b/internal/service/waf/service_endpoints_gen_test.go index bb01df7dd1d..cba2183ee1e 100644 --- a/internal/service/waf/service_endpoints_gen_test.go +++ b/internal/service/waf/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -325,7 +326,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 633cb8eef7a648f62681b3bc5e1253197e415fe4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:18 -0400 Subject: [PATCH 0254/1490] wafregional: Use constant for region strings --- internal/service/wafregional/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/wafregional/service_endpoints_gen_test.go b/internal/service/wafregional/service_endpoints_gen_test.go index c99c9489d42..8f2f9ff36c3 100644 --- a/internal/service/wafregional/service_endpoints_gen_test.go +++ b/internal/service/wafregional/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -326,7 +327,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From e698f8b8bdab83a103d218ecb20bba57d84e908a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:18 -0400 Subject: [PATCH 0255/1490] wafv2: Use constant for region strings --- internal/service/wafv2/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/wafv2/service_endpoints_gen_test.go b/internal/service/wafv2/service_endpoints_gen_test.go index 4263424bc16..566c1558f86 100644 --- a/internal/service/wafv2/service_endpoints_gen_test.go +++ b/internal/service/wafv2/service_endpoints_gen_test.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -338,7 +339,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From b7cf11bb627b71be795e834c9852eed3f94c9b94 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:18 -0400 Subject: [PATCH 0256/1490] wellarchitected: Use constant for region strings --- internal/service/wellarchitected/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/wellarchitected/service_endpoints_gen_test.go b/internal/service/wellarchitected/service_endpoints_gen_test.go index 01b0261ef4a..349cdfe924c 100644 --- a/internal/service/wellarchitected/service_endpoints_gen_test.go +++ b/internal/service/wellarchitected/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 0270d7da306fb5e89ab5e29a59a893dd93ccb33b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:18 -0400 Subject: [PATCH 0257/1490] worklink: Use constant for region strings --- internal/service/worklink/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/worklink/service_endpoints_gen_test.go b/internal/service/worklink/service_endpoints_gen_test.go index 8da80945b58..55bf8108aa5 100644 --- a/internal/service/worklink/service_endpoints_gen_test.go +++ b/internal/service/worklink/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -327,7 +328,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From a8e963f11e4a7c477f84c3ce90ba9c4f9bba8038 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:18 -0400 Subject: [PATCH 0258/1490] workspaces: Use constant for region strings --- internal/service/workspaces/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/workspaces/service_endpoints_gen_test.go b/internal/service/workspaces/service_endpoints_gen_test.go index faecde002de..530b3396f5e 100644 --- a/internal/service/workspaces/service_endpoints_gen_test.go +++ b/internal/service/workspaces/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 02d1e83f252b530b103e3eb870dc07903021cdba Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:18 -0400 Subject: [PATCH 0259/1490] workspacesweb: Use constant for region strings --- internal/service/workspacesweb/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/workspacesweb/service_endpoints_gen_test.go b/internal/service/workspacesweb/service_endpoints_gen_test.go index 1a4251cdd36..617589a470e 100644 --- a/internal/service/workspacesweb/service_endpoints_gen_test.go +++ b/internal/service/workspacesweb/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 714f6eec6619fc234f30167b161496f3a2496ca0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 14:38:18 -0400 Subject: [PATCH 0260/1490] xray: Use constant for region strings --- internal/service/xray/service_endpoints_gen_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/xray/service_endpoints_gen_test.go b/internal/service/xray/service_endpoints_gen_test.go index 8ed163077f8..8ddb54c8230 100644 --- a/internal/service/xray/service_endpoints_gen_test.go +++ b/internal/service/xray/service_endpoints_gen_test.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -335,7 +336,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From 3dab321a5af8499684e5fb1897cc7e5a1775e8af Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 14:48:57 -0400 Subject: [PATCH 0261/1490] Tweak TestBackoffDelayer. --- internal/conns/backoff_delayer_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/internal/conns/backoff_delayer_test.go b/internal/conns/backoff_delayer_test.go index 4d4dd3586dc..30dcebc84f9 100644 --- a/internal/conns/backoff_delayer_test.go +++ b/internal/conns/backoff_delayer_test.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" awsclient "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/request" + smithy "github.com/aws/smithy-go" ) func TestBackoffDelayer(t *testing.T) { @@ -25,13 +26,17 @@ func TestBackoffDelayer(t *testing.T) { MaxRetryDelay: maxBackoff, MaxThrottleDelay: maxBackoff, } - v2compat := &v1CompatibleBackoff{ + v1compat := &v1CompatibleBackoff{ maxRetryDelay: maxBackoff, } - err := awserr.New("ThrottlingException", "Rate exceeded", nil) + err1 := awserr.New("ThrottlingException", "Rate exceeded", nil) + err2 := &smithy.GenericAPIError{ + Code: "ThrottlingException", + Message: "Rate exceeded", + } req := request.Request{ - Error: err, + Error: err1, HTTPResponse: &http.Response{ StatusCode: 400, }, @@ -39,9 +44,9 @@ func TestBackoffDelayer(t *testing.T) { for i := 0; i < maxRetries; i++ { d1 := v1.RetryRules(&req) req.RetryCount++ - d2, _ := v2.BackoffDelay(i, err) - d2compat, _ := v2compat.BackoffDelay(i, err) + d2, _ := v2.BackoffDelay(i, err2) + d1compat, _ := v1compat.BackoffDelay(i, err2) - t.Logf("%d v1: %s, v2: %s v2compat: %s\n", i, d1.String(), d2.String(), d2compat.String()) + t.Logf("%d v1: %s, v2: %s v1compat: %s\n", i, d1.String(), d2.String(), d1compat.String()) } } From 5e59fbed3b9bb4a964824c05a3d18d0d8be363f8 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 14:49:43 -0400 Subject: [PATCH 0262/1490] Revert "Run 'go get github.com/hashicorp/aws-sdk-go-base/v2@d88efef867ba8d45c1532d25cf078c405ac2ab9c && go mod tidy'." This reverts commit 97da4124255d0f957c0fb4ae3335106c1d62db51. --- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index ef85b06f429..f314cddbba2 100644 --- a/go.mod +++ b/go.mod @@ -181,7 +181,7 @@ require ( github.com/gertd/go-pluralize v0.2.1 github.com/google/go-cmp v0.6.0 github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 - github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52.0.20240509160613-d88efef867ba + github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52 github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53 github.com/hashicorp/awspolicyequivalence v1.6.0 github.com/hashicorp/cli v1.1.6 @@ -276,12 +276,12 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/zclconf/go-cty v1.14.3 // indirect - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0 // indirect - go.opentelemetry.io/otel v1.26.0 // indirect - go.opentelemetry.io/otel/metric v1.26.0 // indirect - go.opentelemetry.io/otel/trace v1.26.0 // indirect + go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0 // indirect + go.opentelemetry.io/otel v1.25.0 // indirect + go.opentelemetry.io/otel/metric v1.25.0 // indirect + go.opentelemetry.io/otel/trace v1.25.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.25.0 // indirect + golang.org/x/net v0.24.0 // indirect golang.org/x/sys v0.20.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect diff --git a/go.sum b/go.sum index d4ea9960043..a838ef7ca80 100644 --- a/go.sum +++ b/go.sum @@ -444,8 +444,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 h1:N2V/ooY+BPQwwN3qPRIztByR8mWN6IqgULqVzGoUlog= github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0/go.mod h1:HAmscHyzSOfB1Dr16KLc177KNbn83wscnZC+N7WyaM8= -github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52.0.20240509160613-d88efef867ba h1:fJDkfWDVRPcMBi8jNIcRZ579e8yM82daBWS99OOYgsE= -github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52.0.20240509160613-d88efef867ba/go.mod h1:nvpXIeF0ANfZ7sMssXKSSR3pyXfksajxoC2tl4jjN08= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52 h1:bKvTdvF3jNgDt4rHDk55BxYnyofFVJhXHMj+RBRUmc0= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52/go.mod h1:YlwqmXqrK6MNTtW1cCjPFkoc3plCT939B+Yjmq+/DBc= github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53 h1:hrcewXLBw48wZc6fe7blETM94eTwzTouQ4zWqQvjVwU= github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53/go.mod h1:458CK33gIkH+FvTU2aZcJy2IANdsE3USy1NAUhK/uFg= github.com/hashicorp/awspolicyequivalence v1.6.0 h1:7aadmkalbc5ewStC6g3rljx1iNvP4QyAhg2KsHx8bU8= @@ -613,14 +613,14 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0 h1:FGMfzzxfkNkw+gvKJOeT8dSmBjgrSFh+ClLl+OMKPno= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0/go.mod h1:hmHUXiKhyxbIhuNfG5ZTySq9HqqxJFNxaFOfXXvoMmQ= -go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= -go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= -go.opentelemetry.io/otel/metric v1.26.0 h1:7S39CLuY5Jgg9CrnA9HHiEjGMF/X2VHvoXGgSllRz30= -go.opentelemetry.io/otel/metric v1.26.0/go.mod h1:SY+rHOI4cEawI9a7N1A4nIg/nTQXe1ccCNWYOJUrpX4= -go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= -go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= +go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0 h1:0zXBsTKPsly2MlyLYyra1GuL23fsY5RMsi6E2ZOe988= +go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0/go.mod h1:Tztzncf+ezyOCjXz8zRjVL2agqyBxhymGnK6rqgoY5c= +go.opentelemetry.io/otel v1.25.0 h1:gldB5FfhRl7OJQbUHt/8s0a7cE8fbsPAtdpRaApKy4k= +go.opentelemetry.io/otel v1.25.0/go.mod h1:Wa2ds5NOXEMkCmUou1WA7ZBfLTHWIsp034OVD7AO+Vg= +go.opentelemetry.io/otel/metric v1.25.0 h1:LUKbS7ArpFL/I2jJHdJcqMGxkRdxpPHE0VU/D4NuEwA= +go.opentelemetry.io/otel/metric v1.25.0/go.mod h1:rkDLUSd2lC5lq2dFNrX9LGAbINP5B7WBkC78RXCpH5s= +go.opentelemetry.io/otel/trace v1.25.0 h1:tqukZGLwQYRIFtSQM2u2+yfMVTgGVeqRLPUYx1Dq6RM= +go.opentelemetry.io/otel/trace v1.25.0/go.mod h1:hCCs70XM/ljO+BeQkyFnbK28SBIJ/Emuha+ccrCRT7I= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= @@ -634,8 +634,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 18eee4452cc3255e3cd307b1820f434b65b92da0 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Thu, 9 May 2024 14:59:37 -0400 Subject: [PATCH 0263/1490] d/aws_iam_policy_document(doc): move minified_json addition to root docs --- website/docs/cdktf/python/d/iam_policy_document.html.markdown | 1 - website/docs/d/iam_policy_document.html.markdown | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/cdktf/python/d/iam_policy_document.html.markdown b/website/docs/cdktf/python/d/iam_policy_document.html.markdown index 78c3b369312..3882bf79c0b 100644 --- a/website/docs/cdktf/python/d/iam_policy_document.html.markdown +++ b/website/docs/cdktf/python/d/iam_policy_document.html.markdown @@ -566,6 +566,5 @@ The following arguments are required: This data source exports the following attributes in addition to the arguments above: * `json` - Standard JSON policy document rendered based on the arguments above. -* `minified_json` - Minified JSON policy document rendered based on the arguments above. \ No newline at end of file diff --git a/website/docs/d/iam_policy_document.html.markdown b/website/docs/d/iam_policy_document.html.markdown index 30cf2852ab2..6290c94f7b6 100644 --- a/website/docs/d/iam_policy_document.html.markdown +++ b/website/docs/d/iam_policy_document.html.markdown @@ -536,3 +536,4 @@ The following arguments are required: This data source exports the following attributes in addition to the arguments above: * `json` - Standard JSON policy document rendered based on the arguments above. +* `minified_json` - Minified JSON policy document rendered based on the arguments above. From f69b959a1f1bd0a1fdda502779732c4d2bda35d1 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Thu, 9 May 2024 15:00:10 -0400 Subject: [PATCH 0264/1490] d/aws_iam_policy_document(test): tidy minified_json test check --- internal/service/iam/policy_document_data_source_test.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/internal/service/iam/policy_document_data_source_test.go b/internal/service/iam/policy_document_data_source_test.go index 9881e6df270..a25b698ea90 100644 --- a/internal/service/iam/policy_document_data_source_test.go +++ b/internal/service/iam/policy_document_data_source_test.go @@ -29,11 +29,6 @@ func TestAccIAMPolicyDocumentDataSource_basic(t *testing.T) { resource.TestCheckResourceAttr("data.aws_iam_policy_document.test", "json", testAccPolicyDocumentExpectedJSON(), ), - ), - }, - { - Config: testAccPolicyDocumentDataSourceConfig_basic, - Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.aws_iam_policy_document.test", "minified_json", testAccPolicyDocumentExpectedJSONMinified(), ), From 0b2ccf59030e06ac0e8eba127f92646562165336 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Thu, 9 May 2024 15:01:42 -0400 Subject: [PATCH 0265/1490] chore: changelog --- .changelog/35677.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/35677.txt diff --git a/.changelog/35677.txt b/.changelog/35677.txt new file mode 100644 index 00000000000..12cd6f9fc70 --- /dev/null +++ b/.changelog/35677.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +data-source/aws_iam_policy_document: Add `minified_json` attribute +``` From 85455155b67ccc5a587e7c1a6d271a2e4d9b8469 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:04:13 -0400 Subject: [PATCH 0266/1490] generate: Update to use const over literal --- internal/generate/serviceendpointtests/file.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/generate/serviceendpointtests/file.tmpl b/internal/generate/serviceendpointtests/file.tmpl index c0a0cf85d1e..c7f807385cd 100644 --- a/internal/generate/serviceendpointtests/file.tmpl +++ b/internal/generate/serviceendpointtests/file.tmpl @@ -48,6 +48,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/provider" + "github.com/hashicorp/terraform-provider-aws/names" ) type endpointTestCase struct { @@ -719,7 +720,7 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca config := map[string]any{ "access_key": servicemocks.MockStaticAccessKey, "secret_key": servicemocks.MockStaticSecretKey, - "region": region, + names.AttrRegion: region, "skip_credentials_validation": true, "skip_requesting_account_id": true, } From b06aae7b5156aed0952e709005cc35098a8cf5fa Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 15:04:19 -0400 Subject: [PATCH 0267/1490] Add CHANGELOG entry. --- .changelog/37404.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/37404.txt diff --git a/.changelog/37404.txt b/.changelog/37404.txt new file mode 100644 index 00000000000..c16b6bafba7 --- /dev/null +++ b/.changelog/37404.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/provider: Change the AWS SDK for Go v2 API client [`BackoffDelayer`](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2@v1.26.1/aws/retry#BackoffDelayer) to maintain behavioral compatibility with AWS SDK for Go v1 +``` \ No newline at end of file From 2e4a26f3f7f22b9ffaebfe3432d5f3c0560668f3 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 15:27:42 -0400 Subject: [PATCH 0268/1490] Fix golangci-lint `mnd` --- internal/conns/backoff_delayer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/conns/backoff_delayer.go b/internal/conns/backoff_delayer.go index d1f5331c3ee..1024421c4e9 100644 --- a/internal/conns/backoff_delayer.go +++ b/internal/conns/backoff_delayer.go @@ -39,10 +39,10 @@ func (c *v1CompatibleBackoff) BackoffDelay(attempt int, err error) (time.Duratio if actualRetryCount < 63-attempt { delay = time.Duration(1< maxDelay { - delay = getJitterDelay(maxDelay / 2) + delay = getJitterDelay(maxDelay / 2) //nolint:mnd } } else { - delay = getJitterDelay(maxDelay / 2) + delay = getJitterDelay(maxDelay / 2) //nolint:mnd } return delay, nil From b8188cf52a8aa4dd7c9bea1c792bab0d7829d347 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 15:28:38 -0400 Subject: [PATCH 0269/1490] Fix golangci-lint `usestdlibvars` --- internal/conns/backoff_delayer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/conns/backoff_delayer_test.go b/internal/conns/backoff_delayer_test.go index 30dcebc84f9..49d5422deb5 100644 --- a/internal/conns/backoff_delayer_test.go +++ b/internal/conns/backoff_delayer_test.go @@ -38,7 +38,7 @@ func TestBackoffDelayer(t *testing.T) { req := request.Request{ Error: err1, HTTPResponse: &http.Response{ - StatusCode: 400, + StatusCode: http.StatusBadRequest, }, } for i := 0; i < maxRetries; i++ { From a6b03d26093317e4da2232fd3b24ceb50e294111 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:52 -0400 Subject: [PATCH 0270/1490] ci: Prefer constant for string literals --- .ci/.semgrep.yml | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index d61935c7b2b..7564d99ff1c 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1175,3 +1175,73 @@ rules: - pattern: '"region"' severity: ERROR fix: "names.AttrRegion" + - id: literal-access_key-string-constant + languages: [go] + message: Use the constant `names.AttrAccessKey` for the string literal "access_key" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"access_key"' + severity: ERROR + fix: "names.AttrAccessKey" + - id: literal-endpoints-string-constant + languages: [go] + message: Use the constant `names.AttrEndpoints` for the string literal "endpoints" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"endpoints"' + severity: ERROR + fix: "names.AttrEndpoints" + - id: literal-profile-string-constant + languages: [go] + message: Use the constant `names.AttrProfile` for the string literal "profile" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"profile"' + severity: ERROR + fix: "names.AttrProfile" + - id: literal-secret_key-string-constant + languages: [go] + message: Use the constant `names.AttrSecretKey` for the string literal "secret_key" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"secret_key"' + severity: ERROR + fix: "names.AttrSecretKey" + - id: literal-shared_config_files-string-constant + languages: [go] + message: Use the constant `names.AttrSharedConfigFiles` for the string literal "shared_config_files" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"shared_config_files"' + severity: ERROR + fix: "names.AttrSharedConfigFiles" + - id: literal-skip_credentials_validation-string-constant + languages: [go] + message: Use the constant `names.AttrSkipCredentialsValidation` for the string literal "skip_credentials_validation" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"skip_credentials_validation"' + severity: ERROR + fix: "names.AttrSkipCredentialsValidation" + - id: literal-skip_requesting_account_id-string-constant + languages: [go] + message: Use the constant `names.AttrSkipRequestingAccountID` for the string literal "skip_requesting_account_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"skip_requesting_account_id"' + severity: ERROR + fix: "names.AttrSkipRequestingAccountID" From e399c67928eda30daf3d732962be2dbd0ae318bb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:53 -0400 Subject: [PATCH 0271/1490] names: Add constant for string literals --- names/attr_consts.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/names/attr_consts.go b/names/attr_consts.go index e70b7e2232f..68023e093ef 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -5,6 +5,7 @@ package names const ( AttrARN = "arn" + AttrAccessKey = "access_key" AttrAccountID = "account_id" AttrAutoMinorVersionUpgrade = "auto_minor_version_upgrade" AttrAvailabilityZone = "availability_zone" @@ -19,6 +20,7 @@ const ( AttrDescription = "description" AttrDomainName = "domain_name" AttrEnabled = "enabled" + AttrEndpoints = "endpoints" AttrEngineVersion = "engine_version" AttrID = "id" // Should be explicitly declared only for Framework resources AttrInstanceID = "instance_id" @@ -37,12 +39,17 @@ const ( AttrPolicy = "policy" AttrPort = "port" AttrPreferredMaintenanceWindow = "preferred_maintenance_window" + AttrProfile = "profile" AttrProtocol = "protocol" AttrRegion = "region" AttrResourceARN = "resource_arn" AttrRoleARN = "role_arn" + AttrSecretKey = "secret_key" AttrSecurityGroupIDs = "security_group_ids" AttrSecurityGroups = "security_groups" + AttrSharedConfigFiles = "shared_config_files" + AttrSkipCredentialsValidation = "skip_credentials_validation" + AttrSkipRequestingAccountID = "skip_requesting_account_id" AttrState = "state" AttrStatus = "status" AttrSubnetID = "subnet_id" @@ -53,9 +60,9 @@ const ( AttrTransitGatewayAttachmentID = "transit_gateway_attachment_id" AttrTransitGatewayID = "transit_gateway_id" AttrType = "type" + AttrVPCID = "vpc_id" AttrVPCSecurityGroupIDs = "vpc_security_group_ids" AttrValue = "value" AttrValues = "values" AttrVersion = "version" - AttrVPCID = "vpc_id" ) From a0e35174a872561e8b06abedf96a205c3e02b020 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:53 -0400 Subject: [PATCH 0272/1490] serviceendpointtests: Use constants for strings --- .../generate/serviceendpointtests/file.tmpl | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/generate/serviceendpointtests/file.tmpl b/internal/generate/serviceendpointtests/file.tmpl index c7f807385cd..fd08961386b 100644 --- a/internal/generate/serviceendpointtests/file.tmpl +++ b/internal/generate/serviceendpointtests/file.tmpl @@ -575,23 +575,23 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } {{ range $i, $alias := .Aliases }} func withAliasName{{ $i }}EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName{{ $i }}] = aliasName{{ $i }}ConfigEndpoint } {{ end }} @@ -599,7 +599,7 @@ func withAliasName{{ $i }}EndpointInConfig(setup *caseSetup) { {{ if gt (len .Aliases) 0 }} func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, {{ range $i, $alias := .Aliases -}} aliasName{{ $i }}, @@ -718,17 +718,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -871,10 +871,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 89c84d8e0c3ce62b2a9a7400a81b4ee07b9a1825 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:53 -0400 Subject: [PATCH 0273/1490] accessanalyzer: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/accessanalyzer/service_endpoints_gen_test.go b/internal/service/accessanalyzer/service_endpoints_gen_test.go index 85a86e5e4f0..6cc6db19e18 100644 --- a/internal/service/accessanalyzer/service_endpoints_gen_test.go +++ b/internal/service/accessanalyzer/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 72c6321600834bb088af477362a7a58a4bba27ad Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:53 -0400 Subject: [PATCH 0274/1490] account: Use constants for strings --- .../account/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/account/service_endpoints_gen_test.go b/internal/service/account/service_endpoints_gen_test.go index d94b7c8597e..36eed6221b8 100644 --- a/internal/service/account/service_endpoints_gen_test.go +++ b/internal/service/account/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 41924bc2158cfeb07da608fc0a14b9bdeb14c155 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:53 -0400 Subject: [PATCH 0275/1490] acm: Use constants for strings --- .../service/acm/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/acm/service_endpoints_gen_test.go b/internal/service/acm/service_endpoints_gen_test.go index 3e721badd5a..b0428699ac5 100644 --- a/internal/service/acm/service_endpoints_gen_test.go +++ b/internal/service/acm/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 52c4c869f352a5abeeea25f8c9f29059db071416 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:53 -0400 Subject: [PATCH 0276/1490] acmpca: Use constants for strings --- .../acmpca/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/acmpca/service_endpoints_gen_test.go b/internal/service/acmpca/service_endpoints_gen_test.go index cfcf5f74938..fbf1a48f0b6 100644 --- a/internal/service/acmpca/service_endpoints_gen_test.go +++ b/internal/service/acmpca/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 84b9448cb6bfa744ed9134a0b4de3077df9f07dd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:54 -0400 Subject: [PATCH 0277/1490] amp: Use constants for strings --- .../service/amp/service_endpoints_gen_test.go | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/service/amp/service_endpoints_gen_test.go b/internal/service/amp/service_endpoints_gen_test.go index fc2ebb4a65a..651b682bee0 100644 --- a/internal/service/amp/service_endpoints_gen_test.go +++ b/internal/service/amp/service_endpoints_gen_test.go @@ -371,38 +371,38 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func withAliasName1EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName1] = aliasName1ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, aliasName1, @@ -489,17 +489,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -642,10 +642,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From dd38497e1ff8577df2b8754d8e458bcd8d27c105 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:54 -0400 Subject: [PATCH 0278/1490] amplify: Use constants for strings --- .../amplify/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/amplify/service_endpoints_gen_test.go b/internal/service/amplify/service_endpoints_gen_test.go index 59811532f4c..692ebcbfd30 100644 --- a/internal/service/amplify/service_endpoints_gen_test.go +++ b/internal/service/amplify/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 5ccd20ff2956e2bf6335965bb69847a14b2cbab4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:54 -0400 Subject: [PATCH 0279/1490] apigateway: Use constants for strings --- .../apigateway/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/apigateway/service_endpoints_gen_test.go b/internal/service/apigateway/service_endpoints_gen_test.go index 9460206f647..a52f11fd615 100644 --- a/internal/service/apigateway/service_endpoints_gen_test.go +++ b/internal/service/apigateway/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 816d24437a39f954b18efe1d1993daefeb54dddb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:54 -0400 Subject: [PATCH 0280/1490] apigatewayv2: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/apigatewayv2/service_endpoints_gen_test.go b/internal/service/apigatewayv2/service_endpoints_gen_test.go index c9cb26f38b1..7e3915dcf3f 100644 --- a/internal/service/apigatewayv2/service_endpoints_gen_test.go +++ b/internal/service/apigatewayv2/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f76ae3168b85d368a5e8add7fdab5028f6268b81 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:54 -0400 Subject: [PATCH 0281/1490] appautoscaling: Use constants for strings --- .../service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/appautoscaling/service_endpoints_gen_test.go b/internal/service/appautoscaling/service_endpoints_gen_test.go index 936a02de200..8e76fbb00c6 100644 --- a/internal/service/appautoscaling/service_endpoints_gen_test.go +++ b/internal/service/appautoscaling/service_endpoints_gen_test.go @@ -302,28 +302,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -403,17 +403,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -556,10 +556,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From bfd3133d8ab50a23f21fc9c630ad01de986671fe Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:54 -0400 Subject: [PATCH 0282/1490] appconfig: Use constants for strings --- .../appconfig/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/appconfig/service_endpoints_gen_test.go b/internal/service/appconfig/service_endpoints_gen_test.go index 9416ba9c4a0..9b04e82c0ce 100644 --- a/internal/service/appconfig/service_endpoints_gen_test.go +++ b/internal/service/appconfig/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 6e3fafeb28d29454c21dfd4f4e0dbe844ca47ff7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:54 -0400 Subject: [PATCH 0283/1490] appfabric: Use constants for strings --- .../appfabric/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/appfabric/service_endpoints_gen_test.go b/internal/service/appfabric/service_endpoints_gen_test.go index 45135210d33..07c64f6c52f 100644 --- a/internal/service/appfabric/service_endpoints_gen_test.go +++ b/internal/service/appfabric/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From c224c8a81297a9a0fe1ca9ca17509ae41812674e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:55 -0400 Subject: [PATCH 0284/1490] appflow: Use constants for strings --- internal/service/appflow/connector_profile.go | 4 ++-- .../appflow/service_endpoints_gen_test.go | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/appflow/connector_profile.go b/internal/service/appflow/connector_profile.go index bc40f73eabd..94659d67cf8 100644 --- a/internal/service/appflow/connector_profile.go +++ b/internal/service/appflow/connector_profile.go @@ -82,7 +82,7 @@ func resourceConnectorProfile() *schema.Resource { validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), ), }, - "secret_key": { + names.AttrSecretKey: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -1649,7 +1649,7 @@ func expandConnectorProfileCredentials(m map[string]interface{}) *types.Connecto func expandAmplitudeConnectorProfileCredentials(m map[string]interface{}) *types.AmplitudeConnectorProfileCredentials { credentials := &types.AmplitudeConnectorProfileCredentials{ ApiKey: aws.String(m["api_key"].(string)), - SecretKey: aws.String(m["secret_key"].(string)), + SecretKey: aws.String(m[names.AttrSecretKey].(string)), } return credentials diff --git a/internal/service/appflow/service_endpoints_gen_test.go b/internal/service/appflow/service_endpoints_gen_test.go index 35cf8f9f1ce..c7c4629e37d 100644 --- a/internal/service/appflow/service_endpoints_gen_test.go +++ b/internal/service/appflow/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 8807f7041c93a042d6f6b8fd13626e997418c42f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:55 -0400 Subject: [PATCH 0285/1490] appintegrations: Use constants for strings --- .../service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/appintegrations/service_endpoints_gen_test.go b/internal/service/appintegrations/service_endpoints_gen_test.go index 4df183dc331..f60261640db 100644 --- a/internal/service/appintegrations/service_endpoints_gen_test.go +++ b/internal/service/appintegrations/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7e7067c10553a3ad11b7ce2aa8d6acd521ae7b5c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:55 -0400 Subject: [PATCH 0286/1490] applicationinsights: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/applicationinsights/service_endpoints_gen_test.go b/internal/service/applicationinsights/service_endpoints_gen_test.go index 04a63ee256d..506ca4c9920 100644 --- a/internal/service/applicationinsights/service_endpoints_gen_test.go +++ b/internal/service/applicationinsights/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 8db829272a5443b32b6656f67bd5ec4309e67caf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:55 -0400 Subject: [PATCH 0287/1490] appmesh: Use constants for strings --- .../appmesh/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/appmesh/service_endpoints_gen_test.go b/internal/service/appmesh/service_endpoints_gen_test.go index 96892b33693..938aab6811f 100644 --- a/internal/service/appmesh/service_endpoints_gen_test.go +++ b/internal/service/appmesh/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From dfb1c07762475a1f4b901bbbad80e362453c0146 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:55 -0400 Subject: [PATCH 0288/1490] apprunner: Use constants for strings --- .../apprunner/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/apprunner/service_endpoints_gen_test.go b/internal/service/apprunner/service_endpoints_gen_test.go index b96ff597799..83e74bbe185 100644 --- a/internal/service/apprunner/service_endpoints_gen_test.go +++ b/internal/service/apprunner/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From b578f46455d6d358bfe09ce26742880e0aeebb78 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:55 -0400 Subject: [PATCH 0289/1490] appstream: Use constants for strings --- .../appstream/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/appstream/service_endpoints_gen_test.go b/internal/service/appstream/service_endpoints_gen_test.go index 013eb77fc52..6291f66ef06 100644 --- a/internal/service/appstream/service_endpoints_gen_test.go +++ b/internal/service/appstream/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 4338192bb8c444a72be30ca1d22013b92c1a3482 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:56 -0400 Subject: [PATCH 0290/1490] appsync: Use constants for strings --- .../appsync/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/appsync/service_endpoints_gen_test.go b/internal/service/appsync/service_endpoints_gen_test.go index 57f5bf72fcd..854764da644 100644 --- a/internal/service/appsync/service_endpoints_gen_test.go +++ b/internal/service/appsync/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From c330f5b7b4f3d61814473f89f8078a5043da08a5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:56 -0400 Subject: [PATCH 0291/1490] athena: Use constants for strings --- .../athena/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/athena/service_endpoints_gen_test.go b/internal/service/athena/service_endpoints_gen_test.go index 2965c3f132b..d342210342a 100644 --- a/internal/service/athena/service_endpoints_gen_test.go +++ b/internal/service/athena/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f7a8ff833aee496ee8c4201760f344056c0834e9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:56 -0400 Subject: [PATCH 0292/1490] auditmanager: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/auditmanager/service_endpoints_gen_test.go b/internal/service/auditmanager/service_endpoints_gen_test.go index 7d02c3be603..3d5e665e16f 100644 --- a/internal/service/auditmanager/service_endpoints_gen_test.go +++ b/internal/service/auditmanager/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 799b6a51c0becfa62a2e0c6a34b8b3378e6cf29e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:56 -0400 Subject: [PATCH 0293/1490] autoscaling: Use constants for strings --- .../autoscaling/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/autoscaling/service_endpoints_gen_test.go b/internal/service/autoscaling/service_endpoints_gen_test.go index 6669ab7b7f5..5c27175beb2 100644 --- a/internal/service/autoscaling/service_endpoints_gen_test.go +++ b/internal/service/autoscaling/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 44e6e7c62832077617bf5c27cda6c4457fb33dcb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:56 -0400 Subject: [PATCH 0294/1490] autoscalingplans: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/autoscalingplans/service_endpoints_gen_test.go b/internal/service/autoscalingplans/service_endpoints_gen_test.go index 5c5348d0ac9..83c993a2f90 100644 --- a/internal/service/autoscalingplans/service_endpoints_gen_test.go +++ b/internal/service/autoscalingplans/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 4dc974782b7c7d8c425bfb6945e4dd503013b22a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:56 -0400 Subject: [PATCH 0295/1490] backup: Use constants for strings --- .../backup/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/backup/service_endpoints_gen_test.go b/internal/service/backup/service_endpoints_gen_test.go index 90fcb4eb0e5..8447a2b5be2 100644 --- a/internal/service/backup/service_endpoints_gen_test.go +++ b/internal/service/backup/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 40fa55583ee8f770a18ea7cc7aca795f7ca29554 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:56 -0400 Subject: [PATCH 0296/1490] batch: Use constants for strings --- .../batch/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/batch/service_endpoints_gen_test.go b/internal/service/batch/service_endpoints_gen_test.go index b9b5a307d06..bef8b0b58bc 100644 --- a/internal/service/batch/service_endpoints_gen_test.go +++ b/internal/service/batch/service_endpoints_gen_test.go @@ -285,12 +285,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -361,17 +361,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -514,10 +514,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From ebe24ac459e2c853bb59dd7e8bfa1c18ddbee88d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:56 -0400 Subject: [PATCH 0297/1490] bcmdataexports: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/bcmdataexports/service_endpoints_gen_test.go b/internal/service/bcmdataexports/service_endpoints_gen_test.go index 0afe7b712de..5d3202a75d4 100644 --- a/internal/service/bcmdataexports/service_endpoints_gen_test.go +++ b/internal/service/bcmdataexports/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From e432f164ad8bf8ee124e72fbb088ef25a1000cc0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:57 -0400 Subject: [PATCH 0298/1490] bedrock: Use constants for strings --- .../bedrock/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/bedrock/service_endpoints_gen_test.go b/internal/service/bedrock/service_endpoints_gen_test.go index 53949b03d2b..322de807b87 100644 --- a/internal/service/bedrock/service_endpoints_gen_test.go +++ b/internal/service/bedrock/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 5a65f27d8df831f599e66731ecdc9540d3545cd0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:57 -0400 Subject: [PATCH 0299/1490] bedrockagent: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/bedrockagent/service_endpoints_gen_test.go b/internal/service/bedrockagent/service_endpoints_gen_test.go index c03c6d6d4bb..60b4fa16c8d 100644 --- a/internal/service/bedrockagent/service_endpoints_gen_test.go +++ b/internal/service/bedrockagent/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From d652fd397e174e09c4b0fe438e3ef6108c55249a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:57 -0400 Subject: [PATCH 0300/1490] budgets: Use constants for strings --- .../budgets/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/budgets/service_endpoints_gen_test.go b/internal/service/budgets/service_endpoints_gen_test.go index 71ddc084900..d7ddf5e3989 100644 --- a/internal/service/budgets/service_endpoints_gen_test.go +++ b/internal/service/budgets/service_endpoints_gen_test.go @@ -260,12 +260,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -336,17 +336,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -489,10 +489,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7b7a2c1bb6e3246890fd85064b7e001b7598c264 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:57 -0400 Subject: [PATCH 0301/1490] ce: Use constants for strings --- .../service/ce/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/ce/service_endpoints_gen_test.go b/internal/service/ce/service_endpoints_gen_test.go index dfec92cdefb..67dfcf248be 100644 --- a/internal/service/ce/service_endpoints_gen_test.go +++ b/internal/service/ce/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 3845bd6b75a1687a2f946dd19845376c7778be72 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:57 -0400 Subject: [PATCH 0302/1490] chatbot: Use constants for strings --- .../chatbot/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/chatbot/service_endpoints_gen_test.go b/internal/service/chatbot/service_endpoints_gen_test.go index 5bfcb6747f2..baf9de334ef 100644 --- a/internal/service/chatbot/service_endpoints_gen_test.go +++ b/internal/service/chatbot/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 3d301c14ecf3a614a6e28b44a37eaf16c4e4f61e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:57 -0400 Subject: [PATCH 0303/1490] chime: Use constants for strings --- .../chime/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/chime/service_endpoints_gen_test.go b/internal/service/chime/service_endpoints_gen_test.go index d8f01622aec..4f75d53b59a 100644 --- a/internal/service/chime/service_endpoints_gen_test.go +++ b/internal/service/chime/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 5ce4f0658b22767ebd6431280935c0a62f118f7b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:57 -0400 Subject: [PATCH 0304/1490] chimesdkmediapipelines: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go b/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go index d684392f6b5..36d0d1dd7aa 100644 --- a/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go +++ b/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 453638b120503436e9f974df7cbed2527d82db25 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:58 -0400 Subject: [PATCH 0305/1490] chimesdkvoice: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- .../chimesdkvoice/sip_media_application.go | 10 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/service/chimesdkvoice/service_endpoints_gen_test.go b/internal/service/chimesdkvoice/service_endpoints_gen_test.go index 2452b366bbd..9c8abef3c0c 100644 --- a/internal/service/chimesdkvoice/service_endpoints_gen_test.go +++ b/internal/service/chimesdkvoice/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() diff --git a/internal/service/chimesdkvoice/sip_media_application.go b/internal/service/chimesdkvoice/sip_media_application.go index 15fcc76c133..4dd6fcf3b48 100644 --- a/internal/service/chimesdkvoice/sip_media_application.go +++ b/internal/service/chimesdkvoice/sip_media_application.go @@ -46,7 +46,7 @@ func ResourceSipMediaApplication() *schema.Resource { ForceNew: true, Required: true, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeList, MaxItems: 1, Required: true, @@ -79,7 +79,7 @@ func resourceSipMediaApplicationCreate(ctx context.Context, d *schema.ResourceDa createInput := &chimesdkvoice.CreateSipMediaApplicationInput{ AwsRegion: aws.String(d.Get("aws_region").(string)), Name: aws.String(d.Get(names.AttrName).(string)), - Endpoints: expandSipMediaApplicationEndpoints(d.Get("endpoints").([]interface{})), + Endpoints: expandSipMediaApplicationEndpoints(d.Get(names.AttrEndpoints).([]interface{})), Tags: getTagsIn(ctx), } @@ -109,7 +109,7 @@ func resourceSipMediaApplicationRead(ctx context.Context, d *schema.ResourceData d.Set(names.AttrARN, resp.SipMediaApplicationArn) d.Set("aws_region", resp.AwsRegion) d.Set(names.AttrName, resp.Name) - d.Set("endpoints", flattenSipMediaApplicationEndpoints(resp.Endpoints)) + d.Set(names.AttrEndpoints, flattenSipMediaApplicationEndpoints(resp.Endpoints)) return diags } @@ -118,11 +118,11 @@ func resourceSipMediaApplicationUpdate(ctx context.Context, d *schema.ResourceDa var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ChimeSDKVoiceClient(ctx) - if d.HasChanges(names.AttrName, "endpoints") { + if d.HasChanges(names.AttrName, names.AttrEndpoints) { updateInput := &chimesdkvoice.UpdateSipMediaApplicationInput{ SipMediaApplicationId: aws.String(d.Id()), Name: aws.String(d.Get(names.AttrName).(string)), - Endpoints: expandSipMediaApplicationEndpoints(d.Get("endpoints").([]interface{})), + Endpoints: expandSipMediaApplicationEndpoints(d.Get(names.AttrEndpoints).([]interface{})), } if _, err := conn.UpdateSipMediaApplication(ctx, updateInput); err != nil { From 52a247d3255acd5bab8b0953eeebe17a37d0c888 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:58 -0400 Subject: [PATCH 0306/1490] cleanrooms: Use constants for strings --- .../cleanrooms/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/cleanrooms/service_endpoints_gen_test.go b/internal/service/cleanrooms/service_endpoints_gen_test.go index aaafbecb4e9..47c08765a89 100644 --- a/internal/service/cleanrooms/service_endpoints_gen_test.go +++ b/internal/service/cleanrooms/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 6b27f74ba416368d7a9df9e3386db50f0720c173 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:58 -0400 Subject: [PATCH 0307/1490] cloud9: Use constants for strings --- .../cloud9/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/cloud9/service_endpoints_gen_test.go b/internal/service/cloud9/service_endpoints_gen_test.go index c4fcd299c2e..13558b186cc 100644 --- a/internal/service/cloud9/service_endpoints_gen_test.go +++ b/internal/service/cloud9/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 093e33e620e6accaa79f4b3c720c108785f32938 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:58 -0400 Subject: [PATCH 0308/1490] cloudcontrol: Use constants for strings --- .../service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/cloudcontrol/service_endpoints_gen_test.go b/internal/service/cloudcontrol/service_endpoints_gen_test.go index 3fd57993099..e5886b25799 100644 --- a/internal/service/cloudcontrol/service_endpoints_gen_test.go +++ b/internal/service/cloudcontrol/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 3d857e91a042ce0e3554662acf2227fc27dfe204 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:58 -0400 Subject: [PATCH 0309/1490] cloudformation: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/cloudformation/service_endpoints_gen_test.go b/internal/service/cloudformation/service_endpoints_gen_test.go index a4f7705af07..995d090c271 100644 --- a/internal/service/cloudformation/service_endpoints_gen_test.go +++ b/internal/service/cloudformation/service_endpoints_gen_test.go @@ -260,12 +260,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -336,17 +336,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -489,10 +489,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 3c17c93e4d81013220414ef903cc35a116cd1393 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:58 -0400 Subject: [PATCH 0310/1490] cloudfront: Use constants for strings --- .../cloudfront/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/cloudfront/service_endpoints_gen_test.go b/internal/service/cloudfront/service_endpoints_gen_test.go index e39f345b9ba..0a2d8436544 100644 --- a/internal/service/cloudfront/service_endpoints_gen_test.go +++ b/internal/service/cloudfront/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From b100f1e5190b28b0c7e7c3a343cb9a919a510299 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:58 -0400 Subject: [PATCH 0311/1490] cloudhsmv2: Use constants for strings --- .../cloudhsmv2/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/cloudhsmv2/service_endpoints_gen_test.go b/internal/service/cloudhsmv2/service_endpoints_gen_test.go index 211865da535..d2f41666141 100644 --- a/internal/service/cloudhsmv2/service_endpoints_gen_test.go +++ b/internal/service/cloudhsmv2/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 4b247c8b957769f83cdd43b9610db6487cfc5c27 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:59 -0400 Subject: [PATCH 0312/1490] cloudsearch: Use constants for strings --- .../cloudsearch/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/cloudsearch/service_endpoints_gen_test.go b/internal/service/cloudsearch/service_endpoints_gen_test.go index ea16fc8416e..1e2c3267290 100644 --- a/internal/service/cloudsearch/service_endpoints_gen_test.go +++ b/internal/service/cloudsearch/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 81e3a6a1830ceb51cbc3b5bc542b0769b0a59e85 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:59 -0400 Subject: [PATCH 0313/1490] cloudtrail: Use constants for strings --- .../cloudtrail/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/cloudtrail/service_endpoints_gen_test.go b/internal/service/cloudtrail/service_endpoints_gen_test.go index 2ab19824513..16f2e07913e 100644 --- a/internal/service/cloudtrail/service_endpoints_gen_test.go +++ b/internal/service/cloudtrail/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From c750c9678d053ded123876796da79f629f02f0a4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:59 -0400 Subject: [PATCH 0314/1490] cloudwatch: Use constants for strings --- .../cloudwatch/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/cloudwatch/service_endpoints_gen_test.go b/internal/service/cloudwatch/service_endpoints_gen_test.go index e086ce1a7c2..984332422be 100644 --- a/internal/service/cloudwatch/service_endpoints_gen_test.go +++ b/internal/service/cloudwatch/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7ab311d246702ea18eab09cbaff7aca7c58391bd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:59 -0400 Subject: [PATCH 0315/1490] codeartifact: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/codeartifact/service_endpoints_gen_test.go b/internal/service/codeartifact/service_endpoints_gen_test.go index 3698f16e6ce..f4f8cd227e2 100644 --- a/internal/service/codeartifact/service_endpoints_gen_test.go +++ b/internal/service/codeartifact/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 3bd8ab7ac5caadf1eb8dd455c5bf39a688fe8755 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:59 -0400 Subject: [PATCH 0316/1490] codebuild: Use constants for strings --- .../codebuild/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/codebuild/service_endpoints_gen_test.go b/internal/service/codebuild/service_endpoints_gen_test.go index 74bddf1c47e..bf18f40bf27 100644 --- a/internal/service/codebuild/service_endpoints_gen_test.go +++ b/internal/service/codebuild/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 17e2bfd5d7912ff05da707c0b056c940a155be02 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:59 -0400 Subject: [PATCH 0317/1490] codecommit: Use constants for strings --- .../codecommit/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/codecommit/service_endpoints_gen_test.go b/internal/service/codecommit/service_endpoints_gen_test.go index bb7ee5ea915..49dd8a33cfe 100644 --- a/internal/service/codecommit/service_endpoints_gen_test.go +++ b/internal/service/codecommit/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 858c89ab08c51f0a6863c92e1e636c5828cafd01 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:31:59 -0400 Subject: [PATCH 0318/1490] codeguruprofiler: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/codeguruprofiler/service_endpoints_gen_test.go b/internal/service/codeguruprofiler/service_endpoints_gen_test.go index 988092d99fa..48c4caca4a3 100644 --- a/internal/service/codeguruprofiler/service_endpoints_gen_test.go +++ b/internal/service/codeguruprofiler/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 98d2163632e2a94c2b38860414f6744215008f79 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:00 -0400 Subject: [PATCH 0319/1490] codegurureviewer: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/codegurureviewer/service_endpoints_gen_test.go b/internal/service/codegurureviewer/service_endpoints_gen_test.go index 633c70f73e9..3f59cd38d40 100644 --- a/internal/service/codegurureviewer/service_endpoints_gen_test.go +++ b/internal/service/codegurureviewer/service_endpoints_gen_test.go @@ -261,12 +261,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -337,17 +337,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -490,10 +490,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a9b176a417c5a251bdc02e70b46f0f223fc42bc7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:00 -0400 Subject: [PATCH 0320/1490] codepipeline: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/codepipeline/service_endpoints_gen_test.go b/internal/service/codepipeline/service_endpoints_gen_test.go index 5eb8b8287c6..bf92923552b 100644 --- a/internal/service/codepipeline/service_endpoints_gen_test.go +++ b/internal/service/codepipeline/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 15b07e6c73ca35c9d775700e37bb29f7b5ae122b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:00 -0400 Subject: [PATCH 0321/1490] codestarconnections: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/codestarconnections/service_endpoints_gen_test.go b/internal/service/codestarconnections/service_endpoints_gen_test.go index f510a514d3f..66ce1a90879 100644 --- a/internal/service/codestarconnections/service_endpoints_gen_test.go +++ b/internal/service/codestarconnections/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a120ff70551bc984814b706bc1f72f230cbde49d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:00 -0400 Subject: [PATCH 0322/1490] codestarnotifications: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/codestarnotifications/service_endpoints_gen_test.go b/internal/service/codestarnotifications/service_endpoints_gen_test.go index c6fe12a3b0f..dac3ef9c2ab 100644 --- a/internal/service/codestarnotifications/service_endpoints_gen_test.go +++ b/internal/service/codestarnotifications/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 6b25d9e6a4e9a17247d1a1e3017f35637b059b57 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:00 -0400 Subject: [PATCH 0323/1490] cognitoidentity: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/cognitoidentity/service_endpoints_gen_test.go b/internal/service/cognitoidentity/service_endpoints_gen_test.go index 46ed709b445..e36255a27b7 100644 --- a/internal/service/cognitoidentity/service_endpoints_gen_test.go +++ b/internal/service/cognitoidentity/service_endpoints_gen_test.go @@ -260,12 +260,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -336,17 +336,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -489,10 +489,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From bf5bbe78b8995e3e2975597e32c38b04a6b9c481 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:00 -0400 Subject: [PATCH 0324/1490] cognitoidp: Use constants for strings --- .../managed_user_pool_client_test.go | 6 ++-- .../cognitoidp/service_endpoints_gen_test.go | 32 +++++++++---------- internal/service/cognitoidp/user.go | 2 +- internal/service/cognitoidp/user_pool.go | 2 +- .../cognitoidp/user_pool_client_test.go | 4 +-- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/internal/service/cognitoidp/managed_user_pool_client_test.go b/internal/service/cognitoidp/managed_user_pool_client_test.go index 503fba7435a..ad8242dce7a 100644 --- a/internal/service/cognitoidp/managed_user_pool_client_test.go +++ b/internal/service/cognitoidp/managed_user_pool_client_test.go @@ -54,7 +54,7 @@ func TestAccCognitoIDPManagedUserPoolClient_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "allowed_oauth_scopes.0", "email"), resource.TestCheckResourceAttr(resourceName, "allowed_oauth_scopes.1", "openid"), resource.TestCheckResourceAttr(resourceName, "allowed_oauth_scopes.2", "phone"), - resource.TestCheckResourceAttr(resourceName, "allowed_oauth_scopes.3", "profile"), + resource.TestCheckResourceAttr(resourceName, "allowed_oauth_scopes.3", names.AttrProfile), resource.TestCheckResourceAttr(resourceName, "analytics_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "auth_session_validity", "3"), resource.TestCheckResourceAttr(resourceName, "callback_urls.#", "1"), @@ -630,7 +630,7 @@ func TestAccCognitoIDPManagedUserPoolClient_allFields(t *testing.T) { resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "email"), resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "phone"), resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "aws.cognito.signin.user.admin"), - resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "profile"), + resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", names.AttrProfile), resource.TestCheckResourceAttr(resourceName, "callback_urls.#", "2"), resource.TestCheckTypeSetElemAttr(resourceName, "callback_urls.*", "https://www.example.com/callback"), resource.TestCheckTypeSetElemAttr(resourceName, "callback_urls.*", "https://www.example.com/redirect"), @@ -691,7 +691,7 @@ func TestAccCognitoIDPManagedUserPoolClient_allFieldsUpdatingOneField(t *testing resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "email"), resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "phone"), resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "aws.cognito.signin.user.admin"), - resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "profile"), + resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", names.AttrProfile), resource.TestCheckResourceAttr(resourceName, "callback_urls.#", "2"), resource.TestCheckTypeSetElemAttr(resourceName, "callback_urls.*", "https://www.example.com/callback"), resource.TestCheckTypeSetElemAttr(resourceName, "callback_urls.*", "https://www.example.com/redirect"), diff --git a/internal/service/cognitoidp/service_endpoints_gen_test.go b/internal/service/cognitoidp/service_endpoints_gen_test.go index e24ca82a0c1..d3de2bdb715 100644 --- a/internal/service/cognitoidp/service_endpoints_gen_test.go +++ b/internal/service/cognitoidp/service_endpoints_gen_test.go @@ -302,28 +302,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -403,17 +403,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -556,10 +556,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() diff --git a/internal/service/cognitoidp/user.go b/internal/service/cognitoidp/user.go index b4bd1da4a44..f76b9e88019 100644 --- a/internal/service/cognitoidp/user.go +++ b/internal/service/cognitoidp/user.go @@ -559,7 +559,7 @@ func UserAttributeKeyMatchesStandardAttribute(input string) bool { "phone_number_verified", "picture", "preferred_username", - "profile", + names.AttrProfile, "sub", "updated_at", "website", diff --git a/internal/service/cognitoidp/user_pool.go b/internal/service/cognitoidp/user_pool.go index e0a17e3e2a2..ece52df9248 100644 --- a/internal/service/cognitoidp/user_pool.go +++ b/internal/service/cognitoidp/user_pool.go @@ -2123,7 +2123,7 @@ func UserPoolSchemaAttributeMatchesStandardAttribute(input *cognitoidentityprovi AttributeDataType: aws.String(cognitoidentityprovider.AttributeDataTypeString), DeveloperOnlyAttribute: aws.Bool(false), Mutable: aws.Bool(true), - Name: aws.String("profile"), + Name: aws.String(names.AttrProfile), Required: aws.Bool(false), StringAttributeConstraints: &cognitoidentityprovider.StringAttributeConstraintsType{ MaxLength: aws.String("2048"), diff --git a/internal/service/cognitoidp/user_pool_client_test.go b/internal/service/cognitoidp/user_pool_client_test.go index fd4c7171e4e..4967194f886 100644 --- a/internal/service/cognitoidp/user_pool_client_test.go +++ b/internal/service/cognitoidp/user_pool_client_test.go @@ -583,7 +583,7 @@ func TestAccCognitoIDPUserPoolClient_allFields(t *testing.T) { resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "email"), resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "phone"), resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "aws.cognito.signin.user.admin"), - resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "profile"), + resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", names.AttrProfile), resource.TestCheckResourceAttr(resourceName, "callback_urls.#", "2"), resource.TestCheckTypeSetElemAttr(resourceName, "callback_urls.*", "https://www.example.com/callback"), resource.TestCheckTypeSetElemAttr(resourceName, "callback_urls.*", "https://www.example.com/redirect"), @@ -645,7 +645,7 @@ func TestAccCognitoIDPUserPoolClient_allFieldsUpdatingOneField(t *testing.T) { resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "email"), resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "phone"), resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "aws.cognito.signin.user.admin"), - resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", "profile"), + resource.TestCheckTypeSetElemAttr(resourceName, "allowed_oauth_scopes.*", names.AttrProfile), resource.TestCheckResourceAttr(resourceName, "callback_urls.#", "2"), resource.TestCheckTypeSetElemAttr(resourceName, "callback_urls.*", "https://www.example.com/callback"), resource.TestCheckTypeSetElemAttr(resourceName, "callback_urls.*", "https://www.example.com/redirect"), From 546a4df6d34b46757a75cbe9035ed3ca24e8d306 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:00 -0400 Subject: [PATCH 0325/1490] comprehend: Use constants for strings --- .../comprehend/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/comprehend/service_endpoints_gen_test.go b/internal/service/comprehend/service_endpoints_gen_test.go index 2f71810f66c..19d9b57c9c7 100644 --- a/internal/service/comprehend/service_endpoints_gen_test.go +++ b/internal/service/comprehend/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 16ecbdf8c7f3f959951c9b903ae9f664ce237ad5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:01 -0400 Subject: [PATCH 0326/1490] computeoptimizer: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/computeoptimizer/service_endpoints_gen_test.go b/internal/service/computeoptimizer/service_endpoints_gen_test.go index 4a9a0e29330..4e52ad5c997 100644 --- a/internal/service/computeoptimizer/service_endpoints_gen_test.go +++ b/internal/service/computeoptimizer/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 3b3e5f078c261d2c8658d4cf5e63fe656ceba42f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:01 -0400 Subject: [PATCH 0327/1490] configservice: Use constants for strings --- .../service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/configservice/service_endpoints_gen_test.go b/internal/service/configservice/service_endpoints_gen_test.go index 08a560f0723..db28cacb09a 100644 --- a/internal/service/configservice/service_endpoints_gen_test.go +++ b/internal/service/configservice/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From d739024c2998058aea684c49bb7e83952c0d9ea6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:01 -0400 Subject: [PATCH 0328/1490] connect: Use constants for strings --- .../connect/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/connect/service_endpoints_gen_test.go b/internal/service/connect/service_endpoints_gen_test.go index 72e6da3f7b1..3eb870d4699 100644 --- a/internal/service/connect/service_endpoints_gen_test.go +++ b/internal/service/connect/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From dfd3a12012932502a3a2672a355cd742bb67fb10 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:01 -0400 Subject: [PATCH 0329/1490] connectcases: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/connectcases/service_endpoints_gen_test.go b/internal/service/connectcases/service_endpoints_gen_test.go index 030ffef03d4..6b02bfc7b7f 100644 --- a/internal/service/connectcases/service_endpoints_gen_test.go +++ b/internal/service/connectcases/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From dca3a5d37eaaf4d6c8a20bd2b349bc935d8308f9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:01 -0400 Subject: [PATCH 0330/1490] controltower: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/controltower/service_endpoints_gen_test.go b/internal/service/controltower/service_endpoints_gen_test.go index e04f3b92291..2f7e61abaaa 100644 --- a/internal/service/controltower/service_endpoints_gen_test.go +++ b/internal/service/controltower/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f04f094afd87e1e66010c3295ee8a27141531dd3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:01 -0400 Subject: [PATCH 0331/1490] costoptimizationhub: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/costoptimizationhub/service_endpoints_gen_test.go b/internal/service/costoptimizationhub/service_endpoints_gen_test.go index 07ca7ffbf1e..c4ee066d0b5 100644 --- a/internal/service/costoptimizationhub/service_endpoints_gen_test.go +++ b/internal/service/costoptimizationhub/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 24dec4c395c071b5ce3b67a4f882bf26ed272ff3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:01 -0400 Subject: [PATCH 0332/1490] cur: Use constants for strings --- .../service/cur/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/cur/service_endpoints_gen_test.go b/internal/service/cur/service_endpoints_gen_test.go index 2153627527b..b1ccaa2fb2f 100644 --- a/internal/service/cur/service_endpoints_gen_test.go +++ b/internal/service/cur/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 9ccce412a45d763d6b9449ef04fce5eceb758c55 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:02 -0400 Subject: [PATCH 0333/1490] customerprofiles: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/customerprofiles/service_endpoints_gen_test.go b/internal/service/customerprofiles/service_endpoints_gen_test.go index 879bee38969..1f0b33ed88d 100644 --- a/internal/service/customerprofiles/service_endpoints_gen_test.go +++ b/internal/service/customerprofiles/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 4013832b45216a51433b0d95ec49215075ee2553 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:02 -0400 Subject: [PATCH 0334/1490] dataexchange: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/dataexchange/service_endpoints_gen_test.go b/internal/service/dataexchange/service_endpoints_gen_test.go index 793b9f35c78..deea4f68cb1 100644 --- a/internal/service/dataexchange/service_endpoints_gen_test.go +++ b/internal/service/dataexchange/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 022104987a8c8777aaa1b879fc98746ef9b6b8cc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:02 -0400 Subject: [PATCH 0335/1490] datapipeline: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/datapipeline/service_endpoints_gen_test.go b/internal/service/datapipeline/service_endpoints_gen_test.go index a4f1dd864a9..73f7e540c94 100644 --- a/internal/service/datapipeline/service_endpoints_gen_test.go +++ b/internal/service/datapipeline/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 1fdab5659c8c42457caceb5942b951300378da13 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:02 -0400 Subject: [PATCH 0336/1490] datasync: Use constants for strings --- .../datasync/location_object_storage.go | 22 ++++++++--------- .../datasync/location_object_storage_test.go | 16 ++++++------- .../datasync/service_endpoints_gen_test.go | 24 +++++++++---------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/internal/service/datasync/location_object_storage.go b/internal/service/datasync/location_object_storage.go index e23036fe593..d42431892d0 100644 --- a/internal/service/datasync/location_object_storage.go +++ b/internal/service/datasync/location_object_storage.go @@ -41,7 +41,7 @@ func resourceLocationObjectStorage() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "access_key": { + names.AttrAccessKey: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(8, 200), @@ -64,7 +64,7 @@ func resourceLocationObjectStorage() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(3, 63), }, - "secret_key": { + names.AttrSecretKey: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -122,11 +122,11 @@ func resourceLocationObjectStorageCreate(ctx context.Context, d *schema.Resource Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("access_key"); ok { + if v, ok := d.GetOk(names.AttrAccessKey); ok { input.AccessKey = aws.String(v.(string)) } - if v, ok := d.GetOk("secret_key"); ok { + if v, ok := d.GetOk(names.AttrSecretKey); ok { input.SecretKey = aws.String(v.(string)) } @@ -175,7 +175,7 @@ func resourceLocationObjectStorageRead(ctx context.Context, d *schema.ResourceDa return sdkdiag.AppendFromErr(diags, err) } - d.Set("access_key", output.AccessKey) + d.Set(names.AttrAccessKey, output.AccessKey) d.Set("agent_arns", output.AgentArns) d.Set(names.AttrARN, output.LocationArn) d.Set(names.AttrBucketName, bucketName) @@ -198,8 +198,8 @@ func resourceLocationObjectStorageUpdate(ctx context.Context, d *schema.Resource LocationArn: aws.String(d.Id()), } - if d.HasChange("access_key") { - input.AccessKey = aws.String(d.Get("access_key").(string)) + if d.HasChange(names.AttrAccessKey) { + input.AccessKey = aws.String(d.Get(names.AttrAccessKey).(string)) } if d.HasChange("agent_arns") { @@ -207,19 +207,19 @@ func resourceLocationObjectStorageUpdate(ctx context.Context, d *schema.Resource // Access key must be specified when updating agent ARNs input.AccessKey = aws.String("") - if v, ok := d.GetOk("access_key"); ok { + if v, ok := d.GetOk(names.AttrAccessKey); ok { input.AccessKey = aws.String(v.(string)) } // Secret key must be specified when updating agent ARNs input.SecretKey = aws.String("") - if v, ok := d.GetOk("secret_key"); ok { + if v, ok := d.GetOk(names.AttrSecretKey); ok { input.SecretKey = aws.String(v.(string)) } } - if d.HasChange("secret_key") { - input.SecretKey = aws.String(d.Get("secret_key").(string)) + if d.HasChange(names.AttrSecretKey) { + input.SecretKey = aws.String(d.Get(names.AttrSecretKey).(string)) } if d.HasChange("server_certificate") { diff --git a/internal/service/datasync/location_object_storage_test.go b/internal/service/datasync/location_object_storage_test.go index 9b1744ca1a3..e347e453f11 100644 --- a/internal/service/datasync/location_object_storage_test.go +++ b/internal/service/datasync/location_object_storage_test.go @@ -37,11 +37,11 @@ func TestAccDataSyncLocationObjectStorage_basic(t *testing.T) { Config: testAccLocationObjectStorageConfig_basic(rName, domain), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckLocationObjectStorageExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "access_key", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrAccessKey, ""), resource.TestCheckResourceAttr(resourceName, "agent_arns.#", "1"), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "datasync", regexache.MustCompile(`location/loc-.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrBucketName, rName), - resource.TestCheckNoResourceAttr(resourceName, "secret_key"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrSecretKey), resource.TestCheckResourceAttr(resourceName, "server_certificate", ""), resource.TestCheckResourceAttr(resourceName, "server_hostname", domain), resource.TestCheckResourceAttr(resourceName, "server_port", "8080"), @@ -77,11 +77,11 @@ func TestAccDataSyncLocationObjectStorage_update(t *testing.T) { Config: testAccLocationObjectStorageConfig_basic(rName, domain), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckLocationObjectStorageExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "access_key", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrAccessKey, ""), resource.TestCheckResourceAttr(resourceName, "agent_arns.#", "1"), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "datasync", regexache.MustCompile(`location/loc-.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrBucketName, rName), - resource.TestCheckNoResourceAttr(resourceName, "secret_key"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrSecretKey), resource.TestCheckResourceAttr(resourceName, "server_certificate", ""), resource.TestCheckResourceAttr(resourceName, "server_hostname", domain), resource.TestCheckResourceAttr(resourceName, "server_port", "8080"), @@ -95,11 +95,11 @@ func TestAccDataSyncLocationObjectStorage_update(t *testing.T) { Config: testAccLocationObjectStorageConfig_updateAddAgent(rName, domain), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckLocationObjectStorageExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "access_key", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrAccessKey, ""), resource.TestCheckResourceAttr(resourceName, "agent_arns.#", "2"), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "datasync", regexache.MustCompile(`location/loc-.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrBucketName, rName), - resource.TestCheckNoResourceAttr(resourceName, "secret_key"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrSecretKey), resource.TestCheckResourceAttr(resourceName, "server_certificate", ""), resource.TestCheckResourceAttr(resourceName, "server_hostname", domain), resource.TestCheckResourceAttr(resourceName, "server_port", "8080"), @@ -113,11 +113,11 @@ func TestAccDataSyncLocationObjectStorage_update(t *testing.T) { Config: testAccLocationObjectStorageConfig_updateRemoveAgent(rName, domain), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckLocationObjectStorageExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "access_key", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrAccessKey, ""), resource.TestCheckResourceAttr(resourceName, "agent_arns.#", "1"), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "datasync", regexache.MustCompile(`location/loc-.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrBucketName, rName), - resource.TestCheckNoResourceAttr(resourceName, "secret_key"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrSecretKey), resource.TestCheckResourceAttr(resourceName, "server_certificate", ""), resource.TestCheckResourceAttr(resourceName, "server_hostname", domain), resource.TestCheckResourceAttr(resourceName, "server_port", "8080"), diff --git a/internal/service/datasync/service_endpoints_gen_test.go b/internal/service/datasync/service_endpoints_gen_test.go index 5b88f2babba..afe70bac7b6 100644 --- a/internal/service/datasync/service_endpoints_gen_test.go +++ b/internal/service/datasync/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a674d2bdca145401237901bff92c4fea04e95e0d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:02 -0400 Subject: [PATCH 0337/1490] datazone: Use constants for strings --- .../datazone/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/datazone/service_endpoints_gen_test.go b/internal/service/datazone/service_endpoints_gen_test.go index 77b8c986189..044e9f2dce5 100644 --- a/internal/service/datazone/service_endpoints_gen_test.go +++ b/internal/service/datazone/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 167db9de2911c012a3a62c12670931dc7f6bbfd1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:02 -0400 Subject: [PATCH 0338/1490] dax: Use constants for strings --- .../service/dax/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/dax/service_endpoints_gen_test.go b/internal/service/dax/service_endpoints_gen_test.go index ea604054d27..d4332b4f6a6 100644 --- a/internal/service/dax/service_endpoints_gen_test.go +++ b/internal/service/dax/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7d61563b507a9eedccf17d1b8fce6610a3adcef8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:02 -0400 Subject: [PATCH 0339/1490] deploy: Use constants for strings --- .../deploy/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/deploy/service_endpoints_gen_test.go b/internal/service/deploy/service_endpoints_gen_test.go index 7830da4dc0e..8676250d730 100644 --- a/internal/service/deploy/service_endpoints_gen_test.go +++ b/internal/service/deploy/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From fe0a7614bc099f182ba0188bb0d1beb98f7b3881 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:03 -0400 Subject: [PATCH 0340/1490] detective: Use constants for strings --- .../detective/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/detective/service_endpoints_gen_test.go b/internal/service/detective/service_endpoints_gen_test.go index 578e807e61e..a1ed19de583 100644 --- a/internal/service/detective/service_endpoints_gen_test.go +++ b/internal/service/detective/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 3a0a34f33cbd9e863fe0b2e9b5085d3d0a2896cf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:03 -0400 Subject: [PATCH 0341/1490] devicefarm: Use constants for strings --- .../devicefarm/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/devicefarm/service_endpoints_gen_test.go b/internal/service/devicefarm/service_endpoints_gen_test.go index 00f54c2239e..ed469a1de7d 100644 --- a/internal/service/devicefarm/service_endpoints_gen_test.go +++ b/internal/service/devicefarm/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From c0f1a8d95c12fc56df43abb2fdcd7a7a7067ed27 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:03 -0400 Subject: [PATCH 0342/1490] devopsguru: Use constants for strings --- .../devopsguru/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/devopsguru/service_endpoints_gen_test.go b/internal/service/devopsguru/service_endpoints_gen_test.go index d7244325320..8e41e81640f 100644 --- a/internal/service/devopsguru/service_endpoints_gen_test.go +++ b/internal/service/devopsguru/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 8cf19639533cd92e106e10b9edd1fd12a37f12eb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:03 -0400 Subject: [PATCH 0343/1490] directconnect: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/directconnect/service_endpoints_gen_test.go b/internal/service/directconnect/service_endpoints_gen_test.go index 59311cb0e75..83a0d2422b2 100644 --- a/internal/service/directconnect/service_endpoints_gen_test.go +++ b/internal/service/directconnect/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 23c5d26afc97521a02f9515a98ce5b4b5228c653 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:03 -0400 Subject: [PATCH 0344/1490] dlm: Use constants for strings --- .../service/dlm/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/dlm/service_endpoints_gen_test.go b/internal/service/dlm/service_endpoints_gen_test.go index 3137593f7b3..a851f5a60fc 100644 --- a/internal/service/dlm/service_endpoints_gen_test.go +++ b/internal/service/dlm/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From ecbaa7574f7cb250dc7efd38c66781d038347ad7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:03 -0400 Subject: [PATCH 0345/1490] dms: Use constants for strings --- .../service/dms/service_endpoints_gen_test.go | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/service/dms/service_endpoints_gen_test.go b/internal/service/dms/service_endpoints_gen_test.go index bc133d4f9c9..70bf9582c3f 100644 --- a/internal/service/dms/service_endpoints_gen_test.go +++ b/internal/service/dms/service_endpoints_gen_test.go @@ -361,38 +361,38 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func withAliasName1EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName1] = aliasName1ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, aliasName1, @@ -479,17 +479,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -632,10 +632,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a2cf7bfafea586dcca67a4b3d7fd098b0dc91573 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:03 -0400 Subject: [PATCH 0346/1490] docdb: Use constants for strings --- .../docdb/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/docdb/service_endpoints_gen_test.go b/internal/service/docdb/service_endpoints_gen_test.go index 594a1b1c29e..d2ee1e711f1 100644 --- a/internal/service/docdb/service_endpoints_gen_test.go +++ b/internal/service/docdb/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 258cd589aac1efa77b29f7b8171ca9c29a1f5fb2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:04 -0400 Subject: [PATCH 0347/1490] docdbelastic: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/docdbelastic/service_endpoints_gen_test.go b/internal/service/docdbelastic/service_endpoints_gen_test.go index 187931b02b3..5168991d663 100644 --- a/internal/service/docdbelastic/service_endpoints_gen_test.go +++ b/internal/service/docdbelastic/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 5b0c8691330e625bedbe50084f4934a97fca8122 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:04 -0400 Subject: [PATCH 0348/1490] ds: Use constants for strings --- .../service/ds/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/ds/service_endpoints_gen_test.go b/internal/service/ds/service_endpoints_gen_test.go index 29ea39cc506..ba91e56e363 100644 --- a/internal/service/ds/service_endpoints_gen_test.go +++ b/internal/service/ds/service_endpoints_gen_test.go @@ -339,28 +339,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -440,17 +440,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -593,10 +593,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From da255a11990fe36dc20d14df8077c61af86c6c83 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:04 -0400 Subject: [PATCH 0349/1490] dynamodb: Use constants for strings --- .../dynamodb/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/dynamodb/service_endpoints_gen_test.go b/internal/service/dynamodb/service_endpoints_gen_test.go index 2d897c86677..9576c8ef992 100644 --- a/internal/service/dynamodb/service_endpoints_gen_test.go +++ b/internal/service/dynamodb/service_endpoints_gen_test.go @@ -368,12 +368,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -470,17 +470,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -623,10 +623,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 19ed86df7dd58c8e9dc4b077a5739ce4db2f8102 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:04 -0400 Subject: [PATCH 0350/1490] ec2: Use constants for strings --- .../service/ec2/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ec2/service_endpoints_gen_test.go b/internal/service/ec2/service_endpoints_gen_test.go index 221ba485921..bdaff61a3c8 100644 --- a/internal/service/ec2/service_endpoints_gen_test.go +++ b/internal/service/ec2/service_endpoints_gen_test.go @@ -285,12 +285,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -361,17 +361,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -514,10 +514,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 00efe8e73bb6cc0810645e00a2422c4c0add759e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:04 -0400 Subject: [PATCH 0351/1490] ecr: Use constants for strings --- .../service/ecr/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ecr/service_endpoints_gen_test.go b/internal/service/ecr/service_endpoints_gen_test.go index 5ae37bde777..ab9bea07097 100644 --- a/internal/service/ecr/service_endpoints_gen_test.go +++ b/internal/service/ecr/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From ba83cd48cc8ff5fb6dad4a37e489a711accbb3d7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:04 -0400 Subject: [PATCH 0352/1490] ecrpublic: Use constants for strings --- .../ecrpublic/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ecrpublic/service_endpoints_gen_test.go b/internal/service/ecrpublic/service_endpoints_gen_test.go index 87ed4817f67..bf3cf7cda75 100644 --- a/internal/service/ecrpublic/service_endpoints_gen_test.go +++ b/internal/service/ecrpublic/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 9292c541c58845dd743bffb9bd74a875050d51f6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:04 -0400 Subject: [PATCH 0353/1490] ecs: Use constants for strings --- .../service/ecs/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ecs/service_endpoints_gen_test.go b/internal/service/ecs/service_endpoints_gen_test.go index 7484a244f23..a43fc07455a 100644 --- a/internal/service/ecs/service_endpoints_gen_test.go +++ b/internal/service/ecs/service_endpoints_gen_test.go @@ -285,12 +285,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -361,17 +361,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -514,10 +514,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 341aa284a5f59b77394d0fdfc02a6106cce22ea0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:04 -0400 Subject: [PATCH 0354/1490] efs: Use constants for strings --- .../service/efs/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/efs/service_endpoints_gen_test.go b/internal/service/efs/service_endpoints_gen_test.go index 110e78d6c84..fc6636b2a40 100644 --- a/internal/service/efs/service_endpoints_gen_test.go +++ b/internal/service/efs/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 4fa72c277b4cc57b751d6f9f09820e7f90f71a0f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:05 -0400 Subject: [PATCH 0355/1490] eks: Use constants for strings --- .../service/eks/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/eks/service_endpoints_gen_test.go b/internal/service/eks/service_endpoints_gen_test.go index e4efbc5a73b..6d7bbd94e99 100644 --- a/internal/service/eks/service_endpoints_gen_test.go +++ b/internal/service/eks/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 55376665266ee8b30f01d0a7c073944a2f4f5120 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:05 -0400 Subject: [PATCH 0356/1490] elasticache: Use constants for strings --- .../elasticache/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/elasticache/service_endpoints_gen_test.go b/internal/service/elasticache/service_endpoints_gen_test.go index 363079af74d..9fd6f47d848 100644 --- a/internal/service/elasticache/service_endpoints_gen_test.go +++ b/internal/service/elasticache/service_endpoints_gen_test.go @@ -285,12 +285,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -361,17 +361,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -514,10 +514,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From c8f663f56e6f89672cba86bea7f0672cb83c496b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:05 -0400 Subject: [PATCH 0357/1490] elasticbeanstalk: Use constants for strings --- .../service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/elasticbeanstalk/service_endpoints_gen_test.go b/internal/service/elasticbeanstalk/service_endpoints_gen_test.go index b07003fd31e..525db790d5c 100644 --- a/internal/service/elasticbeanstalk/service_endpoints_gen_test.go +++ b/internal/service/elasticbeanstalk/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a00b90cddc581da806a93191e0b0f2e5af534951 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:05 -0400 Subject: [PATCH 0358/1490] elasticsearch: Use constants for strings --- .../service_endpoints_gen_test.go | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/service/elasticsearch/service_endpoints_gen_test.go b/internal/service/elasticsearch/service_endpoints_gen_test.go index 893ad1fb95d..9056432b3b4 100644 --- a/internal/service/elasticsearch/service_endpoints_gen_test.go +++ b/internal/service/elasticsearch/service_endpoints_gen_test.go @@ -361,38 +361,38 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func withAliasName1EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName1] = aliasName1ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, aliasName1, @@ -479,17 +479,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -632,10 +632,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 20eb497c3cd12625c7b91de18cb1b4ecc72e274f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:05 -0400 Subject: [PATCH 0359/1490] elastictranscoder: Use constants for strings --- internal/service/elastictranscoder/preset.go | 12 +++++----- .../service_endpoints_gen_test.go | 24 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/elastictranscoder/preset.go b/internal/service/elastictranscoder/preset.go index eb45a0f6a89..eb75a9f2ca0 100644 --- a/internal/service/elastictranscoder/preset.go +++ b/internal/service/elastictranscoder/preset.go @@ -129,7 +129,7 @@ func ResourcePreset() *schema.Resource { "LittleEndian", }, false), }, - "profile": { + names.AttrProfile: { Type: schema.TypeString, Optional: true, Computed: true, @@ -631,7 +631,7 @@ func expandETAudioCodecOptions(d *schema.ResourceData) *elastictranscoder.AudioC codecOpts.Signed = aws.String(v.(string)) } - if v, ok := codec["profile"]; ok && v.(string) != "" { + if v, ok := codec[names.AttrProfile]; ok && v.(string) != "" { codecOpts.Profile = aws.String(v.(string)) } @@ -845,10 +845,10 @@ func flattenETAudioCodecOptions(opts *elastictranscoder.AudioCodecOptions) []map } result := map[string]interface{}{ - "bit_depth": aws.StringValue(opts.BitDepth), - "bit_order": aws.StringValue(opts.BitOrder), - "profile": aws.StringValue(opts.Profile), - "signed": aws.StringValue(opts.Signed), + "bit_depth": aws.StringValue(opts.BitDepth), + "bit_order": aws.StringValue(opts.BitOrder), + names.AttrProfile: aws.StringValue(opts.Profile), + "signed": aws.StringValue(opts.Signed), } return []map[string]interface{}{result} diff --git a/internal/service/elastictranscoder/service_endpoints_gen_test.go b/internal/service/elastictranscoder/service_endpoints_gen_test.go index d57f9921ecc..b704a9d7078 100644 --- a/internal/service/elastictranscoder/service_endpoints_gen_test.go +++ b/internal/service/elastictranscoder/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 73f6533e2b4e5a28abe516a0d9ddbc41cca6e420 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:05 -0400 Subject: [PATCH 0360/1490] elb: Use constants for strings --- .../service/elb/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/elb/service_endpoints_gen_test.go b/internal/service/elb/service_endpoints_gen_test.go index 0f4388aa0fb..bb431fdb106 100644 --- a/internal/service/elb/service_endpoints_gen_test.go +++ b/internal/service/elb/service_endpoints_gen_test.go @@ -302,28 +302,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -403,17 +403,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -556,10 +556,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From dfafc2ff12970b26bd4a70eb290696456b5274e5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:05 -0400 Subject: [PATCH 0361/1490] elbv2: Use constants for strings --- .../elbv2/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/elbv2/service_endpoints_gen_test.go b/internal/service/elbv2/service_endpoints_gen_test.go index 326997febc7..e7a42312b92 100644 --- a/internal/service/elbv2/service_endpoints_gen_test.go +++ b/internal/service/elbv2/service_endpoints_gen_test.go @@ -339,28 +339,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -440,17 +440,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -593,10 +593,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 47827e83202062050d5669620ea71872b46edd39 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:06 -0400 Subject: [PATCH 0362/1490] emr: Use constants for strings --- .../service/emr/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/emr/service_endpoints_gen_test.go b/internal/service/emr/service_endpoints_gen_test.go index 7d82c2cb7b3..d0465d4afea 100644 --- a/internal/service/emr/service_endpoints_gen_test.go +++ b/internal/service/emr/service_endpoints_gen_test.go @@ -285,12 +285,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -361,17 +361,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -514,10 +514,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 3b764c9808cc17faae73ea8a8aeb3852af0d4006 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:06 -0400 Subject: [PATCH 0363/1490] emrcontainers: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/emrcontainers/service_endpoints_gen_test.go b/internal/service/emrcontainers/service_endpoints_gen_test.go index 9bb3b531ca8..92c8e4548d0 100644 --- a/internal/service/emrcontainers/service_endpoints_gen_test.go +++ b/internal/service/emrcontainers/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 78056d0839d5196100df65e7dac18a0c2079bc89 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:06 -0400 Subject: [PATCH 0364/1490] emrserverless: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/emrserverless/service_endpoints_gen_test.go b/internal/service/emrserverless/service_endpoints_gen_test.go index 4899847f1b8..0d62631853b 100644 --- a/internal/service/emrserverless/service_endpoints_gen_test.go +++ b/internal/service/emrserverless/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 2e12ef083389cf39a78ba329923307474ed3bf76 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:06 -0400 Subject: [PATCH 0365/1490] events: Use constants for strings --- .../events/service_endpoints_gen_test.go | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/service/events/service_endpoints_gen_test.go b/internal/service/events/service_endpoints_gen_test.go index 7cfc39f574b..f85c70cba46 100644 --- a/internal/service/events/service_endpoints_gen_test.go +++ b/internal/service/events/service_endpoints_gen_test.go @@ -371,38 +371,38 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func withAliasName1EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName1] = aliasName1ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, aliasName1, @@ -489,17 +489,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -642,10 +642,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From cfa37c4f69d25a8b0c451af157cede03252d23a4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:06 -0400 Subject: [PATCH 0366/1490] evidently: Use constants for strings --- .../evidently/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/evidently/service_endpoints_gen_test.go b/internal/service/evidently/service_endpoints_gen_test.go index 7e46408c6b3..902db3f060a 100644 --- a/internal/service/evidently/service_endpoints_gen_test.go +++ b/internal/service/evidently/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f0d592966cc9f6f95022f9c2adefc39409127688 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:06 -0400 Subject: [PATCH 0367/1490] finspace: Use constants for strings --- .../finspace/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/finspace/service_endpoints_gen_test.go b/internal/service/finspace/service_endpoints_gen_test.go index c13b22b076c..71a7696e3b7 100644 --- a/internal/service/finspace/service_endpoints_gen_test.go +++ b/internal/service/finspace/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7d297607f5c62f2b73a7627cc869f47e9a228bf9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:06 -0400 Subject: [PATCH 0368/1490] firehose: Use constants for strings --- internal/service/firehose/delivery_stream.go | 6 ++--- .../firehose/service_endpoints_gen_test.go | 24 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index 13ec823c29f..42d35597e97 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -735,7 +735,7 @@ func resourceDeliveryStream() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "access_key": { + names.AttrAccessKey: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 4096), @@ -2938,7 +2938,7 @@ func expandHTTPEndpointConfiguration(ep map[string]interface{}) *types.HttpEndpo endpointConfiguration.Name = aws.String(Name.(string)) } - if AccessKey, ok := ep["access_key"]; ok { + if AccessKey, ok := ep[names.AttrAccessKey]; ok { endpointConfiguration.AccessKey = aws.String(AccessKey.(string)) } @@ -3812,7 +3812,7 @@ func flattenHTTPEndpointDestinationDescription(description *types.HttpEndpointDe return []map[string]interface{}{} } m := map[string]interface{}{ - "access_key": configuredAccessKey, + names.AttrAccessKey: configuredAccessKey, "url": aws.ToString(description.EndpointConfiguration.Url), names.AttrName: aws.ToString(description.EndpointConfiguration.Name), names.AttrRoleARN: aws.ToString(description.RoleARN), diff --git a/internal/service/firehose/service_endpoints_gen_test.go b/internal/service/firehose/service_endpoints_gen_test.go index 0640a2bcc35..496e92b9fc4 100644 --- a/internal/service/firehose/service_endpoints_gen_test.go +++ b/internal/service/firehose/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 1f4a45491ae66d3532e30fb1e3283d9c2400cb58 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:07 -0400 Subject: [PATCH 0369/1490] fis: Use constants for strings --- .../service/fis/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/fis/service_endpoints_gen_test.go b/internal/service/fis/service_endpoints_gen_test.go index 64d5b785a26..c6ba3e1834e 100644 --- a/internal/service/fis/service_endpoints_gen_test.go +++ b/internal/service/fis/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From be88e58ccfe7981b95c2befa86be342acafd0a95 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:07 -0400 Subject: [PATCH 0370/1490] fms: Use constants for strings --- .../service/fms/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/fms/service_endpoints_gen_test.go b/internal/service/fms/service_endpoints_gen_test.go index 421a66d699d..7af6d5b06d0 100644 --- a/internal/service/fms/service_endpoints_gen_test.go +++ b/internal/service/fms/service_endpoints_gen_test.go @@ -260,12 +260,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -336,17 +336,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -489,10 +489,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 491804a7eec08bbc171c3181be6f67b3321634b2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:07 -0400 Subject: [PATCH 0371/1490] fsx: Use constants for strings --- internal/service/fsx/ontap_file_system.go | 4 ++-- .../fsx/ontap_file_system_data_source.go | 4 ++-- .../fsx/ontap_storage_virtual_machine.go | 4 ++-- ...tap_storage_virtual_machine_data_source.go | 4 ++-- .../ontap_storage_virtual_machine_migrate.go | 2 +- .../service/fsx/service_endpoints_gen_test.go | 24 +++++++++---------- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/internal/service/fsx/ontap_file_system.go b/internal/service/fsx/ontap_file_system.go index aa796bdebaa..1e9aab43999 100644 --- a/internal/service/fsx/ontap_file_system.go +++ b/internal/service/fsx/ontap_file_system.go @@ -104,7 +104,7 @@ func resourceONTAPFileSystem() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidIPv4CIDRNetworkAddress, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -367,7 +367,7 @@ func resourceONTAPFileSystemRead(ctx context.Context, d *schema.ResourceData, me } d.Set("dns_name", filesystem.DNSName) d.Set("endpoint_ip_address_range", ontapConfig.EndpointIpAddressRange) - if err := d.Set("endpoints", flattenOntapFileSystemEndpoints(ontapConfig.Endpoints)); err != nil { + if err := d.Set(names.AttrEndpoints, flattenOntapFileSystemEndpoints(ontapConfig.Endpoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoints: %s", err) } d.Set("fsx_admin_password", d.Get("fsx_admin_password").(string)) diff --git a/internal/service/fsx/ontap_file_system_data_source.go b/internal/service/fsx/ontap_file_system_data_source.go index 73ebe6f5c70..9e479b150f8 100644 --- a/internal/service/fsx/ontap_file_system_data_source.go +++ b/internal/service/fsx/ontap_file_system_data_source.go @@ -63,7 +63,7 @@ func dataSourceONTAPFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -194,7 +194,7 @@ func dataSourceONTAPFileSystemRead(ctx context.Context, d *schema.ResourceData, } d.Set("dns_name", filesystem.DNSName) d.Set("endpoint_ip_address_range", ontapConfig.EndpointIpAddressRange) - if err := d.Set("endpoints", flattenOntapFileSystemEndpoints(ontapConfig.Endpoints)); err != nil { + if err := d.Set(names.AttrEndpoints, flattenOntapFileSystemEndpoints(ontapConfig.Endpoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoints: %s", err) } haPairs := aws.Int64Value(ontapConfig.HAPairs) diff --git a/internal/service/fsx/ontap_storage_virtual_machine.go b/internal/service/fsx/ontap_storage_virtual_machine.go index c446e7363b6..7a11f2fca1c 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine.go +++ b/internal/service/fsx/ontap_storage_virtual_machine.go @@ -121,7 +121,7 @@ func resourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -295,7 +295,7 @@ func resourceONTAPStorageVirtualMachineRead(ctx context.Context, d *schema.Resou return sdkdiag.AppendErrorf(diags, "setting active_directory_configuration: %s", err) } d.Set(names.AttrARN, storageVirtualMachine.ResourceARN) - if err := d.Set("endpoints", flattenSvmEndpoints(storageVirtualMachine.Endpoints)); err != nil { + if err := d.Set(names.AttrEndpoints, flattenSvmEndpoints(storageVirtualMachine.Endpoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoints: %s", err) } d.Set("file_system_id", storageVirtualMachine.FileSystemId) 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 0e613e415e6..574de360a2a 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go @@ -74,7 +74,7 @@ func dataSourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -225,7 +225,7 @@ func dataSourceONTAPStorageVirtualMachineRead(ctx context.Context, d *schema.Res } d.Set(names.AttrARN, svm.ResourceARN) d.Set("creation_time", svm.CreationTime.Format(time.RFC3339)) - if err := d.Set("endpoints", flattenSvmEndpoints(svm.Endpoints)); err != nil { + if err := d.Set(names.AttrEndpoints, flattenSvmEndpoints(svm.Endpoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoints: %s", err) } d.Set("file_system_id", svm.FileSystemId) diff --git a/internal/service/fsx/ontap_storage_virtual_machine_migrate.go b/internal/service/fsx/ontap_storage_virtual_machine_migrate.go index e1f978e02c8..52c685eebaf 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_migrate.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_migrate.go @@ -97,7 +97,7 @@ func resourceONTAPStorageVirtualMachineV0() *schema.Resource { }, }, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ diff --git a/internal/service/fsx/service_endpoints_gen_test.go b/internal/service/fsx/service_endpoints_gen_test.go index 3cc1697bcda..42ef2a774c8 100644 --- a/internal/service/fsx/service_endpoints_gen_test.go +++ b/internal/service/fsx/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 28aaabc2458963e344482ee286085c0ccd173572 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:07 -0400 Subject: [PATCH 0372/1490] gamelift: Use constants for strings --- .../gamelift/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/gamelift/service_endpoints_gen_test.go b/internal/service/gamelift/service_endpoints_gen_test.go index e59e09f6b0d..5727368a067 100644 --- a/internal/service/gamelift/service_endpoints_gen_test.go +++ b/internal/service/gamelift/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From dea0d5e3bf303345f4007a875617adfa74ca47a7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:07 -0400 Subject: [PATCH 0373/1490] glacier: Use constants for strings --- .../glacier/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/glacier/service_endpoints_gen_test.go b/internal/service/glacier/service_endpoints_gen_test.go index ca0f2c31c7b..c9f257076e9 100644 --- a/internal/service/glacier/service_endpoints_gen_test.go +++ b/internal/service/glacier/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7cb7aa9d3fa11745087ce74a6ecd2ecb452d28f3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:07 -0400 Subject: [PATCH 0374/1490] globalaccelerator: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/globalaccelerator/service_endpoints_gen_test.go b/internal/service/globalaccelerator/service_endpoints_gen_test.go index 1139bb68b69..82027593496 100644 --- a/internal/service/globalaccelerator/service_endpoints_gen_test.go +++ b/internal/service/globalaccelerator/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a9e7c137be1267fa02c38802b84dbc7f9b93137a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:08 -0400 Subject: [PATCH 0375/1490] glue: Use constants for strings --- .../glue/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/glue/service_endpoints_gen_test.go b/internal/service/glue/service_endpoints_gen_test.go index ccd468a4c11..aa567925fe7 100644 --- a/internal/service/glue/service_endpoints_gen_test.go +++ b/internal/service/glue/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 996a1a79736be86235d965d6620cb9453edfeba2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:08 -0400 Subject: [PATCH 0376/1490] grafana: Use constants for strings --- .../grafana/service_endpoints_gen_test.go | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/service/grafana/service_endpoints_gen_test.go b/internal/service/grafana/service_endpoints_gen_test.go index 5e97c93f7a1..cc98dcf7e7e 100644 --- a/internal/service/grafana/service_endpoints_gen_test.go +++ b/internal/service/grafana/service_endpoints_gen_test.go @@ -361,38 +361,38 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func withAliasName1EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName1] = aliasName1ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, aliasName1, @@ -479,17 +479,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -632,10 +632,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f4a7d9b86e84663aaa587a9ead32a7aa273932db Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:08 -0400 Subject: [PATCH 0377/1490] greengrass: Use constants for strings --- .../greengrass/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/greengrass/service_endpoints_gen_test.go b/internal/service/greengrass/service_endpoints_gen_test.go index 126ee400e5c..2ba42b0a8b6 100644 --- a/internal/service/greengrass/service_endpoints_gen_test.go +++ b/internal/service/greengrass/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From ad186cbd989099a5e9a8f2c73217e24d3158a388 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:08 -0400 Subject: [PATCH 0378/1490] groundstation: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/groundstation/service_endpoints_gen_test.go b/internal/service/groundstation/service_endpoints_gen_test.go index 460d4e93e5c..ef0005fde54 100644 --- a/internal/service/groundstation/service_endpoints_gen_test.go +++ b/internal/service/groundstation/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 446d8a73b7615bc12909bc32494996b8118485bb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:08 -0400 Subject: [PATCH 0379/1490] guardduty: Use constants for strings --- .../guardduty/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/guardduty/service_endpoints_gen_test.go b/internal/service/guardduty/service_endpoints_gen_test.go index d0775ea1542..d4825156cc7 100644 --- a/internal/service/guardduty/service_endpoints_gen_test.go +++ b/internal/service/guardduty/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From cb96fa67e9bae17bf8d72b361d5b4dd21eb4d901 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:08 -0400 Subject: [PATCH 0380/1490] healthlake: Use constants for strings --- .../healthlake/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/healthlake/service_endpoints_gen_test.go b/internal/service/healthlake/service_endpoints_gen_test.go index 1d864e17967..d4a48f7ea1f 100644 --- a/internal/service/healthlake/service_endpoints_gen_test.go +++ b/internal/service/healthlake/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From e176c4715d6681ee1aa2499bb4762e899654d99a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:08 -0400 Subject: [PATCH 0381/1490] iam: Use constants for strings --- .../service/iam/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/iam/service_endpoints_gen_test.go b/internal/service/iam/service_endpoints_gen_test.go index 0aad82c9863..470fa66e08a 100644 --- a/internal/service/iam/service_endpoints_gen_test.go +++ b/internal/service/iam/service_endpoints_gen_test.go @@ -368,12 +368,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -470,17 +470,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -623,10 +623,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 0712b055aa7e91e1bc4b0eab678a9a10e39fce4b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:09 -0400 Subject: [PATCH 0382/1490] identitystore: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/identitystore/service_endpoints_gen_test.go b/internal/service/identitystore/service_endpoints_gen_test.go index 2140bfc089a..39ea1dd7a23 100644 --- a/internal/service/identitystore/service_endpoints_gen_test.go +++ b/internal/service/identitystore/service_endpoints_gen_test.go @@ -260,12 +260,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -336,17 +336,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -489,10 +489,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 0c07626ca1af750188dd9e376aa4bdbe89cf90e7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:09 -0400 Subject: [PATCH 0383/1490] imagebuilder: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/imagebuilder/service_endpoints_gen_test.go b/internal/service/imagebuilder/service_endpoints_gen_test.go index 1652375e1fd..f9fff8e3312 100644 --- a/internal/service/imagebuilder/service_endpoints_gen_test.go +++ b/internal/service/imagebuilder/service_endpoints_gen_test.go @@ -250,12 +250,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -326,17 +326,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -479,10 +479,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 52f66cc02a9dcefda778a3314fecc6f986f2a301 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:09 -0400 Subject: [PATCH 0384/1490] inspector: Use constants for strings --- .../inspector/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/inspector/service_endpoints_gen_test.go b/internal/service/inspector/service_endpoints_gen_test.go index 87930ae696e..f8a988a46c7 100644 --- a/internal/service/inspector/service_endpoints_gen_test.go +++ b/internal/service/inspector/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f039ded0f89891b88162ec05035004e68d597511 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:09 -0400 Subject: [PATCH 0385/1490] inspector2: Use constants for strings --- .../inspector2/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/inspector2/service_endpoints_gen_test.go b/internal/service/inspector2/service_endpoints_gen_test.go index 9c7542f123e..ac53a95763c 100644 --- a/internal/service/inspector2/service_endpoints_gen_test.go +++ b/internal/service/inspector2/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From bed59d32cf5fc49504cb110d7cefff1bde5ae14c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:09 -0400 Subject: [PATCH 0386/1490] internetmonitor: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/internetmonitor/service_endpoints_gen_test.go b/internal/service/internetmonitor/service_endpoints_gen_test.go index 27e208f2837..6c276530abc 100644 --- a/internal/service/internetmonitor/service_endpoints_gen_test.go +++ b/internal/service/internetmonitor/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 63356b934a8f8302f3b67b47a3524da021b9b360 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:09 -0400 Subject: [PATCH 0387/1490] iot: Use constants for strings --- .../service/iot/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/iot/service_endpoints_gen_test.go b/internal/service/iot/service_endpoints_gen_test.go index 9d5bf421ee0..ac58b3a1b03 100644 --- a/internal/service/iot/service_endpoints_gen_test.go +++ b/internal/service/iot/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 69d91b6fa3d0c0ea3a4786bd412830cd62cbf4f8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:09 -0400 Subject: [PATCH 0388/1490] iotanalytics: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/iotanalytics/service_endpoints_gen_test.go b/internal/service/iotanalytics/service_endpoints_gen_test.go index a564c9d76d6..4c1dfdbaf62 100644 --- a/internal/service/iotanalytics/service_endpoints_gen_test.go +++ b/internal/service/iotanalytics/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 04d1d3328a5c0f43f816aaa0b747e9e7e56980e8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:09 -0400 Subject: [PATCH 0389/1490] iotevents: Use constants for strings --- .../iotevents/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/iotevents/service_endpoints_gen_test.go b/internal/service/iotevents/service_endpoints_gen_test.go index ae0c602e267..e79f26a6294 100644 --- a/internal/service/iotevents/service_endpoints_gen_test.go +++ b/internal/service/iotevents/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 95aa24d06b9f70838ca6a0cae4efe276bcad0007 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:10 -0400 Subject: [PATCH 0390/1490] ivs: Use constants for strings --- .../service/ivs/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ivs/service_endpoints_gen_test.go b/internal/service/ivs/service_endpoints_gen_test.go index e5a8eafe34f..7924fa53d30 100644 --- a/internal/service/ivs/service_endpoints_gen_test.go +++ b/internal/service/ivs/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 3707eb1f34692cce608bacfadeb7635226669b20 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:10 -0400 Subject: [PATCH 0391/1490] ivschat: Use constants for strings --- .../ivschat/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ivschat/service_endpoints_gen_test.go b/internal/service/ivschat/service_endpoints_gen_test.go index 27aa8fca237..51f682be261 100644 --- a/internal/service/ivschat/service_endpoints_gen_test.go +++ b/internal/service/ivschat/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 1b3312a8a90c26663b5234e940e81136f0e73fd9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:10 -0400 Subject: [PATCH 0392/1490] kafka: Use constants for strings --- .../service/kafka/broker_nodes_data_source.go | 5 +-- .../kafka/service_endpoints_gen_test.go | 32 +++++++++---------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/internal/service/kafka/broker_nodes_data_source.go b/internal/service/kafka/broker_nodes_data_source.go index 6bd13319894..e6961b2cc4e 100644 --- a/internal/service/kafka/broker_nodes_data_source.go +++ b/internal/service/kafka/broker_nodes_data_source.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_msk_broker_nodes", name="Broker Nodes") @@ -49,7 +50,7 @@ func dataSourceBrokerNodes() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -101,7 +102,7 @@ func dataSourceBrokerNodesRead(ctx context.Context, d *schema.ResourceData, meta "broker_id": aws.ToFloat64(brokerNodeInfo.BrokerId), "client_subnet": aws.ToString(brokerNodeInfo.ClientSubnet), "client_vpc_ip_address": aws.ToString(brokerNodeInfo.ClientVpcIpAddress), - "endpoints": brokerNodeInfo.Endpoints, + names.AttrEndpoints: brokerNodeInfo.Endpoints, "node_arn": aws.ToString(apiObject.NodeARN), } tfList = append(tfList, tfMap) diff --git a/internal/service/kafka/service_endpoints_gen_test.go b/internal/service/kafka/service_endpoints_gen_test.go index af53d92ee11..bb8768fcedc 100644 --- a/internal/service/kafka/service_endpoints_gen_test.go +++ b/internal/service/kafka/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 948ab8233aac81462fd6a28dc92045b9e3b6520a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:10 -0400 Subject: [PATCH 0393/1490] kafkaconnect: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/kafkaconnect/service_endpoints_gen_test.go b/internal/service/kafkaconnect/service_endpoints_gen_test.go index 3626023a0ab..0a6e2880978 100644 --- a/internal/service/kafkaconnect/service_endpoints_gen_test.go +++ b/internal/service/kafkaconnect/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From ccdb7d876a8bae9b10a598678af34654d4b0f062 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:10 -0400 Subject: [PATCH 0394/1490] kendra: Use constants for strings --- internal/service/kendra/experience.go | 4 ++-- .../service/kendra/experience_data_source.go | 4 ++-- .../kendra/service_endpoints_gen_test.go | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/kendra/experience.go b/internal/service/kendra/experience.go index 0f19a491e68..a38e53130ee 100644 --- a/internal/service/kendra/experience.go +++ b/internal/service/kendra/experience.go @@ -124,7 +124,7 @@ func ResourceExperience() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(0, 1000), }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ @@ -257,7 +257,7 @@ func resourceExperienceRead(ctx context.Context, d *schema.ResourceData, meta in d.Set(names.AttrRoleARN, out.RoleArn) d.Set(names.AttrStatus, out.Status) - if err := d.Set("endpoints", flattenEndpoints(out.Endpoints)); err != nil { + if err := d.Set(names.AttrEndpoints, flattenEndpoints(out.Endpoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoints argument: %s", err) } diff --git a/internal/service/kendra/experience_data_source.go b/internal/service/kendra/experience_data_source.go index a7a6e7ffeb9..89f5ce5cb6d 100644 --- a/internal/service/kendra/experience_data_source.go +++ b/internal/service/kendra/experience_data_source.go @@ -82,7 +82,7 @@ func DataSourceExperience() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ @@ -177,7 +177,7 @@ func dataSourceExperienceRead(ctx context.Context, d *schema.ResourceData, meta return sdkdiag.AppendErrorf(diags, "setting configuration argument: %s", err) } - if err := d.Set("endpoints", flattenEndpoints(resp.Endpoints)); err != nil { + if err := d.Set(names.AttrEndpoints, flattenEndpoints(resp.Endpoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoints argument: %s", err) } diff --git a/internal/service/kendra/service_endpoints_gen_test.go b/internal/service/kendra/service_endpoints_gen_test.go index c4e7f11658d..0e7a8d9d9e2 100644 --- a/internal/service/kendra/service_endpoints_gen_test.go +++ b/internal/service/kendra/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 9262cbadcdb0aff50c9eae23ba4660dbc79f5f51 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:10 -0400 Subject: [PATCH 0395/1490] keyspaces: Use constants for strings --- .../keyspaces/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/keyspaces/service_endpoints_gen_test.go b/internal/service/keyspaces/service_endpoints_gen_test.go index a5586e5385e..2e206c98515 100644 --- a/internal/service/keyspaces/service_endpoints_gen_test.go +++ b/internal/service/keyspaces/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From e05cf555724d9b2c1c01bcd64d5f2c5681fcd1d7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:10 -0400 Subject: [PATCH 0396/1490] kinesis: Use constants for strings --- .../kinesis/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/kinesis/service_endpoints_gen_test.go b/internal/service/kinesis/service_endpoints_gen_test.go index d2ab586f647..1ed40283b87 100644 --- a/internal/service/kinesis/service_endpoints_gen_test.go +++ b/internal/service/kinesis/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 36374e5433db073647048994412b6d4b17375d4d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:11 -0400 Subject: [PATCH 0397/1490] kinesisanalytics: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/kinesisanalytics/service_endpoints_gen_test.go b/internal/service/kinesisanalytics/service_endpoints_gen_test.go index 02aa2d37a65..b91ba50a9dc 100644 --- a/internal/service/kinesisanalytics/service_endpoints_gen_test.go +++ b/internal/service/kinesisanalytics/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 86ca2158bc8ed8ffef5f5bc4c3fb01386111c828 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:11 -0400 Subject: [PATCH 0398/1490] kinesisanalyticsv2: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go b/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go index c87d95b5da4..2eee2232c40 100644 --- a/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go +++ b/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a605540d18b16c40770c39eb27637286e279ee97 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:11 -0400 Subject: [PATCH 0399/1490] kinesisvideo: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/kinesisvideo/service_endpoints_gen_test.go b/internal/service/kinesisvideo/service_endpoints_gen_test.go index e8da41dc690..3539c0dd629 100644 --- a/internal/service/kinesisvideo/service_endpoints_gen_test.go +++ b/internal/service/kinesisvideo/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 380c0997fa467169f3e20ad280c665869aeb2e96 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:11 -0400 Subject: [PATCH 0400/1490] kms: Use constants for strings --- .../service/kms/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/kms/service_endpoints_gen_test.go b/internal/service/kms/service_endpoints_gen_test.go index 4ceb04aaf47..22e311ea0e4 100644 --- a/internal/service/kms/service_endpoints_gen_test.go +++ b/internal/service/kms/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From d72c0b4bea0ecc489d9cfb3cdd7035dd655da90e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:11 -0400 Subject: [PATCH 0401/1490] lakeformation: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/lakeformation/service_endpoints_gen_test.go b/internal/service/lakeformation/service_endpoints_gen_test.go index eac536b226c..5e38d669d38 100644 --- a/internal/service/lakeformation/service_endpoints_gen_test.go +++ b/internal/service/lakeformation/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From dc76eaf8973c431a4c65b441e32cfa211eb1c895 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:11 -0400 Subject: [PATCH 0402/1490] lambda: Use constants for strings --- .../service/lambda/event_source_mapping.go | 6 ++--- .../lambda/service_endpoints_gen_test.go | 24 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/service/lambda/event_source_mapping.go b/internal/service/lambda/event_source_mapping.go index af8cde41fea..f0f51c204d3 100644 --- a/internal/service/lambda/event_source_mapping.go +++ b/internal/service/lambda/event_source_mapping.go @@ -263,7 +263,7 @@ func resourceEventSourceMapping() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeMap, Required: true, ForceNew: true, @@ -978,7 +978,7 @@ func expandSelfManagedEventSource(tfMap map[string]interface{}) *awstypes.SelfMa apiObject := &awstypes.SelfManagedEventSource{} - if v, ok := tfMap["endpoints"].(map[string]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrEndpoints].(map[string]interface{}); ok && len(v) > 0 { m := map[string][]string{} for k, v := range v { @@ -1005,7 +1005,7 @@ func flattenSelfManagedEventSource(apiObject *awstypes.SelfManagedEventSource) m m[k] = strings.Join(v, ",") } - tfMap["endpoints"] = m + tfMap[names.AttrEndpoints] = m } return tfMap diff --git a/internal/service/lambda/service_endpoints_gen_test.go b/internal/service/lambda/service_endpoints_gen_test.go index 6c8479517b2..efbce328afa 100644 --- a/internal/service/lambda/service_endpoints_gen_test.go +++ b/internal/service/lambda/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 6d413a2e02e7f3547c70ba99653592c2ff314573 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:11 -0400 Subject: [PATCH 0403/1490] launchwizard: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/launchwizard/service_endpoints_gen_test.go b/internal/service/launchwizard/service_endpoints_gen_test.go index 316e3cec417..d95375dc08a 100644 --- a/internal/service/launchwizard/service_endpoints_gen_test.go +++ b/internal/service/launchwizard/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From fd9143e801fb3e702f9aa9a235985fc6f8c19a2e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:12 -0400 Subject: [PATCH 0404/1490] lexmodels: Use constants for strings --- .../lexmodels/service_endpoints_gen_test.go | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/internal/service/lexmodels/service_endpoints_gen_test.go b/internal/service/lexmodels/service_endpoints_gen_test.go index 2eb06ea47e2..705e94430a3 100644 --- a/internal/service/lexmodels/service_endpoints_gen_test.go +++ b/internal/service/lexmodels/service_endpoints_gen_test.go @@ -428,48 +428,48 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func withAliasName1EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName1] = aliasName1ConfigEndpoint } func withAliasName2EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName2] = aliasName2ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, aliasName1, @@ -563,17 +563,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -716,10 +716,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 14449ef0ae59767e545a89c70bd742e3865df802 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:12 -0400 Subject: [PATCH 0405/1490] lexv2models: Use constants for strings --- .../lexv2models/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/lexv2models/service_endpoints_gen_test.go b/internal/service/lexv2models/service_endpoints_gen_test.go index 10e13c775b3..429fc683f0e 100644 --- a/internal/service/lexv2models/service_endpoints_gen_test.go +++ b/internal/service/lexv2models/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 4eb8b06149830904d35542766abe971a610a4b7c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:12 -0400 Subject: [PATCH 0406/1490] licensemanager: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/licensemanager/service_endpoints_gen_test.go b/internal/service/licensemanager/service_endpoints_gen_test.go index bb378dd4958..f471472976f 100644 --- a/internal/service/licensemanager/service_endpoints_gen_test.go +++ b/internal/service/licensemanager/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 46cdb126fd1d672c51919f99aaaa802fd7781cb7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:12 -0400 Subject: [PATCH 0407/1490] lightsail: Use constants for strings --- .../lightsail/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/lightsail/service_endpoints_gen_test.go b/internal/service/lightsail/service_endpoints_gen_test.go index dad8a9e0806..52c61806fa0 100644 --- a/internal/service/lightsail/service_endpoints_gen_test.go +++ b/internal/service/lightsail/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7d0d2f645251009ee85f13ba258fa7ba95f1e880 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:12 -0400 Subject: [PATCH 0408/1490] location: Use constants for strings --- .../location/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/location/service_endpoints_gen_test.go b/internal/service/location/service_endpoints_gen_test.go index 1e0fe517166..2c85ffce643 100644 --- a/internal/service/location/service_endpoints_gen_test.go +++ b/internal/service/location/service_endpoints_gen_test.go @@ -302,28 +302,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -403,17 +403,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -556,10 +556,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From e74d256cf9f847682f6468120403be75dced951c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:12 -0400 Subject: [PATCH 0409/1490] logs: Use constants for strings --- .../logs/service_endpoints_gen_test.go | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/service/logs/service_endpoints_gen_test.go b/internal/service/logs/service_endpoints_gen_test.go index c1f1891489a..8c2254a6dd1 100644 --- a/internal/service/logs/service_endpoints_gen_test.go +++ b/internal/service/logs/service_endpoints_gen_test.go @@ -371,38 +371,38 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func withAliasName1EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName1] = aliasName1ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, aliasName1, @@ -489,17 +489,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -642,10 +642,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 5042a76ca80a599644b1a8fbd51ef4b81cf9f45d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:12 -0400 Subject: [PATCH 0410/1490] lookoutmetrics: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/lookoutmetrics/service_endpoints_gen_test.go b/internal/service/lookoutmetrics/service_endpoints_gen_test.go index e48ef8bcf0b..43c120839db 100644 --- a/internal/service/lookoutmetrics/service_endpoints_gen_test.go +++ b/internal/service/lookoutmetrics/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From ac193938fe24bcf1e55880dba1bf3488ef38cafc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:13 -0400 Subject: [PATCH 0411/1490] m2: Use constants for strings --- .../service/m2/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/m2/service_endpoints_gen_test.go b/internal/service/m2/service_endpoints_gen_test.go index 36623b63717..c63e94d23ac 100644 --- a/internal/service/m2/service_endpoints_gen_test.go +++ b/internal/service/m2/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 789fe2ea5c315e4ef640282ee499b0c52cbf392b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:13 -0400 Subject: [PATCH 0412/1490] macie2: Use constants for strings --- .../macie2/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/macie2/service_endpoints_gen_test.go b/internal/service/macie2/service_endpoints_gen_test.go index c3ac7c68af1..0bda240cdd7 100644 --- a/internal/service/macie2/service_endpoints_gen_test.go +++ b/internal/service/macie2/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 01fcfef3bb95254d9fcf0c4d8b0a188042cc4501 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:13 -0400 Subject: [PATCH 0413/1490] mediaconnect: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/mediaconnect/service_endpoints_gen_test.go b/internal/service/mediaconnect/service_endpoints_gen_test.go index 5f432b54203..d727747bb0e 100644 --- a/internal/service/mediaconnect/service_endpoints_gen_test.go +++ b/internal/service/mediaconnect/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 588c7ff11095600b128c85a4a17059da47c8743f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:13 -0400 Subject: [PATCH 0414/1490] mediaconvert: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/mediaconvert/service_endpoints_gen_test.go b/internal/service/mediaconvert/service_endpoints_gen_test.go index c7c74303678..d5a74f989b8 100644 --- a/internal/service/mediaconvert/service_endpoints_gen_test.go +++ b/internal/service/mediaconvert/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 2c75b87a4b8f0e471c5088495230e441c4c7700b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:13 -0400 Subject: [PATCH 0415/1490] medialive: Use constants for strings --- .../channel_encoder_settings_schema.go | 18 +++++++------- internal/service/medialive/channel_test.go | 4 ++-- .../medialive/service_endpoints_gen_test.go | 24 +++++++++---------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index 28588d83b50..7627414704b 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -166,7 +166,7 @@ func channelEncoderSettingsSchema() *schema.Schema { Computed: true, ValidateDiagFunc: enum.Validate[types.AacInputType](), }, - "profile": { + names.AttrProfile: { Type: schema.TypeString, Optional: true, Computed: true, @@ -1524,7 +1524,7 @@ func channelEncoderSettingsSchema() *schema.Schema { Optional: true, Computed: true, }, - "profile": { + names.AttrProfile: { Type: schema.TypeString, Optional: true, Computed: true, @@ -1797,7 +1797,7 @@ func channelEncoderSettingsSchema() *schema.Schema { Type: schema.TypeInt, Optional: true, }, - "profile": { + names.AttrProfile: { Type: schema.TypeString, Optional: true, Computed: true, @@ -3257,7 +3257,7 @@ func expandAudioDescriptionsCodecSettingsAacSettings(tfList []interface{}) *type if v, ok := m["input_type"].(string); ok && v != "" { out.InputType = types.AacInputType(v) } - if v, ok := m["profile"].(string); ok && v != "" { + if v, ok := m[names.AttrProfile].(string); ok && v != "" { out.Profile = types.AacProfile(v) } if v, ok := m["rate_control_mode"].(string); ok && v != "" { @@ -5466,7 +5466,7 @@ func expandsVideoDescriptionsCodecSettingsH264Settings(tfList []interface{}) *ty if v, ok := m["par_numerator"].(int); ok && v != 0 { out.ParNumerator = aws.Int32(int32(v)) } - if v, ok := m["profile"].(string); ok && v != "" { + if v, ok := m[names.AttrProfile].(string); ok && v != "" { out.Profile = types.H264Profile(v) } if v, ok := m["quality_level"].(string); ok && v != "" { @@ -5613,7 +5613,7 @@ func expandsVideoDescriptionsCodecSettingsH265Settings(tfList []interface{}) *ty if v, ok := m["par_numerator"].(int); ok && v != 0 { out.ParNumerator = aws.Int32(int32(v)) } - if v, ok := m["profile"].(string); ok && v != "" { + if v, ok := m[names.AttrProfile].(string); ok && v != "" { out.Profile = types.H265Profile(v) } if v, ok := m["qvbr_quality_level"].(int); ok && v != 0 { @@ -6954,7 +6954,7 @@ func flattenCodecSettingsH264Settings(in *types.H264Settings) []interface{} { "par_control": string(in.ParControl), "par_denominator": int(aws.ToInt32(in.ParDenominator)), "par_numerator": int(aws.ToInt32(in.ParNumerator)), - "profile": string(in.Profile), + names.AttrProfile: string(in.Profile), "quality_level": string(in.QualityLevel), "qvbr_quality_level": int(aws.ToInt32(in.QvbrQualityLevel)), "rate_control_mode": string(in.RateControlMode), @@ -7023,7 +7023,7 @@ func flattenCodecSettingsH265Settings(in *types.H265Settings) []interface{} { "min_i_interval": int(aws.ToInt32(in.MinIInterval)), "par_denominator": int(aws.ToInt32(in.ParDenominator)), "par_numerator": int(aws.ToInt32(in.ParNumerator)), - "profile": string(in.Profile), + names.AttrProfile: string(in.Profile), "qvbr_quality_level": int(aws.ToInt32(in.QvbrQualityLevel)), "rate_control_mode": string(in.RateControlMode), "scan_type": string(in.ScanType), @@ -7181,7 +7181,7 @@ func flattenCodecSettingsAacSettings(in *types.AacSettings) []interface{} { "bitrate": in.Bitrate, "coding_mode": string(in.CodingMode), "input_type": string(in.InputType), - "profile": string(in.Profile), + names.AttrProfile: string(in.Profile), "rate_control_mode": string(in.RateControlMode), "raw_format": string(in.RawFormat), "sample_rate": in.SampleRate, diff --git a/internal/service/medialive/channel_test.go b/internal/service/medialive/channel_test.go index f310b4e73c5..7d1539827d7 100644 --- a/internal/service/medialive/channel_test.go +++ b/internal/service/medialive/channel_test.go @@ -466,7 +466,7 @@ func TestAccMediaLiveChannel_VideoDescriptions_CodecSettings_h264Settings(t *tes "par_control": "INITIALIZE_FROM_SOURCE", "par_denominator": "0", "par_numerator": "0", - "profile": "HIGH", + names.AttrProfile: "HIGH", "quality_level": "", "qvbr_quality_level": "0", "rate_control_mode": "CBR", @@ -557,7 +557,7 @@ func TestAccMediaLiveChannel_VideoDescriptions_CodecSettings_h265Settings(t *tes "level": "H265_LEVEL_AUTO", "look_ahead_rate_control": "HIGH", "min_i_interval": "6", - "profile": "MAIN_10BIT", + names.AttrProfile: "MAIN_10BIT", "rate_control_mode": "CBR", "scan_type": "PROGRESSIVE", "scene_change_detect": "ENABLED", diff --git a/internal/service/medialive/service_endpoints_gen_test.go b/internal/service/medialive/service_endpoints_gen_test.go index 9ace61c22ec..c827c2dab96 100644 --- a/internal/service/medialive/service_endpoints_gen_test.go +++ b/internal/service/medialive/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From af6e92d77c26d5da2be9fe5f1b2e20222ab110b5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:13 -0400 Subject: [PATCH 0416/1490] mediapackage: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/mediapackage/service_endpoints_gen_test.go b/internal/service/mediapackage/service_endpoints_gen_test.go index 445c8dd80a8..466af5cecc6 100644 --- a/internal/service/mediapackage/service_endpoints_gen_test.go +++ b/internal/service/mediapackage/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 6e6e80ef3ba67cfe5d646b4cfcb48c866ed002a7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:13 -0400 Subject: [PATCH 0417/1490] mediapackagev2: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/mediapackagev2/service_endpoints_gen_test.go b/internal/service/mediapackagev2/service_endpoints_gen_test.go index cc5976ac2b8..95b64c865e3 100644 --- a/internal/service/mediapackagev2/service_endpoints_gen_test.go +++ b/internal/service/mediapackagev2/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 1654d7206084ee5b366807164c491da96f7774be Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:14 -0400 Subject: [PATCH 0418/1490] mediastore: Use constants for strings --- .../mediastore/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/mediastore/service_endpoints_gen_test.go b/internal/service/mediastore/service_endpoints_gen_test.go index 23a79ade2c9..933a6c57af3 100644 --- a/internal/service/mediastore/service_endpoints_gen_test.go +++ b/internal/service/mediastore/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a5a5455488dada76a29f06625851ea22462b149e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:14 -0400 Subject: [PATCH 0419/1490] memorydb: Use constants for strings --- .../memorydb/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/memorydb/service_endpoints_gen_test.go b/internal/service/memorydb/service_endpoints_gen_test.go index 7c000b8908a..3d0084b0c27 100644 --- a/internal/service/memorydb/service_endpoints_gen_test.go +++ b/internal/service/memorydb/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From ba05a9f68c3f00f19014669cce1d2ab3b6d62955 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:14 -0400 Subject: [PATCH 0420/1490] mq: Use constants for strings --- internal/service/mq/broker.go | 4 ++-- internal/service/mq/broker_data_source.go | 2 +- .../service/mq/service_endpoints_gen_test.go | 24 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/service/mq/broker.go b/internal/service/mq/broker.go index 681cb8dd9ed..dc7a70f7af6 100644 --- a/internal/service/mq/broker.go +++ b/internal/service/mq/broker.go @@ -180,7 +180,7 @@ func resourceBroker() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -1125,7 +1125,7 @@ func flattenBrokerInstances(instances []types.BrokerInstance) []interface{} { m["console_url"] = aws.ToString(instance.ConsoleURL) } if len(instance.Endpoints) > 0 { - m["endpoints"] = instance.Endpoints + m[names.AttrEndpoints] = instance.Endpoints } if instance.IpAddress != nil { m["ip_address"] = aws.ToString(instance.IpAddress) diff --git a/internal/service/mq/broker_data_source.go b/internal/service/mq/broker_data_source.go index 43b42589b21..99c5e2604cf 100644 --- a/internal/service/mq/broker_data_source.go +++ b/internal/service/mq/broker_data_source.go @@ -107,7 +107,7 @@ func dataSourceBroker() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, diff --git a/internal/service/mq/service_endpoints_gen_test.go b/internal/service/mq/service_endpoints_gen_test.go index ebf95054e8f..d1ecaab0aff 100644 --- a/internal/service/mq/service_endpoints_gen_test.go +++ b/internal/service/mq/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 54a711ceae4e8600207f8487825df1e026cfd55c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:14 -0400 Subject: [PATCH 0421/1490] neptune: Use constants for strings --- .../neptune/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/neptune/service_endpoints_gen_test.go b/internal/service/neptune/service_endpoints_gen_test.go index 9cc41fd4f77..63cf08f0436 100644 --- a/internal/service/neptune/service_endpoints_gen_test.go +++ b/internal/service/neptune/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From ac577ca35d821ae5c277f9550eb2ab03d59b3e6c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:14 -0400 Subject: [PATCH 0422/1490] networkfirewall: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/networkfirewall/service_endpoints_gen_test.go b/internal/service/networkfirewall/service_endpoints_gen_test.go index 6df2ad30d5e..4ef3ef4940e 100644 --- a/internal/service/networkfirewall/service_endpoints_gen_test.go +++ b/internal/service/networkfirewall/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 4260a8482bfc5061c0c6294cffc7ebbcdb8455e8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:14 -0400 Subject: [PATCH 0423/1490] networkmanager: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/networkmanager/service_endpoints_gen_test.go b/internal/service/networkmanager/service_endpoints_gen_test.go index 78aa3e757e3..cd05c6e308a 100644 --- a/internal/service/networkmanager/service_endpoints_gen_test.go +++ b/internal/service/networkmanager/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From d2dd18093bd819600bfbb1af7ce8701d370fad8d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:14 -0400 Subject: [PATCH 0424/1490] oam: Use constants for strings --- .../service/oam/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/oam/service_endpoints_gen_test.go b/internal/service/oam/service_endpoints_gen_test.go index ff6f4fce908..5d859a0d535 100644 --- a/internal/service/oam/service_endpoints_gen_test.go +++ b/internal/service/oam/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 144192d8b7123cd763dd6839c27fa3463993c224 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:15 -0400 Subject: [PATCH 0425/1490] opensearch: Use constants for strings --- .../opensearch/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/opensearch/service_endpoints_gen_test.go b/internal/service/opensearch/service_endpoints_gen_test.go index fd010cec78b..eac11e26a2b 100644 --- a/internal/service/opensearch/service_endpoints_gen_test.go +++ b/internal/service/opensearch/service_endpoints_gen_test.go @@ -302,28 +302,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -403,17 +403,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -556,10 +556,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 137d89fb7fba66fa359b7b58cf435dbfcd2cd3ab Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:15 -0400 Subject: [PATCH 0426/1490] opensearchserverless: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/opensearchserverless/service_endpoints_gen_test.go b/internal/service/opensearchserverless/service_endpoints_gen_test.go index 21c3bef2105..c1cb08d22a6 100644 --- a/internal/service/opensearchserverless/service_endpoints_gen_test.go +++ b/internal/service/opensearchserverless/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 4359f206299d447eb382d4701daf998c1cb2677c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:15 -0400 Subject: [PATCH 0427/1490] opsworks: Use constants for strings --- .../opsworks/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/opsworks/service_endpoints_gen_test.go b/internal/service/opsworks/service_endpoints_gen_test.go index 05d5185e765..27a86500bed 100644 --- a/internal/service/opsworks/service_endpoints_gen_test.go +++ b/internal/service/opsworks/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From cd79c610f0605b1382bcd9f6c85fdcffa14ccf11 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:15 -0400 Subject: [PATCH 0428/1490] organizations: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/organizations/service_endpoints_gen_test.go b/internal/service/organizations/service_endpoints_gen_test.go index 0ffa11658cb..07a120fe630 100644 --- a/internal/service/organizations/service_endpoints_gen_test.go +++ b/internal/service/organizations/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 71dd3a02a85535a07d399414f64dc0703c0b8db6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:15 -0400 Subject: [PATCH 0429/1490] osis: Use constants for strings --- .../osis/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/osis/service_endpoints_gen_test.go b/internal/service/osis/service_endpoints_gen_test.go index c85633088a7..c1805137737 100644 --- a/internal/service/osis/service_endpoints_gen_test.go +++ b/internal/service/osis/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f05461fea009edbabf7855e1b27842407e706a63 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:15 -0400 Subject: [PATCH 0430/1490] outposts: Use constants for strings --- .../outposts/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/outposts/service_endpoints_gen_test.go b/internal/service/outposts/service_endpoints_gen_test.go index bcf74df0887..31116f13eb6 100644 --- a/internal/service/outposts/service_endpoints_gen_test.go +++ b/internal/service/outposts/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 672f0789e51982a132d1c87cf60a975b68c068e0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:15 -0400 Subject: [PATCH 0431/1490] pcaconnectorad: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/pcaconnectorad/service_endpoints_gen_test.go b/internal/service/pcaconnectorad/service_endpoints_gen_test.go index 9e17e83eb33..d678a4cd581 100644 --- a/internal/service/pcaconnectorad/service_endpoints_gen_test.go +++ b/internal/service/pcaconnectorad/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From e88cd10226d33e01735a803a0371ac9184bd2d3e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:16 -0400 Subject: [PATCH 0432/1490] pinpoint: Use constants for strings --- internal/service/pinpoint/baidu_channel.go | 4 ++-- .../service/pinpoint/baidu_channel_test.go | 6 ++--- .../pinpoint/service_endpoints_gen_test.go | 24 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/service/pinpoint/baidu_channel.go b/internal/service/pinpoint/baidu_channel.go index 7c13d959123..c64caa91c18 100644 --- a/internal/service/pinpoint/baidu_channel.go +++ b/internal/service/pinpoint/baidu_channel.go @@ -44,7 +44,7 @@ func ResourceBaiduChannel() *schema.Resource { Required: true, Sensitive: true, }, - "secret_key": { + names.AttrSecretKey: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -63,7 +63,7 @@ func resourceBaiduChannelUpsert(ctx context.Context, d *schema.ResourceData, met params.Enabled = aws.Bool(d.Get(names.AttrEnabled).(bool)) params.ApiKey = aws.String(d.Get("api_key").(string)) - params.SecretKey = aws.String(d.Get("secret_key").(string)) + params.SecretKey = aws.String(d.Get(names.AttrSecretKey).(string)) req := pinpoint.UpdateBaiduChannelInput{ ApplicationId: aws.String(applicationId), diff --git a/internal/service/pinpoint/baidu_channel_test.go b/internal/service/pinpoint/baidu_channel_test.go index ba9e540a606..d965f2d26c8 100644 --- a/internal/service/pinpoint/baidu_channel_test.go +++ b/internal/service/pinpoint/baidu_channel_test.go @@ -39,14 +39,14 @@ func TestAccPinpointBaiduChannel_basic(t *testing.T) { testAccCheckBaiduChannelExists(ctx, resourceName, &channel), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "false"), resource.TestCheckResourceAttr(resourceName, "api_key", apiKey), - resource.TestCheckResourceAttr(resourceName, "secret_key", secretKey), + resource.TestCheckResourceAttr(resourceName, names.AttrSecretKey, secretKey), ), }, { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"api_key", "secret_key"}, + ImportStateVerifyIgnore: []string{"api_key", names.AttrSecretKey}, }, { Config: testAccBaiduChannelConfig_basic(apikeyUpdated, secretKey), @@ -54,7 +54,7 @@ func TestAccPinpointBaiduChannel_basic(t *testing.T) { testAccCheckBaiduChannelExists(ctx, resourceName, &channel), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "false"), resource.TestCheckResourceAttr(resourceName, "api_key", apikeyUpdated), - resource.TestCheckResourceAttr(resourceName, "secret_key", secretKey), + resource.TestCheckResourceAttr(resourceName, names.AttrSecretKey, secretKey), ), }, }, diff --git a/internal/service/pinpoint/service_endpoints_gen_test.go b/internal/service/pinpoint/service_endpoints_gen_test.go index 68542db537b..d96cee26ac2 100644 --- a/internal/service/pinpoint/service_endpoints_gen_test.go +++ b/internal/service/pinpoint/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7c868c1fad1cddf2285f9a7ca7e6b4a0e041a31d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:16 -0400 Subject: [PATCH 0433/1490] pipes: Use constants for strings --- .../pipes/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/pipes/service_endpoints_gen_test.go b/internal/service/pipes/service_endpoints_gen_test.go index 5234d793b3f..30b329712c6 100644 --- a/internal/service/pipes/service_endpoints_gen_test.go +++ b/internal/service/pipes/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a21a467aad0bc6a74deb3fb6e9ed0d8c65b7ab89 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:16 -0400 Subject: [PATCH 0434/1490] polly: Use constants for strings --- .../polly/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/polly/service_endpoints_gen_test.go b/internal/service/polly/service_endpoints_gen_test.go index 6da7c97d310..2eeee019cd6 100644 --- a/internal/service/polly/service_endpoints_gen_test.go +++ b/internal/service/polly/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From fc764773845b3e22d6ae375dac88c1ef3d627d5e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:16 -0400 Subject: [PATCH 0435/1490] pricing: Use constants for strings --- .../pricing/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/pricing/service_endpoints_gen_test.go b/internal/service/pricing/service_endpoints_gen_test.go index 97d3fdac3ea..78537db0223 100644 --- a/internal/service/pricing/service_endpoints_gen_test.go +++ b/internal/service/pricing/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From bb3c80659caf7bb08e8a5a20d430ce265b9be70b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:16 -0400 Subject: [PATCH 0436/1490] qbusiness: Use constants for strings --- .../qbusiness/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/qbusiness/service_endpoints_gen_test.go b/internal/service/qbusiness/service_endpoints_gen_test.go index 0fb6a387f6a..79c30a9191d 100644 --- a/internal/service/qbusiness/service_endpoints_gen_test.go +++ b/internal/service/qbusiness/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 23ec65dc2365768371b2a079b7ad18f0c57389cf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:16 -0400 Subject: [PATCH 0437/1490] qldb: Use constants for strings --- .../qldb/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/qldb/service_endpoints_gen_test.go b/internal/service/qldb/service_endpoints_gen_test.go index 0330c2031ad..d01cb3c42f8 100644 --- a/internal/service/qldb/service_endpoints_gen_test.go +++ b/internal/service/qldb/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 1b8f14a5cd687801d03a2156d730fd404f3db379 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:16 -0400 Subject: [PATCH 0438/1490] quicksight: Use constants for strings --- .../quicksight/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/quicksight/service_endpoints_gen_test.go b/internal/service/quicksight/service_endpoints_gen_test.go index fa7810404b0..0b04982beb3 100644 --- a/internal/service/quicksight/service_endpoints_gen_test.go +++ b/internal/service/quicksight/service_endpoints_gen_test.go @@ -251,12 +251,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -327,17 +327,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -480,10 +480,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 8ee815d6c4388068eae68b684eaa058ed1a43ca5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:17 -0400 Subject: [PATCH 0439/1490] ram: Use constants for strings --- .../service/ram/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ram/service_endpoints_gen_test.go b/internal/service/ram/service_endpoints_gen_test.go index 93302e6c24c..d94110368c3 100644 --- a/internal/service/ram/service_endpoints_gen_test.go +++ b/internal/service/ram/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 9a6b113ee34d29b8d758ff9ec852844b32df4417 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:17 -0400 Subject: [PATCH 0440/1490] rbin: Use constants for strings --- .../rbin/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/rbin/service_endpoints_gen_test.go b/internal/service/rbin/service_endpoints_gen_test.go index 0e8265757cc..5d0997b6b91 100644 --- a/internal/service/rbin/service_endpoints_gen_test.go +++ b/internal/service/rbin/service_endpoints_gen_test.go @@ -315,28 +315,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -416,17 +416,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -569,10 +569,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f64c81dde77a62ce233378177cc3ea4c97b6b8bf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:17 -0400 Subject: [PATCH 0441/1490] rds: Use constants for strings --- .../service/rds/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/rds/service_endpoints_gen_test.go b/internal/service/rds/service_endpoints_gen_test.go index 7d05e7fb02a..a7e5cab4e8d 100644 --- a/internal/service/rds/service_endpoints_gen_test.go +++ b/internal/service/rds/service_endpoints_gen_test.go @@ -285,12 +285,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -361,17 +361,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -514,10 +514,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 726d75a7e268123cde33751b9f940697ca4cece2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:17 -0400 Subject: [PATCH 0442/1490] redshift: Use constants for strings --- .../redshift/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/redshift/service_endpoints_gen_test.go b/internal/service/redshift/service_endpoints_gen_test.go index 6af348852bc..e1b18a0ec3c 100644 --- a/internal/service/redshift/service_endpoints_gen_test.go +++ b/internal/service/redshift/service_endpoints_gen_test.go @@ -285,12 +285,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -361,17 +361,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -514,10 +514,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f5bf3ede71358c52d49e163faa1785bc69a0abb4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:17 -0400 Subject: [PATCH 0443/1490] redshiftdata: Use constants for strings --- .../service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/redshiftdata/service_endpoints_gen_test.go b/internal/service/redshiftdata/service_endpoints_gen_test.go index 79ba840c617..f00ac227e39 100644 --- a/internal/service/redshiftdata/service_endpoints_gen_test.go +++ b/internal/service/redshiftdata/service_endpoints_gen_test.go @@ -314,28 +314,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -415,17 +415,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -568,10 +568,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7be26eb1363363e7607ff3c06517dec1ca387f5d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:17 -0400 Subject: [PATCH 0444/1490] redshiftserverless: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/redshiftserverless/service_endpoints_gen_test.go b/internal/service/redshiftserverless/service_endpoints_gen_test.go index c6461a03ad1..618dbd5cd35 100644 --- a/internal/service/redshiftserverless/service_endpoints_gen_test.go +++ b/internal/service/redshiftserverless/service_endpoints_gen_test.go @@ -285,12 +285,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -361,17 +361,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -514,10 +514,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From fa334cdfd16b488b958214fc8f346dc38fb47a99 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:17 -0400 Subject: [PATCH 0445/1490] rekognition: Use constants for strings --- .../rekognition/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/rekognition/service_endpoints_gen_test.go b/internal/service/rekognition/service_endpoints_gen_test.go index fe1790a21c7..266c85ca0e8 100644 --- a/internal/service/rekognition/service_endpoints_gen_test.go +++ b/internal/service/rekognition/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 5d7968c3bd3c0e9c8f872e68d5b6682d7ad58995 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:18 -0400 Subject: [PATCH 0446/1490] resourceexplorer2: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/resourceexplorer2/service_endpoints_gen_test.go b/internal/service/resourceexplorer2/service_endpoints_gen_test.go index b4b9522325b..a60e8970564 100644 --- a/internal/service/resourceexplorer2/service_endpoints_gen_test.go +++ b/internal/service/resourceexplorer2/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 70703d05241c63748d87d288cb9073b173e2189f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:18 -0400 Subject: [PATCH 0447/1490] resourcegroups: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/resourcegroups/service_endpoints_gen_test.go b/internal/service/resourcegroups/service_endpoints_gen_test.go index cf9507abee3..f32428f8d26 100644 --- a/internal/service/resourcegroups/service_endpoints_gen_test.go +++ b/internal/service/resourcegroups/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 8b47db1b14ede045719a29688e5db38a1d1ad70b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:18 -0400 Subject: [PATCH 0448/1490] resourcegroupstaggingapi: Use constants for strings --- .../service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go b/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go index 3451de73ad6..018fa8417d2 100644 --- a/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go +++ b/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 05da7853fdb3dbc03091f77ac30ce924c3c02250 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:18 -0400 Subject: [PATCH 0449/1490] rolesanywhere: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/rolesanywhere/service_endpoints_gen_test.go b/internal/service/rolesanywhere/service_endpoints_gen_test.go index 2b14b5e20cd..7f45063e721 100644 --- a/internal/service/rolesanywhere/service_endpoints_gen_test.go +++ b/internal/service/rolesanywhere/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f21de1b33f3ff8e1c349afce137fd73ff2ce41a2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:18 -0400 Subject: [PATCH 0450/1490] route53: Use constants for strings --- .../route53/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/route53/service_endpoints_gen_test.go b/internal/service/route53/service_endpoints_gen_test.go index e3a6c251034..9a7ff24b754 100644 --- a/internal/service/route53/service_endpoints_gen_test.go +++ b/internal/service/route53/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From f9d8eeeab7892292cc88e1feba48abcfa9e25164 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:18 -0400 Subject: [PATCH 0451/1490] route53domains: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/route53domains/service_endpoints_gen_test.go b/internal/service/route53domains/service_endpoints_gen_test.go index d27c620543e..c32df7830cd 100644 --- a/internal/service/route53domains/service_endpoints_gen_test.go +++ b/internal/service/route53domains/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 54ba75812c90954982cd5d26305a7d9e8f0291ad Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:18 -0400 Subject: [PATCH 0452/1490] route53recoverycontrolconfig: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go b/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go index c200232efe5..12ac686a8fe 100644 --- a/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go +++ b/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From e404a2b89d97f0c3dfeab463f390849061dd8266 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:19 -0400 Subject: [PATCH 0453/1490] route53recoveryreadiness: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go b/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go index ab0ca949576..1ce6c2c96ec 100644 --- a/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go +++ b/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go @@ -250,12 +250,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -326,17 +326,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -479,10 +479,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 5d63a412ebcc395484372c7c040ed1c7ed17cd76 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:19 -0400 Subject: [PATCH 0454/1490] route53resolver: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/route53resolver/service_endpoints_gen_test.go b/internal/service/route53resolver/service_endpoints_gen_test.go index 59fed173093..90e4805f08f 100644 --- a/internal/service/route53resolver/service_endpoints_gen_test.go +++ b/internal/service/route53resolver/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 0d9e3b22f602a69d17332ad1e76e4925c95405fa Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:19 -0400 Subject: [PATCH 0455/1490] rum: Use constants for strings --- .../service/rum/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/rum/service_endpoints_gen_test.go b/internal/service/rum/service_endpoints_gen_test.go index f01cff7f8e7..04d9db3348d 100644 --- a/internal/service/rum/service_endpoints_gen_test.go +++ b/internal/service/rum/service_endpoints_gen_test.go @@ -302,28 +302,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -403,17 +403,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -556,10 +556,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7112aefb38f58d4a8ffc9948427ab26f791003b1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:19 -0400 Subject: [PATCH 0456/1490] s3: Use constants for strings --- .../service/s3/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/s3/service_endpoints_gen_test.go b/internal/service/s3/service_endpoints_gen_test.go index e18b2507a7c..3b81901d22b 100644 --- a/internal/service/s3/service_endpoints_gen_test.go +++ b/internal/service/s3/service_endpoints_gen_test.go @@ -436,28 +436,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -563,17 +563,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -716,10 +716,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 65dbce72d09ba93da68fff7e1a7718e81b5400e4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:19 -0400 Subject: [PATCH 0457/1490] s3control: Use constants for strings --- internal/service/s3control/access_point.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/s3control/access_point.go b/internal/service/s3control/access_point.go index 7c5991bbd78..0e17d10ddba 100644 --- a/internal/service/s3control/access_point.go +++ b/internal/service/s3control/access_point.go @@ -70,7 +70,7 @@ func resourceAccessPoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoints": { + names.AttrEndpoints: { Type: schema.TypeMap, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -285,7 +285,7 @@ func resourceAccessPointRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("alias", output.Alias) d.Set("bucket_account_id", output.BucketAccountId) d.Set(names.AttrDomainName, meta.(*conns.AWSClient).RegionalHostname(ctx, fmt.Sprintf("%s-%s.s3-accesspoint", aws.ToString(output.Name), accountID))) - d.Set("endpoints", output.Endpoints) + d.Set(names.AttrEndpoints, output.Endpoints) d.Set(names.AttrName, output.Name) d.Set("network_origin", output.NetworkOrigin) if output.PublicAccessBlockConfiguration != nil { From 2c09506f73f72d91b35ce701371c7d533e1c9ff6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:19 -0400 Subject: [PATCH 0458/1490] s3outposts: Use constants for strings --- .../s3outposts/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/s3outposts/service_endpoints_gen_test.go b/internal/service/s3outposts/service_endpoints_gen_test.go index 33c6c0c1b6d..60c953f464e 100644 --- a/internal/service/s3outposts/service_endpoints_gen_test.go +++ b/internal/service/s3outposts/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 91436cd8d6572131ae69e423ea67f4063a33abce Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:19 -0400 Subject: [PATCH 0459/1490] sagemaker: Use constants for strings --- .../sagemaker/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/sagemaker/service_endpoints_gen_test.go b/internal/service/sagemaker/service_endpoints_gen_test.go index 14f832ae689..58d43a1906a 100644 --- a/internal/service/sagemaker/service_endpoints_gen_test.go +++ b/internal/service/sagemaker/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 75db01411b5bdfdb379e3e1d183cb7b1720b27ea Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:20 -0400 Subject: [PATCH 0460/1490] scheduler: Use constants for strings --- .../scheduler/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/scheduler/service_endpoints_gen_test.go b/internal/service/scheduler/service_endpoints_gen_test.go index 6d8b7717dce..df245aac79c 100644 --- a/internal/service/scheduler/service_endpoints_gen_test.go +++ b/internal/service/scheduler/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 35920787bc76cb493fdaf34d6a035578332823a2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:20 -0400 Subject: [PATCH 0461/1490] schemas: Use constants for strings --- .../schemas/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/schemas/service_endpoints_gen_test.go b/internal/service/schemas/service_endpoints_gen_test.go index ef161cd9721..3aacc0107aa 100644 --- a/internal/service/schemas/service_endpoints_gen_test.go +++ b/internal/service/schemas/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 2fe90e063bc0b0c7a496fcff9e821cf848743756 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:20 -0400 Subject: [PATCH 0462/1490] secretsmanager: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/secretsmanager/service_endpoints_gen_test.go b/internal/service/secretsmanager/service_endpoints_gen_test.go index b19695e445e..43efbe3d49a 100644 --- a/internal/service/secretsmanager/service_endpoints_gen_test.go +++ b/internal/service/secretsmanager/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From de368bfe3133214babc6cd0a27b12b7bf309bf60 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:20 -0400 Subject: [PATCH 0463/1490] securityhub: Use constants for strings --- .../securityhub/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/securityhub/service_endpoints_gen_test.go b/internal/service/securityhub/service_endpoints_gen_test.go index a1a56b3429f..fdc90655ced 100644 --- a/internal/service/securityhub/service_endpoints_gen_test.go +++ b/internal/service/securityhub/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From e47c0da714dbfc0e1b722340a9d1a53a1fa769bf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:20 -0400 Subject: [PATCH 0464/1490] securitylake: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/securitylake/service_endpoints_gen_test.go b/internal/service/securitylake/service_endpoints_gen_test.go index bc7de5cda41..cf154376b7f 100644 --- a/internal/service/securitylake/service_endpoints_gen_test.go +++ b/internal/service/securitylake/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 811a463a208a4c8fc81e46071715d53378b3c1cb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:20 -0400 Subject: [PATCH 0465/1490] serverlessrepo: Use constants for strings --- .../service_endpoints_gen_test.go | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/service/serverlessrepo/service_endpoints_gen_test.go b/internal/service/serverlessrepo/service_endpoints_gen_test.go index 596352b35ba..acba450124d 100644 --- a/internal/service/serverlessrepo/service_endpoints_gen_test.go +++ b/internal/service/serverlessrepo/service_endpoints_gen_test.go @@ -361,38 +361,38 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func withAliasName1EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName1] = aliasName1ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, aliasName1, @@ -479,17 +479,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -632,10 +632,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From d0c0f30605b8e0d0e438ef75ad72bb27ac65ef16 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:20 -0400 Subject: [PATCH 0466/1490] servicecatalog: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/servicecatalog/service_endpoints_gen_test.go b/internal/service/servicecatalog/service_endpoints_gen_test.go index ab52effe752..1cec30dfa0a 100644 --- a/internal/service/servicecatalog/service_endpoints_gen_test.go +++ b/internal/service/servicecatalog/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 080d5ab7e37f32587759ee6e86dd43484d6f0dfb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:21 -0400 Subject: [PATCH 0467/1490] servicecatalogappregistry: Use constants for strings --- .../service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go b/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go index c0729d9f85b..b3ea1822c7d 100644 --- a/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go +++ b/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 6eb9d5c082bfc5de2bb427972ef0bbd4dcb30b01 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:21 -0400 Subject: [PATCH 0468/1490] servicediscovery: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/servicediscovery/service_endpoints_gen_test.go b/internal/service/servicediscovery/service_endpoints_gen_test.go index 39c4aa3bd45..436ee8a181b 100644 --- a/internal/service/servicediscovery/service_endpoints_gen_test.go +++ b/internal/service/servicediscovery/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 1760f18cd9f5be444f2532611f76e132b7ba5358 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:21 -0400 Subject: [PATCH 0469/1490] servicequotas: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/servicequotas/service_endpoints_gen_test.go b/internal/service/servicequotas/service_endpoints_gen_test.go index dd49bb76650..47c8998c553 100644 --- a/internal/service/servicequotas/service_endpoints_gen_test.go +++ b/internal/service/servicequotas/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From e3d8efceaac1b112ca9ea93f10a64d76df705cfa Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:21 -0400 Subject: [PATCH 0470/1490] ses: Use constants for strings --- .../service/ses/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ses/service_endpoints_gen_test.go b/internal/service/ses/service_endpoints_gen_test.go index dad22756215..241f2d77b1b 100644 --- a/internal/service/ses/service_endpoints_gen_test.go +++ b/internal/service/ses/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 81e3def94d3a91a8364559f27c417cba1c8c239b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:21 -0400 Subject: [PATCH 0471/1490] sesv2: Use constants for strings --- .../sesv2/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/sesv2/service_endpoints_gen_test.go b/internal/service/sesv2/service_endpoints_gen_test.go index bb6cc14fe2a..5ef41e7fd03 100644 --- a/internal/service/sesv2/service_endpoints_gen_test.go +++ b/internal/service/sesv2/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From dfa03a7f37f04847c1803d01a7084377934f0248 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:21 -0400 Subject: [PATCH 0472/1490] sfn: Use constants for strings --- .../service/sfn/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/sfn/service_endpoints_gen_test.go b/internal/service/sfn/service_endpoints_gen_test.go index 64f3a6e2a26..178e2022bca 100644 --- a/internal/service/sfn/service_endpoints_gen_test.go +++ b/internal/service/sfn/service_endpoints_gen_test.go @@ -302,28 +302,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -403,17 +403,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -556,10 +556,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From ac31b914d2561495bb0f41e38648d04ca9a1726c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:21 -0400 Subject: [PATCH 0473/1490] shield: Use constants for strings --- .../shield/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/shield/service_endpoints_gen_test.go b/internal/service/shield/service_endpoints_gen_test.go index 671bd991c34..1c3815e41fd 100644 --- a/internal/service/shield/service_endpoints_gen_test.go +++ b/internal/service/shield/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 45f2f40ecd6c698cd19545a192acdda48176d3c7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:21 -0400 Subject: [PATCH 0474/1490] signer: Use constants for strings --- .../signer/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/signer/service_endpoints_gen_test.go b/internal/service/signer/service_endpoints_gen_test.go index 95888d1fb28..3255f1fcbcc 100644 --- a/internal/service/signer/service_endpoints_gen_test.go +++ b/internal/service/signer/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 17591886ddbd2bd046f08f70544f63a1db87382e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:22 -0400 Subject: [PATCH 0475/1490] simpledb: Use constants for strings --- .../simpledb/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/simpledb/service_endpoints_gen_test.go b/internal/service/simpledb/service_endpoints_gen_test.go index 24791dc064f..996993e04da 100644 --- a/internal/service/simpledb/service_endpoints_gen_test.go +++ b/internal/service/simpledb/service_endpoints_gen_test.go @@ -302,28 +302,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -403,17 +403,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -556,10 +556,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a0d67b78577444e34c32a31daa3fd2f7e0568e13 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:22 -0400 Subject: [PATCH 0476/1490] sns: Use constants for strings --- .../service/sns/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/sns/service_endpoints_gen_test.go b/internal/service/sns/service_endpoints_gen_test.go index f6c08734529..2467e06f121 100644 --- a/internal/service/sns/service_endpoints_gen_test.go +++ b/internal/service/sns/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 62564f9bcd8e3db16c3149e873127990b5da4b2e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:22 -0400 Subject: [PATCH 0477/1490] sqs: Use constants for strings --- .../service/sqs/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/sqs/service_endpoints_gen_test.go b/internal/service/sqs/service_endpoints_gen_test.go index c7c4741bc66..e5d9f53f323 100644 --- a/internal/service/sqs/service_endpoints_gen_test.go +++ b/internal/service/sqs/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From cd97b8d2054c127accbfe9423dbc3cb515cf83f6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:22 -0400 Subject: [PATCH 0478/1490] ssm: Use constants for strings --- .../service/ssm/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ssm/service_endpoints_gen_test.go b/internal/service/ssm/service_endpoints_gen_test.go index 54ad18bf4cf..016523562bc 100644 --- a/internal/service/ssm/service_endpoints_gen_test.go +++ b/internal/service/ssm/service_endpoints_gen_test.go @@ -285,12 +285,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -361,17 +361,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -514,10 +514,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 84149e9e78cbfa032273d0268e27c7f99687f8b5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:22 -0400 Subject: [PATCH 0479/1490] ssmcontacts: Use constants for strings --- .../ssmcontacts/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ssmcontacts/service_endpoints_gen_test.go b/internal/service/ssmcontacts/service_endpoints_gen_test.go index 5c414a11ce2..bed510fe7ba 100644 --- a/internal/service/ssmcontacts/service_endpoints_gen_test.go +++ b/internal/service/ssmcontacts/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From e8966aa64c860fd7e30697b86c005d70f43bb1cf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:22 -0400 Subject: [PATCH 0480/1490] ssmincidents: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ssmincidents/service_endpoints_gen_test.go b/internal/service/ssmincidents/service_endpoints_gen_test.go index 32c241c8959..4ad1200e9cc 100644 --- a/internal/service/ssmincidents/service_endpoints_gen_test.go +++ b/internal/service/ssmincidents/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 5d7ae87ab9f101b248acd0bc2239557dace96638 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:22 -0400 Subject: [PATCH 0481/1490] ssmsap: Use constants for strings --- .../ssmsap/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ssmsap/service_endpoints_gen_test.go b/internal/service/ssmsap/service_endpoints_gen_test.go index a2920555ae8..8b1c2bb5d36 100644 --- a/internal/service/ssmsap/service_endpoints_gen_test.go +++ b/internal/service/ssmsap/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From a6de4b4855d2b3f3a83ba2b438505491e2480a39 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:23 -0400 Subject: [PATCH 0482/1490] sso: Use constants for strings --- .../service/sso/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/sso/service_endpoints_gen_test.go b/internal/service/sso/service_endpoints_gen_test.go index 9e3fa38d54a..2fa57e841dd 100644 --- a/internal/service/sso/service_endpoints_gen_test.go +++ b/internal/service/sso/service_endpoints_gen_test.go @@ -260,12 +260,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -336,17 +336,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -489,10 +489,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 77fb208a1fe44887b2049fdc812160f6c11ddfa1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:23 -0400 Subject: [PATCH 0483/1490] ssoadmin: Use constants for strings --- .../ssoadmin/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ssoadmin/service_endpoints_gen_test.go b/internal/service/ssoadmin/service_endpoints_gen_test.go index 431057d1c83..0957f262ad9 100644 --- a/internal/service/ssoadmin/service_endpoints_gen_test.go +++ b/internal/service/ssoadmin/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From b2380e039a9a348d4d4f8449bf481b88b211b3b6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:23 -0400 Subject: [PATCH 0484/1490] storagegateway: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/storagegateway/service_endpoints_gen_test.go b/internal/service/storagegateway/service_endpoints_gen_test.go index b49f588b21f..6e6dcfb81b6 100644 --- a/internal/service/storagegateway/service_endpoints_gen_test.go +++ b/internal/service/storagegateway/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From e53d56fd2ca78e278122cfb62b6d54c1d748197d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:23 -0400 Subject: [PATCH 0485/1490] sts: Use constants for strings --- .../service/sts/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/sts/service_endpoints_gen_test.go b/internal/service/sts/service_endpoints_gen_test.go index 73408250efe..17a7494c200 100644 --- a/internal/service/sts/service_endpoints_gen_test.go +++ b/internal/service/sts/service_endpoints_gen_test.go @@ -368,12 +368,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -470,17 +470,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -623,10 +623,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 045878f6eabcdb1480baa4f87e216adb40a48d7e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:24 -0400 Subject: [PATCH 0486/1490] swf: Use constants for strings --- .../service/swf/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/swf/service_endpoints_gen_test.go b/internal/service/swf/service_endpoints_gen_test.go index 1932fe34a0b..8bf4b1a5c97 100644 --- a/internal/service/swf/service_endpoints_gen_test.go +++ b/internal/service/swf/service_endpoints_gen_test.go @@ -260,12 +260,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -336,17 +336,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -489,10 +489,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 65737bca239ae8325c7a32ffee8226adfae4a0fb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:24 -0400 Subject: [PATCH 0487/1490] synthetics: Use constants for strings --- .../synthetics/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/synthetics/service_endpoints_gen_test.go b/internal/service/synthetics/service_endpoints_gen_test.go index a922ddae89b..9a6cc74674d 100644 --- a/internal/service/synthetics/service_endpoints_gen_test.go +++ b/internal/service/synthetics/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 20c31b49c36a06638798c774a9e9be54fecb6d61 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:24 -0400 Subject: [PATCH 0488/1490] transcribe: Use constants for strings --- .../transcribe/service_endpoints_gen_test.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/transcribe/service_endpoints_gen_test.go b/internal/service/transcribe/service_endpoints_gen_test.go index 54186218565..94295d22cea 100644 --- a/internal/service/transcribe/service_endpoints_gen_test.go +++ b/internal/service/transcribe/service_endpoints_gen_test.go @@ -312,28 +312,28 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } func withAliasName0EndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[aliasName0] = aliasName0ConfigEndpoint } func conflictsWith(e caseExpectations) caseExpectations { e.diags = append(e.diags, provider.ConflictingEndpointsWarningDiag( - cty.GetAttrPath("endpoints").IndexInt(0), + cty.GetAttrPath(names.AttrEndpoints).IndexInt(0), packageName, aliasName0, )) @@ -413,17 +413,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -566,10 +566,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From b7913b5f349b9cf7b30a9aaa65cfac15bfb2192b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:24 -0400 Subject: [PATCH 0489/1490] transfer: Use constants for strings --- .../transfer/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/transfer/service_endpoints_gen_test.go b/internal/service/transfer/service_endpoints_gen_test.go index 3fa83904d67..1a3d73a6377 100644 --- a/internal/service/transfer/service_endpoints_gen_test.go +++ b/internal/service/transfer/service_endpoints_gen_test.go @@ -285,12 +285,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -361,17 +361,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -514,10 +514,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 1edb1cc157b93e7f5fb1086304a862d4f7e90d4d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:25 -0400 Subject: [PATCH 0490/1490] verifiedpermissions: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/verifiedpermissions/service_endpoints_gen_test.go b/internal/service/verifiedpermissions/service_endpoints_gen_test.go index d6f59700d71..6c9e300e658 100644 --- a/internal/service/verifiedpermissions/service_endpoints_gen_test.go +++ b/internal/service/verifiedpermissions/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 6f4ffd457ee1b833497adbf3b81bffaba6a0836c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:25 -0400 Subject: [PATCH 0491/1490] vpclattice: Use constants for strings --- .../vpclattice/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/vpclattice/service_endpoints_gen_test.go b/internal/service/vpclattice/service_endpoints_gen_test.go index 1f4554b1cd5..6fd030eb25c 100644 --- a/internal/service/vpclattice/service_endpoints_gen_test.go +++ b/internal/service/vpclattice/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 4f30a0531ea1ef895085242ceabc7299094993af Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:25 -0400 Subject: [PATCH 0492/1490] waf: Use constants for strings --- .../service/waf/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/waf/service_endpoints_gen_test.go b/internal/service/waf/service_endpoints_gen_test.go index cba2183ee1e..87a620d6781 100644 --- a/internal/service/waf/service_endpoints_gen_test.go +++ b/internal/service/waf/service_endpoints_gen_test.go @@ -248,12 +248,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -324,17 +324,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -477,10 +477,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From c7b2fff718214172170625ae3193283be5bc0647 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:25 -0400 Subject: [PATCH 0493/1490] wafregional: Use constants for strings --- .../wafregional/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/wafregional/service_endpoints_gen_test.go b/internal/service/wafregional/service_endpoints_gen_test.go index 8f2f9ff36c3..61efd0637b1 100644 --- a/internal/service/wafregional/service_endpoints_gen_test.go +++ b/internal/service/wafregional/service_endpoints_gen_test.go @@ -249,12 +249,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -325,17 +325,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -478,10 +478,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 33331990905a1710f058d2cf241c346698a0f1bb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:25 -0400 Subject: [PATCH 0494/1490] wafv2: Use constants for strings --- .../wafv2/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/wafv2/service_endpoints_gen_test.go b/internal/service/wafv2/service_endpoints_gen_test.go index 566c1558f86..ec988601cb7 100644 --- a/internal/service/wafv2/service_endpoints_gen_test.go +++ b/internal/service/wafv2/service_endpoints_gen_test.go @@ -261,12 +261,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -337,17 +337,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -490,10 +490,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 7f889949dfcbbab44ad56852618176e14c0ef34a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:25 -0400 Subject: [PATCH 0495/1490] wellarchitected: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/wellarchitected/service_endpoints_gen_test.go b/internal/service/wellarchitected/service_endpoints_gen_test.go index 349cdfe924c..897c244e7d0 100644 --- a/internal/service/wellarchitected/service_endpoints_gen_test.go +++ b/internal/service/wellarchitected/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 72d46cce71a62db3146494a80685ed488bd63c7e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:26 -0400 Subject: [PATCH 0496/1490] worklink: Use constants for strings --- .../worklink/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/worklink/service_endpoints_gen_test.go b/internal/service/worklink/service_endpoints_gen_test.go index 55bf8108aa5..e2373a775ad 100644 --- a/internal/service/worklink/service_endpoints_gen_test.go +++ b/internal/service/worklink/service_endpoints_gen_test.go @@ -250,12 +250,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -326,17 +326,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -479,10 +479,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 2effacca568efe452898bff8a751bf05596b4d68 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:26 -0400 Subject: [PATCH 0497/1490] workspaces: Use constants for strings --- .../workspaces/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/workspaces/service_endpoints_gen_test.go b/internal/service/workspaces/service_endpoints_gen_test.go index 530b3396f5e..8eb822d3ffa 100644 --- a/internal/service/workspaces/service_endpoints_gen_test.go +++ b/internal/service/workspaces/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 54cc75419cf4f5ba17a4490dd4fd7398b748817c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:26 -0400 Subject: [PATCH 0498/1490] workspacesweb: Use constants for strings --- .../service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/workspacesweb/service_endpoints_gen_test.go b/internal/service/workspacesweb/service_endpoints_gen_test.go index 617589a470e..c0139ee5d07 100644 --- a/internal/service/workspacesweb/service_endpoints_gen_test.go +++ b/internal/service/workspacesweb/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 78085cefa62c2525e95f8b7bdf5a517812916eeb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:32:26 -0400 Subject: [PATCH 0499/1490] xray: Use constants for strings --- .../xray/service_endpoints_gen_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/xray/service_endpoints_gen_test.go b/internal/service/xray/service_endpoints_gen_test.go index 8ddb54c8230..cc86903f938 100644 --- a/internal/service/xray/service_endpoints_gen_test.go +++ b/internal/service/xray/service_endpoints_gen_test.go @@ -258,12 +258,12 @@ func withNoConfig(_ *caseSetup) { } func withPackageNameEndpointInConfig(setup *caseSetup) { - if _, ok := setup.config["endpoints"]; !ok { - setup.config["endpoints"] = []any{ + if _, ok := setup.config[names.AttrEndpoints]; !ok { + setup.config[names.AttrEndpoints] = []any{ map[string]any{}, } } - endpoints := setup.config["endpoints"].([]any)[0].(map[string]any) + endpoints := setup.config[names.AttrEndpoints].([]any)[0].(map[string]any) endpoints[packageName] = packageNameConfigEndpoint } @@ -334,17 +334,17 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - "access_key": servicemocks.MockStaticAccessKey, - "secret_key": servicemocks.MockStaticSecretKey, - names.AttrRegion: region, - "skip_credentials_validation": true, - "skip_requesting_account_id": true, + names.AccessKey: servicemocks.MockStaticAccessKey, + names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrRegion: region, + names.AttrSkipCredentialsValidation: true, + names.AttrSkipRequestingAccountID: true, } maps.Copy(config, setup.config) if setup.configFile.baseUrl != "" || setup.configFile.serviceUrl != "" { - config["profile"] = "default" + config[names.AttrProfile] = "default" tempDir := t.TempDir() writeSharedConfigFile(t, &config, tempDir, generateSharedConfigFile(setup.configFile)) } @@ -487,10 +487,10 @@ func writeSharedConfigFile(t *testing.T, config *map[string]any, tempDir, conten t.Fatalf(" writing shared configuration file: %s", err) } - if v, ok := (*config)["shared_config_files"]; !ok { - (*config)["shared_config_files"] = []any{file.Name()} + if v, ok := (*config)[names.AttrSharedConfigFiles]; !ok { + (*config)[names.AttrSharedConfigFiles] = []any{file.Name()} } else { - (*config)["shared_config_files"] = append(v.([]any), file.Name()) + (*config)[names.AttrSharedConfigFiles] = append(v.([]any), file.Name()) } return file.Name() From 84b9c48eda8dbaa1f20ebea35002ddf85007f144 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 15:36:20 -0400 Subject: [PATCH 0500/1490] generate: Fix constant --- internal/generate/serviceendpointtests/file.tmpl | 4 ++-- internal/service/accessanalyzer/service_endpoints_gen_test.go | 4 ++-- internal/service/account/service_endpoints_gen_test.go | 4 ++-- internal/service/acm/service_endpoints_gen_test.go | 4 ++-- internal/service/acmpca/service_endpoints_gen_test.go | 4 ++-- internal/service/amp/service_endpoints_gen_test.go | 4 ++-- internal/service/amplify/service_endpoints_gen_test.go | 4 ++-- internal/service/apigateway/service_endpoints_gen_test.go | 4 ++-- internal/service/apigatewayv2/service_endpoints_gen_test.go | 4 ++-- internal/service/appautoscaling/service_endpoints_gen_test.go | 4 ++-- internal/service/appconfig/service_endpoints_gen_test.go | 4 ++-- internal/service/appfabric/service_endpoints_gen_test.go | 4 ++-- internal/service/appflow/service_endpoints_gen_test.go | 4 ++-- .../service/appintegrations/service_endpoints_gen_test.go | 4 ++-- .../service/applicationinsights/service_endpoints_gen_test.go | 4 ++-- internal/service/appmesh/service_endpoints_gen_test.go | 4 ++-- internal/service/apprunner/service_endpoints_gen_test.go | 4 ++-- internal/service/appstream/service_endpoints_gen_test.go | 4 ++-- internal/service/appsync/service_endpoints_gen_test.go | 4 ++-- internal/service/athena/service_endpoints_gen_test.go | 4 ++-- internal/service/auditmanager/service_endpoints_gen_test.go | 4 ++-- internal/service/autoscaling/service_endpoints_gen_test.go | 4 ++-- .../service/autoscalingplans/service_endpoints_gen_test.go | 4 ++-- internal/service/backup/service_endpoints_gen_test.go | 4 ++-- internal/service/batch/service_endpoints_gen_test.go | 4 ++-- internal/service/bcmdataexports/service_endpoints_gen_test.go | 4 ++-- internal/service/bedrock/service_endpoints_gen_test.go | 4 ++-- internal/service/bedrockagent/service_endpoints_gen_test.go | 4 ++-- internal/service/budgets/service_endpoints_gen_test.go | 4 ++-- internal/service/ce/service_endpoints_gen_test.go | 4 ++-- internal/service/chatbot/service_endpoints_gen_test.go | 4 ++-- internal/service/chime/service_endpoints_gen_test.go | 4 ++-- .../chimesdkmediapipelines/service_endpoints_gen_test.go | 4 ++-- internal/service/chimesdkvoice/service_endpoints_gen_test.go | 4 ++-- internal/service/cleanrooms/service_endpoints_gen_test.go | 4 ++-- internal/service/cloud9/service_endpoints_gen_test.go | 4 ++-- internal/service/cloudcontrol/service_endpoints_gen_test.go | 4 ++-- internal/service/cloudformation/service_endpoints_gen_test.go | 4 ++-- internal/service/cloudfront/service_endpoints_gen_test.go | 4 ++-- internal/service/cloudhsmv2/service_endpoints_gen_test.go | 4 ++-- internal/service/cloudsearch/service_endpoints_gen_test.go | 4 ++-- internal/service/cloudtrail/service_endpoints_gen_test.go | 4 ++-- internal/service/cloudwatch/service_endpoints_gen_test.go | 4 ++-- internal/service/codeartifact/service_endpoints_gen_test.go | 4 ++-- internal/service/codebuild/service_endpoints_gen_test.go | 4 ++-- internal/service/codecommit/service_endpoints_gen_test.go | 4 ++-- .../service/codeguruprofiler/service_endpoints_gen_test.go | 4 ++-- .../service/codegurureviewer/service_endpoints_gen_test.go | 4 ++-- internal/service/codepipeline/service_endpoints_gen_test.go | 4 ++-- .../service/codestarconnections/service_endpoints_gen_test.go | 4 ++-- .../codestarnotifications/service_endpoints_gen_test.go | 4 ++-- .../service/cognitoidentity/service_endpoints_gen_test.go | 4 ++-- internal/service/cognitoidp/service_endpoints_gen_test.go | 4 ++-- internal/service/comprehend/service_endpoints_gen_test.go | 4 ++-- .../service/computeoptimizer/service_endpoints_gen_test.go | 4 ++-- internal/service/configservice/service_endpoints_gen_test.go | 4 ++-- internal/service/connect/service_endpoints_gen_test.go | 4 ++-- internal/service/connectcases/service_endpoints_gen_test.go | 4 ++-- internal/service/controltower/service_endpoints_gen_test.go | 4 ++-- .../service/costoptimizationhub/service_endpoints_gen_test.go | 4 ++-- internal/service/cur/service_endpoints_gen_test.go | 4 ++-- .../service/customerprofiles/service_endpoints_gen_test.go | 4 ++-- internal/service/dataexchange/service_endpoints_gen_test.go | 4 ++-- internal/service/datapipeline/service_endpoints_gen_test.go | 4 ++-- internal/service/datasync/service_endpoints_gen_test.go | 4 ++-- internal/service/datazone/service_endpoints_gen_test.go | 4 ++-- internal/service/dax/service_endpoints_gen_test.go | 4 ++-- internal/service/deploy/service_endpoints_gen_test.go | 4 ++-- internal/service/detective/service_endpoints_gen_test.go | 4 ++-- internal/service/devicefarm/service_endpoints_gen_test.go | 4 ++-- internal/service/devopsguru/service_endpoints_gen_test.go | 4 ++-- internal/service/directconnect/service_endpoints_gen_test.go | 4 ++-- internal/service/dlm/service_endpoints_gen_test.go | 4 ++-- internal/service/dms/service_endpoints_gen_test.go | 4 ++-- internal/service/docdb/service_endpoints_gen_test.go | 4 ++-- internal/service/docdbelastic/service_endpoints_gen_test.go | 4 ++-- internal/service/ds/service_endpoints_gen_test.go | 4 ++-- internal/service/dynamodb/service_endpoints_gen_test.go | 4 ++-- internal/service/ec2/service_endpoints_gen_test.go | 4 ++-- internal/service/ecr/service_endpoints_gen_test.go | 4 ++-- internal/service/ecrpublic/service_endpoints_gen_test.go | 4 ++-- internal/service/ecs/service_endpoints_gen_test.go | 4 ++-- internal/service/efs/service_endpoints_gen_test.go | 4 ++-- internal/service/eks/service_endpoints_gen_test.go | 4 ++-- internal/service/elasticache/service_endpoints_gen_test.go | 4 ++-- .../service/elasticbeanstalk/service_endpoints_gen_test.go | 4 ++-- internal/service/elasticsearch/service_endpoints_gen_test.go | 4 ++-- .../service/elastictranscoder/service_endpoints_gen_test.go | 4 ++-- internal/service/elb/service_endpoints_gen_test.go | 4 ++-- internal/service/elbv2/service_endpoints_gen_test.go | 4 ++-- internal/service/emr/service_endpoints_gen_test.go | 4 ++-- internal/service/emrcontainers/service_endpoints_gen_test.go | 4 ++-- internal/service/emrserverless/service_endpoints_gen_test.go | 4 ++-- internal/service/events/service_endpoints_gen_test.go | 4 ++-- internal/service/evidently/service_endpoints_gen_test.go | 4 ++-- internal/service/finspace/service_endpoints_gen_test.go | 4 ++-- internal/service/firehose/service_endpoints_gen_test.go | 4 ++-- internal/service/fis/service_endpoints_gen_test.go | 4 ++-- internal/service/fms/service_endpoints_gen_test.go | 4 ++-- internal/service/fsx/service_endpoints_gen_test.go | 4 ++-- internal/service/gamelift/service_endpoints_gen_test.go | 4 ++-- internal/service/glacier/service_endpoints_gen_test.go | 4 ++-- .../service/globalaccelerator/service_endpoints_gen_test.go | 4 ++-- internal/service/glue/service_endpoints_gen_test.go | 4 ++-- internal/service/grafana/service_endpoints_gen_test.go | 4 ++-- internal/service/greengrass/service_endpoints_gen_test.go | 4 ++-- internal/service/groundstation/service_endpoints_gen_test.go | 4 ++-- internal/service/guardduty/service_endpoints_gen_test.go | 4 ++-- internal/service/healthlake/service_endpoints_gen_test.go | 4 ++-- internal/service/iam/service_endpoints_gen_test.go | 4 ++-- internal/service/identitystore/service_endpoints_gen_test.go | 4 ++-- internal/service/imagebuilder/service_endpoints_gen_test.go | 4 ++-- internal/service/inspector/service_endpoints_gen_test.go | 4 ++-- internal/service/inspector2/service_endpoints_gen_test.go | 4 ++-- .../service/internetmonitor/service_endpoints_gen_test.go | 4 ++-- internal/service/iot/service_endpoints_gen_test.go | 4 ++-- internal/service/iotanalytics/service_endpoints_gen_test.go | 4 ++-- internal/service/iotevents/service_endpoints_gen_test.go | 4 ++-- internal/service/ivs/service_endpoints_gen_test.go | 4 ++-- internal/service/ivschat/service_endpoints_gen_test.go | 4 ++-- internal/service/kafka/service_endpoints_gen_test.go | 4 ++-- internal/service/kafkaconnect/service_endpoints_gen_test.go | 4 ++-- internal/service/kendra/service_endpoints_gen_test.go | 4 ++-- internal/service/keyspaces/service_endpoints_gen_test.go | 4 ++-- internal/service/kinesis/service_endpoints_gen_test.go | 4 ++-- .../service/kinesisanalytics/service_endpoints_gen_test.go | 4 ++-- .../service/kinesisanalyticsv2/service_endpoints_gen_test.go | 4 ++-- internal/service/kinesisvideo/service_endpoints_gen_test.go | 4 ++-- internal/service/kms/service_endpoints_gen_test.go | 4 ++-- internal/service/lakeformation/service_endpoints_gen_test.go | 4 ++-- internal/service/lambda/service_endpoints_gen_test.go | 4 ++-- internal/service/launchwizard/service_endpoints_gen_test.go | 4 ++-- internal/service/lexmodels/service_endpoints_gen_test.go | 4 ++-- internal/service/lexv2models/service_endpoints_gen_test.go | 4 ++-- internal/service/licensemanager/service_endpoints_gen_test.go | 4 ++-- internal/service/lightsail/service_endpoints_gen_test.go | 4 ++-- internal/service/location/service_endpoints_gen_test.go | 4 ++-- internal/service/logs/service_endpoints_gen_test.go | 4 ++-- internal/service/lookoutmetrics/service_endpoints_gen_test.go | 4 ++-- internal/service/m2/service_endpoints_gen_test.go | 4 ++-- internal/service/macie2/service_endpoints_gen_test.go | 4 ++-- internal/service/mediaconnect/service_endpoints_gen_test.go | 4 ++-- internal/service/mediaconvert/service_endpoints_gen_test.go | 4 ++-- internal/service/medialive/service_endpoints_gen_test.go | 4 ++-- internal/service/mediapackage/service_endpoints_gen_test.go | 4 ++-- internal/service/mediapackagev2/service_endpoints_gen_test.go | 4 ++-- internal/service/mediastore/service_endpoints_gen_test.go | 4 ++-- internal/service/memorydb/service_endpoints_gen_test.go | 4 ++-- internal/service/mq/service_endpoints_gen_test.go | 4 ++-- internal/service/neptune/service_endpoints_gen_test.go | 4 ++-- .../service/networkfirewall/service_endpoints_gen_test.go | 4 ++-- internal/service/networkmanager/service_endpoints_gen_test.go | 4 ++-- internal/service/oam/service_endpoints_gen_test.go | 4 ++-- internal/service/opensearch/service_endpoints_gen_test.go | 4 ++-- .../opensearchserverless/service_endpoints_gen_test.go | 4 ++-- internal/service/opsworks/service_endpoints_gen_test.go | 4 ++-- internal/service/organizations/service_endpoints_gen_test.go | 4 ++-- internal/service/osis/service_endpoints_gen_test.go | 4 ++-- internal/service/outposts/service_endpoints_gen_test.go | 4 ++-- internal/service/pcaconnectorad/service_endpoints_gen_test.go | 4 ++-- internal/service/pinpoint/service_endpoints_gen_test.go | 4 ++-- internal/service/pipes/service_endpoints_gen_test.go | 4 ++-- internal/service/polly/service_endpoints_gen_test.go | 4 ++-- internal/service/pricing/service_endpoints_gen_test.go | 4 ++-- internal/service/qbusiness/service_endpoints_gen_test.go | 4 ++-- internal/service/qldb/service_endpoints_gen_test.go | 4 ++-- internal/service/quicksight/service_endpoints_gen_test.go | 4 ++-- internal/service/ram/service_endpoints_gen_test.go | 4 ++-- internal/service/rbin/service_endpoints_gen_test.go | 4 ++-- internal/service/rds/service_endpoints_gen_test.go | 4 ++-- internal/service/redshift/service_endpoints_gen_test.go | 4 ++-- internal/service/redshiftdata/service_endpoints_gen_test.go | 4 ++-- .../service/redshiftserverless/service_endpoints_gen_test.go | 4 ++-- internal/service/rekognition/service_endpoints_gen_test.go | 4 ++-- .../service/resourceexplorer2/service_endpoints_gen_test.go | 4 ++-- internal/service/resourcegroups/service_endpoints_gen_test.go | 4 ++-- .../resourcegroupstaggingapi/service_endpoints_gen_test.go | 4 ++-- internal/service/rolesanywhere/service_endpoints_gen_test.go | 4 ++-- internal/service/route53/service_endpoints_gen_test.go | 4 ++-- internal/service/route53domains/service_endpoints_gen_test.go | 4 ++-- .../service_endpoints_gen_test.go | 4 ++-- .../route53recoveryreadiness/service_endpoints_gen_test.go | 4 ++-- .../service/route53resolver/service_endpoints_gen_test.go | 4 ++-- internal/service/rum/service_endpoints_gen_test.go | 4 ++-- internal/service/s3/service_endpoints_gen_test.go | 4 ++-- internal/service/s3outposts/service_endpoints_gen_test.go | 4 ++-- internal/service/sagemaker/service_endpoints_gen_test.go | 4 ++-- internal/service/scheduler/service_endpoints_gen_test.go | 4 ++-- internal/service/schemas/service_endpoints_gen_test.go | 4 ++-- internal/service/secretsmanager/service_endpoints_gen_test.go | 4 ++-- internal/service/securityhub/service_endpoints_gen_test.go | 4 ++-- internal/service/securitylake/service_endpoints_gen_test.go | 4 ++-- internal/service/serverlessrepo/service_endpoints_gen_test.go | 4 ++-- internal/service/servicecatalog/service_endpoints_gen_test.go | 4 ++-- .../servicecatalogappregistry/service_endpoints_gen_test.go | 4 ++-- .../service/servicediscovery/service_endpoints_gen_test.go | 4 ++-- internal/service/servicequotas/service_endpoints_gen_test.go | 4 ++-- internal/service/ses/service_endpoints_gen_test.go | 4 ++-- internal/service/sesv2/service_endpoints_gen_test.go | 4 ++-- internal/service/sfn/service_endpoints_gen_test.go | 4 ++-- internal/service/shield/service_endpoints_gen_test.go | 4 ++-- internal/service/signer/service_endpoints_gen_test.go | 4 ++-- internal/service/simpledb/service_endpoints_gen_test.go | 4 ++-- internal/service/sns/service_endpoints_gen_test.go | 4 ++-- internal/service/sqs/service_endpoints_gen_test.go | 4 ++-- internal/service/ssm/service_endpoints_gen_test.go | 4 ++-- internal/service/ssmcontacts/service_endpoints_gen_test.go | 4 ++-- internal/service/ssmincidents/service_endpoints_gen_test.go | 4 ++-- internal/service/ssmsap/service_endpoints_gen_test.go | 4 ++-- internal/service/sso/service_endpoints_gen_test.go | 4 ++-- internal/service/ssoadmin/service_endpoints_gen_test.go | 4 ++-- internal/service/storagegateway/service_endpoints_gen_test.go | 4 ++-- internal/service/sts/service_endpoints_gen_test.go | 4 ++-- internal/service/swf/service_endpoints_gen_test.go | 4 ++-- internal/service/synthetics/service_endpoints_gen_test.go | 4 ++-- internal/service/transcribe/service_endpoints_gen_test.go | 4 ++-- internal/service/transfer/service_endpoints_gen_test.go | 4 ++-- .../service/verifiedpermissions/service_endpoints_gen_test.go | 4 ++-- internal/service/vpclattice/service_endpoints_gen_test.go | 4 ++-- internal/service/waf/service_endpoints_gen_test.go | 4 ++-- internal/service/wafregional/service_endpoints_gen_test.go | 4 ++-- internal/service/wafv2/service_endpoints_gen_test.go | 4 ++-- .../service/wellarchitected/service_endpoints_gen_test.go | 4 ++-- internal/service/worklink/service_endpoints_gen_test.go | 4 ++-- internal/service/workspaces/service_endpoints_gen_test.go | 4 ++-- internal/service/workspacesweb/service_endpoints_gen_test.go | 4 ++-- internal/service/xray/service_endpoints_gen_test.go | 4 ++-- 227 files changed, 454 insertions(+), 454 deletions(-) diff --git a/internal/generate/serviceendpointtests/file.tmpl b/internal/generate/serviceendpointtests/file.tmpl index fd08961386b..ec925e1154f 100644 --- a/internal/generate/serviceendpointtests/file.tmpl +++ b/internal/generate/serviceendpointtests/file.tmpl @@ -718,8 +718,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/accessanalyzer/service_endpoints_gen_test.go b/internal/service/accessanalyzer/service_endpoints_gen_test.go index 6cc6db19e18..7bef2862029 100644 --- a/internal/service/accessanalyzer/service_endpoints_gen_test.go +++ b/internal/service/accessanalyzer/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/account/service_endpoints_gen_test.go b/internal/service/account/service_endpoints_gen_test.go index 36eed6221b8..bf1c5d136a1 100644 --- a/internal/service/account/service_endpoints_gen_test.go +++ b/internal/service/account/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/acm/service_endpoints_gen_test.go b/internal/service/acm/service_endpoints_gen_test.go index b0428699ac5..5ec297ead9e 100644 --- a/internal/service/acm/service_endpoints_gen_test.go +++ b/internal/service/acm/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/acmpca/service_endpoints_gen_test.go b/internal/service/acmpca/service_endpoints_gen_test.go index fbf1a48f0b6..07236ac7e06 100644 --- a/internal/service/acmpca/service_endpoints_gen_test.go +++ b/internal/service/acmpca/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/amp/service_endpoints_gen_test.go b/internal/service/amp/service_endpoints_gen_test.go index 651b682bee0..f83060e9163 100644 --- a/internal/service/amp/service_endpoints_gen_test.go +++ b/internal/service/amp/service_endpoints_gen_test.go @@ -489,8 +489,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/amplify/service_endpoints_gen_test.go b/internal/service/amplify/service_endpoints_gen_test.go index 692ebcbfd30..d09773fa95f 100644 --- a/internal/service/amplify/service_endpoints_gen_test.go +++ b/internal/service/amplify/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/apigateway/service_endpoints_gen_test.go b/internal/service/apigateway/service_endpoints_gen_test.go index a52f11fd615..4e0fa595aff 100644 --- a/internal/service/apigateway/service_endpoints_gen_test.go +++ b/internal/service/apigateway/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/apigatewayv2/service_endpoints_gen_test.go b/internal/service/apigatewayv2/service_endpoints_gen_test.go index 7e3915dcf3f..348516fdc53 100644 --- a/internal/service/apigatewayv2/service_endpoints_gen_test.go +++ b/internal/service/apigatewayv2/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/appautoscaling/service_endpoints_gen_test.go b/internal/service/appautoscaling/service_endpoints_gen_test.go index 8e76fbb00c6..6c9288e8d34 100644 --- a/internal/service/appautoscaling/service_endpoints_gen_test.go +++ b/internal/service/appautoscaling/service_endpoints_gen_test.go @@ -403,8 +403,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/appconfig/service_endpoints_gen_test.go b/internal/service/appconfig/service_endpoints_gen_test.go index 9b04e82c0ce..b45c1e67751 100644 --- a/internal/service/appconfig/service_endpoints_gen_test.go +++ b/internal/service/appconfig/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/appfabric/service_endpoints_gen_test.go b/internal/service/appfabric/service_endpoints_gen_test.go index 07c64f6c52f..4d799b34836 100644 --- a/internal/service/appfabric/service_endpoints_gen_test.go +++ b/internal/service/appfabric/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/appflow/service_endpoints_gen_test.go b/internal/service/appflow/service_endpoints_gen_test.go index c7c4629e37d..9b43437d217 100644 --- a/internal/service/appflow/service_endpoints_gen_test.go +++ b/internal/service/appflow/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/appintegrations/service_endpoints_gen_test.go b/internal/service/appintegrations/service_endpoints_gen_test.go index f60261640db..95349bb868e 100644 --- a/internal/service/appintegrations/service_endpoints_gen_test.go +++ b/internal/service/appintegrations/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/applicationinsights/service_endpoints_gen_test.go b/internal/service/applicationinsights/service_endpoints_gen_test.go index 506ca4c9920..fe70cd4beda 100644 --- a/internal/service/applicationinsights/service_endpoints_gen_test.go +++ b/internal/service/applicationinsights/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/appmesh/service_endpoints_gen_test.go b/internal/service/appmesh/service_endpoints_gen_test.go index 938aab6811f..7d208c35291 100644 --- a/internal/service/appmesh/service_endpoints_gen_test.go +++ b/internal/service/appmesh/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/apprunner/service_endpoints_gen_test.go b/internal/service/apprunner/service_endpoints_gen_test.go index 83e74bbe185..7dd52ec1d99 100644 --- a/internal/service/apprunner/service_endpoints_gen_test.go +++ b/internal/service/apprunner/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/appstream/service_endpoints_gen_test.go b/internal/service/appstream/service_endpoints_gen_test.go index 6291f66ef06..fc284979526 100644 --- a/internal/service/appstream/service_endpoints_gen_test.go +++ b/internal/service/appstream/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/appsync/service_endpoints_gen_test.go b/internal/service/appsync/service_endpoints_gen_test.go index 854764da644..a6f82489d77 100644 --- a/internal/service/appsync/service_endpoints_gen_test.go +++ b/internal/service/appsync/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/athena/service_endpoints_gen_test.go b/internal/service/athena/service_endpoints_gen_test.go index d342210342a..06410602151 100644 --- a/internal/service/athena/service_endpoints_gen_test.go +++ b/internal/service/athena/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/auditmanager/service_endpoints_gen_test.go b/internal/service/auditmanager/service_endpoints_gen_test.go index 3d5e665e16f..e3d907b5b9a 100644 --- a/internal/service/auditmanager/service_endpoints_gen_test.go +++ b/internal/service/auditmanager/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/autoscaling/service_endpoints_gen_test.go b/internal/service/autoscaling/service_endpoints_gen_test.go index 5c27175beb2..7e87f4b3d2a 100644 --- a/internal/service/autoscaling/service_endpoints_gen_test.go +++ b/internal/service/autoscaling/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/autoscalingplans/service_endpoints_gen_test.go b/internal/service/autoscalingplans/service_endpoints_gen_test.go index 83c993a2f90..cf17031ff78 100644 --- a/internal/service/autoscalingplans/service_endpoints_gen_test.go +++ b/internal/service/autoscalingplans/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/backup/service_endpoints_gen_test.go b/internal/service/backup/service_endpoints_gen_test.go index 8447a2b5be2..2a005b58201 100644 --- a/internal/service/backup/service_endpoints_gen_test.go +++ b/internal/service/backup/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/batch/service_endpoints_gen_test.go b/internal/service/batch/service_endpoints_gen_test.go index bef8b0b58bc..4ac98cf4f57 100644 --- a/internal/service/batch/service_endpoints_gen_test.go +++ b/internal/service/batch/service_endpoints_gen_test.go @@ -361,8 +361,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/bcmdataexports/service_endpoints_gen_test.go b/internal/service/bcmdataexports/service_endpoints_gen_test.go index 5d3202a75d4..ee4a837475f 100644 --- a/internal/service/bcmdataexports/service_endpoints_gen_test.go +++ b/internal/service/bcmdataexports/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/bedrock/service_endpoints_gen_test.go b/internal/service/bedrock/service_endpoints_gen_test.go index 322de807b87..3cbf65f15bf 100644 --- a/internal/service/bedrock/service_endpoints_gen_test.go +++ b/internal/service/bedrock/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/bedrockagent/service_endpoints_gen_test.go b/internal/service/bedrockagent/service_endpoints_gen_test.go index 60b4fa16c8d..86ff6522d78 100644 --- a/internal/service/bedrockagent/service_endpoints_gen_test.go +++ b/internal/service/bedrockagent/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/budgets/service_endpoints_gen_test.go b/internal/service/budgets/service_endpoints_gen_test.go index d7ddf5e3989..4579159b57b 100644 --- a/internal/service/budgets/service_endpoints_gen_test.go +++ b/internal/service/budgets/service_endpoints_gen_test.go @@ -336,8 +336,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ce/service_endpoints_gen_test.go b/internal/service/ce/service_endpoints_gen_test.go index 67dfcf248be..b39f3abb04a 100644 --- a/internal/service/ce/service_endpoints_gen_test.go +++ b/internal/service/ce/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/chatbot/service_endpoints_gen_test.go b/internal/service/chatbot/service_endpoints_gen_test.go index baf9de334ef..4bd5816a911 100644 --- a/internal/service/chatbot/service_endpoints_gen_test.go +++ b/internal/service/chatbot/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/chime/service_endpoints_gen_test.go b/internal/service/chime/service_endpoints_gen_test.go index 4f75d53b59a..979ba6a008c 100644 --- a/internal/service/chime/service_endpoints_gen_test.go +++ b/internal/service/chime/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go b/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go index 36d0d1dd7aa..9e66ec54aa0 100644 --- a/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go +++ b/internal/service/chimesdkmediapipelines/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/chimesdkvoice/service_endpoints_gen_test.go b/internal/service/chimesdkvoice/service_endpoints_gen_test.go index 9c8abef3c0c..6803407b7e8 100644 --- a/internal/service/chimesdkvoice/service_endpoints_gen_test.go +++ b/internal/service/chimesdkvoice/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cleanrooms/service_endpoints_gen_test.go b/internal/service/cleanrooms/service_endpoints_gen_test.go index 47c08765a89..67110c3f0f0 100644 --- a/internal/service/cleanrooms/service_endpoints_gen_test.go +++ b/internal/service/cleanrooms/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cloud9/service_endpoints_gen_test.go b/internal/service/cloud9/service_endpoints_gen_test.go index 13558b186cc..171a41e5609 100644 --- a/internal/service/cloud9/service_endpoints_gen_test.go +++ b/internal/service/cloud9/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cloudcontrol/service_endpoints_gen_test.go b/internal/service/cloudcontrol/service_endpoints_gen_test.go index e5886b25799..b64a621d7c1 100644 --- a/internal/service/cloudcontrol/service_endpoints_gen_test.go +++ b/internal/service/cloudcontrol/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cloudformation/service_endpoints_gen_test.go b/internal/service/cloudformation/service_endpoints_gen_test.go index 995d090c271..c35d108598d 100644 --- a/internal/service/cloudformation/service_endpoints_gen_test.go +++ b/internal/service/cloudformation/service_endpoints_gen_test.go @@ -336,8 +336,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cloudfront/service_endpoints_gen_test.go b/internal/service/cloudfront/service_endpoints_gen_test.go index 0a2d8436544..09febfbb36c 100644 --- a/internal/service/cloudfront/service_endpoints_gen_test.go +++ b/internal/service/cloudfront/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cloudhsmv2/service_endpoints_gen_test.go b/internal/service/cloudhsmv2/service_endpoints_gen_test.go index d2f41666141..1a2e9148aa0 100644 --- a/internal/service/cloudhsmv2/service_endpoints_gen_test.go +++ b/internal/service/cloudhsmv2/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cloudsearch/service_endpoints_gen_test.go b/internal/service/cloudsearch/service_endpoints_gen_test.go index 1e2c3267290..aee7df508d4 100644 --- a/internal/service/cloudsearch/service_endpoints_gen_test.go +++ b/internal/service/cloudsearch/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cloudtrail/service_endpoints_gen_test.go b/internal/service/cloudtrail/service_endpoints_gen_test.go index 16f2e07913e..841b79d2b2b 100644 --- a/internal/service/cloudtrail/service_endpoints_gen_test.go +++ b/internal/service/cloudtrail/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cloudwatch/service_endpoints_gen_test.go b/internal/service/cloudwatch/service_endpoints_gen_test.go index 984332422be..d0efa29ccf2 100644 --- a/internal/service/cloudwatch/service_endpoints_gen_test.go +++ b/internal/service/cloudwatch/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/codeartifact/service_endpoints_gen_test.go b/internal/service/codeartifact/service_endpoints_gen_test.go index f4f8cd227e2..be156e49a1f 100644 --- a/internal/service/codeartifact/service_endpoints_gen_test.go +++ b/internal/service/codeartifact/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/codebuild/service_endpoints_gen_test.go b/internal/service/codebuild/service_endpoints_gen_test.go index bf18f40bf27..6c2440f41e8 100644 --- a/internal/service/codebuild/service_endpoints_gen_test.go +++ b/internal/service/codebuild/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/codecommit/service_endpoints_gen_test.go b/internal/service/codecommit/service_endpoints_gen_test.go index 49dd8a33cfe..06e526af9fc 100644 --- a/internal/service/codecommit/service_endpoints_gen_test.go +++ b/internal/service/codecommit/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/codeguruprofiler/service_endpoints_gen_test.go b/internal/service/codeguruprofiler/service_endpoints_gen_test.go index 48c4caca4a3..2994cb42192 100644 --- a/internal/service/codeguruprofiler/service_endpoints_gen_test.go +++ b/internal/service/codeguruprofiler/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/codegurureviewer/service_endpoints_gen_test.go b/internal/service/codegurureviewer/service_endpoints_gen_test.go index 3f59cd38d40..0e479ff270c 100644 --- a/internal/service/codegurureviewer/service_endpoints_gen_test.go +++ b/internal/service/codegurureviewer/service_endpoints_gen_test.go @@ -337,8 +337,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/codepipeline/service_endpoints_gen_test.go b/internal/service/codepipeline/service_endpoints_gen_test.go index bf92923552b..22d46e609e3 100644 --- a/internal/service/codepipeline/service_endpoints_gen_test.go +++ b/internal/service/codepipeline/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/codestarconnections/service_endpoints_gen_test.go b/internal/service/codestarconnections/service_endpoints_gen_test.go index 66ce1a90879..b87a0ead5f6 100644 --- a/internal/service/codestarconnections/service_endpoints_gen_test.go +++ b/internal/service/codestarconnections/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/codestarnotifications/service_endpoints_gen_test.go b/internal/service/codestarnotifications/service_endpoints_gen_test.go index dac3ef9c2ab..0ed2d76ac71 100644 --- a/internal/service/codestarnotifications/service_endpoints_gen_test.go +++ b/internal/service/codestarnotifications/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cognitoidentity/service_endpoints_gen_test.go b/internal/service/cognitoidentity/service_endpoints_gen_test.go index e36255a27b7..884776edb8b 100644 --- a/internal/service/cognitoidentity/service_endpoints_gen_test.go +++ b/internal/service/cognitoidentity/service_endpoints_gen_test.go @@ -336,8 +336,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cognitoidp/service_endpoints_gen_test.go b/internal/service/cognitoidp/service_endpoints_gen_test.go index d3de2bdb715..892a0b5fdd9 100644 --- a/internal/service/cognitoidp/service_endpoints_gen_test.go +++ b/internal/service/cognitoidp/service_endpoints_gen_test.go @@ -403,8 +403,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/comprehend/service_endpoints_gen_test.go b/internal/service/comprehend/service_endpoints_gen_test.go index 19d9b57c9c7..2cd172a4105 100644 --- a/internal/service/comprehend/service_endpoints_gen_test.go +++ b/internal/service/comprehend/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/computeoptimizer/service_endpoints_gen_test.go b/internal/service/computeoptimizer/service_endpoints_gen_test.go index 4e52ad5c997..610bd893a19 100644 --- a/internal/service/computeoptimizer/service_endpoints_gen_test.go +++ b/internal/service/computeoptimizer/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/configservice/service_endpoints_gen_test.go b/internal/service/configservice/service_endpoints_gen_test.go index db28cacb09a..cb8f180c740 100644 --- a/internal/service/configservice/service_endpoints_gen_test.go +++ b/internal/service/configservice/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/connect/service_endpoints_gen_test.go b/internal/service/connect/service_endpoints_gen_test.go index 3eb870d4699..b653f08f285 100644 --- a/internal/service/connect/service_endpoints_gen_test.go +++ b/internal/service/connect/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/connectcases/service_endpoints_gen_test.go b/internal/service/connectcases/service_endpoints_gen_test.go index 6b02bfc7b7f..e6687d808eb 100644 --- a/internal/service/connectcases/service_endpoints_gen_test.go +++ b/internal/service/connectcases/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/controltower/service_endpoints_gen_test.go b/internal/service/controltower/service_endpoints_gen_test.go index 2f7e61abaaa..39931ad56b7 100644 --- a/internal/service/controltower/service_endpoints_gen_test.go +++ b/internal/service/controltower/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/costoptimizationhub/service_endpoints_gen_test.go b/internal/service/costoptimizationhub/service_endpoints_gen_test.go index c4ee066d0b5..4885869f7a9 100644 --- a/internal/service/costoptimizationhub/service_endpoints_gen_test.go +++ b/internal/service/costoptimizationhub/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/cur/service_endpoints_gen_test.go b/internal/service/cur/service_endpoints_gen_test.go index b1ccaa2fb2f..6e5b9e043a3 100644 --- a/internal/service/cur/service_endpoints_gen_test.go +++ b/internal/service/cur/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/customerprofiles/service_endpoints_gen_test.go b/internal/service/customerprofiles/service_endpoints_gen_test.go index 1f0b33ed88d..8f9e5acf72d 100644 --- a/internal/service/customerprofiles/service_endpoints_gen_test.go +++ b/internal/service/customerprofiles/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/dataexchange/service_endpoints_gen_test.go b/internal/service/dataexchange/service_endpoints_gen_test.go index deea4f68cb1..cf4fddb3c82 100644 --- a/internal/service/dataexchange/service_endpoints_gen_test.go +++ b/internal/service/dataexchange/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/datapipeline/service_endpoints_gen_test.go b/internal/service/datapipeline/service_endpoints_gen_test.go index 73f7e540c94..8057fe2539d 100644 --- a/internal/service/datapipeline/service_endpoints_gen_test.go +++ b/internal/service/datapipeline/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/datasync/service_endpoints_gen_test.go b/internal/service/datasync/service_endpoints_gen_test.go index afe70bac7b6..6c5ff421d0d 100644 --- a/internal/service/datasync/service_endpoints_gen_test.go +++ b/internal/service/datasync/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/datazone/service_endpoints_gen_test.go b/internal/service/datazone/service_endpoints_gen_test.go index 044e9f2dce5..4e029b75fd8 100644 --- a/internal/service/datazone/service_endpoints_gen_test.go +++ b/internal/service/datazone/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/dax/service_endpoints_gen_test.go b/internal/service/dax/service_endpoints_gen_test.go index d4332b4f6a6..fa378aa4ce5 100644 --- a/internal/service/dax/service_endpoints_gen_test.go +++ b/internal/service/dax/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/deploy/service_endpoints_gen_test.go b/internal/service/deploy/service_endpoints_gen_test.go index 8676250d730..60d2e2ee349 100644 --- a/internal/service/deploy/service_endpoints_gen_test.go +++ b/internal/service/deploy/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/detective/service_endpoints_gen_test.go b/internal/service/detective/service_endpoints_gen_test.go index a1ed19de583..a111c2980e9 100644 --- a/internal/service/detective/service_endpoints_gen_test.go +++ b/internal/service/detective/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/devicefarm/service_endpoints_gen_test.go b/internal/service/devicefarm/service_endpoints_gen_test.go index ed469a1de7d..26a64c1b0a9 100644 --- a/internal/service/devicefarm/service_endpoints_gen_test.go +++ b/internal/service/devicefarm/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/devopsguru/service_endpoints_gen_test.go b/internal/service/devopsguru/service_endpoints_gen_test.go index 8e41e81640f..21da314c059 100644 --- a/internal/service/devopsguru/service_endpoints_gen_test.go +++ b/internal/service/devopsguru/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/directconnect/service_endpoints_gen_test.go b/internal/service/directconnect/service_endpoints_gen_test.go index 83a0d2422b2..f254f6909c3 100644 --- a/internal/service/directconnect/service_endpoints_gen_test.go +++ b/internal/service/directconnect/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/dlm/service_endpoints_gen_test.go b/internal/service/dlm/service_endpoints_gen_test.go index a851f5a60fc..cf15fe1d5b0 100644 --- a/internal/service/dlm/service_endpoints_gen_test.go +++ b/internal/service/dlm/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/dms/service_endpoints_gen_test.go b/internal/service/dms/service_endpoints_gen_test.go index 70bf9582c3f..09049805de2 100644 --- a/internal/service/dms/service_endpoints_gen_test.go +++ b/internal/service/dms/service_endpoints_gen_test.go @@ -479,8 +479,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/docdb/service_endpoints_gen_test.go b/internal/service/docdb/service_endpoints_gen_test.go index d2ee1e711f1..640217d4b7a 100644 --- a/internal/service/docdb/service_endpoints_gen_test.go +++ b/internal/service/docdb/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/docdbelastic/service_endpoints_gen_test.go b/internal/service/docdbelastic/service_endpoints_gen_test.go index 5168991d663..5b4583c5413 100644 --- a/internal/service/docdbelastic/service_endpoints_gen_test.go +++ b/internal/service/docdbelastic/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ds/service_endpoints_gen_test.go b/internal/service/ds/service_endpoints_gen_test.go index ba91e56e363..16e907d2567 100644 --- a/internal/service/ds/service_endpoints_gen_test.go +++ b/internal/service/ds/service_endpoints_gen_test.go @@ -440,8 +440,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/dynamodb/service_endpoints_gen_test.go b/internal/service/dynamodb/service_endpoints_gen_test.go index 9576c8ef992..5c2d881d804 100644 --- a/internal/service/dynamodb/service_endpoints_gen_test.go +++ b/internal/service/dynamodb/service_endpoints_gen_test.go @@ -470,8 +470,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ec2/service_endpoints_gen_test.go b/internal/service/ec2/service_endpoints_gen_test.go index bdaff61a3c8..a8507cdadd6 100644 --- a/internal/service/ec2/service_endpoints_gen_test.go +++ b/internal/service/ec2/service_endpoints_gen_test.go @@ -361,8 +361,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ecr/service_endpoints_gen_test.go b/internal/service/ecr/service_endpoints_gen_test.go index ab9bea07097..cbc6686d905 100644 --- a/internal/service/ecr/service_endpoints_gen_test.go +++ b/internal/service/ecr/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ecrpublic/service_endpoints_gen_test.go b/internal/service/ecrpublic/service_endpoints_gen_test.go index bf3cf7cda75..b5564c8737f 100644 --- a/internal/service/ecrpublic/service_endpoints_gen_test.go +++ b/internal/service/ecrpublic/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ecs/service_endpoints_gen_test.go b/internal/service/ecs/service_endpoints_gen_test.go index a43fc07455a..4a51f80b9ec 100644 --- a/internal/service/ecs/service_endpoints_gen_test.go +++ b/internal/service/ecs/service_endpoints_gen_test.go @@ -361,8 +361,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/efs/service_endpoints_gen_test.go b/internal/service/efs/service_endpoints_gen_test.go index fc6636b2a40..b0f7933687b 100644 --- a/internal/service/efs/service_endpoints_gen_test.go +++ b/internal/service/efs/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/eks/service_endpoints_gen_test.go b/internal/service/eks/service_endpoints_gen_test.go index 6d7bbd94e99..2b4954f012f 100644 --- a/internal/service/eks/service_endpoints_gen_test.go +++ b/internal/service/eks/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/elasticache/service_endpoints_gen_test.go b/internal/service/elasticache/service_endpoints_gen_test.go index 9fd6f47d848..d15d0cbb478 100644 --- a/internal/service/elasticache/service_endpoints_gen_test.go +++ b/internal/service/elasticache/service_endpoints_gen_test.go @@ -361,8 +361,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/elasticbeanstalk/service_endpoints_gen_test.go b/internal/service/elasticbeanstalk/service_endpoints_gen_test.go index 525db790d5c..4ffd518dd4f 100644 --- a/internal/service/elasticbeanstalk/service_endpoints_gen_test.go +++ b/internal/service/elasticbeanstalk/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/elasticsearch/service_endpoints_gen_test.go b/internal/service/elasticsearch/service_endpoints_gen_test.go index 9056432b3b4..21bda65ad80 100644 --- a/internal/service/elasticsearch/service_endpoints_gen_test.go +++ b/internal/service/elasticsearch/service_endpoints_gen_test.go @@ -479,8 +479,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/elastictranscoder/service_endpoints_gen_test.go b/internal/service/elastictranscoder/service_endpoints_gen_test.go index b704a9d7078..e4e457a1861 100644 --- a/internal/service/elastictranscoder/service_endpoints_gen_test.go +++ b/internal/service/elastictranscoder/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/elb/service_endpoints_gen_test.go b/internal/service/elb/service_endpoints_gen_test.go index bb431fdb106..196553eb3e3 100644 --- a/internal/service/elb/service_endpoints_gen_test.go +++ b/internal/service/elb/service_endpoints_gen_test.go @@ -403,8 +403,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/elbv2/service_endpoints_gen_test.go b/internal/service/elbv2/service_endpoints_gen_test.go index e7a42312b92..b4011a2e21b 100644 --- a/internal/service/elbv2/service_endpoints_gen_test.go +++ b/internal/service/elbv2/service_endpoints_gen_test.go @@ -440,8 +440,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/emr/service_endpoints_gen_test.go b/internal/service/emr/service_endpoints_gen_test.go index d0465d4afea..2ca63f77efe 100644 --- a/internal/service/emr/service_endpoints_gen_test.go +++ b/internal/service/emr/service_endpoints_gen_test.go @@ -361,8 +361,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/emrcontainers/service_endpoints_gen_test.go b/internal/service/emrcontainers/service_endpoints_gen_test.go index 92c8e4548d0..c637988a34c 100644 --- a/internal/service/emrcontainers/service_endpoints_gen_test.go +++ b/internal/service/emrcontainers/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/emrserverless/service_endpoints_gen_test.go b/internal/service/emrserverless/service_endpoints_gen_test.go index 0d62631853b..957c5476a85 100644 --- a/internal/service/emrserverless/service_endpoints_gen_test.go +++ b/internal/service/emrserverless/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/events/service_endpoints_gen_test.go b/internal/service/events/service_endpoints_gen_test.go index f85c70cba46..47558bec377 100644 --- a/internal/service/events/service_endpoints_gen_test.go +++ b/internal/service/events/service_endpoints_gen_test.go @@ -489,8 +489,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/evidently/service_endpoints_gen_test.go b/internal/service/evidently/service_endpoints_gen_test.go index 902db3f060a..83fff337df9 100644 --- a/internal/service/evidently/service_endpoints_gen_test.go +++ b/internal/service/evidently/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/finspace/service_endpoints_gen_test.go b/internal/service/finspace/service_endpoints_gen_test.go index 71a7696e3b7..6c27f94b7ad 100644 --- a/internal/service/finspace/service_endpoints_gen_test.go +++ b/internal/service/finspace/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/firehose/service_endpoints_gen_test.go b/internal/service/firehose/service_endpoints_gen_test.go index 496e92b9fc4..6b3e943b381 100644 --- a/internal/service/firehose/service_endpoints_gen_test.go +++ b/internal/service/firehose/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/fis/service_endpoints_gen_test.go b/internal/service/fis/service_endpoints_gen_test.go index c6ba3e1834e..d5a04f29db1 100644 --- a/internal/service/fis/service_endpoints_gen_test.go +++ b/internal/service/fis/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/fms/service_endpoints_gen_test.go b/internal/service/fms/service_endpoints_gen_test.go index 7af6d5b06d0..2d011a1bd2b 100644 --- a/internal/service/fms/service_endpoints_gen_test.go +++ b/internal/service/fms/service_endpoints_gen_test.go @@ -336,8 +336,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/fsx/service_endpoints_gen_test.go b/internal/service/fsx/service_endpoints_gen_test.go index 42ef2a774c8..1385ba733ba 100644 --- a/internal/service/fsx/service_endpoints_gen_test.go +++ b/internal/service/fsx/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/gamelift/service_endpoints_gen_test.go b/internal/service/gamelift/service_endpoints_gen_test.go index 5727368a067..3b5ced7a03f 100644 --- a/internal/service/gamelift/service_endpoints_gen_test.go +++ b/internal/service/gamelift/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/glacier/service_endpoints_gen_test.go b/internal/service/glacier/service_endpoints_gen_test.go index c9f257076e9..002383c65bb 100644 --- a/internal/service/glacier/service_endpoints_gen_test.go +++ b/internal/service/glacier/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/globalaccelerator/service_endpoints_gen_test.go b/internal/service/globalaccelerator/service_endpoints_gen_test.go index 82027593496..c8d8234a4bf 100644 --- a/internal/service/globalaccelerator/service_endpoints_gen_test.go +++ b/internal/service/globalaccelerator/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/glue/service_endpoints_gen_test.go b/internal/service/glue/service_endpoints_gen_test.go index aa567925fe7..4ee96ee230c 100644 --- a/internal/service/glue/service_endpoints_gen_test.go +++ b/internal/service/glue/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/grafana/service_endpoints_gen_test.go b/internal/service/grafana/service_endpoints_gen_test.go index cc98dcf7e7e..601b9255e38 100644 --- a/internal/service/grafana/service_endpoints_gen_test.go +++ b/internal/service/grafana/service_endpoints_gen_test.go @@ -479,8 +479,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/greengrass/service_endpoints_gen_test.go b/internal/service/greengrass/service_endpoints_gen_test.go index 2ba42b0a8b6..1062c432de6 100644 --- a/internal/service/greengrass/service_endpoints_gen_test.go +++ b/internal/service/greengrass/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/groundstation/service_endpoints_gen_test.go b/internal/service/groundstation/service_endpoints_gen_test.go index ef0005fde54..05ff3dcbb3f 100644 --- a/internal/service/groundstation/service_endpoints_gen_test.go +++ b/internal/service/groundstation/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/guardduty/service_endpoints_gen_test.go b/internal/service/guardduty/service_endpoints_gen_test.go index d4825156cc7..de8cabcb82d 100644 --- a/internal/service/guardduty/service_endpoints_gen_test.go +++ b/internal/service/guardduty/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/healthlake/service_endpoints_gen_test.go b/internal/service/healthlake/service_endpoints_gen_test.go index d4a48f7ea1f..f9c325e6191 100644 --- a/internal/service/healthlake/service_endpoints_gen_test.go +++ b/internal/service/healthlake/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/iam/service_endpoints_gen_test.go b/internal/service/iam/service_endpoints_gen_test.go index 470fa66e08a..b6ebab6f48a 100644 --- a/internal/service/iam/service_endpoints_gen_test.go +++ b/internal/service/iam/service_endpoints_gen_test.go @@ -470,8 +470,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/identitystore/service_endpoints_gen_test.go b/internal/service/identitystore/service_endpoints_gen_test.go index 39ea1dd7a23..d64b237aa7d 100644 --- a/internal/service/identitystore/service_endpoints_gen_test.go +++ b/internal/service/identitystore/service_endpoints_gen_test.go @@ -336,8 +336,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/imagebuilder/service_endpoints_gen_test.go b/internal/service/imagebuilder/service_endpoints_gen_test.go index f9fff8e3312..7778ab8a49e 100644 --- a/internal/service/imagebuilder/service_endpoints_gen_test.go +++ b/internal/service/imagebuilder/service_endpoints_gen_test.go @@ -326,8 +326,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/inspector/service_endpoints_gen_test.go b/internal/service/inspector/service_endpoints_gen_test.go index f8a988a46c7..0d4db9da6b5 100644 --- a/internal/service/inspector/service_endpoints_gen_test.go +++ b/internal/service/inspector/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/inspector2/service_endpoints_gen_test.go b/internal/service/inspector2/service_endpoints_gen_test.go index ac53a95763c..a4b74f8519f 100644 --- a/internal/service/inspector2/service_endpoints_gen_test.go +++ b/internal/service/inspector2/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/internetmonitor/service_endpoints_gen_test.go b/internal/service/internetmonitor/service_endpoints_gen_test.go index 6c276530abc..2420b5238b3 100644 --- a/internal/service/internetmonitor/service_endpoints_gen_test.go +++ b/internal/service/internetmonitor/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/iot/service_endpoints_gen_test.go b/internal/service/iot/service_endpoints_gen_test.go index ac58b3a1b03..bbdbce2bae8 100644 --- a/internal/service/iot/service_endpoints_gen_test.go +++ b/internal/service/iot/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/iotanalytics/service_endpoints_gen_test.go b/internal/service/iotanalytics/service_endpoints_gen_test.go index 4c1dfdbaf62..bd991e9238a 100644 --- a/internal/service/iotanalytics/service_endpoints_gen_test.go +++ b/internal/service/iotanalytics/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/iotevents/service_endpoints_gen_test.go b/internal/service/iotevents/service_endpoints_gen_test.go index e79f26a6294..6edeecc0651 100644 --- a/internal/service/iotevents/service_endpoints_gen_test.go +++ b/internal/service/iotevents/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ivs/service_endpoints_gen_test.go b/internal/service/ivs/service_endpoints_gen_test.go index 7924fa53d30..07e0c2a55da 100644 --- a/internal/service/ivs/service_endpoints_gen_test.go +++ b/internal/service/ivs/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ivschat/service_endpoints_gen_test.go b/internal/service/ivschat/service_endpoints_gen_test.go index 51f682be261..f7cde36a0d2 100644 --- a/internal/service/ivschat/service_endpoints_gen_test.go +++ b/internal/service/ivschat/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/kafka/service_endpoints_gen_test.go b/internal/service/kafka/service_endpoints_gen_test.go index bb8768fcedc..eed68a5f4b8 100644 --- a/internal/service/kafka/service_endpoints_gen_test.go +++ b/internal/service/kafka/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/kafkaconnect/service_endpoints_gen_test.go b/internal/service/kafkaconnect/service_endpoints_gen_test.go index 0a6e2880978..e6214c84fea 100644 --- a/internal/service/kafkaconnect/service_endpoints_gen_test.go +++ b/internal/service/kafkaconnect/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/kendra/service_endpoints_gen_test.go b/internal/service/kendra/service_endpoints_gen_test.go index 0e7a8d9d9e2..6c99833d15f 100644 --- a/internal/service/kendra/service_endpoints_gen_test.go +++ b/internal/service/kendra/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/keyspaces/service_endpoints_gen_test.go b/internal/service/keyspaces/service_endpoints_gen_test.go index 2e206c98515..56cc29fefc6 100644 --- a/internal/service/keyspaces/service_endpoints_gen_test.go +++ b/internal/service/keyspaces/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/kinesis/service_endpoints_gen_test.go b/internal/service/kinesis/service_endpoints_gen_test.go index 1ed40283b87..d17521b327f 100644 --- a/internal/service/kinesis/service_endpoints_gen_test.go +++ b/internal/service/kinesis/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/kinesisanalytics/service_endpoints_gen_test.go b/internal/service/kinesisanalytics/service_endpoints_gen_test.go index b91ba50a9dc..0e417c620a6 100644 --- a/internal/service/kinesisanalytics/service_endpoints_gen_test.go +++ b/internal/service/kinesisanalytics/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go b/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go index 2eee2232c40..94f305276ba 100644 --- a/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go +++ b/internal/service/kinesisanalyticsv2/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/kinesisvideo/service_endpoints_gen_test.go b/internal/service/kinesisvideo/service_endpoints_gen_test.go index 3539c0dd629..d1f5c7fcdb8 100644 --- a/internal/service/kinesisvideo/service_endpoints_gen_test.go +++ b/internal/service/kinesisvideo/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/kms/service_endpoints_gen_test.go b/internal/service/kms/service_endpoints_gen_test.go index 22e311ea0e4..550368d0e0e 100644 --- a/internal/service/kms/service_endpoints_gen_test.go +++ b/internal/service/kms/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/lakeformation/service_endpoints_gen_test.go b/internal/service/lakeformation/service_endpoints_gen_test.go index 5e38d669d38..bb83ed6ca95 100644 --- a/internal/service/lakeformation/service_endpoints_gen_test.go +++ b/internal/service/lakeformation/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/lambda/service_endpoints_gen_test.go b/internal/service/lambda/service_endpoints_gen_test.go index efbce328afa..09d7029e8a2 100644 --- a/internal/service/lambda/service_endpoints_gen_test.go +++ b/internal/service/lambda/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/launchwizard/service_endpoints_gen_test.go b/internal/service/launchwizard/service_endpoints_gen_test.go index d95375dc08a..e4ffe60c5a2 100644 --- a/internal/service/launchwizard/service_endpoints_gen_test.go +++ b/internal/service/launchwizard/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/lexmodels/service_endpoints_gen_test.go b/internal/service/lexmodels/service_endpoints_gen_test.go index 705e94430a3..a26caf4536a 100644 --- a/internal/service/lexmodels/service_endpoints_gen_test.go +++ b/internal/service/lexmodels/service_endpoints_gen_test.go @@ -563,8 +563,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/lexv2models/service_endpoints_gen_test.go b/internal/service/lexv2models/service_endpoints_gen_test.go index 429fc683f0e..59852d30a6b 100644 --- a/internal/service/lexv2models/service_endpoints_gen_test.go +++ b/internal/service/lexv2models/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/licensemanager/service_endpoints_gen_test.go b/internal/service/licensemanager/service_endpoints_gen_test.go index f471472976f..f572d72b861 100644 --- a/internal/service/licensemanager/service_endpoints_gen_test.go +++ b/internal/service/licensemanager/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/lightsail/service_endpoints_gen_test.go b/internal/service/lightsail/service_endpoints_gen_test.go index 52c61806fa0..dc7509c0e0a 100644 --- a/internal/service/lightsail/service_endpoints_gen_test.go +++ b/internal/service/lightsail/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/location/service_endpoints_gen_test.go b/internal/service/location/service_endpoints_gen_test.go index 2c85ffce643..edc8648d839 100644 --- a/internal/service/location/service_endpoints_gen_test.go +++ b/internal/service/location/service_endpoints_gen_test.go @@ -403,8 +403,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/logs/service_endpoints_gen_test.go b/internal/service/logs/service_endpoints_gen_test.go index 8c2254a6dd1..40babeb61e0 100644 --- a/internal/service/logs/service_endpoints_gen_test.go +++ b/internal/service/logs/service_endpoints_gen_test.go @@ -489,8 +489,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/lookoutmetrics/service_endpoints_gen_test.go b/internal/service/lookoutmetrics/service_endpoints_gen_test.go index 43c120839db..44ff4a0feb1 100644 --- a/internal/service/lookoutmetrics/service_endpoints_gen_test.go +++ b/internal/service/lookoutmetrics/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/m2/service_endpoints_gen_test.go b/internal/service/m2/service_endpoints_gen_test.go index c63e94d23ac..4a9deaeb73e 100644 --- a/internal/service/m2/service_endpoints_gen_test.go +++ b/internal/service/m2/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/macie2/service_endpoints_gen_test.go b/internal/service/macie2/service_endpoints_gen_test.go index 0bda240cdd7..058a8782bf6 100644 --- a/internal/service/macie2/service_endpoints_gen_test.go +++ b/internal/service/macie2/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/mediaconnect/service_endpoints_gen_test.go b/internal/service/mediaconnect/service_endpoints_gen_test.go index d727747bb0e..9b8dfb844ff 100644 --- a/internal/service/mediaconnect/service_endpoints_gen_test.go +++ b/internal/service/mediaconnect/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/mediaconvert/service_endpoints_gen_test.go b/internal/service/mediaconvert/service_endpoints_gen_test.go index d5a74f989b8..8a7bcd0b466 100644 --- a/internal/service/mediaconvert/service_endpoints_gen_test.go +++ b/internal/service/mediaconvert/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/medialive/service_endpoints_gen_test.go b/internal/service/medialive/service_endpoints_gen_test.go index c827c2dab96..d64e48639f4 100644 --- a/internal/service/medialive/service_endpoints_gen_test.go +++ b/internal/service/medialive/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/mediapackage/service_endpoints_gen_test.go b/internal/service/mediapackage/service_endpoints_gen_test.go index 466af5cecc6..4fb02c73591 100644 --- a/internal/service/mediapackage/service_endpoints_gen_test.go +++ b/internal/service/mediapackage/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/mediapackagev2/service_endpoints_gen_test.go b/internal/service/mediapackagev2/service_endpoints_gen_test.go index 95b64c865e3..397bceb21d8 100644 --- a/internal/service/mediapackagev2/service_endpoints_gen_test.go +++ b/internal/service/mediapackagev2/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/mediastore/service_endpoints_gen_test.go b/internal/service/mediastore/service_endpoints_gen_test.go index 933a6c57af3..a4261f8da01 100644 --- a/internal/service/mediastore/service_endpoints_gen_test.go +++ b/internal/service/mediastore/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/memorydb/service_endpoints_gen_test.go b/internal/service/memorydb/service_endpoints_gen_test.go index 3d0084b0c27..a99beedc566 100644 --- a/internal/service/memorydb/service_endpoints_gen_test.go +++ b/internal/service/memorydb/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/mq/service_endpoints_gen_test.go b/internal/service/mq/service_endpoints_gen_test.go index d1ecaab0aff..7d39cac40a3 100644 --- a/internal/service/mq/service_endpoints_gen_test.go +++ b/internal/service/mq/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/neptune/service_endpoints_gen_test.go b/internal/service/neptune/service_endpoints_gen_test.go index 63cf08f0436..840ebfadc81 100644 --- a/internal/service/neptune/service_endpoints_gen_test.go +++ b/internal/service/neptune/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/networkfirewall/service_endpoints_gen_test.go b/internal/service/networkfirewall/service_endpoints_gen_test.go index 4ef3ef4940e..b7b345a44da 100644 --- a/internal/service/networkfirewall/service_endpoints_gen_test.go +++ b/internal/service/networkfirewall/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/networkmanager/service_endpoints_gen_test.go b/internal/service/networkmanager/service_endpoints_gen_test.go index cd05c6e308a..0b8e9918619 100644 --- a/internal/service/networkmanager/service_endpoints_gen_test.go +++ b/internal/service/networkmanager/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/oam/service_endpoints_gen_test.go b/internal/service/oam/service_endpoints_gen_test.go index 5d859a0d535..f1b288f31dd 100644 --- a/internal/service/oam/service_endpoints_gen_test.go +++ b/internal/service/oam/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/opensearch/service_endpoints_gen_test.go b/internal/service/opensearch/service_endpoints_gen_test.go index eac11e26a2b..ccb60b1b590 100644 --- a/internal/service/opensearch/service_endpoints_gen_test.go +++ b/internal/service/opensearch/service_endpoints_gen_test.go @@ -403,8 +403,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/opensearchserverless/service_endpoints_gen_test.go b/internal/service/opensearchserverless/service_endpoints_gen_test.go index c1cb08d22a6..023f192cb1f 100644 --- a/internal/service/opensearchserverless/service_endpoints_gen_test.go +++ b/internal/service/opensearchserverless/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/opsworks/service_endpoints_gen_test.go b/internal/service/opsworks/service_endpoints_gen_test.go index 27a86500bed..f0387b4b4bf 100644 --- a/internal/service/opsworks/service_endpoints_gen_test.go +++ b/internal/service/opsworks/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/organizations/service_endpoints_gen_test.go b/internal/service/organizations/service_endpoints_gen_test.go index 07a120fe630..25e98627e72 100644 --- a/internal/service/organizations/service_endpoints_gen_test.go +++ b/internal/service/organizations/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/osis/service_endpoints_gen_test.go b/internal/service/osis/service_endpoints_gen_test.go index c1805137737..1a27c269fd4 100644 --- a/internal/service/osis/service_endpoints_gen_test.go +++ b/internal/service/osis/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/outposts/service_endpoints_gen_test.go b/internal/service/outposts/service_endpoints_gen_test.go index 31116f13eb6..72ea588e6aa 100644 --- a/internal/service/outposts/service_endpoints_gen_test.go +++ b/internal/service/outposts/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/pcaconnectorad/service_endpoints_gen_test.go b/internal/service/pcaconnectorad/service_endpoints_gen_test.go index d678a4cd581..bfcf2d8e671 100644 --- a/internal/service/pcaconnectorad/service_endpoints_gen_test.go +++ b/internal/service/pcaconnectorad/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/pinpoint/service_endpoints_gen_test.go b/internal/service/pinpoint/service_endpoints_gen_test.go index d96cee26ac2..134b4538b96 100644 --- a/internal/service/pinpoint/service_endpoints_gen_test.go +++ b/internal/service/pinpoint/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/pipes/service_endpoints_gen_test.go b/internal/service/pipes/service_endpoints_gen_test.go index 30b329712c6..085e1cbfa55 100644 --- a/internal/service/pipes/service_endpoints_gen_test.go +++ b/internal/service/pipes/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/polly/service_endpoints_gen_test.go b/internal/service/polly/service_endpoints_gen_test.go index 2eeee019cd6..41202e0f153 100644 --- a/internal/service/polly/service_endpoints_gen_test.go +++ b/internal/service/polly/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/pricing/service_endpoints_gen_test.go b/internal/service/pricing/service_endpoints_gen_test.go index 78537db0223..237e6f81b7f 100644 --- a/internal/service/pricing/service_endpoints_gen_test.go +++ b/internal/service/pricing/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/qbusiness/service_endpoints_gen_test.go b/internal/service/qbusiness/service_endpoints_gen_test.go index 79c30a9191d..cfb17b338b8 100644 --- a/internal/service/qbusiness/service_endpoints_gen_test.go +++ b/internal/service/qbusiness/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/qldb/service_endpoints_gen_test.go b/internal/service/qldb/service_endpoints_gen_test.go index d01cb3c42f8..4cd03f15cfe 100644 --- a/internal/service/qldb/service_endpoints_gen_test.go +++ b/internal/service/qldb/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/quicksight/service_endpoints_gen_test.go b/internal/service/quicksight/service_endpoints_gen_test.go index 0b04982beb3..b613beb1f6e 100644 --- a/internal/service/quicksight/service_endpoints_gen_test.go +++ b/internal/service/quicksight/service_endpoints_gen_test.go @@ -327,8 +327,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ram/service_endpoints_gen_test.go b/internal/service/ram/service_endpoints_gen_test.go index d94110368c3..97df2dcd536 100644 --- a/internal/service/ram/service_endpoints_gen_test.go +++ b/internal/service/ram/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/rbin/service_endpoints_gen_test.go b/internal/service/rbin/service_endpoints_gen_test.go index 5d0997b6b91..da0e86bcb35 100644 --- a/internal/service/rbin/service_endpoints_gen_test.go +++ b/internal/service/rbin/service_endpoints_gen_test.go @@ -416,8 +416,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/rds/service_endpoints_gen_test.go b/internal/service/rds/service_endpoints_gen_test.go index a7e5cab4e8d..3ac9cdac312 100644 --- a/internal/service/rds/service_endpoints_gen_test.go +++ b/internal/service/rds/service_endpoints_gen_test.go @@ -361,8 +361,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/redshift/service_endpoints_gen_test.go b/internal/service/redshift/service_endpoints_gen_test.go index e1b18a0ec3c..7be04ca81e8 100644 --- a/internal/service/redshift/service_endpoints_gen_test.go +++ b/internal/service/redshift/service_endpoints_gen_test.go @@ -361,8 +361,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/redshiftdata/service_endpoints_gen_test.go b/internal/service/redshiftdata/service_endpoints_gen_test.go index f00ac227e39..3f9ec4e602b 100644 --- a/internal/service/redshiftdata/service_endpoints_gen_test.go +++ b/internal/service/redshiftdata/service_endpoints_gen_test.go @@ -415,8 +415,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/redshiftserverless/service_endpoints_gen_test.go b/internal/service/redshiftserverless/service_endpoints_gen_test.go index 618dbd5cd35..5dd1b62491a 100644 --- a/internal/service/redshiftserverless/service_endpoints_gen_test.go +++ b/internal/service/redshiftserverless/service_endpoints_gen_test.go @@ -361,8 +361,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/rekognition/service_endpoints_gen_test.go b/internal/service/rekognition/service_endpoints_gen_test.go index 266c85ca0e8..b4d5fe51ac9 100644 --- a/internal/service/rekognition/service_endpoints_gen_test.go +++ b/internal/service/rekognition/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/resourceexplorer2/service_endpoints_gen_test.go b/internal/service/resourceexplorer2/service_endpoints_gen_test.go index a60e8970564..47b1b262835 100644 --- a/internal/service/resourceexplorer2/service_endpoints_gen_test.go +++ b/internal/service/resourceexplorer2/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/resourcegroups/service_endpoints_gen_test.go b/internal/service/resourcegroups/service_endpoints_gen_test.go index f32428f8d26..490e12f6387 100644 --- a/internal/service/resourcegroups/service_endpoints_gen_test.go +++ b/internal/service/resourcegroups/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go b/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go index 018fa8417d2..714a1fee27c 100644 --- a/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go +++ b/internal/service/resourcegroupstaggingapi/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/rolesanywhere/service_endpoints_gen_test.go b/internal/service/rolesanywhere/service_endpoints_gen_test.go index 7f45063e721..edeb42ed354 100644 --- a/internal/service/rolesanywhere/service_endpoints_gen_test.go +++ b/internal/service/rolesanywhere/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/route53/service_endpoints_gen_test.go b/internal/service/route53/service_endpoints_gen_test.go index 9a7ff24b754..8fad46d428d 100644 --- a/internal/service/route53/service_endpoints_gen_test.go +++ b/internal/service/route53/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/route53domains/service_endpoints_gen_test.go b/internal/service/route53domains/service_endpoints_gen_test.go index c32df7830cd..999c0c2dc38 100644 --- a/internal/service/route53domains/service_endpoints_gen_test.go +++ b/internal/service/route53domains/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go b/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go index 12ac686a8fe..83d796d0892 100644 --- a/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go +++ b/internal/service/route53recoverycontrolconfig/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go b/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go index 1ce6c2c96ec..787b9959313 100644 --- a/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go +++ b/internal/service/route53recoveryreadiness/service_endpoints_gen_test.go @@ -326,8 +326,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/route53resolver/service_endpoints_gen_test.go b/internal/service/route53resolver/service_endpoints_gen_test.go index 90e4805f08f..3f008684918 100644 --- a/internal/service/route53resolver/service_endpoints_gen_test.go +++ b/internal/service/route53resolver/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/rum/service_endpoints_gen_test.go b/internal/service/rum/service_endpoints_gen_test.go index 04d9db3348d..3fc2eecbc07 100644 --- a/internal/service/rum/service_endpoints_gen_test.go +++ b/internal/service/rum/service_endpoints_gen_test.go @@ -403,8 +403,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/s3/service_endpoints_gen_test.go b/internal/service/s3/service_endpoints_gen_test.go index 3b81901d22b..856763557c1 100644 --- a/internal/service/s3/service_endpoints_gen_test.go +++ b/internal/service/s3/service_endpoints_gen_test.go @@ -563,8 +563,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/s3outposts/service_endpoints_gen_test.go b/internal/service/s3outposts/service_endpoints_gen_test.go index 60c953f464e..6dc283deb02 100644 --- a/internal/service/s3outposts/service_endpoints_gen_test.go +++ b/internal/service/s3outposts/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/sagemaker/service_endpoints_gen_test.go b/internal/service/sagemaker/service_endpoints_gen_test.go index 58d43a1906a..9c7a492629d 100644 --- a/internal/service/sagemaker/service_endpoints_gen_test.go +++ b/internal/service/sagemaker/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/scheduler/service_endpoints_gen_test.go b/internal/service/scheduler/service_endpoints_gen_test.go index df245aac79c..c2e658b7306 100644 --- a/internal/service/scheduler/service_endpoints_gen_test.go +++ b/internal/service/scheduler/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/schemas/service_endpoints_gen_test.go b/internal/service/schemas/service_endpoints_gen_test.go index 3aacc0107aa..2d3a12c83d1 100644 --- a/internal/service/schemas/service_endpoints_gen_test.go +++ b/internal/service/schemas/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/secretsmanager/service_endpoints_gen_test.go b/internal/service/secretsmanager/service_endpoints_gen_test.go index 43efbe3d49a..71e8ead0b8f 100644 --- a/internal/service/secretsmanager/service_endpoints_gen_test.go +++ b/internal/service/secretsmanager/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/securityhub/service_endpoints_gen_test.go b/internal/service/securityhub/service_endpoints_gen_test.go index fdc90655ced..33d317064e2 100644 --- a/internal/service/securityhub/service_endpoints_gen_test.go +++ b/internal/service/securityhub/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/securitylake/service_endpoints_gen_test.go b/internal/service/securitylake/service_endpoints_gen_test.go index cf154376b7f..4f2a2a42f3a 100644 --- a/internal/service/securitylake/service_endpoints_gen_test.go +++ b/internal/service/securitylake/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/serverlessrepo/service_endpoints_gen_test.go b/internal/service/serverlessrepo/service_endpoints_gen_test.go index acba450124d..bc9404d37c4 100644 --- a/internal/service/serverlessrepo/service_endpoints_gen_test.go +++ b/internal/service/serverlessrepo/service_endpoints_gen_test.go @@ -479,8 +479,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/servicecatalog/service_endpoints_gen_test.go b/internal/service/servicecatalog/service_endpoints_gen_test.go index 1cec30dfa0a..020eb089993 100644 --- a/internal/service/servicecatalog/service_endpoints_gen_test.go +++ b/internal/service/servicecatalog/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go b/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go index b3ea1822c7d..772ba3ff7a9 100644 --- a/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go +++ b/internal/service/servicecatalogappregistry/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/servicediscovery/service_endpoints_gen_test.go b/internal/service/servicediscovery/service_endpoints_gen_test.go index 436ee8a181b..736f2afd235 100644 --- a/internal/service/servicediscovery/service_endpoints_gen_test.go +++ b/internal/service/servicediscovery/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/servicequotas/service_endpoints_gen_test.go b/internal/service/servicequotas/service_endpoints_gen_test.go index 47c8998c553..c76c4c5ccc7 100644 --- a/internal/service/servicequotas/service_endpoints_gen_test.go +++ b/internal/service/servicequotas/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ses/service_endpoints_gen_test.go b/internal/service/ses/service_endpoints_gen_test.go index 241f2d77b1b..9409f9008b8 100644 --- a/internal/service/ses/service_endpoints_gen_test.go +++ b/internal/service/ses/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/sesv2/service_endpoints_gen_test.go b/internal/service/sesv2/service_endpoints_gen_test.go index 5ef41e7fd03..a48825288d5 100644 --- a/internal/service/sesv2/service_endpoints_gen_test.go +++ b/internal/service/sesv2/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/sfn/service_endpoints_gen_test.go b/internal/service/sfn/service_endpoints_gen_test.go index 178e2022bca..a7bb4f6cdbc 100644 --- a/internal/service/sfn/service_endpoints_gen_test.go +++ b/internal/service/sfn/service_endpoints_gen_test.go @@ -403,8 +403,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/shield/service_endpoints_gen_test.go b/internal/service/shield/service_endpoints_gen_test.go index 1c3815e41fd..feda07c5c4e 100644 --- a/internal/service/shield/service_endpoints_gen_test.go +++ b/internal/service/shield/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/signer/service_endpoints_gen_test.go b/internal/service/signer/service_endpoints_gen_test.go index 3255f1fcbcc..59f082f0846 100644 --- a/internal/service/signer/service_endpoints_gen_test.go +++ b/internal/service/signer/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/simpledb/service_endpoints_gen_test.go b/internal/service/simpledb/service_endpoints_gen_test.go index 996993e04da..75033124ca2 100644 --- a/internal/service/simpledb/service_endpoints_gen_test.go +++ b/internal/service/simpledb/service_endpoints_gen_test.go @@ -403,8 +403,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/sns/service_endpoints_gen_test.go b/internal/service/sns/service_endpoints_gen_test.go index 2467e06f121..7e8a049c761 100644 --- a/internal/service/sns/service_endpoints_gen_test.go +++ b/internal/service/sns/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/sqs/service_endpoints_gen_test.go b/internal/service/sqs/service_endpoints_gen_test.go index e5d9f53f323..60b00b9b355 100644 --- a/internal/service/sqs/service_endpoints_gen_test.go +++ b/internal/service/sqs/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ssm/service_endpoints_gen_test.go b/internal/service/ssm/service_endpoints_gen_test.go index 016523562bc..dd307b74442 100644 --- a/internal/service/ssm/service_endpoints_gen_test.go +++ b/internal/service/ssm/service_endpoints_gen_test.go @@ -361,8 +361,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ssmcontacts/service_endpoints_gen_test.go b/internal/service/ssmcontacts/service_endpoints_gen_test.go index bed510fe7ba..477e73bb7fe 100644 --- a/internal/service/ssmcontacts/service_endpoints_gen_test.go +++ b/internal/service/ssmcontacts/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ssmincidents/service_endpoints_gen_test.go b/internal/service/ssmincidents/service_endpoints_gen_test.go index 4ad1200e9cc..df22f983fe0 100644 --- a/internal/service/ssmincidents/service_endpoints_gen_test.go +++ b/internal/service/ssmincidents/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ssmsap/service_endpoints_gen_test.go b/internal/service/ssmsap/service_endpoints_gen_test.go index 8b1c2bb5d36..f5c9e927c78 100644 --- a/internal/service/ssmsap/service_endpoints_gen_test.go +++ b/internal/service/ssmsap/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/sso/service_endpoints_gen_test.go b/internal/service/sso/service_endpoints_gen_test.go index 2fa57e841dd..2241f9108cd 100644 --- a/internal/service/sso/service_endpoints_gen_test.go +++ b/internal/service/sso/service_endpoints_gen_test.go @@ -336,8 +336,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/ssoadmin/service_endpoints_gen_test.go b/internal/service/ssoadmin/service_endpoints_gen_test.go index 0957f262ad9..19ed3a74abc 100644 --- a/internal/service/ssoadmin/service_endpoints_gen_test.go +++ b/internal/service/ssoadmin/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/storagegateway/service_endpoints_gen_test.go b/internal/service/storagegateway/service_endpoints_gen_test.go index 6e6dcfb81b6..b111cbb7129 100644 --- a/internal/service/storagegateway/service_endpoints_gen_test.go +++ b/internal/service/storagegateway/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/sts/service_endpoints_gen_test.go b/internal/service/sts/service_endpoints_gen_test.go index 17a7494c200..560fd76f0bf 100644 --- a/internal/service/sts/service_endpoints_gen_test.go +++ b/internal/service/sts/service_endpoints_gen_test.go @@ -470,8 +470,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/swf/service_endpoints_gen_test.go b/internal/service/swf/service_endpoints_gen_test.go index 8bf4b1a5c97..7314f629347 100644 --- a/internal/service/swf/service_endpoints_gen_test.go +++ b/internal/service/swf/service_endpoints_gen_test.go @@ -336,8 +336,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/synthetics/service_endpoints_gen_test.go b/internal/service/synthetics/service_endpoints_gen_test.go index 9a6cc74674d..d4c9908a229 100644 --- a/internal/service/synthetics/service_endpoints_gen_test.go +++ b/internal/service/synthetics/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/transcribe/service_endpoints_gen_test.go b/internal/service/transcribe/service_endpoints_gen_test.go index 94295d22cea..4a3fd2f4fb7 100644 --- a/internal/service/transcribe/service_endpoints_gen_test.go +++ b/internal/service/transcribe/service_endpoints_gen_test.go @@ -413,8 +413,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/transfer/service_endpoints_gen_test.go b/internal/service/transfer/service_endpoints_gen_test.go index 1a3d73a6377..b3ace11c65b 100644 --- a/internal/service/transfer/service_endpoints_gen_test.go +++ b/internal/service/transfer/service_endpoints_gen_test.go @@ -361,8 +361,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/verifiedpermissions/service_endpoints_gen_test.go b/internal/service/verifiedpermissions/service_endpoints_gen_test.go index 6c9e300e658..e369ba65f97 100644 --- a/internal/service/verifiedpermissions/service_endpoints_gen_test.go +++ b/internal/service/verifiedpermissions/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/vpclattice/service_endpoints_gen_test.go b/internal/service/vpclattice/service_endpoints_gen_test.go index 6fd030eb25c..d1caebc3218 100644 --- a/internal/service/vpclattice/service_endpoints_gen_test.go +++ b/internal/service/vpclattice/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/waf/service_endpoints_gen_test.go b/internal/service/waf/service_endpoints_gen_test.go index 87a620d6781..fb5d01b6cf8 100644 --- a/internal/service/waf/service_endpoints_gen_test.go +++ b/internal/service/waf/service_endpoints_gen_test.go @@ -324,8 +324,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/wafregional/service_endpoints_gen_test.go b/internal/service/wafregional/service_endpoints_gen_test.go index 61efd0637b1..e0a8ab91166 100644 --- a/internal/service/wafregional/service_endpoints_gen_test.go +++ b/internal/service/wafregional/service_endpoints_gen_test.go @@ -325,8 +325,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/wafv2/service_endpoints_gen_test.go b/internal/service/wafv2/service_endpoints_gen_test.go index ec988601cb7..4f015d3a169 100644 --- a/internal/service/wafv2/service_endpoints_gen_test.go +++ b/internal/service/wafv2/service_endpoints_gen_test.go @@ -337,8 +337,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/wellarchitected/service_endpoints_gen_test.go b/internal/service/wellarchitected/service_endpoints_gen_test.go index 897c244e7d0..1c2a4446b41 100644 --- a/internal/service/wellarchitected/service_endpoints_gen_test.go +++ b/internal/service/wellarchitected/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/worklink/service_endpoints_gen_test.go b/internal/service/worklink/service_endpoints_gen_test.go index e2373a775ad..5d341cad791 100644 --- a/internal/service/worklink/service_endpoints_gen_test.go +++ b/internal/service/worklink/service_endpoints_gen_test.go @@ -326,8 +326,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/workspaces/service_endpoints_gen_test.go b/internal/service/workspaces/service_endpoints_gen_test.go index 8eb822d3ffa..62d23b7e063 100644 --- a/internal/service/workspaces/service_endpoints_gen_test.go +++ b/internal/service/workspaces/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/workspacesweb/service_endpoints_gen_test.go b/internal/service/workspacesweb/service_endpoints_gen_test.go index c0139ee5d07..ea64a9d0228 100644 --- a/internal/service/workspacesweb/service_endpoints_gen_test.go +++ b/internal/service/workspacesweb/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, diff --git a/internal/service/xray/service_endpoints_gen_test.go b/internal/service/xray/service_endpoints_gen_test.go index cc86903f938..624facec2bc 100644 --- a/internal/service/xray/service_endpoints_gen_test.go +++ b/internal/service/xray/service_endpoints_gen_test.go @@ -334,8 +334,8 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca } config := map[string]any{ - names.AccessKey: servicemocks.MockStaticAccessKey, - names.SecretKey: servicemocks.MockStaticSecretKey, + names.AttrAccessKey: servicemocks.MockStaticAccessKey, + names.AttrSecretKey: servicemocks.MockStaticSecretKey, names.AttrRegion: region, names.AttrSkipCredentialsValidation: true, names.AttrSkipRequestingAccountID: true, From 51a431002f285511edaa66be55e168c44d1c1bf2 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Thu, 9 May 2024 14:47:53 -0500 Subject: [PATCH 0501/1490] update aws_route documentation --- website/docs/r/route.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/r/route.html.markdown b/website/docs/r/route.html.markdown index ecb0f0da5f7..d40dc4ea89c 100644 --- a/website/docs/r/route.html.markdown +++ b/website/docs/r/route.html.markdown @@ -14,6 +14,8 @@ Provides a resource to create a routing table entry (a route) in a VPC routing t ~> **NOTE on `gateway_id` attribute:** The AWS API is very forgiving with the resource ID passed in the `gateway_id` attribute. For example an `aws_route` resource can be created with an [`aws_nat_gateway`](nat_gateway.html) or [`aws_egress_only_internet_gateway`](egress_only_internet_gateway.html) ID specified for the `gateway_id` attribute. Specifying anything other than an [`aws_internet_gateway`](internet_gateway.html) or [`aws_vpn_gateway`](vpn_gateway.html) ID will lead to Terraform reporting a permanent diff between your configuration and recorded state, as the AWS API returns the more-specific attribute. If you are experiencing constant diffs with an `aws_route` resource, the first thing to check is that the correct attribute is being specified. +~> **NOTE on combining `vpc_endpoint_id` and `destination_prefix_list_id` attributes:** To associate a Gateway VPC Endpoint (such as S3) with destination prefix list, use the `aws_vpc_endpoint_route_table_association`resource instead. + ## Example Usage ```terraform From e3e0b22d87a7330d901fa5ef176956f9d9a8f6df Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 9 May 2024 15:52:44 -0400 Subject: [PATCH 0502/1490] Fix golangci-lint `nolintlint` --- internal/conns/backoff_delayer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/conns/backoff_delayer.go b/internal/conns/backoff_delayer.go index 1024421c4e9..1c5360434e0 100644 --- a/internal/conns/backoff_delayer.go +++ b/internal/conns/backoff_delayer.go @@ -39,10 +39,10 @@ func (c *v1CompatibleBackoff) BackoffDelay(attempt int, err error) (time.Duratio if actualRetryCount < 63-attempt { delay = time.Duration(1< maxDelay { - delay = getJitterDelay(maxDelay / 2) //nolint:mnd + delay = getJitterDelay(maxDelay / 2) //nolint:mnd // copied verbatim } } else { - delay = getJitterDelay(maxDelay / 2) //nolint:mnd + delay = getJitterDelay(maxDelay / 2) //nolint:mnd // copied verbatim } return delay, nil From 08bedd739ea75c474000c78979b997a565aa4772 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Thu, 9 May 2024 14:52:47 -0500 Subject: [PATCH 0503/1490] add document link --- website/docs/r/route.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/route.html.markdown b/website/docs/r/route.html.markdown index d40dc4ea89c..206f7f93bfe 100644 --- a/website/docs/r/route.html.markdown +++ b/website/docs/r/route.html.markdown @@ -14,7 +14,7 @@ Provides a resource to create a routing table entry (a route) in a VPC routing t ~> **NOTE on `gateway_id` attribute:** The AWS API is very forgiving with the resource ID passed in the `gateway_id` attribute. For example an `aws_route` resource can be created with an [`aws_nat_gateway`](nat_gateway.html) or [`aws_egress_only_internet_gateway`](egress_only_internet_gateway.html) ID specified for the `gateway_id` attribute. Specifying anything other than an [`aws_internet_gateway`](internet_gateway.html) or [`aws_vpn_gateway`](vpn_gateway.html) ID will lead to Terraform reporting a permanent diff between your configuration and recorded state, as the AWS API returns the more-specific attribute. If you are experiencing constant diffs with an `aws_route` resource, the first thing to check is that the correct attribute is being specified. -~> **NOTE on combining `vpc_endpoint_id` and `destination_prefix_list_id` attributes:** To associate a Gateway VPC Endpoint (such as S3) with destination prefix list, use the `aws_vpc_endpoint_route_table_association`resource instead. +~> **NOTE on combining `vpc_endpoint_id` and `destination_prefix_list_id` attributes:** To associate a Gateway VPC Endpoint (such as S3) with destination prefix list, use the [`aws_vpc_endpoint_route_table_association`](vpc_endpoint_route_table_association.html) resource instead. ## Example Usage From f46294539a9442c4ea81c9261cb2d5c36693f623 Mon Sep 17 00:00:00 2001 From: changelogbot Date: Thu, 9 May 2024 20:03:35 +0000 Subject: [PATCH 0504/1490] Update CHANGELOG.md for #37402 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19911341d67..e649e17e5c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ FEATURES: ENHANCEMENTS: +* data-source/aws_iam_policy_document: Add `minified_json` attribute ([#35677](https://github.com/hashicorp/terraform-provider-aws/issues/35677)) * resource/aws_dynamodb_table_export: Add plan-time validation of `table_arn` ([#37288](https://github.com/hashicorp/terraform-provider-aws/issues/37288)) * resource/aws_kms_key: Add `rotation_period_in_days` argument ([#37140](https://github.com/hashicorp/terraform-provider-aws/issues/37140)) * resource/aws_securitylake_subscriber_notification: Better handles importing resource ([#37332](https://github.com/hashicorp/terraform-provider-aws/issues/37332)) From 8b6582fb7cc842f8aee01ec3b1af4974329f3bec Mon Sep 17 00:00:00 2001 From: changelogbot Date: Thu, 9 May 2024 20:24:45 +0000 Subject: [PATCH 0505/1490] Update CHANGELOG.md for #37404 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e649e17e5c5..c9fb58b34e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ BUG FIXES: * resource/aws_securitylake_subscriber: Correctly requires `source_name` parameter for `aws_log_source_resource` and `custom_log_source_resource` ([#36268](https://github.com/hashicorp/terraform-provider-aws/issues/36268)) * resource/aws_securitylake_subscriber_notification: No longer recreates resource when not needed ([#37332](https://github.com/hashicorp/terraform-provider-aws/issues/37332)) * resource/aws_securitylake_subscriber_notification: Requires value for `configuration.https_notification_configuration.endpoint` ([#37332](https://github.com/hashicorp/terraform-provider-aws/issues/37332)) +* resource/provider: Change the AWS SDK for Go v2 API client [`BackoffDelayer`](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2@v1.26.1/aws/retry#BackoffDelayer) to maintain behavioral compatibility with AWS SDK for Go v1 ([#37404](https://github.com/hashicorp/terraform-provider-aws/issues/37404)) ## 5.48.0 (May 2, 2024) From fb484027ce359a644a5f5c9ec1dfddb8797467ca Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:28 -0400 Subject: [PATCH 0506/1490] ci: Prefer constant for string literal "endpoint" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 7564d99ff1c..532f1060794 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1245,3 +1245,13 @@ rules: - pattern: '"skip_requesting_account_id"' severity: ERROR fix: "names.AttrSkipRequestingAccountID" + - id: literal-endpoint-string-constant + languages: [go] + message: Use the constant `names.AttrEndpoint` for the string literal "endpoint" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"endpoint"' + severity: ERROR + fix: "names.AttrEndpoint" From 74d30b4ce96da24b73deb06a0bf3ae126fd9ce9b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:28 -0400 Subject: [PATCH 0507/1490] names: Add constant for string literal "endpoint" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 68023e093ef..6ea9bf869f5 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -20,6 +20,7 @@ const ( AttrDescription = "description" AttrDomainName = "domain_name" AttrEnabled = "enabled" + AttrEndpoint = "endpoint" AttrEndpoints = "endpoints" AttrEngineVersion = "engine_version" AttrID = "id" // Should be explicitly declared only for Framework resources From abdb3f5a57b56d1df578df4b245cb08cd44cfb86 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:29 -0400 Subject: [PATCH 0508/1490] accessanalyzer: Use constant for endpoint strings --- internal/service/accessanalyzer/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/accessanalyzer/service_package_gen.go b/internal/service/accessanalyzer/service_package_gen.go index 7ce8e39daae..e5459f2380e 100644 --- a/internal/service/accessanalyzer/service_package_gen.go +++ b/internal/service/accessanalyzer/service_package_gen.go @@ -52,7 +52,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return accessanalyzer_sdkv2.NewFromConfig(cfg, func(o *accessanalyzer_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 074acf024210c7b7ef5f722e97a120641a258b00 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:29 -0400 Subject: [PATCH 0509/1490] account: Use constant for endpoint strings --- internal/service/account/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/account/service_package_gen.go b/internal/service/account/service_package_gen.go index 887fd0899e1..5df3d9d9157 100644 --- a/internal/service/account/service_package_gen.go +++ b/internal/service/account/service_package_gen.go @@ -53,7 +53,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return account_sdkv2.NewFromConfig(cfg, func(o *account_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From ab98fe0cc00a746efdfbcb57e68ffdba8a8c7c08 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:29 -0400 Subject: [PATCH 0510/1490] acm: Use constant for endpoint strings --- internal/service/acm/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/acm/service_package_gen.go b/internal/service/acm/service_package_gen.go index b52abc1c473..b75c973f68c 100644 --- a/internal/service/acm/service_package_gen.go +++ b/internal/service/acm/service_package_gen.go @@ -57,7 +57,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return acm_sdkv2.NewFromConfig(cfg, func(o *acm_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 722746f1a09b1511853a10cb37284d4184de8fea Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:29 -0400 Subject: [PATCH 0511/1490] acmpca: Use constant for endpoint strings --- internal/service/acmpca/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/acmpca/service_package_gen.go b/internal/service/acmpca/service_package_gen.go index e352e3f200b..34d4f06719b 100644 --- a/internal/service/acmpca/service_package_gen.go +++ b/internal/service/acmpca/service_package_gen.go @@ -82,7 +82,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return acmpca_sdkv2.NewFromConfig(cfg, func(o *acmpca_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From cb5df71c6422775a2fd8b22790d94ae8fa42e1fe Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:29 -0400 Subject: [PATCH 0512/1490] amp: Use constant for endpoint strings --- internal/service/amp/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/amp/service_package_gen.go b/internal/service/amp/service_package_gen.go index d493e187bae..38b63ede03d 100644 --- a/internal/service/amp/service_package_gen.go +++ b/internal/service/amp/service_package_gen.go @@ -77,7 +77,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return amp_sdkv2.NewFromConfig(cfg, func(o *amp_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 647eb92ca9542d56c3f9737980ddbc24c342f316 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:30 -0400 Subject: [PATCH 0513/1490] amplify: Use constant for endpoint strings --- internal/service/amplify/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/amplify/service_package_gen.go b/internal/service/amplify/service_package_gen.go index 8b0e47ebc55..b16fdbec09b 100644 --- a/internal/service/amplify/service_package_gen.go +++ b/internal/service/amplify/service_package_gen.go @@ -71,7 +71,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return amplify_sdkv2.NewFromConfig(cfg, func(o *amplify_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 3bdbe0e59c6a75d133ee13485845eb2bcec1e825 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:30 -0400 Subject: [PATCH 0514/1490] apigateway: Use constant for endpoint strings --- internal/service/apigateway/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/apigateway/service_package.go b/internal/service/apigateway/service_package.go index ae28b5641d9..fae1c4a6c8e 100644 --- a/internal/service/apigateway/service_package.go +++ b/internal/service/apigateway/service_package.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/apigateway/types" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -19,7 +20,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return apigateway.NewFromConfig(cfg, func(o *apigateway.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } From ba3c6bc6570d6d59ede33bfd647b0e6ac6b86578 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:30 -0400 Subject: [PATCH 0515/1490] apigatewayv2: Use constant for endpoint strings --- internal/service/apigatewayv2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/apigatewayv2/service_package_gen.go b/internal/service/apigatewayv2/service_package_gen.go index 2431396d1ee..c66d93e0a36 100644 --- a/internal/service/apigatewayv2/service_package_gen.go +++ b/internal/service/apigatewayv2/service_package_gen.go @@ -135,7 +135,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return apigatewayv2_sdkv2.NewFromConfig(cfg, func(o *apigatewayv2_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 97d8abe8072f1a708f742481af395bdc646026e9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:30 -0400 Subject: [PATCH 0516/1490] appautoscaling: Use constant for endpoint strings --- internal/service/appautoscaling/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appautoscaling/service_package_gen.go b/internal/service/appautoscaling/service_package_gen.go index 0bdd362f029..98575caec35 100644 --- a/internal/service/appautoscaling/service_package_gen.go +++ b/internal/service/appautoscaling/service_package_gen.go @@ -57,7 +57,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*applicationautoscaling_sdkv1.ApplicationAutoScaling, error) { sess := config["session"].(*session_sdkv1.Session) - return applicationautoscaling_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return applicationautoscaling_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 6c6df73b99d3018034fa5ccf60ea4ac8e2c296b9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:30 -0400 Subject: [PATCH 0517/1490] appconfig: Use constant for endpoint strings --- internal/service/appconfig/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appconfig/service_package_gen.go b/internal/service/appconfig/service_package_gen.go index 5662e4ef91f..a9b2872581f 100644 --- a/internal/service/appconfig/service_package_gen.go +++ b/internal/service/appconfig/service_package_gen.go @@ -112,7 +112,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return appconfig_sdkv2.NewFromConfig(cfg, func(o *appconfig_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From fc65b9f63bb9b24a8094506abcfb74b4da7b143d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:31 -0400 Subject: [PATCH 0518/1490] appfabric: Use constant for endpoint strings --- internal/service/appfabric/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appfabric/service_package_gen.go b/internal/service/appfabric/service_package_gen.go index 1182cac7c89..1066d45117d 100644 --- a/internal/service/appfabric/service_package_gen.go +++ b/internal/service/appfabric/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return appfabric_sdkv2.NewFromConfig(cfg, func(o *appfabric_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 9025ed2aab1002215822bf4069cb7100fe09e372 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:31 -0400 Subject: [PATCH 0519/1490] appflow: Use constant for endpoint strings --- internal/service/appflow/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appflow/service_package_gen.go b/internal/service/appflow/service_package_gen.go index 8d12aeb59cc..32a775a2b08 100644 --- a/internal/service/appflow/service_package_gen.go +++ b/internal/service/appflow/service_package_gen.go @@ -53,7 +53,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return appflow_sdkv2.NewFromConfig(cfg, func(o *appflow_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From cd66892ea3e287f494180745cbc29db8742b508f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:31 -0400 Subject: [PATCH 0520/1490] appintegrations: Use constant for endpoint strings --- internal/service/appintegrations/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appintegrations/service_package_gen.go b/internal/service/appintegrations/service_package_gen.go index 43743c760e9..1b87c67bceb 100644 --- a/internal/service/appintegrations/service_package_gen.go +++ b/internal/service/appintegrations/service_package_gen.go @@ -62,7 +62,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return appintegrations_sdkv2.NewFromConfig(cfg, func(o *appintegrations_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 3b270762ec37a369528c387ee80c519fce02a00b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:31 -0400 Subject: [PATCH 0521/1490] applicationinsights: Use constant for endpoint strings --- internal/service/applicationinsights/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/applicationinsights/service_package_gen.go b/internal/service/applicationinsights/service_package_gen.go index a74e709fb17..031dbf31bde 100644 --- a/internal/service/applicationinsights/service_package_gen.go +++ b/internal/service/applicationinsights/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*applicationinsights_sdkv1.ApplicationInsights, error) { sess := config["session"].(*session_sdkv1.Session) - return applicationinsights_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return applicationinsights_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 2d91bde7b781f167f7205d1261408d491caa29f2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:32 -0400 Subject: [PATCH 0522/1490] appmesh: Use constant for endpoint strings --- internal/service/appmesh/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index d279ce20212..e9fc9d4b2e1 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -132,7 +132,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*appmesh_sdkv1.AppMesh, error) { sess := config["session"].(*session_sdkv1.Session) - return appmesh_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return appmesh_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 3f5cf4f39ed5ae90ea4e86015eaa5cc479f5a994 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:32 -0400 Subject: [PATCH 0523/1490] apprunner: Use constant for endpoint strings --- internal/service/apprunner/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/apprunner/service_package_gen.go b/internal/service/apprunner/service_package_gen.go index 72bd8b1ecb2..537da0dd515 100644 --- a/internal/service/apprunner/service_package_gen.go +++ b/internal/service/apprunner/service_package_gen.go @@ -107,7 +107,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return apprunner_sdkv2.NewFromConfig(cfg, func(o *apprunner_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From a252c857eefb4526a161afdc40744316435d80e2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:32 -0400 Subject: [PATCH 0524/1490] appstream: Use constant for endpoint strings --- internal/service/appstream/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appstream/service_package_gen.go b/internal/service/appstream/service_package_gen.go index 21e7fcc8661..33dfb3539b0 100644 --- a/internal/service/appstream/service_package_gen.go +++ b/internal/service/appstream/service_package_gen.go @@ -80,7 +80,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*appstream_sdkv1.AppStream, error) { sess := config["session"].(*session_sdkv1.Session) - return appstream_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return appstream_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 14c5f69d3e5ccb3ddefe7a5d3b2d0d1ae64daf03 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:33 -0400 Subject: [PATCH 0525/1490] appsync: Use constant for endpoint strings --- internal/service/appsync/datasource.go | 22 +++++++++---------- .../service/appsync/service_package_gen.go | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/appsync/datasource.go b/internal/service/appsync/datasource.go index 77bcd582016..df54fec4c4c 100644 --- a/internal/service/appsync/datasource.go +++ b/internal/service/appsync/datasource.go @@ -103,7 +103,7 @@ func ResourceDataSource() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Required: true, }, @@ -169,7 +169,7 @@ func ResourceDataSource() *schema.Resource { }, }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Required: true, }, @@ -198,7 +198,7 @@ func ResourceDataSource() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Required: true, }, @@ -623,7 +623,7 @@ func expandElasticsearchDataSourceConfig(l []interface{}, currentRegion string) result := &appsync.ElasticsearchDataSourceConfig{ AwsRegion: aws.String(currentRegion), - Endpoint: aws.String(configured["endpoint"].(string)), + Endpoint: aws.String(configured[names.AttrEndpoint].(string)), } if v, ok := configured[names.AttrRegion]; ok && v.(string) != "" { @@ -642,7 +642,7 @@ func expandOpenSearchServiceDataSourceConfig(l []interface{}, currentRegion stri result := &appsync.OpenSearchServiceDataSourceConfig{ AwsRegion: aws.String(currentRegion), - Endpoint: aws.String(configured["endpoint"].(string)), + Endpoint: aws.String(configured[names.AttrEndpoint].(string)), } if v, ok := configured[names.AttrRegion]; ok && v.(string) != "" { @@ -658,8 +658,8 @@ func flattenElasticsearchDataSourceConfig(config *appsync.ElasticsearchDataSourc } result := map[string]interface{}{ - "endpoint": aws.StringValue(config.Endpoint), - names.AttrRegion: aws.StringValue(config.AwsRegion), + names.AttrEndpoint: aws.StringValue(config.Endpoint), + names.AttrRegion: aws.StringValue(config.AwsRegion), } return []map[string]interface{}{result} @@ -671,8 +671,8 @@ func flattenOpenSearchServiceDataSourceConfig(config *appsync.OpenSearchServiceD } result := map[string]interface{}{ - "endpoint": aws.StringValue(config.Endpoint), - names.AttrRegion: aws.StringValue(config.AwsRegion), + names.AttrEndpoint: aws.StringValue(config.Endpoint), + names.AttrRegion: aws.StringValue(config.AwsRegion), } return []map[string]interface{}{result} @@ -686,7 +686,7 @@ func expandHTTPDataSourceConfig(l []interface{}) *appsync.HttpDataSourceConfig { configured := l[0].(map[string]interface{}) result := &appsync.HttpDataSourceConfig{ - Endpoint: aws.String(configured["endpoint"].(string)), + Endpoint: aws.String(configured[names.AttrEndpoint].(string)), } if v, ok := configured["authorization_config"].([]interface{}); ok && len(v) > 0 { @@ -702,7 +702,7 @@ func flattenHTTPDataSourceConfig(config *appsync.HttpDataSourceConfig) []map[str } result := map[string]interface{}{ - "endpoint": aws.StringValue(config.Endpoint), + names.AttrEndpoint: aws.StringValue(config.Endpoint), } if config.AuthorizationConfig != nil { diff --git a/internal/service/appsync/service_package_gen.go b/internal/service/appsync/service_package_gen.go index e54e5a31ff7..e1fe120a54d 100644 --- a/internal/service/appsync/service_package_gen.go +++ b/internal/service/appsync/service_package_gen.go @@ -81,7 +81,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*appsync_sdkv1.AppSync, error) { sess := config["session"].(*session_sdkv1.Session) - return appsync_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return appsync_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From f924f11fe6e8b0e3f8221804342a58144f9bbd80 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:33 -0400 Subject: [PATCH 0526/1490] athena: Use constant for endpoint strings --- internal/service/athena/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/athena/service_package_gen.go b/internal/service/athena/service_package_gen.go index 460b18a9db3..e659a72c5c3 100644 --- a/internal/service/athena/service_package_gen.go +++ b/internal/service/athena/service_package_gen.go @@ -74,7 +74,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return athena_sdkv2.NewFromConfig(cfg, func(o *athena_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From f9c841eefb6b744aecb0bf7c05f6099c3a289622 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:33 -0400 Subject: [PATCH 0527/1490] auditmanager: Use constant for endpoint strings --- internal/service/auditmanager/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/auditmanager/service_package_gen.go b/internal/service/auditmanager/service_package_gen.go index da4a22ca399..967d36277b9 100644 --- a/internal/service/auditmanager/service_package_gen.go +++ b/internal/service/auditmanager/service_package_gen.go @@ -83,7 +83,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return auditmanager_sdkv2.NewFromConfig(cfg, func(o *auditmanager_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 99513208fb4a1c708565c82f66426ecf3363b9f6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:33 -0400 Subject: [PATCH 0528/1490] autoscaling: Use constant for endpoint strings --- internal/service/autoscaling/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/autoscaling/service_package_gen.go b/internal/service/autoscaling/service_package_gen.go index 6601af1369c..3753d8fd70c 100644 --- a/internal/service/autoscaling/service_package_gen.go +++ b/internal/service/autoscaling/service_package_gen.go @@ -101,7 +101,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return autoscaling_sdkv2.NewFromConfig(cfg, func(o *autoscaling_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 91743bf9cb545139563d7d116a79bf3c2e5efcc4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:34 -0400 Subject: [PATCH 0529/1490] autoscalingplans: Use constant for endpoint strings --- internal/service/autoscalingplans/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/autoscalingplans/service_package_gen.go b/internal/service/autoscalingplans/service_package_gen.go index acd311eb371..0ed6db217d4 100644 --- a/internal/service/autoscalingplans/service_package_gen.go +++ b/internal/service/autoscalingplans/service_package_gen.go @@ -44,7 +44,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return autoscalingplans_sdkv2.NewFromConfig(cfg, func(o *autoscalingplans_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 0279263441c8b28e789c8b32cadebad6d4b90d75 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:34 -0400 Subject: [PATCH 0530/1490] backup: Use constant for endpoint strings --- internal/service/backup/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/backup/service_package_gen.go b/internal/service/backup/service_package_gen.go index edae7c1f2db..3c33428890e 100644 --- a/internal/service/backup/service_package_gen.go +++ b/internal/service/backup/service_package_gen.go @@ -117,7 +117,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*backup_sdkv1.Backup, error) { sess := config["session"].(*session_sdkv1.Session) - return backup_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return backup_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 8c1e416090cd55a1a0c39a9f4f9f99511d10f6b1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:34 -0400 Subject: [PATCH 0531/1490] batch: Use constant for endpoint strings --- internal/service/batch/service_package_gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/batch/service_package_gen.go b/internal/service/batch/service_package_gen.go index a0fb44a5954..3143b00152f 100644 --- a/internal/service/batch/service_package_gen.go +++ b/internal/service/batch/service_package_gen.go @@ -92,7 +92,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*batch_sdkv1.Batch, error) { sess := config["session"].(*session_sdkv1.Session) - return batch_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return batch_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -100,7 +100,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return batch_sdkv2.NewFromConfig(cfg, func(o *batch_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From bbf251514c1a05008236578ebf3ffa3c0d3b8614 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:34 -0400 Subject: [PATCH 0532/1490] bcmdataexports: Use constant for endpoint strings --- internal/service/bcmdataexports/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/bcmdataexports/service_package_gen.go b/internal/service/bcmdataexports/service_package_gen.go index 35ede54a117..9e418b95612 100644 --- a/internal/service/bcmdataexports/service_package_gen.go +++ b/internal/service/bcmdataexports/service_package_gen.go @@ -47,7 +47,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return bcmdataexports_sdkv2.NewFromConfig(cfg, func(o *bcmdataexports_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 5b0f91d21932ebccfd24f39dd329bcb1ea5ca2d4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:34 -0400 Subject: [PATCH 0533/1490] bedrock: Use constant for endpoint strings --- internal/service/bedrock/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/bedrock/service_package_gen.go b/internal/service/bedrock/service_package_gen.go index 476ee9196df..1dc5f0ff7ef 100644 --- a/internal/service/bedrock/service_package_gen.go +++ b/internal/service/bedrock/service_package_gen.go @@ -75,7 +75,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return bedrock_sdkv2.NewFromConfig(cfg, func(o *bedrock_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 369a31cda7fd3512f8846a899f9997bdc961f50a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:35 -0400 Subject: [PATCH 0534/1490] bedrockagent: Use constant for endpoint strings --- internal/service/bedrockagent/knowledge_base.go | 2 +- internal/service/bedrockagent/service_package_gen.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/bedrockagent/knowledge_base.go b/internal/service/bedrockagent/knowledge_base.go index fa7db266cbc..47f166f4090 100644 --- a/internal/service/bedrockagent/knowledge_base.go +++ b/internal/service/bedrockagent/knowledge_base.go @@ -239,7 +239,7 @@ func (r *knowledgeBaseResource) Schema(ctx context.Context, request resource.Sch CustomType: fwtypes.ARNType, Required: true, }, - "endpoint": schema.StringAttribute{ + names.AttrEndpoint: schema.StringAttribute{ Required: true, }, "vector_index_name": schema.StringAttribute{ diff --git a/internal/service/bedrockagent/service_package_gen.go b/internal/service/bedrockagent/service_package_gen.go index a6b8f470ceb..d5b2f2dd1df 100644 --- a/internal/service/bedrockagent/service_package_gen.go +++ b/internal/service/bedrockagent/service_package_gen.go @@ -73,7 +73,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return bedrockagent_sdkv2.NewFromConfig(cfg, func(o *bedrockagent_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 71bd7ef2203a7ef03e76d392071402298dabb2ef Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:35 -0400 Subject: [PATCH 0535/1490] budgets: Use constant for endpoint strings --- internal/service/budgets/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/budgets/service_package_gen.go b/internal/service/budgets/service_package_gen.go index 90d46f856db..389abc6c277 100644 --- a/internal/service/budgets/service_package_gen.go +++ b/internal/service/budgets/service_package_gen.go @@ -53,7 +53,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return budgets_sdkv2.NewFromConfig(cfg, func(o *budgets_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 4f9487af7d051501de017481c3922d5eafc77dae Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:35 -0400 Subject: [PATCH 0536/1490] ce: Use constant for endpoint strings --- internal/service/ce/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ce/service_package_gen.go b/internal/service/ce/service_package_gen.go index 43fcaec38c2..925738c8cfd 100644 --- a/internal/service/ce/service_package_gen.go +++ b/internal/service/ce/service_package_gen.go @@ -80,7 +80,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return costexplorer_sdkv2.NewFromConfig(cfg, func(o *costexplorer_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 8590eebc6213fe692cb9c1c012f28d66d4a835bc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:36 -0400 Subject: [PATCH 0537/1490] chatbot: Use constant for endpoint strings --- internal/service/chatbot/service_package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/chatbot/service_package.go b/internal/service/chatbot/service_package.go index c58dd9b3690..7b764b6440a 100644 --- a/internal/service/chatbot/service_package.go +++ b/internal/service/chatbot/service_package.go @@ -17,7 +17,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return chatbot.NewFromConfig(cfg, func(o *chatbot.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } else if config["partition"].(string) == names.StandardPartitionID { // Chatbot endpoint is available only in the 4 regions us-east-2, us-west-2, eu-west-1, and ap-southeast-1. From 74b1595d2ffdff624af96716ba369eb9cb47e77d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:36 -0400 Subject: [PATCH 0538/1490] chime: Use constant for endpoint strings --- internal/service/chime/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/chime/service_package_gen.go b/internal/service/chime/service_package_gen.go index 47f0af9a0ff..eb5ae80b7cd 100644 --- a/internal/service/chime/service_package_gen.go +++ b/internal/service/chime/service_package_gen.go @@ -72,7 +72,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*chime_sdkv1.Chime, error) { sess := config["session"].(*session_sdkv1.Session) - return chime_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return chime_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From cffd3cc93d50f93a2a1b7f08ea6133ead7f9ebc8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:36 -0400 Subject: [PATCH 0539/1490] chimesdkmediapipelines: Use constant for endpoint strings --- internal/service/chimesdkmediapipelines/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/chimesdkmediapipelines/service_package_gen.go b/internal/service/chimesdkmediapipelines/service_package_gen.go index 830fe080cb1..ba6c6904b73 100644 --- a/internal/service/chimesdkmediapipelines/service_package_gen.go +++ b/internal/service/chimesdkmediapipelines/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return chimesdkmediapipelines_sdkv2.NewFromConfig(cfg, func(o *chimesdkmediapipelines_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 99d9d1b142a23eeaee51f5e162618a2d9b233269 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:36 -0400 Subject: [PATCH 0540/1490] chimesdkvoice: Use constant for endpoint strings --- internal/service/chimesdkvoice/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/chimesdkvoice/service_package_gen.go b/internal/service/chimesdkvoice/service_package_gen.go index 31c37a7c3c2..21d7358cd5c 100644 --- a/internal/service/chimesdkvoice/service_package_gen.go +++ b/internal/service/chimesdkvoice/service_package_gen.go @@ -65,7 +65,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return chimesdkvoice_sdkv2.NewFromConfig(cfg, func(o *chimesdkvoice_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 53db3008c474aea052da8b6a533ccfd7e6d4bb8d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:37 -0400 Subject: [PATCH 0541/1490] cleanrooms: Use constant for endpoint strings --- internal/service/cleanrooms/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cleanrooms/service_package_gen.go b/internal/service/cleanrooms/service_package_gen.go index 53da1e0ef32..1eb9ffd27e6 100644 --- a/internal/service/cleanrooms/service_package_gen.go +++ b/internal/service/cleanrooms/service_package_gen.go @@ -54,7 +54,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return cleanrooms_sdkv2.NewFromConfig(cfg, func(o *cleanrooms_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From c63f1acb73e19910d27fcf03a19f38b3e3277071 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:37 -0400 Subject: [PATCH 0542/1490] cloud9: Use constant for endpoint strings --- internal/service/cloud9/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cloud9/service_package_gen.go b/internal/service/cloud9/service_package_gen.go index 9329d9b578d..235a3998d05 100644 --- a/internal/service/cloud9/service_package_gen.go +++ b/internal/service/cloud9/service_package_gen.go @@ -53,7 +53,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return cloud9_sdkv2.NewFromConfig(cfg, func(o *cloud9_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From d0677c0c3b583670a27e03ca38a958d165f5861b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:37 -0400 Subject: [PATCH 0543/1490] cloudcontrol: Use constant for endpoint strings --- internal/service/cloudcontrol/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cloudcontrol/service_package_gen.go b/internal/service/cloudcontrol/service_package_gen.go index 25c4207e0ac..7893384b14d 100644 --- a/internal/service/cloudcontrol/service_package_gen.go +++ b/internal/service/cloudcontrol/service_package_gen.go @@ -51,7 +51,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return cloudcontrol_sdkv2.NewFromConfig(cfg, func(o *cloudcontrol_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 8d22b5b01eef588a7837dcba49c89d43180835a9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:37 -0400 Subject: [PATCH 0544/1490] cloudformation: Use constant for endpoint strings --- internal/service/cloudformation/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/cloudformation/service_package.go b/internal/service/cloudformation/service_package.go index fb9eae2a63d..af2114b3e62 100644 --- a/internal/service/cloudformation/service_package.go +++ b/internal/service/cloudformation/service_package.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/cloudformation/types" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -19,7 +20,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return cloudformation.NewFromConfig(cfg, func(o *cloudformation.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } From 15275f8740ec5a207cd61d68c2d0688ec2798a01 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:37 -0400 Subject: [PATCH 0545/1490] cloudfront: Use constant for endpoint strings --- internal/service/cloudfront/realtime_log_config.go | 8 ++++---- .../service/cloudfront/realtime_log_config_data_source.go | 4 ++-- internal/service/cloudfront/service_package_gen.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/cloudfront/realtime_log_config.go b/internal/service/cloudfront/realtime_log_config.go index 6ba9b77028f..11d26169c37 100644 --- a/internal/service/cloudfront/realtime_log_config.go +++ b/internal/service/cloudfront/realtime_log_config.go @@ -41,7 +41,7 @@ func resourceRealtimeLogConfig() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeList, Required: true, MinItems: 1, @@ -104,7 +104,7 @@ func resourceRealtimeLogConfigCreate(ctx context.Context, d *schema.ResourceData Name: aws.String(name), } - if v, ok := d.GetOk("endpoint"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrEndpoint); ok && len(v.([]interface{})) > 0 { input.EndPoints = expandEndPoints(v.([]interface{})) } @@ -144,7 +144,7 @@ func resourceRealtimeLogConfigRead(ctx context.Context, d *schema.ResourceData, } d.Set(names.AttrARN, logConfig.ARN) - if err := d.Set("endpoint", flattenEndPoints(logConfig.EndPoints)); err != nil { + if err := d.Set(names.AttrEndpoint, flattenEndPoints(logConfig.EndPoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoint: %s", err) } d.Set("fields", logConfig.Fields) @@ -166,7 +166,7 @@ func resourceRealtimeLogConfigUpdate(ctx context.Context, d *schema.ResourceData ARN: aws.String(d.Id()), } - if v, ok := d.GetOk("endpoint"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrEndpoint); ok && len(v.([]interface{})) > 0 { input.EndPoints = expandEndPoints(v.([]interface{})) } diff --git a/internal/service/cloudfront/realtime_log_config_data_source.go b/internal/service/cloudfront/realtime_log_config_data_source.go index f0b1ad08dfd..190652f3273 100644 --- a/internal/service/cloudfront/realtime_log_config_data_source.go +++ b/internal/service/cloudfront/realtime_log_config_data_source.go @@ -26,7 +26,7 @@ func dataSourceRealtimeLogConfig() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -85,7 +85,7 @@ func dataSourceRealtimeLogConfigRead(ctx context.Context, d *schema.ResourceData arn := aws.ToString(logConfig.ARN) d.SetId(arn) d.Set(names.AttrARN, arn) - if err := d.Set("endpoint", flattenEndPoints(logConfig.EndPoints)); err != nil { + if err := d.Set(names.AttrEndpoint, flattenEndPoints(logConfig.EndPoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoint: %s", err) } d.Set("fields", logConfig.Fields) diff --git a/internal/service/cloudfront/service_package_gen.go b/internal/service/cloudfront/service_package_gen.go index ec28badd984..ce294b4e0b7 100644 --- a/internal/service/cloudfront/service_package_gen.go +++ b/internal/service/cloudfront/service_package_gen.go @@ -166,7 +166,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return cloudfront_sdkv2.NewFromConfig(cfg, func(o *cloudfront_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 1c693a073bfb9cf092dee09c46f94560b28ef38f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:38 -0400 Subject: [PATCH 0546/1490] cloudfrontkeyvaluestore: Use constant for endpoint strings --- internal/service/cloudfrontkeyvaluestore/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cloudfrontkeyvaluestore/service_package_gen.go b/internal/service/cloudfrontkeyvaluestore/service_package_gen.go index e2fd3132ab7..1553466ad8c 100644 --- a/internal/service/cloudfrontkeyvaluestore/service_package_gen.go +++ b/internal/service/cloudfrontkeyvaluestore/service_package_gen.go @@ -44,7 +44,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return cloudfrontkeyvaluestore_sdkv2.NewFromConfig(cfg, func(o *cloudfrontkeyvaluestore_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 56c7547ca7ba32e5892ab8fcea74d70634da9623 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:38 -0400 Subject: [PATCH 0547/1490] cloudhsmv2: Use constant for endpoint strings --- internal/service/cloudhsmv2/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/cloudhsmv2/service_package.go b/internal/service/cloudhsmv2/service_package.go index 386c4d14d9e..ce68c6c2322 100644 --- a/internal/service/cloudhsmv2/service_package.go +++ b/internal/service/cloudhsmv2/service_package.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/cloudhsmv2/types" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -19,7 +20,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return cloudhsmv2.NewFromConfig(cfg, func(o *cloudhsmv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } From 10c1ef8c803e9a60b996e4ac4fc10138bf1ad78b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:38 -0400 Subject: [PATCH 0548/1490] cloudsearch: Use constant for endpoint strings --- internal/service/cloudsearch/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cloudsearch/service_package_gen.go b/internal/service/cloudsearch/service_package_gen.go index d727ef838c6..a88a0a58564 100644 --- a/internal/service/cloudsearch/service_package_gen.go +++ b/internal/service/cloudsearch/service_package_gen.go @@ -50,7 +50,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return cloudsearch_sdkv2.NewFromConfig(cfg, func(o *cloudsearch_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From d92d3c80775f01f8486cc09c4e1eedd917d11a2b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:38 -0400 Subject: [PATCH 0549/1490] cloudtrail: Use constant for endpoint strings --- internal/service/cloudtrail/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cloudtrail/service_package_gen.go b/internal/service/cloudtrail/service_package_gen.go index 1e298771bdb..fcb6cadad39 100644 --- a/internal/service/cloudtrail/service_package_gen.go +++ b/internal/service/cloudtrail/service_package_gen.go @@ -62,7 +62,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return cloudtrail_sdkv2.NewFromConfig(cfg, func(o *cloudtrail_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From e712ce1d120abf772cfe67216cbf363ccae3fb33 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:38 -0400 Subject: [PATCH 0550/1490] cloudwatch: Use constant for endpoint strings --- internal/service/cloudwatch/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cloudwatch/service_package_gen.go b/internal/service/cloudwatch/service_package_gen.go index 467b015e456..db1042b5114 100644 --- a/internal/service/cloudwatch/service_package_gen.go +++ b/internal/service/cloudwatch/service_package_gen.go @@ -69,7 +69,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return cloudwatch_sdkv2.NewFromConfig(cfg, func(o *cloudwatch_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 03e80441aceb49937de34d6a0a294d16c1022d87 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:39 -0400 Subject: [PATCH 0551/1490] codeartifact: Use constant for endpoint strings --- internal/service/codeartifact/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/codeartifact/service_package_gen.go b/internal/service/codeartifact/service_package_gen.go index 9391cdb160f..bdd24fc52b3 100644 --- a/internal/service/codeartifact/service_package_gen.go +++ b/internal/service/codeartifact/service_package_gen.go @@ -77,7 +77,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return codeartifact_sdkv2.NewFromConfig(cfg, func(o *codeartifact_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 8fc3bb8b029b25fb5c8105e693c7786745db7a0f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:39 -0400 Subject: [PATCH 0552/1490] codebuild: Use constant for endpoint strings --- internal/service/codebuild/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/codebuild/service_package_gen.go b/internal/service/codebuild/service_package_gen.go index e2bbba731f2..11ac0a069b5 100644 --- a/internal/service/codebuild/service_package_gen.go +++ b/internal/service/codebuild/service_package_gen.go @@ -67,7 +67,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return codebuild_sdkv2.NewFromConfig(cfg, func(o *codebuild_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 1e7247590c0b9d0cfec8c579a122e3d338ac01fc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:39 -0400 Subject: [PATCH 0553/1490] codecatalyst: Use constant for endpoint strings --- internal/service/codecatalyst/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/codecatalyst/service_package_gen.go b/internal/service/codecatalyst/service_package_gen.go index c9f04d85f24..b41c1c2cc86 100644 --- a/internal/service/codecatalyst/service_package_gen.go +++ b/internal/service/codecatalyst/service_package_gen.go @@ -61,7 +61,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return codecatalyst_sdkv2.NewFromConfig(cfg, func(o *codecatalyst_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From a8cd721c0dc559a401d244baf7ec06f327695dec Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:39 -0400 Subject: [PATCH 0554/1490] codecommit: Use constant for endpoint strings --- internal/service/codecommit/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/codecommit/service_package_gen.go b/internal/service/codecommit/service_package_gen.go index 85cc1541df1..38fbc1087a0 100644 --- a/internal/service/codecommit/service_package_gen.go +++ b/internal/service/codecommit/service_package_gen.go @@ -74,7 +74,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return codecommit_sdkv2.NewFromConfig(cfg, func(o *codecommit_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From a0ff29834bd08d7a3c6a68c3765b5f4e5d7ddda8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:39 -0400 Subject: [PATCH 0555/1490] codeguruprofiler: Use constant for endpoint strings --- internal/service/codeguruprofiler/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/codeguruprofiler/service_package_gen.go b/internal/service/codeguruprofiler/service_package_gen.go index 5120c57a90f..bb599a8ab90 100644 --- a/internal/service/codeguruprofiler/service_package_gen.go +++ b/internal/service/codeguruprofiler/service_package_gen.go @@ -52,7 +52,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return codeguruprofiler_sdkv2.NewFromConfig(cfg, func(o *codeguruprofiler_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 5a37d95dcfc150f60b7774d4782b7b47461d91a1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:40 -0400 Subject: [PATCH 0556/1490] codegurureviewer: Use constant for endpoint strings --- internal/service/codegurureviewer/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/codegurureviewer/service_package_gen.go b/internal/service/codegurureviewer/service_package_gen.go index 441f69515f5..46973d0d3a8 100644 --- a/internal/service/codegurureviewer/service_package_gen.go +++ b/internal/service/codegurureviewer/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return codegurureviewer_sdkv2.NewFromConfig(cfg, func(o *codegurureviewer_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 5ee1aee8bfa208545ec4af146fbcb45a78b0d611 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:40 -0400 Subject: [PATCH 0557/1490] codepipeline: Use constant for endpoint strings --- internal/service/codepipeline/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/codepipeline/service_package_gen.go b/internal/service/codepipeline/service_package_gen.go index 9c53d183623..0fca34825c8 100644 --- a/internal/service/codepipeline/service_package_gen.go +++ b/internal/service/codepipeline/service_package_gen.go @@ -64,7 +64,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return codepipeline_sdkv2.NewFromConfig(cfg, func(o *codepipeline_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 771489697ff18dcb2b4ad2d3ded9a4130fdce416 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:40 -0400 Subject: [PATCH 0558/1490] codestarconnections: Use constant for endpoint strings --- internal/service/codestarconnections/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/codestarconnections/service_package_gen.go b/internal/service/codestarconnections/service_package_gen.go index 960baedd76e..cfb094b5289 100644 --- a/internal/service/codestarconnections/service_package_gen.go +++ b/internal/service/codestarconnections/service_package_gen.go @@ -58,7 +58,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return codestarconnections_sdkv2.NewFromConfig(cfg, func(o *codestarconnections_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 503f604205472377d90b2099c4f333648415cafe Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:40 -0400 Subject: [PATCH 0559/1490] codestarnotifications: Use constant for endpoint strings --- internal/service/codestarnotifications/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/codestarnotifications/service_package_gen.go b/internal/service/codestarnotifications/service_package_gen.go index 03bd1976f9b..cab5d9666bc 100644 --- a/internal/service/codestarnotifications/service_package_gen.go +++ b/internal/service/codestarnotifications/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return codestarnotifications_sdkv2.NewFromConfig(cfg, func(o *codestarnotifications_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 9be2b7e448840592aadcc79058d0f0185f0fe697 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:41 -0400 Subject: [PATCH 0560/1490] cognitoidentity: Use constant for endpoint strings --- internal/service/cognitoidentity/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cognitoidentity/service_package_gen.go b/internal/service/cognitoidentity/service_package_gen.go index 68f45fc6d87..1b8da57c025 100644 --- a/internal/service/cognitoidentity/service_package_gen.go +++ b/internal/service/cognitoidentity/service_package_gen.go @@ -67,7 +67,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return cognitoidentity_sdkv2.NewFromConfig(cfg, func(o *cognitoidentity_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 4926927321eab69c178ea1b84be32f7a13d220b7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:41 -0400 Subject: [PATCH 0561/1490] cognitoidp: Use constant for endpoint strings --- internal/service/cognitoidp/service_package_gen.go | 2 +- internal/service/cognitoidp/user_pool.go | 4 ++-- internal/service/cognitoidp/user_pool_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/cognitoidp/service_package_gen.go b/internal/service/cognitoidp/service_package_gen.go index 104d635d1bc..c1bc5f2f999 100644 --- a/internal/service/cognitoidp/service_package_gen.go +++ b/internal/service/cognitoidp/service_package_gen.go @@ -125,7 +125,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*cognitoidentityprovider_sdkv1.CognitoIdentityProvider, error) { sess := config["session"].(*session_sdkv1.Session) - return cognitoidentityprovider_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return cognitoidentityprovider_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { diff --git a/internal/service/cognitoidp/user_pool.go b/internal/service/cognitoidp/user_pool.go index ece52df9248..881f054d0c1 100644 --- a/internal/service/cognitoidp/user_pool.go +++ b/internal/service/cognitoidp/user_pool.go @@ -223,7 +223,7 @@ func resourceUserPool() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -858,7 +858,7 @@ func resourceUserPoolRead(ctx context.Context, d *schema.ResourceData, meta inte } d.Set("email_verification_subject", userPool.EmailVerificationSubject) d.Set("email_verification_message", userPool.EmailVerificationMessage) - d.Set("endpoint", fmt.Sprintf("%s/%s", meta.(*conns.AWSClient).RegionalHostname(ctx, "cognito-idp"), d.Id())) + d.Set(names.AttrEndpoint, fmt.Sprintf("%s/%s", meta.(*conns.AWSClient).RegionalHostname(ctx, "cognito-idp"), d.Id())) d.Set("estimated_number_of_users", userPool.EstimatedNumberOfUsers) if err := d.Set("lambda_config", flattenUserPoolLambdaConfig(userPool.LambdaConfig)); err != nil { return sdkdiag.AppendErrorf(diags, "setting lambda_config: %s", err) diff --git a/internal/service/cognitoidp/user_pool_test.go b/internal/service/cognitoidp/user_pool_test.go index 786647d90e3..afb9f7cf91a 100644 --- a/internal/service/cognitoidp/user_pool_test.go +++ b/internal/service/cognitoidp/user_pool_test.go @@ -49,7 +49,7 @@ func TestAccCognitoIDPUserPool_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolExists(ctx, resourceName, &pool), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "cognito-idp", regexache.MustCompile(`userpool/.+`)), - resource.TestMatchResourceAttr(resourceName, "endpoint", regexache.MustCompile(`^cognito-idp\.[^.]+\.amazonaws.com/[\w-]+_[0-9A-Za-z]+$`)), + resource.TestMatchResourceAttr(resourceName, names.AttrEndpoint, regexache.MustCompile(`^cognito-idp\.[^.]+\.amazonaws.com/[\w-]+_[0-9A-Za-z]+$`)), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrSet(resourceName, "creation_date"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), From f289abf356633f15cf35cb049289ddabf683533c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:41 -0400 Subject: [PATCH 0562/1490] comprehend: Use constant for endpoint strings --- internal/service/comprehend/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/comprehend/service_package_gen.go b/internal/service/comprehend/service_package_gen.go index e0ea50332f1..e76767974eb 100644 --- a/internal/service/comprehend/service_package_gen.go +++ b/internal/service/comprehend/service_package_gen.go @@ -56,7 +56,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return comprehend_sdkv2.NewFromConfig(cfg, func(o *comprehend_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 9d732146f75861f4c1625fdd9fe5141e8af6c45e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:41 -0400 Subject: [PATCH 0563/1490] computeoptimizer: Use constant for endpoint strings --- internal/service/computeoptimizer/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/computeoptimizer/service_package_gen.go b/internal/service/computeoptimizer/service_package_gen.go index 72c0abee804..59182558365 100644 --- a/internal/service/computeoptimizer/service_package_gen.go +++ b/internal/service/computeoptimizer/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return computeoptimizer_sdkv2.NewFromConfig(cfg, func(o *computeoptimizer_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From edc0c4a8bfebfd688625a6d61259a3371f266db9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:42 -0400 Subject: [PATCH 0564/1490] configservice: Use constant for endpoint strings --- internal/service/configservice/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/configservice/service_package_gen.go b/internal/service/configservice/service_package_gen.go index a60de99542c..56800d04857 100644 --- a/internal/service/configservice/service_package_gen.go +++ b/internal/service/configservice/service_package_gen.go @@ -114,7 +114,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return configservice_sdkv2.NewFromConfig(cfg, func(o *configservice_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 12f1232e7982eeaa91171552245d65dd48b91292 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:42 -0400 Subject: [PATCH 0565/1490] connect: Use constant for endpoint strings --- internal/service/connect/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/connect/service_package_gen.go b/internal/service/connect/service_package_gen.go index 9eeeda54936..f3c21ac0a12 100644 --- a/internal/service/connect/service_package_gen.go +++ b/internal/service/connect/service_package_gen.go @@ -213,7 +213,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*connect_sdkv1.Connect, error) { sess := config["session"].(*session_sdkv1.Session) - return connect_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return connect_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 7feff64e55b1c977c71b19861e23cf7dcc7a0a7e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:42 -0400 Subject: [PATCH 0566/1490] connectcases: Use constant for endpoint strings --- internal/service/connectcases/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/connectcases/service_package_gen.go b/internal/service/connectcases/service_package_gen.go index 25354176c68..16641a5ff0f 100644 --- a/internal/service/connectcases/service_package_gen.go +++ b/internal/service/connectcases/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return connectcases_sdkv2.NewFromConfig(cfg, func(o *connectcases_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 3ec01450f08ced5ea1295e98de3f0287af2e2d51 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:42 -0400 Subject: [PATCH 0567/1490] controltower: Use constant for endpoint strings --- internal/service/controltower/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/controltower/service_package_gen.go b/internal/service/controltower/service_package_gen.go index 46accc07b44..17a6b35b2e4 100644 --- a/internal/service/controltower/service_package_gen.go +++ b/internal/service/controltower/service_package_gen.go @@ -59,7 +59,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return controltower_sdkv2.NewFromConfig(cfg, func(o *controltower_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 58e16a6c12a3cdb44d2d6410de66127bf2749d5f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:42 -0400 Subject: [PATCH 0568/1490] costoptimizationhub: Use constant for endpoint strings --- internal/service/costoptimizationhub/service_package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/costoptimizationhub/service_package.go b/internal/service/costoptimizationhub/service_package.go index d6f215005a0..b1f9ef02eec 100644 --- a/internal/service/costoptimizationhub/service_package.go +++ b/internal/service/costoptimizationhub/service_package.go @@ -16,7 +16,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return costoptimizationhub.NewFromConfig(cfg, func(o *costoptimizationhub.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } else if config["partition"].(string) == names.StandardPartitionID { // Cost Optimization Hub endpoint is available only in us-east-1 Region. From 6cc594519a20ed4e00e4030066667158ee8e903f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:43 -0400 Subject: [PATCH 0569/1490] cur: Use constant for endpoint strings --- internal/service/cur/service_package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cur/service_package.go b/internal/service/cur/service_package.go index 4d26df475f1..05c41f7fba5 100644 --- a/internal/service/cur/service_package.go +++ b/internal/service/cur/service_package.go @@ -15,7 +15,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return costandusagereportservice.NewFromConfig(cfg, func(o *costandusagereportservice.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } else if config["partition"].(string) == names.StandardPartitionID { // AWS Cost and Usage Reports is only available in AWS Commercial us-east-1 Region. From 10e3702022248905ff612f0ffe3983409977e90b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:43 -0400 Subject: [PATCH 0570/1490] customerprofiles: Use constant for endpoint strings --- internal/service/customerprofiles/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/customerprofiles/service_package_gen.go b/internal/service/customerprofiles/service_package_gen.go index be95beb11d3..989e98ca0f0 100644 --- a/internal/service/customerprofiles/service_package_gen.go +++ b/internal/service/customerprofiles/service_package_gen.go @@ -51,7 +51,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return customerprofiles_sdkv2.NewFromConfig(cfg, func(o *customerprofiles_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 655a8cc75e26106e83728c91d869b9d6749ded08 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:43 -0400 Subject: [PATCH 0571/1490] dataexchange: Use constant for endpoint strings --- internal/service/dataexchange/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/dataexchange/service_package_gen.go b/internal/service/dataexchange/service_package_gen.go index c6f07b92e76..7e3b04c95b1 100644 --- a/internal/service/dataexchange/service_package_gen.go +++ b/internal/service/dataexchange/service_package_gen.go @@ -56,7 +56,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*dataexchange_sdkv1.DataExchange, error) { sess := config["session"].(*session_sdkv1.Session) - return dataexchange_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return dataexchange_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 0814135825f1376c55a17d63e35e5eb0c1e638e2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:43 -0400 Subject: [PATCH 0572/1490] datapipeline: Use constant for endpoint strings --- internal/service/datapipeline/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/datapipeline/service_package_gen.go b/internal/service/datapipeline/service_package_gen.go index f778f94a65a..992734106d3 100644 --- a/internal/service/datapipeline/service_package_gen.go +++ b/internal/service/datapipeline/service_package_gen.go @@ -61,7 +61,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*datapipeline_sdkv1.DataPipeline, error) { sess := config["session"].(*session_sdkv1.Session) - return datapipeline_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return datapipeline_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From fa8d4d5d7b761a180accb4bfc8e148189f694830 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:43 -0400 Subject: [PATCH 0573/1490] datasync: Use constant for endpoint strings --- internal/service/datasync/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/datasync/service_package_gen.go b/internal/service/datasync/service_package_gen.go index 3b877ac50d1..b3857b3fadf 100644 --- a/internal/service/datasync/service_package_gen.go +++ b/internal/service/datasync/service_package_gen.go @@ -144,7 +144,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return datasync_sdkv2.NewFromConfig(cfg, func(o *datasync_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 24beca66d603801e33da1f9aade9bbd1b551d60a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:43 -0400 Subject: [PATCH 0574/1490] datazone: Use constant for endpoint strings --- internal/service/datazone/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/datazone/service_package_gen.go b/internal/service/datazone/service_package_gen.go index 76665842816..fd52cfb895a 100644 --- a/internal/service/datazone/service_package_gen.go +++ b/internal/service/datazone/service_package_gen.go @@ -56,7 +56,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return datazone_sdkv2.NewFromConfig(cfg, func(o *datazone_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From a9fadbe671230559419136fab7481f7296b11533 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:44 -0400 Subject: [PATCH 0575/1490] dax: Use constant for endpoint strings --- internal/service/dax/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/dax/service_package_gen.go b/internal/service/dax/service_package_gen.go index c3ac44959e5..fd259853e62 100644 --- a/internal/service/dax/service_package_gen.go +++ b/internal/service/dax/service_package_gen.go @@ -56,7 +56,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return dax_sdkv2.NewFromConfig(cfg, func(o *dax_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 059f1f7868c338fcd0fa08cf4e383021cc8dcdbc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:44 -0400 Subject: [PATCH 0576/1490] deploy: Use constant for endpoint strings --- internal/service/deploy/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/deploy/service_package_gen.go b/internal/service/deploy/service_package_gen.go index 838a3accd1a..d7bcea0c037 100644 --- a/internal/service/deploy/service_package_gen.go +++ b/internal/service/deploy/service_package_gen.go @@ -61,7 +61,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return codedeploy_sdkv2.NewFromConfig(cfg, func(o *codedeploy_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 87698069d520c90c7a8de43a2314981c2766d230 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:44 -0400 Subject: [PATCH 0577/1490] detective: Use constant for endpoint strings --- internal/service/detective/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/detective/service_package_gen.go b/internal/service/detective/service_package_gen.go index 635b818acde..c8540b1d5bb 100644 --- a/internal/service/detective/service_package_gen.go +++ b/internal/service/detective/service_package_gen.go @@ -64,7 +64,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*detective_sdkv1.Detective, error) { sess := config["session"].(*session_sdkv1.Session) - return detective_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return detective_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From a0b7c0db7a8fc6c9602921fc3b8bbbecae6c8de9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:44 -0400 Subject: [PATCH 0578/1490] devicefarm: Use constant for endpoint strings --- internal/service/devicefarm/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/devicefarm/service_package_gen.go b/internal/service/devicefarm/service_package_gen.go index 331a676d6e9..4d502817067 100644 --- a/internal/service/devicefarm/service_package_gen.go +++ b/internal/service/devicefarm/service_package_gen.go @@ -84,7 +84,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*devicefarm_sdkv1.DeviceFarm, error) { sess := config["session"].(*session_sdkv1.Session) - return devicefarm_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return devicefarm_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From c01ca5bf5368f928e0e3796126f188ad9334ba6b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:44 -0400 Subject: [PATCH 0579/1490] devopsguru: Use constant for endpoint strings --- internal/service/devopsguru/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/devopsguru/service_package_gen.go b/internal/service/devopsguru/service_package_gen.go index bd4978bd9b8..c1612ac5fa7 100644 --- a/internal/service/devopsguru/service_package_gen.go +++ b/internal/service/devopsguru/service_package_gen.go @@ -65,7 +65,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return devopsguru_sdkv2.NewFromConfig(cfg, func(o *devopsguru_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 9e876d84c2440334d842b7ae348cc7c85805e5d3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:44 -0400 Subject: [PATCH 0580/1490] directconnect: Use constant for endpoint strings --- internal/service/directconnect/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/directconnect/service_package_gen.go b/internal/service/directconnect/service_package_gen.go index db0269597a9..8dc55779c67 100644 --- a/internal/service/directconnect/service_package_gen.go +++ b/internal/service/directconnect/service_package_gen.go @@ -169,7 +169,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*directconnect_sdkv1.DirectConnect, error) { sess := config["session"].(*session_sdkv1.Session) - return directconnect_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return directconnect_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 0b878415350aa2c5da08cc31c8881e90dba3586e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:45 -0400 Subject: [PATCH 0581/1490] dlm: Use constant for endpoint strings --- internal/service/dlm/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/dlm/service_package_gen.go b/internal/service/dlm/service_package_gen.go index f10a5dfcbfc..66ffff5d2ce 100644 --- a/internal/service/dlm/service_package_gen.go +++ b/internal/service/dlm/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*dlm_sdkv1.DLM, error) { sess := config["session"].(*session_sdkv1.Session) - return dlm_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return dlm_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From c6b181510af69b2eefdecb49a61e008aad20c6e3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:45 -0400 Subject: [PATCH 0582/1490] dms: Use constant for endpoint strings --- internal/service/dms/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/dms/service_package_gen.go b/internal/service/dms/service_package_gen.go index 178dae1a989..ec98d3a5ecc 100644 --- a/internal/service/dms/service_package_gen.go +++ b/internal/service/dms/service_package_gen.go @@ -125,7 +125,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*databasemigrationservice_sdkv1.DatabaseMigrationService, error) { sess := config["session"].(*session_sdkv1.Session) - return databasemigrationservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return databasemigrationservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 5cfe6bc7b572d3d75d092aa24498f50c8a83f6d0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:45 -0400 Subject: [PATCH 0583/1490] docdb: Use constant for endpoint strings --- internal/service/docdb/cluster.go | 4 ++-- internal/service/docdb/cluster_instance.go | 4 ++-- internal/service/docdb/cluster_instance_test.go | 2 +- internal/service/docdb/cluster_test.go | 4 ++-- internal/service/docdb/service_package_gen.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/docdb/cluster.go b/internal/service/docdb/cluster.go index 3e4b3a74cbf..15f7fad6c61 100644 --- a/internal/service/docdb/cluster.go +++ b/internal/service/docdb/cluster.go @@ -132,7 +132,7 @@ func ResourceCluster() *schema.Resource { }, false), }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -510,7 +510,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("db_subnet_group_name", dbc.DBSubnetGroup) d.Set("deletion_protection", dbc.DeletionProtection) d.Set("enabled_cloudwatch_logs_exports", aws.StringValueSlice(dbc.EnabledCloudwatchLogsExports)) - d.Set("endpoint", dbc.Endpoint) + d.Set(names.AttrEndpoint, dbc.Endpoint) d.Set(names.AttrEngineVersion, dbc.EngineVersion) d.Set("engine", dbc.Engine) d.Set("hosted_zone_id", dbc.HostedZoneId) diff --git a/internal/service/docdb/cluster_instance.go b/internal/service/docdb/cluster_instance.go index a70eb1b4d96..40b19d0db97 100644 --- a/internal/service/docdb/cluster_instance.go +++ b/internal/service/docdb/cluster_instance.go @@ -91,7 +91,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -274,7 +274,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me // as soon as it is available in the DescribeDBClusters output. //d.Set("enable_performance_insights", db.EnablePerformanceInsights) if db.Endpoint != nil { - d.Set("endpoint", db.Endpoint.Address) + d.Set(names.AttrEndpoint, db.Endpoint.Address) d.Set(names.AttrPort, db.Endpoint.Port) } d.Set("engine", db.Engine) diff --git a/internal/service/docdb/cluster_instance_test.go b/internal/service/docdb/cluster_instance_test.go index e6ffcb91224..d4e5525910b 100644 --- a/internal/service/docdb/cluster_instance_test.go +++ b/internal/service/docdb/cluster_instance_test.go @@ -46,7 +46,7 @@ func TestAccDocDBClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "db_subnet_group_name"), resource.TestCheckResourceAttrSet(resourceName, "dbi_resource_id"), resource.TestCheckNoResourceAttr(resourceName, "enable_performance_insights"), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "engine", "docdb"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, "identifier", rName), diff --git a/internal/service/docdb/cluster_test.go b/internal/service/docdb/cluster_test.go index 92039c30b5a..ce85507b604 100644 --- a/internal/service/docdb/cluster_test.go +++ b/internal/service/docdb/cluster_test.go @@ -64,7 +64,7 @@ func TestAccDocDBCluster_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.#", "2"), resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.0", "audit"), resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.1", "profiler"), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "engine", "docdb"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckNoResourceAttr(resourceName, "final_snapshot_identifier"), @@ -792,7 +792,7 @@ func TestAccDocDBCluster_updateEngineMajorVersion(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "db_subnet_group_name", "default"), resource.TestCheckResourceAttr(resourceName, "deletion_protection", "false"), resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "engine", "docdb"), resource.TestCheckResourceAttr(resourceName, names.AttrEngineVersion, "4.0.0"), resource.TestCheckNoResourceAttr(resourceName, "final_snapshot_identifier"), diff --git a/internal/service/docdb/service_package_gen.go b/internal/service/docdb/service_package_gen.go index 70175bef7c5..306d01fd928 100644 --- a/internal/service/docdb/service_package_gen.go +++ b/internal/service/docdb/service_package_gen.go @@ -97,7 +97,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*docdb_sdkv1.DocDB, error) { sess := config["session"].(*session_sdkv1.Session) - return docdb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return docdb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 2ee8387dfdecda4c351daed114a809966fe5b37f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:45 -0400 Subject: [PATCH 0584/1490] docdbelastic: Use constant for endpoint strings --- internal/service/docdbelastic/cluster.go | 2 +- internal/service/docdbelastic/cluster_test.go | 6 +++--- internal/service/docdbelastic/service_package_gen.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/docdbelastic/cluster.go b/internal/service/docdbelastic/cluster.go index 52bae32101b..e4c13754ab0 100644 --- a/internal/service/docdbelastic/cluster.go +++ b/internal/service/docdbelastic/cluster.go @@ -81,7 +81,7 @@ func (r *resourceCluster) Schema(ctx context.Context, _ resource.SchemaRequest, enum.FrameworkValidate[awstypes.Auth](), }, }, - "endpoint": schema.StringAttribute{ + names.AttrEndpoint: schema.StringAttribute{ Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), diff --git a/internal/service/docdbelastic/cluster_test.go b/internal/service/docdbelastic/cluster_test.go index ebb0d0682c2..dfce4ae01da 100644 --- a/internal/service/docdbelastic/cluster_test.go +++ b/internal/service/docdbelastic/cluster_test.go @@ -47,7 +47,7 @@ func TestAccDocDBElasticCluster_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &cluster), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "shard_capacity", "2"), resource.TestCheckResourceAttr(resourceName, "shard_count", "1"), resource.TestCheckResourceAttr(resourceName, "admin_user_name", "testuser"), @@ -175,7 +175,7 @@ func TestAccDocDBElasticCluster_update(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &cluster), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "shard_capacity", "2"), resource.TestCheckResourceAttr(resourceName, "shard_count", "1"), resource.TestCheckResourceAttr(resourceName, "admin_user_name", "testuser"), @@ -191,7 +191,7 @@ func TestAccDocDBElasticCluster_update(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &cluster), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "shard_capacity", "4"), resource.TestCheckResourceAttr(resourceName, "shard_count", "1"), resource.TestCheckResourceAttr(resourceName, "admin_user_name", "testuser"), diff --git a/internal/service/docdbelastic/service_package_gen.go b/internal/service/docdbelastic/service_package_gen.go index 3e210079005..22bf1d79f15 100644 --- a/internal/service/docdbelastic/service_package_gen.go +++ b/internal/service/docdbelastic/service_package_gen.go @@ -47,7 +47,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return docdbelastic_sdkv2.NewFromConfig(cfg, func(o *docdbelastic_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From c4e794707b96d242649500e2c0c4b183fee4d912 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:45 -0400 Subject: [PATCH 0585/1490] ds: Use constant for endpoint strings --- internal/service/ds/service_package_gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ds/service_package_gen.go b/internal/service/ds/service_package_gen.go index 03fdc3b5ab7..72a67be6b0f 100644 --- a/internal/service/ds/service_package_gen.go +++ b/internal/service/ds/service_package_gen.go @@ -85,7 +85,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*directoryservice_sdkv1.DirectoryService, error) { sess := config["session"].(*session_sdkv1.Session) - return directoryservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return directoryservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -93,7 +93,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return directoryservice_sdkv2.NewFromConfig(cfg, func(o *directoryservice_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 0cff3e01a28e1aa2b11fec9a328169fefb55a3a7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:45 -0400 Subject: [PATCH 0586/1490] dynamodb: Use constant for endpoint strings --- internal/service/dynamodb/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/dynamodb/service_package.go b/internal/service/dynamodb/service_package.go index a25244e8386..6d65012f098 100644 --- a/internal/service/dynamodb/service_package.go +++ b/internal/service/dynamodb/service_package.go @@ -12,6 +12,7 @@ import ( awstypes "github.com/aws/aws-sdk-go-v2/service/dynamodb/types" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -19,7 +20,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return dynamodb.NewFromConfig(cfg, func(o *dynamodb.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } From 3511809bdbb687b4134484e0cc7538b7d4b46eba Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:46 -0400 Subject: [PATCH 0587/1490] ec2: Use constant for endpoint strings --- internal/service/ec2/service_package_gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ec2/service_package_gen.go b/internal/service/ec2/service_package_gen.go index ac3d9ba2a9b..4ab3abea782 100644 --- a/internal/service/ec2/service_package_gen.go +++ b/internal/service/ec2/service_package_gen.go @@ -1222,7 +1222,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ec2_sdkv1.EC2, error) { sess := config["session"].(*session_sdkv1.Session) - return ec2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return ec2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -1230,7 +1230,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return ec2_sdkv2.NewFromConfig(cfg, func(o *ec2_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 1038504dd65e233891c839a6976555d2ec455a4e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:46 -0400 Subject: [PATCH 0588/1490] ecr: Use constant for endpoint strings --- internal/service/ecr/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ecr/service_package_gen.go b/internal/service/ecr/service_package_gen.go index a3682f7e8f8..01f450f46c2 100644 --- a/internal/service/ecr/service_package_gen.go +++ b/internal/service/ecr/service_package_gen.go @@ -108,7 +108,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return ecr_sdkv2.NewFromConfig(cfg, func(o *ecr_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From d4fddb8d39532879fa03b2e3453fa472087b00bb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:46 -0400 Subject: [PATCH 0589/1490] ecrpublic: Use constant for endpoint strings --- internal/service/ecrpublic/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ecrpublic/service_package_gen.go b/internal/service/ecrpublic/service_package_gen.go index fca729019b1..e85abfc2513 100644 --- a/internal/service/ecrpublic/service_package_gen.go +++ b/internal/service/ecrpublic/service_package_gen.go @@ -57,7 +57,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return ecrpublic_sdkv2.NewFromConfig(cfg, func(o *ecrpublic_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From d66e624d9ee8b6084d8e12d9beae6737213e75fe Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:46 -0400 Subject: [PATCH 0590/1490] ecs: Use constant for endpoint strings --- internal/service/ecs/service_package_gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ecs/service_package_gen.go b/internal/service/ecs/service_package_gen.go index 38ac7bb3470..b261f6543ea 100644 --- a/internal/service/ecs/service_package_gen.go +++ b/internal/service/ecs/service_package_gen.go @@ -117,7 +117,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ecs_sdkv1.ECS, error) { sess := config["session"].(*session_sdkv1.Session) - return ecs_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return ecs_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -125,7 +125,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return ecs_sdkv2.NewFromConfig(cfg, func(o *ecs_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 3c1c9893e7663d4f3892cd0273ffb241c37fe8a5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:46 -0400 Subject: [PATCH 0591/1490] efs: Use constant for endpoint strings --- internal/service/efs/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/efs/service_package_gen.go b/internal/service/efs/service_package_gen.go index a3f6097e968..dc290d187b1 100644 --- a/internal/service/efs/service_package_gen.go +++ b/internal/service/efs/service_package_gen.go @@ -91,7 +91,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*efs_sdkv1.EFS, error) { sess := config["session"].(*session_sdkv1.Session) - return efs_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return efs_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From a49f3f1d225ffe4078fc026712999cb5cf0b813a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:46 -0400 Subject: [PATCH 0592/1490] eks: Use constant for endpoint strings --- internal/service/eks/cluster.go | 4 ++-- internal/service/eks/cluster_data_source.go | 4 ++-- internal/service/eks/cluster_data_source_test.go | 4 ++-- internal/service/eks/cluster_test.go | 2 +- internal/service/eks/service_package_gen.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/eks/cluster.go b/internal/service/eks/cluster.go index 70e35426d7a..2826bc48f23 100644 --- a/internal/service/eks/cluster.go +++ b/internal/service/eks/cluster.go @@ -142,7 +142,7 @@ func resourceCluster() *schema.Resource { }, }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -432,7 +432,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter if err := d.Set("encryption_config", flattenEncryptionConfigs(cluster.EncryptionConfig)); err != nil { return sdkdiag.AppendErrorf(diags, "setting encryption_config: %s", err) } - d.Set("endpoint", cluster.Endpoint) + d.Set(names.AttrEndpoint, cluster.Endpoint) if err := d.Set("identity", flattenIdentity(cluster.Identity)); err != nil { return sdkdiag.AppendErrorf(diags, "setting identity: %s", err) } diff --git a/internal/service/eks/cluster_data_source.go b/internal/service/eks/cluster_data_source.go index 93e92a07645..d71e738b2e4 100644 --- a/internal/service/eks/cluster_data_source.go +++ b/internal/service/eks/cluster_data_source.go @@ -62,7 +62,7 @@ func dataSourceCluster() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -231,7 +231,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int if err := d.Set("enabled_cluster_log_types", flattenLogging(cluster.Logging)); err != nil { return sdkdiag.AppendErrorf(diags, "setting enabled_cluster_log_types: %s", err) } - d.Set("endpoint", cluster.Endpoint) + d.Set(names.AttrEndpoint, cluster.Endpoint) if err := d.Set("identity", flattenIdentity(cluster.Identity)); err != nil { return sdkdiag.AppendErrorf(diags, "setting identity: %s", err) } diff --git a/internal/service/eks/cluster_data_source_test.go b/internal/service/eks/cluster_data_source_test.go index 3db7d0753dd..073bd51b1cc 100644 --- a/internal/service/eks/cluster_data_source_test.go +++ b/internal/service/eks/cluster_data_source_test.go @@ -37,7 +37,7 @@ func TestAccEKSClusterDataSource_basic(t *testing.T) { resource.TestCheckResourceAttr(dataSourceResourceName, "enabled_cluster_log_types.#", "2"), resource.TestCheckTypeSetElemAttr(dataSourceResourceName, "enabled_cluster_log_types.*", "api"), resource.TestCheckTypeSetElemAttr(dataSourceResourceName, "enabled_cluster_log_types.*", "audit"), - resource.TestCheckResourceAttrPair(resourceName, "endpoint", dataSourceResourceName, "endpoint"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEndpoint, dataSourceResourceName, names.AttrEndpoint), resource.TestCheckResourceAttrPair(resourceName, "identity.#", dataSourceResourceName, "identity.#"), resource.TestCheckResourceAttrPair(resourceName, "identity.0.oidc.#", dataSourceResourceName, "identity.0.oidc.#"), resource.TestCheckResourceAttrPair(resourceName, "identity.0.oidc.0.issuer", dataSourceResourceName, "identity.0.oidc.0.issuer"), @@ -85,7 +85,7 @@ func TestAccEKSClusterDataSource_outpost(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "certificate_authority.0.data", dataSourceResourceName, "certificate_authority.0.data"), resource.TestCheckResourceAttrPair(resourceName, names.AttrCreatedAt, dataSourceResourceName, names.AttrCreatedAt), resource.TestCheckResourceAttr(dataSourceResourceName, "enabled_cluster_log_types.#", "0"), - resource.TestCheckResourceAttrPair(resourceName, "endpoint", dataSourceResourceName, "endpoint"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEndpoint, dataSourceResourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(dataSourceResourceName, "identity.#", "0"), resource.TestCheckResourceAttrPair(resourceName, "kubernetes_network_config.#", dataSourceResourceName, "kubernetes_network_config.#"), resource.TestCheckResourceAttrPair(resourceName, "kubernetes_network_config.0.ip_family", dataSourceResourceName, "kubernetes_network_config.0.ip_family"), diff --git a/internal/service/eks/cluster_test.go b/internal/service/eks/cluster_test.go index dd346c4418e..c71f12dbf68 100644 --- a/internal/service/eks/cluster_test.go +++ b/internal/service/eks/cluster_test.go @@ -53,7 +53,7 @@ func TestAccEKSCluster_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrCreatedAt), resource.TestCheckResourceAttr(resourceName, "enabled_cluster_log_types.#", "0"), resource.TestCheckResourceAttr(resourceName, "encryption_config.#", "0"), - resource.TestMatchResourceAttr(resourceName, "endpoint", regexache.MustCompile(`^https://`)), + resource.TestMatchResourceAttr(resourceName, names.AttrEndpoint, regexache.MustCompile(`^https://`)), resource.TestCheckResourceAttr(resourceName, "identity.#", "1"), resource.TestCheckResourceAttr(resourceName, "identity.0.oidc.#", "1"), resource.TestMatchResourceAttr(resourceName, "identity.0.oidc.0.issuer", regexache.MustCompile(`^https://`)), diff --git a/internal/service/eks/service_package_gen.go b/internal/service/eks/service_package_gen.go index e5695449b36..5ea74e0bd67 100644 --- a/internal/service/eks/service_package_gen.go +++ b/internal/service/eks/service_package_gen.go @@ -135,7 +135,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return eks_sdkv2.NewFromConfig(cfg, func(o *eks_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 27fbe5745793fd8d38206ee42e6ab7bb391a650b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:46 -0400 Subject: [PATCH 0593/1490] elasticache: Use constant for endpoint strings --- internal/service/elasticache/serverless_cache.go | 2 +- internal/service/elasticache/service_package_gen.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/elasticache/serverless_cache.go b/internal/service/elasticache/serverless_cache.go index 727ac2601ad..d5433bb59f5 100644 --- a/internal/service/elasticache/serverless_cache.go +++ b/internal/service/elasticache/serverless_cache.go @@ -83,7 +83,7 @@ func (r *serverlessCacheResource) Schema(ctx context.Context, request resource.S stringplanmodifier.UseStateForUnknown(), }, }, - "endpoint": schema.ListAttribute{ + names.AttrEndpoint: schema.ListAttribute{ CustomType: fwtypes.NewListNestedObjectTypeOf[endpointModel](ctx), ElementType: fwtypes.NewObjectTypeOf[endpointModel](ctx), Computed: true, diff --git a/internal/service/elasticache/service_package_gen.go b/internal/service/elasticache/service_package_gen.go index 2416f251cee..38ee64321e1 100644 --- a/internal/service/elasticache/service_package_gen.go +++ b/internal/service/elasticache/service_package_gen.go @@ -129,7 +129,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*elasticache_sdkv1.ElastiCache, error) { sess := config["session"].(*session_sdkv1.Session) - return elasticache_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return elasticache_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -137,7 +137,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return elasticache_sdkv2.NewFromConfig(cfg, func(o *elasticache_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 12d0c50b3147ac9b392e28e9c870828bd5ecf919 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:47 -0400 Subject: [PATCH 0594/1490] elasticbeanstalk: Use constant for endpoint strings --- internal/service/elasticbeanstalk/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/elasticbeanstalk/service_package_gen.go b/internal/service/elasticbeanstalk/service_package_gen.go index 64d0df3fff4..73d684ce72e 100644 --- a/internal/service/elasticbeanstalk/service_package_gen.go +++ b/internal/service/elasticbeanstalk/service_package_gen.go @@ -81,7 +81,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return elasticbeanstalk_sdkv2.NewFromConfig(cfg, func(o *elasticbeanstalk_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From f946252b571da67ec184c310b53f6b9b1b8f6939 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:47 -0400 Subject: [PATCH 0595/1490] elasticsearch: Use constant for endpoint strings --- internal/service/elasticsearch/domain.go | 8 ++++---- internal/service/elasticsearch/domain_data_source.go | 8 ++++---- internal/service/elasticsearch/service_package_gen.go | 2 +- internal/service/elasticsearch/vpc_endpoint.go | 4 ++-- internal/service/elasticsearch/vpc_endpoint_test.go | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/elasticsearch/domain.go b/internal/service/elasticsearch/domain.go index f223b9f7b28..1ff7ba021b9 100644 --- a/internal/service/elasticsearch/domain.go +++ b/internal/service/elasticsearch/domain.go @@ -441,7 +441,7 @@ func ResourceDomain() *schema.Resource { }, }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -813,7 +813,7 @@ func resourceDomainRead(ctx context.Context, d *schema.ResourceData, meta interf } endpoints := flex.FlattenStringMap(ds.Endpoints) - d.Set("endpoint", endpoints["vpc"]) + d.Set(names.AttrEndpoint, endpoints["vpc"]) d.Set("kibana_endpoint", getKibanaEndpoint(d)) if ds.Endpoint != nil { @@ -821,7 +821,7 @@ func resourceDomainRead(ctx context.Context, d *schema.ResourceData, meta interf } } else { if ds.Endpoint != nil { - d.Set("endpoint", ds.Endpoint) + d.Set(names.AttrEndpoint, ds.Endpoint) d.Set("kibana_endpoint", getKibanaEndpoint(d)) } if ds.Endpoints != nil { @@ -1040,7 +1040,7 @@ func suppressEquivalentKMSKeyIDs(k, old, new string, d *schema.ResourceData) boo } func getKibanaEndpoint(d *schema.ResourceData) string { - return d.Get("endpoint").(string) + "/_plugin/kibana/" + return d.Get(names.AttrEndpoint).(string) + "/_plugin/kibana/" } func isDedicatedMasterDisabled(k, old, new string, d *schema.ResourceData) bool { diff --git a/internal/service/elasticsearch/domain_data_source.go b/internal/service/elasticsearch/domain_data_source.go index ba4b80d81f3..a00581d8a31 100644 --- a/internal/service/elasticsearch/domain_data_source.go +++ b/internal/service/elasticsearch/domain_data_source.go @@ -257,7 +257,7 @@ func DataSourceDomain() *schema.Resource { }, }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -386,7 +386,7 @@ func dataSourceDomainRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrARN, ds.ARN) d.Set("domain_id", ds.DomainId) - d.Set("endpoint", ds.Endpoint) + d.Set(names.AttrEndpoint, ds.Endpoint) d.Set("kibana_endpoint", getKibanaEndpoint(d)) if err := d.Set("advanced_security_options", flattenAdvancedSecurityOptions(ds.AdvancedSecurityOptions)); err != nil { @@ -425,7 +425,7 @@ func dataSourceDomainRead(ctx context.Context, d *schema.ResourceData, meta inte } endpoints := flex.FlattenStringMap(ds.Endpoints) - if err := d.Set("endpoint", endpoints["vpc"]); err != nil { + if err := d.Set(names.AttrEndpoint, endpoints["vpc"]); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoint: %s", err) } d.Set("kibana_endpoint", getKibanaEndpoint(d)) @@ -434,7 +434,7 @@ func dataSourceDomainRead(ctx context.Context, d *schema.ResourceData, meta inte } } else { if ds.Endpoint != nil { - d.Set("endpoint", ds.Endpoint) + d.Set(names.AttrEndpoint, ds.Endpoint) d.Set("kibana_endpoint", getKibanaEndpoint(d)) } if ds.Endpoints != nil { diff --git a/internal/service/elasticsearch/service_package_gen.go b/internal/service/elasticsearch/service_package_gen.go index e67e5ddcc88..cf24f6f09bb 100644 --- a/internal/service/elasticsearch/service_package_gen.go +++ b/internal/service/elasticsearch/service_package_gen.go @@ -65,7 +65,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*elasticsearchservice_sdkv1.ElasticsearchService, error) { sess := config["session"].(*session_sdkv1.Session) - return elasticsearchservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return elasticsearchservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { diff --git a/internal/service/elasticsearch/vpc_endpoint.go b/internal/service/elasticsearch/vpc_endpoint.go index 538d58282ae..528456d7a4f 100644 --- a/internal/service/elasticsearch/vpc_endpoint.go +++ b/internal/service/elasticsearch/vpc_endpoint.go @@ -48,7 +48,7 @@ func ResourceVPCEndpoint() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -126,7 +126,7 @@ func resourceVPCEndpointRead(ctx context.Context, d *schema.ResourceData, meta i } d.Set("domain_arn", endpoint.DomainArn) - d.Set("endpoint", endpoint.Endpoint) + d.Set(names.AttrEndpoint, endpoint.Endpoint) if endpoint.VpcOptions != nil { if err := d.Set("vpc_options", []interface{}{flattenVPCDerivedInfo(endpoint.VpcOptions)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting vpc_options: %s", err) diff --git a/internal/service/elasticsearch/vpc_endpoint_test.go b/internal/service/elasticsearch/vpc_endpoint_test.go index 657bab2f912..6a1fdb6fb7b 100644 --- a/internal/service/elasticsearch/vpc_endpoint_test.go +++ b/internal/service/elasticsearch/vpc_endpoint_test.go @@ -118,7 +118,7 @@ func TestAccElasticsearchVPCEndpoint_basic(t *testing.T) { Config: testAccVPCEndpointConfig_basic(rName, domainName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVPCEndpointExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "vpc_options.#", "1"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.availability_zones.#", "2"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.security_group_ids.#", "1"), @@ -185,7 +185,7 @@ func TestAccElasticsearchVPCEndpoint_update(t *testing.T) { Config: testAccVPCEndpointConfig_basic(rName, domainName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVPCEndpointExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "vpc_options.#", "1"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.availability_zones.#", "2"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.security_group_ids.#", "1"), @@ -197,7 +197,7 @@ func TestAccElasticsearchVPCEndpoint_update(t *testing.T) { Config: testAccVPCEndpointConfig_updated(rName, domainName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVPCEndpointExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "vpc_options.#", "1"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.availability_zones.#", "2"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.security_group_ids.#", "2"), From 9b619fd76f4c89ad7fc09ef01dbad8fc6053625b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:47 -0400 Subject: [PATCH 0596/1490] elastictranscoder: Use constant for endpoint strings --- internal/service/elastictranscoder/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/elastictranscoder/service_package_gen.go b/internal/service/elastictranscoder/service_package_gen.go index 18c4a859477..ede8fb9af6d 100644 --- a/internal/service/elastictranscoder/service_package_gen.go +++ b/internal/service/elastictranscoder/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*elastictranscoder_sdkv1.ElasticTranscoder, error) { sess := config["session"].(*session_sdkv1.Session) - return elastictranscoder_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return elastictranscoder_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From dc4400af48e745d2ed11f07efe762383edf5e567 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:47 -0400 Subject: [PATCH 0597/1490] elb: Use constant for endpoint strings --- internal/service/elb/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/elb/service_package_gen.go b/internal/service/elb/service_package_gen.go index 2a2ea49ebd1..8583e662d88 100644 --- a/internal/service/elb/service_package_gen.go +++ b/internal/service/elb/service_package_gen.go @@ -93,7 +93,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*elb_sdkv1.ELB, error) { sess := config["session"].(*session_sdkv1.Session) - return elb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return elb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From c206ed1d04987a3127da7532878a0243f58910d3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:47 -0400 Subject: [PATCH 0598/1490] elbv2: Use constant for endpoint strings --- internal/service/elbv2/service_package_gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/elbv2/service_package_gen.go b/internal/service/elbv2/service_package_gen.go index b0da4ca07e7..4b8fc24a368 100644 --- a/internal/service/elbv2/service_package_gen.go +++ b/internal/service/elbv2/service_package_gen.go @@ -173,7 +173,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*elbv2_sdkv1.ELBV2, error) { sess := config["session"].(*session_sdkv1.Session) - return elbv2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return elbv2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -181,7 +181,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return elasticloadbalancingv2_sdkv2.NewFromConfig(cfg, func(o *elasticloadbalancingv2_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From d0a8e7194ee61902ce924414dd915f0ca1d41a48 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:47 -0400 Subject: [PATCH 0599/1490] emr: Use constant for endpoint strings --- internal/service/emr/service_package_gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/emr/service_package_gen.go b/internal/service/emr/service_package_gen.go index d9001733986..f2c6b1442ef 100644 --- a/internal/service/emr/service_package_gen.go +++ b/internal/service/emr/service_package_gen.go @@ -99,7 +99,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*emr_sdkv1.EMR, error) { sess := config["session"].(*session_sdkv1.Session) - return emr_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return emr_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -107,7 +107,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return emr_sdkv2.NewFromConfig(cfg, func(o *emr_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 701f1c0dceca7ef77d50c3ebf33414f06f03cb60 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:48 -0400 Subject: [PATCH 0600/1490] emrcontainers: Use constant for endpoint strings --- internal/service/emrcontainers/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/emrcontainers/service_package_gen.go b/internal/service/emrcontainers/service_package_gen.go index 18d2f028697..bc79d117a84 100644 --- a/internal/service/emrcontainers/service_package_gen.go +++ b/internal/service/emrcontainers/service_package_gen.go @@ -61,7 +61,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*emrcontainers_sdkv1.EMRContainers, error) { sess := config["session"].(*session_sdkv1.Session) - return emrcontainers_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return emrcontainers_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 503896b64b1f5401b042a563131e38c31e808862 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:48 -0400 Subject: [PATCH 0601/1490] emrserverless: Use constant for endpoint strings --- internal/service/emrserverless/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/emrserverless/service_package_gen.go b/internal/service/emrserverless/service_package_gen.go index 8908c9f5a38..0634947c0e4 100644 --- a/internal/service/emrserverless/service_package_gen.go +++ b/internal/service/emrserverless/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return emrserverless_sdkv2.NewFromConfig(cfg, func(o *emrserverless_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 4ade49832a1d29864191ad812e10385e593c7b0c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:48 -0400 Subject: [PATCH 0602/1490] events: Use constant for endpoint strings --- internal/service/events/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/events/service_package_gen.go b/internal/service/events/service_package_gen.go index 247b4c47f4d..b1c250cbee9 100644 --- a/internal/service/events/service_package_gen.go +++ b/internal/service/events/service_package_gen.go @@ -107,7 +107,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return eventbridge_sdkv2.NewFromConfig(cfg, func(o *eventbridge_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 7efd2bec79bc95c302c68f6a27723ccaade9c7e1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:48 -0400 Subject: [PATCH 0603/1490] evidently: Use constant for endpoint strings --- internal/service/evidently/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/evidently/service_package_gen.go b/internal/service/evidently/service_package_gen.go index 91a5022fbae..3d2091c8714 100644 --- a/internal/service/evidently/service_package_gen.go +++ b/internal/service/evidently/service_package_gen.go @@ -72,7 +72,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return evidently_sdkv2.NewFromConfig(cfg, func(o *evidently_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From c40e51fa5154d819ee2014d3ce2179187aa5b88c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:48 -0400 Subject: [PATCH 0604/1490] finspace: Use constant for endpoint strings --- internal/service/finspace/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/finspace/service_package_gen.go b/internal/service/finspace/service_package_gen.go index b8d2be787c3..1b79170a6f8 100644 --- a/internal/service/finspace/service_package_gen.go +++ b/internal/service/finspace/service_package_gen.go @@ -96,7 +96,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return finspace_sdkv2.NewFromConfig(cfg, func(o *finspace_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 191a3172682f294200e5dd61719ef72bc2c2b202 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:48 -0400 Subject: [PATCH 0605/1490] firehose: Use constant for endpoint strings --- internal/service/firehose/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/firehose/service_package_gen.go b/internal/service/firehose/service_package_gen.go index 5c53d137c5b..a8c70360bbc 100644 --- a/internal/service/firehose/service_package_gen.go +++ b/internal/service/firehose/service_package_gen.go @@ -53,7 +53,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return firehose_sdkv2.NewFromConfig(cfg, func(o *firehose_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 7eb5f33cebc688a54c90aa1b11d6b028b74db3a4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:48 -0400 Subject: [PATCH 0606/1490] fis: Use constant for endpoint strings --- internal/service/fis/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/fis/service_package_gen.go b/internal/service/fis/service_package_gen.go index d1d3af871f5..3231e16c612 100644 --- a/internal/service/fis/service_package_gen.go +++ b/internal/service/fis/service_package_gen.go @@ -46,7 +46,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return fis_sdkv2.NewFromConfig(cfg, func(o *fis_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 5da87cdc83baacd8a612c2c3ec76e5c052305eac Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:49 -0400 Subject: [PATCH 0607/1490] fms: Use constant for endpoint strings --- internal/service/fms/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/fms/service_package.go b/internal/service/fms/service_package.go index 1b96b7a0b57..6be07e3e255 100644 --- a/internal/service/fms/service_package.go +++ b/internal/service/fms/service_package.go @@ -12,6 +12,7 @@ import ( awstypes "github.com/aws/aws-sdk-go-v2/service/fms/types" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -19,7 +20,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return fms.NewFromConfig(cfg, func(o *fms.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } From 27c604ce1ed65090c8495944e2a68411c7b484ab Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:49 -0400 Subject: [PATCH 0608/1490] fsx: Use constant for endpoint strings --- internal/service/fsx/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/fsx/service_package_gen.go b/internal/service/fsx/service_package_gen.go index 906034ab381..abb209756c3 100644 --- a/internal/service/fsx/service_package_gen.go +++ b/internal/service/fsx/service_package_gen.go @@ -157,7 +157,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*fsx_sdkv1.FSx, error) { sess := config["session"].(*session_sdkv1.Session) - return fsx_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return fsx_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From de0d05277a39d0360f3ea26bb88ee5ab00effa2e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:49 -0400 Subject: [PATCH 0609/1490] gamelift: Use constant for endpoint strings --- internal/service/gamelift/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/gamelift/service_package_gen.go b/internal/service/gamelift/service_package_gen.go index 189259d1a17..b6b8e6becba 100644 --- a/internal/service/gamelift/service_package_gen.go +++ b/internal/service/gamelift/service_package_gen.go @@ -88,7 +88,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*gamelift_sdkv1.GameLift, error) { sess := config["session"].(*session_sdkv1.Session) - return gamelift_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return gamelift_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 05ff3ca753ea2fcd43f5f71440ad95ad7f71c3f3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:49 -0400 Subject: [PATCH 0610/1490] glacier: Use constant for endpoint strings --- internal/service/glacier/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/glacier/service_package_gen.go b/internal/service/glacier/service_package_gen.go index 7fc70c80dba..fc8e3b395fd 100644 --- a/internal/service/glacier/service_package_gen.go +++ b/internal/service/glacier/service_package_gen.go @@ -52,7 +52,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return glacier_sdkv2.NewFromConfig(cfg, func(o *glacier_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From f84e9e69942a3e91332b00d1eb9d06675ebb78a1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:49 -0400 Subject: [PATCH 0611/1490] globalaccelerator: Use constant for endpoint strings --- internal/service/globalaccelerator/service_package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/globalaccelerator/service_package.go b/internal/service/globalaccelerator/service_package.go index f6ebfa80016..422d3decc3f 100644 --- a/internal/service/globalaccelerator/service_package.go +++ b/internal/service/globalaccelerator/service_package.go @@ -16,7 +16,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return globalaccelerator.NewFromConfig(cfg, func(o *globalaccelerator.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } else if config["partition"].(string) == names.StandardPartitionID { // Global Accelerator endpoint is only available in AWS Commercial us-west-2 Region. From cf2124271802b017733a4a8f901b608617132054 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:49 -0400 Subject: [PATCH 0612/1490] glue: Use constant for endpoint strings --- internal/service/glue/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/glue/service_package_gen.go b/internal/service/glue/service_package_gen.go index cb049ad630c..6c11d045201 100644 --- a/internal/service/glue/service_package_gen.go +++ b/internal/service/glue/service_package_gen.go @@ -177,7 +177,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*glue_sdkv1.Glue, error) { sess := config["session"].(*session_sdkv1.Session) - return glue_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return glue_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 21157024904e0df9cad03a88d71d150a8d1f698b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:49 -0400 Subject: [PATCH 0613/1490] grafana: Use constant for endpoint strings --- internal/service/grafana/service_package_gen.go | 2 +- internal/service/grafana/workspace.go | 4 ++-- internal/service/grafana/workspace_data_source.go | 4 ++-- internal/service/grafana/workspace_data_source_test.go | 2 +- internal/service/grafana/workspace_test.go | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/grafana/service_package_gen.go b/internal/service/grafana/service_package_gen.go index 7a18d5b6fa3..a877706a7f9 100644 --- a/internal/service/grafana/service_package_gen.go +++ b/internal/service/grafana/service_package_gen.go @@ -69,7 +69,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*managedgrafana_sdkv1.ManagedGrafana, error) { sess := config["session"].(*session_sdkv1.Session) - return managedgrafana_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return managedgrafana_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { diff --git a/internal/service/grafana/workspace.go b/internal/service/grafana/workspace.go index b7e3fbd3715..85e8f3947cd 100644 --- a/internal/service/grafana/workspace.go +++ b/internal/service/grafana/workspace.go @@ -88,7 +88,7 @@ func ResourceWorkspace() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -292,7 +292,7 @@ func resourceWorkspaceRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("authentication_providers", workspace.Authentication.Providers) d.Set("data_sources", workspace.DataSources) d.Set(names.AttrDescription, workspace.Description) - d.Set("endpoint", workspace.Endpoint) + d.Set(names.AttrEndpoint, workspace.Endpoint) d.Set("grafana_version", workspace.GrafanaVersion) d.Set(names.AttrName, workspace.Name) if err := d.Set("network_access_control", flattenNetworkAccessControl(workspace.NetworkAccessControl)); err != nil { diff --git a/internal/service/grafana/workspace_data_source.go b/internal/service/grafana/workspace_data_source.go index 2805fba9133..1f3b6362a17 100644 --- a/internal/service/grafana/workspace_data_source.go +++ b/internal/service/grafana/workspace_data_source.go @@ -50,7 +50,7 @@ func DataSourceWorkspace() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -136,7 +136,7 @@ func dataSourceWorkspaceRead(ctx context.Context, d *schema.ResourceData, meta i d.Set(names.AttrCreatedDate, workspace.Created.Format(time.RFC3339)) d.Set("data_sources", workspace.DataSources) d.Set(names.AttrDescription, workspace.Description) - d.Set("endpoint", workspace.Endpoint) + d.Set(names.AttrEndpoint, workspace.Endpoint) d.Set("grafana_version", workspace.GrafanaVersion) d.Set(names.AttrLastUpdatedDate, workspace.Modified.Format(time.RFC3339)) d.Set(names.AttrName, workspace.Name) diff --git a/internal/service/grafana/workspace_data_source_test.go b/internal/service/grafana/workspace_data_source_test.go index 7b11a2bb63b..22f246a54c4 100644 --- a/internal/service/grafana/workspace_data_source_test.go +++ b/internal/service/grafana/workspace_data_source_test.go @@ -34,7 +34,7 @@ func testAccWorkspaceDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreatedDate), resource.TestCheckResourceAttrPair(resourceName, "data_sources.#", dataSourceName, "data_sources.#"), resource.TestCheckResourceAttrPair(resourceName, names.AttrDescription, dataSourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(resourceName, "endpoint", dataSourceName, "endpoint"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEndpoint, dataSourceName, names.AttrEndpoint), resource.TestCheckResourceAttrPair(resourceName, "grafana_version", dataSourceName, "grafana_version"), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrLastUpdatedDate), resource.TestCheckResourceAttrPair(resourceName, names.AttrName, dataSourceName, names.AttrName), diff --git a/internal/service/grafana/workspace_test.go b/internal/service/grafana/workspace_test.go index 42150fecc64..3822ff1e13d 100644 --- a/internal/service/grafana/workspace_test.go +++ b/internal/service/grafana/workspace_test.go @@ -45,7 +45,7 @@ func testAccWorkspace_saml(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "authentication_providers.0", managedgrafana.AuthenticationProviderTypesSaml), resource.TestCheckResourceAttr(resourceName, "data_sources.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttrSet(resourceName, "grafana_version"), resource.TestCheckResourceAttrSet(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "notification_destinations.#", "0"), @@ -142,7 +142,7 @@ func testAccWorkspace_sso(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "authentication_providers.0", managedgrafana.AuthenticationProviderTypesAwsSso), resource.TestCheckResourceAttr(resourceName, "data_sources.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttrSet(resourceName, "grafana_version"), resource.TestCheckResourceAttrSet(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "notification_destinations.#", "0"), @@ -297,7 +297,7 @@ func testAccWorkspace_dataSources(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "data_sources.1", "PROMETHEUS"), resource.TestCheckResourceAttr(resourceName, "data_sources.2", "XRAY"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, rName), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttrSet(resourceName, "grafana_version"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, "notification_destinations.#", "0"), From 3b6c4d7426a7645f3392428c2cbb7327b5a5af71 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:50 -0400 Subject: [PATCH 0614/1490] greengrass: Use constant for endpoint strings --- internal/service/greengrass/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/greengrass/service_package_gen.go b/internal/service/greengrass/service_package_gen.go index 8ed2f760003..b628d871594 100644 --- a/internal/service/greengrass/service_package_gen.go +++ b/internal/service/greengrass/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*greengrass_sdkv1.Greengrass, error) { sess := config["session"].(*session_sdkv1.Session) - return greengrass_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return greengrass_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 47aa61ace32b01cfd9eaa61cd475d3ebb31a3b86 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:50 -0400 Subject: [PATCH 0615/1490] groundstation: Use constant for endpoint strings --- internal/service/groundstation/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/groundstation/service_package_gen.go b/internal/service/groundstation/service_package_gen.go index 50d1eecd72e..e4bd981a1e6 100644 --- a/internal/service/groundstation/service_package_gen.go +++ b/internal/service/groundstation/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return groundstation_sdkv2.NewFromConfig(cfg, func(o *groundstation_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 581d6876fc6ef03c3742ef5e2cbb7a2f5bd37598 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:50 -0400 Subject: [PATCH 0616/1490] guardduty: Use constant for endpoint strings --- internal/service/guardduty/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/guardduty/service_package_gen.go b/internal/service/guardduty/service_package_gen.go index 2fa2f6afce3..77ad40e9ce6 100644 --- a/internal/service/guardduty/service_package_gen.go +++ b/internal/service/guardduty/service_package_gen.go @@ -113,7 +113,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*guardduty_sdkv1.GuardDuty, error) { sess := config["session"].(*session_sdkv1.Session) - return guardduty_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return guardduty_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 72262015cba674ef97688de6fa75587862ec4f1b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:50 -0400 Subject: [PATCH 0617/1490] healthlake: Use constant for endpoint strings --- internal/service/healthlake/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/healthlake/service_package_gen.go b/internal/service/healthlake/service_package_gen.go index 670cb6de735..c2cafe6064b 100644 --- a/internal/service/healthlake/service_package_gen.go +++ b/internal/service/healthlake/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return healthlake_sdkv2.NewFromConfig(cfg, func(o *healthlake_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 73edd37483089b37dbb884a7942c5f3e7e5ed251 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:50 -0400 Subject: [PATCH 0618/1490] iam: Use constant for endpoint strings --- internal/service/iam/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/iam/service_package_gen.go b/internal/service/iam/service_package_gen.go index 6bcf87edc80..610aad592ce 100644 --- a/internal/service/iam/service_package_gen.go +++ b/internal/service/iam/service_package_gen.go @@ -297,7 +297,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return iam_sdkv2.NewFromConfig(cfg, func(o *iam_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From c82c509bd96954324600b9f3fa38fdb0a9379dd9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:50 -0400 Subject: [PATCH 0619/1490] identitystore: Use constant for endpoint strings --- internal/service/identitystore/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/identitystore/service_package_gen.go b/internal/service/identitystore/service_package_gen.go index de35b8fa0b7..660e7b15718 100644 --- a/internal/service/identitystore/service_package_gen.go +++ b/internal/service/identitystore/service_package_gen.go @@ -66,7 +66,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return identitystore_sdkv2.NewFromConfig(cfg, func(o *identitystore_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From dc9a0807e36b22c9fad9ce4825f14a14c7d5eb5c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:50 -0400 Subject: [PATCH 0620/1490] imagebuilder: Use constant for endpoint strings --- internal/service/imagebuilder/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/imagebuilder/service_package_gen.go b/internal/service/imagebuilder/service_package_gen.go index f6ef5ee0256..5cfab40d7b7 100644 --- a/internal/service/imagebuilder/service_package_gen.go +++ b/internal/service/imagebuilder/service_package_gen.go @@ -160,7 +160,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*imagebuilder_sdkv1.Imagebuilder, error) { sess := config["session"].(*session_sdkv1.Session) - return imagebuilder_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return imagebuilder_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From eca8f12771a9fa0868e1f50ca40ca446fed95721 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:51 -0400 Subject: [PATCH 0621/1490] inspector: Use constant for endpoint strings --- internal/service/inspector/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/inspector/service_package_gen.go b/internal/service/inspector/service_package_gen.go index 8444fc98932..42f109a4d80 100644 --- a/internal/service/inspector/service_package_gen.go +++ b/internal/service/inspector/service_package_gen.go @@ -61,7 +61,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*inspector_sdkv1.Inspector, error) { sess := config["session"].(*session_sdkv1.Session) - return inspector_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return inspector_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From e2f5600ada7bc93bede1f4581692fd4ee4d66a86 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:51 -0400 Subject: [PATCH 0622/1490] inspector2: Use constant for endpoint strings --- internal/service/inspector2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/inspector2/service_package_gen.go b/internal/service/inspector2/service_package_gen.go index 842cf5c7e94..96782364fc4 100644 --- a/internal/service/inspector2/service_package_gen.go +++ b/internal/service/inspector2/service_package_gen.go @@ -56,7 +56,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return inspector2_sdkv2.NewFromConfig(cfg, func(o *inspector2_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 1118ba9f877525e0a8c261ca595a6e339ee7e43d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:51 -0400 Subject: [PATCH 0623/1490] internetmonitor: Use constant for endpoint strings --- internal/service/internetmonitor/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/internetmonitor/service_package_gen.go b/internal/service/internetmonitor/service_package_gen.go index 519b3bbba7d..001d53e3c85 100644 --- a/internal/service/internetmonitor/service_package_gen.go +++ b/internal/service/internetmonitor/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return internetmonitor_sdkv2.NewFromConfig(cfg, func(o *internetmonitor_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From f43f4ba1429a02b7bcbdefd1c528d775774d6156 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:51 -0400 Subject: [PATCH 0624/1490] iot: Use constant for endpoint strings --- internal/service/iot/service_package_gen.go | 2 +- internal/service/iot/topic_rule.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/iot/service_package_gen.go b/internal/service/iot/service_package_gen.go index c8f6f7bbcdd..3e1c3724236 100644 --- a/internal/service/iot/service_package_gen.go +++ b/internal/service/iot/service_package_gen.go @@ -162,7 +162,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*iot_sdkv1.IoT, error) { sess := config["session"].(*session_sdkv1.Session) - return iot_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return iot_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { diff --git a/internal/service/iot/topic_rule.go b/internal/service/iot/topic_rule.go index dbbb0e25b0a..ab9e84b4ab8 100644 --- a/internal/service/iot/topic_rule.go +++ b/internal/service/iot/topic_rule.go @@ -206,7 +206,7 @@ func ResourceTopicRule() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Required: true, ValidateFunc: validTopicRuleElasticsearchEndpoint, @@ -414,7 +414,7 @@ func ResourceTopicRule() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Required: true, ValidateFunc: validTopicRuleElasticsearchEndpoint, @@ -1572,7 +1572,7 @@ func expandElasticsearchAction(tfList []interface{}) *iot.ElasticsearchAction { apiObject := &iot.ElasticsearchAction{} tfMap := tfList[0].(map[string]interface{}) - if v, ok := tfMap["endpoint"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrEndpoint].(string); ok && v != "" { apiObject.Endpoint = aws.String(v) } @@ -2681,7 +2681,7 @@ func flattenElasticsearchAction(apiObject *iot.ElasticsearchAction) []interface{ tfMap := make(map[string]interface{}) if v := apiObject.Endpoint; v != nil { - tfMap["endpoint"] = aws.StringValue(v) + tfMap[names.AttrEndpoint] = aws.StringValue(v) } if v := apiObject.Id; v != nil { From da34c0c10710b9d514195d7eab6b5b3c0580cf19 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:51 -0400 Subject: [PATCH 0625/1490] iotanalytics: Use constant for endpoint strings --- internal/service/iotanalytics/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/iotanalytics/service_package_gen.go b/internal/service/iotanalytics/service_package_gen.go index 6ef6bc9a53e..f04a829d2f4 100644 --- a/internal/service/iotanalytics/service_package_gen.go +++ b/internal/service/iotanalytics/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*iotanalytics_sdkv1.IoTAnalytics, error) { sess := config["session"].(*session_sdkv1.Session) - return iotanalytics_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return iotanalytics_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From e26ac3e42f73d69869b5b4a5b34f3c26640b60c7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:51 -0400 Subject: [PATCH 0626/1490] iotevents: Use constant for endpoint strings --- internal/service/iotevents/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/iotevents/service_package_gen.go b/internal/service/iotevents/service_package_gen.go index 5586b9e6aee..e19d8167fb9 100644 --- a/internal/service/iotevents/service_package_gen.go +++ b/internal/service/iotevents/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*iotevents_sdkv1.IoTEvents, error) { sess := config["session"].(*session_sdkv1.Session) - return iotevents_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return iotevents_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 5c6c9c8ecbb6b7bea7ced5d87472ea193ce053a1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:51 -0400 Subject: [PATCH 0627/1490] ivs: Use constant for endpoint strings --- internal/service/ivs/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ivs/service_package_gen.go b/internal/service/ivs/service_package_gen.go index 716394b271e..aabd4d31b79 100644 --- a/internal/service/ivs/service_package_gen.go +++ b/internal/service/ivs/service_package_gen.go @@ -69,7 +69,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ivs_sdkv1.IVS, error) { sess := config["session"].(*session_sdkv1.Session) - return ivs_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return ivs_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From e95ff496046c9874c42754427ba5a98a2033f4e0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:52 -0400 Subject: [PATCH 0628/1490] ivschat: Use constant for endpoint strings --- internal/service/ivschat/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ivschat/service_package_gen.go b/internal/service/ivschat/service_package_gen.go index ea2c7298d65..9abb1f40007 100644 --- a/internal/service/ivschat/service_package_gen.go +++ b/internal/service/ivschat/service_package_gen.go @@ -56,7 +56,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return ivschat_sdkv2.NewFromConfig(cfg, func(o *ivschat_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 9174059106cf817bf69317b676f14f82fe9764b6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:52 -0400 Subject: [PATCH 0629/1490] kafka: Use constant for endpoint strings --- internal/service/kafka/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/kafka/service_package.go b/internal/service/kafka/service_package.go index 848690b75b3..1b508d6aa14 100644 --- a/internal/service/kafka/service_package.go +++ b/internal/service/kafka/service_package.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/kafka/types" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -19,7 +20,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return kafka.NewFromConfig(cfg, func(o *kafka.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } From bc67c51f4518e64f2c202bbb7c87b449df8bbc8a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:52 -0400 Subject: [PATCH 0630/1490] kafkaconnect: Use constant for endpoint strings --- internal/service/kafkaconnect/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/kafkaconnect/service_package_gen.go b/internal/service/kafkaconnect/service_package_gen.go index 43e36b2f4e1..f9064d78026 100644 --- a/internal/service/kafkaconnect/service_package_gen.go +++ b/internal/service/kafkaconnect/service_package_gen.go @@ -65,7 +65,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*kafkaconnect_sdkv1.KafkaConnect, error) { sess := config["session"].(*session_sdkv1.Session) - return kafkaconnect_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return kafkaconnect_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 0589d3fbc46b888c01e7de4b0d4b169898721eae Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:52 -0400 Subject: [PATCH 0631/1490] kendra: Use constant for endpoint strings --- internal/service/kendra/experience.go | 4 ++-- internal/service/kendra/experience_data_source.go | 2 +- internal/service/kendra/service_package_gen.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/kendra/experience.go b/internal/service/kendra/experience.go index a38e53130ee..92005c31207 100644 --- a/internal/service/kendra/experience.go +++ b/internal/service/kendra/experience.go @@ -129,7 +129,7 @@ func ResourceExperience() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -492,7 +492,7 @@ func flattenEndpoints(apiObjects []types.ExperienceEndpoint) []interface{} { m := make(map[string]interface{}) if v := apiObject.Endpoint; v != nil { - m["endpoint"] = aws.ToString(v) + m[names.AttrEndpoint] = aws.ToString(v) } if v := string(apiObject.EndpointType); v != "" { diff --git a/internal/service/kendra/experience_data_source.go b/internal/service/kendra/experience_data_source.go index 89f5ce5cb6d..56047ca126c 100644 --- a/internal/service/kendra/experience_data_source.go +++ b/internal/service/kendra/experience_data_source.go @@ -87,7 +87,7 @@ func DataSourceExperience() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/kendra/service_package_gen.go b/internal/service/kendra/service_package_gen.go index cbd5027e17e..381e7938be0 100644 --- a/internal/service/kendra/service_package_gen.go +++ b/internal/service/kendra/service_package_gen.go @@ -105,7 +105,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return kendra_sdkv2.NewFromConfig(cfg, func(o *kendra_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From eb868d0310645ad9ceb3732cc29dce7a19b989e7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:52 -0400 Subject: [PATCH 0632/1490] keyspaces: Use constant for endpoint strings --- internal/service/keyspaces/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/keyspaces/service_package_gen.go b/internal/service/keyspaces/service_package_gen.go index 2202b2fe1b1..2fc64948dff 100644 --- a/internal/service/keyspaces/service_package_gen.go +++ b/internal/service/keyspaces/service_package_gen.go @@ -56,7 +56,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return keyspaces_sdkv2.NewFromConfig(cfg, func(o *keyspaces_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 9230efe1557e2e2cc151ef0a62d58ee96fe6d802 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:52 -0400 Subject: [PATCH 0633/1490] kinesis: Use constant for endpoint strings --- internal/service/kinesis/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/kinesis/service_package.go b/internal/service/kinesis/service_package.go index 2765f2d45e3..715241b7946 100644 --- a/internal/service/kinesis/service_package.go +++ b/internal/service/kinesis/service_package.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/kinesis/types" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -19,7 +20,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return kinesis.NewFromConfig(cfg, func(o *kinesis.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } From 9c1e211fa963d1a4fe55c8568dcde69f0d0db33d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:52 -0400 Subject: [PATCH 0634/1490] kinesisanalytics: Use constant for endpoint strings --- internal/service/kinesisanalytics/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/kinesisanalytics/service_package_gen.go b/internal/service/kinesisanalytics/service_package_gen.go index 655eed59af4..e10dc6ebf63 100644 --- a/internal/service/kinesisanalytics/service_package_gen.go +++ b/internal/service/kinesisanalytics/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*kinesisanalytics_sdkv1.KinesisAnalytics, error) { sess := config["session"].(*session_sdkv1.Session) - return kinesisanalytics_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return kinesisanalytics_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From d7cb3f595575e37d0f8db623dd9d4cbe7cabf7ce Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:53 -0400 Subject: [PATCH 0635/1490] kinesisanalyticsv2: Use constant for endpoint strings --- internal/service/kinesisanalyticsv2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/kinesisanalyticsv2/service_package_gen.go b/internal/service/kinesisanalyticsv2/service_package_gen.go index 0ceb3338193..9934c82c59f 100644 --- a/internal/service/kinesisanalyticsv2/service_package_gen.go +++ b/internal/service/kinesisanalyticsv2/service_package_gen.go @@ -52,7 +52,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*kinesisanalyticsv2_sdkv1.KinesisAnalyticsV2, error) { sess := config["session"].(*session_sdkv1.Session) - return kinesisanalyticsv2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return kinesisanalyticsv2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 268eed511d7641e12dd623fc877dd17af43f37fd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:53 -0400 Subject: [PATCH 0636/1490] kinesisvideo: Use constant for endpoint strings --- internal/service/kinesisvideo/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/kinesisvideo/service_package_gen.go b/internal/service/kinesisvideo/service_package_gen.go index 4d6c1bcac74..c87c68e191c 100644 --- a/internal/service/kinesisvideo/service_package_gen.go +++ b/internal/service/kinesisvideo/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*kinesisvideo_sdkv1.KinesisVideo, error) { sess := config["session"].(*session_sdkv1.Session) - return kinesisvideo_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return kinesisvideo_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From aa44d53b355db2362ce67b11eef0aeaed6c8842b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:53 -0400 Subject: [PATCH 0637/1490] kms: Use constant for endpoint strings --- internal/service/kms/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/kms/service_package_gen.go b/internal/service/kms/service_package_gen.go index 225353bddbd..b16ee7d4cf0 100644 --- a/internal/service/kms/service_package_gen.go +++ b/internal/service/kms/service_package_gen.go @@ -133,7 +133,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return kms_sdkv2.NewFromConfig(cfg, func(o *kms_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 39863d7905f7b64d19d3190d9923068f370cd63b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:53 -0400 Subject: [PATCH 0638/1490] lakeformation: Use constant for endpoint strings --- internal/service/lakeformation/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/lakeformation/service_package_gen.go b/internal/service/lakeformation/service_package_gen.go index a152c0d1fd7..b527b8bf72c 100644 --- a/internal/service/lakeformation/service_package_gen.go +++ b/internal/service/lakeformation/service_package_gen.go @@ -83,7 +83,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return lakeformation_sdkv2.NewFromConfig(cfg, func(o *lakeformation_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 896548e3c954c37b0bad9cfaa1eca911588c1422 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:53 -0400 Subject: [PATCH 0639/1490] lambda: Use constant for endpoint strings --- internal/service/lambda/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/lambda/service_package_gen.go b/internal/service/lambda/service_package_gen.go index d24e53d2eca..c127b052004 100644 --- a/internal/service/lambda/service_package_gen.go +++ b/internal/service/lambda/service_package_gen.go @@ -134,7 +134,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return lambda_sdkv2.NewFromConfig(cfg, func(o *lambda_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 5c3718e0a6d0dc02a281e2e59328839a14ceb0dd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:53 -0400 Subject: [PATCH 0640/1490] launchwizard: Use constant for endpoint strings --- internal/service/launchwizard/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/launchwizard/service_package_gen.go b/internal/service/launchwizard/service_package_gen.go index 9c3c8d4c23f..5ac5a8c2c7b 100644 --- a/internal/service/launchwizard/service_package_gen.go +++ b/internal/service/launchwizard/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return launchwizard_sdkv2.NewFromConfig(cfg, func(o *launchwizard_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From bc3fd9a1e720128f643a1b099e2aedf3b38c8a4b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:53 -0400 Subject: [PATCH 0641/1490] lexmodels: Use constant for endpoint strings --- internal/service/lexmodels/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/lexmodels/service_package_gen.go b/internal/service/lexmodels/service_package_gen.go index 7280e8b0290..841771188d3 100644 --- a/internal/service/lexmodels/service_package_gen.go +++ b/internal/service/lexmodels/service_package_gen.go @@ -73,7 +73,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*lexmodelbuildingservice_sdkv1.LexModelBuildingService, error) { sess := config["session"].(*session_sdkv1.Session) - return lexmodelbuildingservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return lexmodelbuildingservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 5b63680b16ec0089bbe71dd5a38cfc41fff1c39b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:54 -0400 Subject: [PATCH 0642/1490] lexv2models: Use constant for endpoint strings --- internal/service/lexv2models/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/lexv2models/service_package_gen.go b/internal/service/lexv2models/service_package_gen.go index 30cb774f558..c99e00b0dec 100644 --- a/internal/service/lexv2models/service_package_gen.go +++ b/internal/service/lexv2models/service_package_gen.go @@ -67,7 +67,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return lexmodelsv2_sdkv2.NewFromConfig(cfg, func(o *lexmodelsv2_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From ea728b016254747a548d990ca56f712b6c851cb6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:54 -0400 Subject: [PATCH 0643/1490] licensemanager: Use constant for endpoint strings --- internal/service/licensemanager/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/licensemanager/service_package_gen.go b/internal/service/licensemanager/service_package_gen.go index 1551f2cefdb..844b49b98f0 100644 --- a/internal/service/licensemanager/service_package_gen.go +++ b/internal/service/licensemanager/service_package_gen.go @@ -73,7 +73,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*licensemanager_sdkv1.LicenseManager, error) { sess := config["session"].(*session_sdkv1.Session) - return licensemanager_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return licensemanager_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From f8c2226d98403364c0d7469da1898d959b324f0d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:54 -0400 Subject: [PATCH 0644/1490] lightsail: Use constant for endpoint strings --- internal/service/lightsail/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/lightsail/service_package.go b/internal/service/lightsail/service_package.go index 5a9d9cd0757..e5bc1f002f0 100644 --- a/internal/service/lightsail/service_package.go +++ b/internal/service/lightsail/service_package.go @@ -11,6 +11,7 @@ import ( aws_sdkv2 "github.com/aws/aws-sdk-go-v2/aws" retry_sdkv2 "github.com/aws/aws-sdk-go-v2/aws/retry" lightsail_sdkv2 "github.com/aws/aws-sdk-go-v2/service/lightsail" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -18,7 +19,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return lightsail_sdkv2.NewFromConfig(cfg, func(o *lightsail_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } From cc4255b7114ab4271890c1aaa549eb2fb4ad47f9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:54 -0400 Subject: [PATCH 0645/1490] location: Use constant for endpoint strings --- internal/service/location/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/location/service_package_gen.go b/internal/service/location/service_package_gen.go index e913d27b0bc..fb86837351a 100644 --- a/internal/service/location/service_package_gen.go +++ b/internal/service/location/service_package_gen.go @@ -113,7 +113,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*locationservice_sdkv1.LocationService, error) { sess := config["session"].(*session_sdkv1.Session) - return locationservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return locationservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From e03380ea4efc42e55a8822516741d5612905aa4c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:54 -0400 Subject: [PATCH 0646/1490] logs: Use constant for endpoint strings --- internal/service/logs/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/logs/service_package_gen.go b/internal/service/logs/service_package_gen.go index 0db3e519538..23ef723a9ca 100644 --- a/internal/service/logs/service_package_gen.go +++ b/internal/service/logs/service_package_gen.go @@ -95,7 +95,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return cloudwatchlogs_sdkv2.NewFromConfig(cfg, func(o *cloudwatchlogs_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 8ea5760a88736a84329a412833ea12eed6b866ae Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:54 -0400 Subject: [PATCH 0647/1490] lookoutmetrics: Use constant for endpoint strings --- internal/service/lookoutmetrics/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/lookoutmetrics/service_package_gen.go b/internal/service/lookoutmetrics/service_package_gen.go index 007860d79be..bb044e40f11 100644 --- a/internal/service/lookoutmetrics/service_package_gen.go +++ b/internal/service/lookoutmetrics/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return lookoutmetrics_sdkv2.NewFromConfig(cfg, func(o *lookoutmetrics_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 5d051bb3355e6000592eb516b899e391076d2c01 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:54 -0400 Subject: [PATCH 0648/1490] m2: Use constant for endpoint strings --- internal/service/m2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/m2/service_package_gen.go b/internal/service/m2/service_package_gen.go index c8f9f257d25..0262e78d822 100644 --- a/internal/service/m2/service_package_gen.go +++ b/internal/service/m2/service_package_gen.go @@ -58,7 +58,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return m2_sdkv2.NewFromConfig(cfg, func(o *m2_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 4fc65e90dccb47734e955bcd8c982243f8c24dd8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:54 -0400 Subject: [PATCH 0649/1490] macie2: Use constant for endpoint strings --- internal/service/macie2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/macie2/service_package_gen.go b/internal/service/macie2/service_package_gen.go index 1cb66d10e4c..c92d2a119aa 100644 --- a/internal/service/macie2/service_package_gen.go +++ b/internal/service/macie2/service_package_gen.go @@ -80,7 +80,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*macie2_sdkv1.Macie2, error) { sess := config["session"].(*session_sdkv1.Session) - return macie2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return macie2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 82be8db3262850c53955dabfe624d917f92b43bc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:55 -0400 Subject: [PATCH 0650/1490] mediaconnect: Use constant for endpoint strings --- internal/service/mediaconnect/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/mediaconnect/service_package_gen.go b/internal/service/mediaconnect/service_package_gen.go index 1c3e8fc9bed..615dccf3b88 100644 --- a/internal/service/mediaconnect/service_package_gen.go +++ b/internal/service/mediaconnect/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return mediaconnect_sdkv2.NewFromConfig(cfg, func(o *mediaconnect_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From e0b3c7ffce76a8a5b2c4e0f0bb2fa97ab4ec73b0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:55 -0400 Subject: [PATCH 0651/1490] mediaconvert: Use constant for endpoint strings --- internal/service/mediaconvert/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/mediaconvert/service_package_gen.go b/internal/service/mediaconvert/service_package_gen.go index cad2fd9823b..b282c0793e2 100644 --- a/internal/service/mediaconvert/service_package_gen.go +++ b/internal/service/mediaconvert/service_package_gen.go @@ -57,7 +57,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return mediaconvert_sdkv2.NewFromConfig(cfg, func(o *mediaconvert_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 4135fd9f264dc84b837be8a59e9b7c463a89d7dd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:55 -0400 Subject: [PATCH 0652/1490] medialive: Use constant for endpoint strings --- internal/service/medialive/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/medialive/service_package_gen.go b/internal/service/medialive/service_package_gen.go index d1883565c53..d2f9e51873d 100644 --- a/internal/service/medialive/service_package_gen.go +++ b/internal/service/medialive/service_package_gen.go @@ -81,7 +81,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return medialive_sdkv2.NewFromConfig(cfg, func(o *medialive_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 6a665a012c5c1e94bbcb6da52ffb23dab9a888cf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:55 -0400 Subject: [PATCH 0653/1490] mediapackage: Use constant for endpoint strings --- internal/service/mediapackage/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/mediapackage/service_package_gen.go b/internal/service/mediapackage/service_package_gen.go index 73be8e91c1b..639b024f93d 100644 --- a/internal/service/mediapackage/service_package_gen.go +++ b/internal/service/mediapackage/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return mediapackage_sdkv2.NewFromConfig(cfg, func(o *mediapackage_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 76ea0187a3e1aecaa9e934ab01f55f754d0a33de Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:55 -0400 Subject: [PATCH 0654/1490] mediapackagev2: Use constant for endpoint strings --- internal/service/mediapackagev2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/mediapackagev2/service_package_gen.go b/internal/service/mediapackagev2/service_package_gen.go index a2247bb293a..b810ea7ab47 100644 --- a/internal/service/mediapackagev2/service_package_gen.go +++ b/internal/service/mediapackagev2/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return mediapackagev2_sdkv2.NewFromConfig(cfg, func(o *mediapackagev2_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 004363f1f4c32b86afc7c6256c92c3fe2171c6fb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:55 -0400 Subject: [PATCH 0655/1490] mediastore: Use constant for endpoint strings --- internal/service/mediastore/container.go | 4 ++-- internal/service/mediastore/service_package_gen.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/mediastore/container.go b/internal/service/mediastore/container.go index ec901944370..96079821068 100644 --- a/internal/service/mediastore/container.go +++ b/internal/service/mediastore/container.go @@ -48,7 +48,7 @@ func ResourceContainer() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -104,7 +104,7 @@ func resourceContainerRead(ctx context.Context, d *schema.ResourceData, meta int arn := aws.ToString(resp.ARN) d.Set(names.AttrARN, arn) d.Set(names.AttrName, resp.Name) - d.Set("endpoint", resp.Endpoint) + d.Set(names.AttrEndpoint, resp.Endpoint) return diags } diff --git a/internal/service/mediastore/service_package_gen.go b/internal/service/mediastore/service_package_gen.go index 769380257c9..eba27f0d0fe 100644 --- a/internal/service/mediastore/service_package_gen.go +++ b/internal/service/mediastore/service_package_gen.go @@ -52,7 +52,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return mediastore_sdkv2.NewFromConfig(cfg, func(o *mediastore_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From b9d66f6283a7e455526569dd1b6099e5e7e8e6c4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:55 -0400 Subject: [PATCH 0656/1490] memorydb: Use constant for endpoint strings --- internal/service/memorydb/cluster.go | 4 ++-- internal/service/memorydb/cluster_data_source.go | 2 +- internal/service/memorydb/service_package_gen.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/memorydb/cluster.go b/internal/service/memorydb/cluster.go index 673cb99824b..55d3637a4e8 100644 --- a/internal/service/memorydb/cluster.go +++ b/internal/service/memorydb/cluster.go @@ -179,7 +179,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint": endpointSchema(), + names.AttrEndpoint: endpointSchema(), names.AttrName: { Type: schema.TypeString, Computed: true, @@ -628,7 +628,7 @@ func flattenShards(shards []*memorydb.Shard) *schema.Set { nodeSet.Add(map[string]interface{}{ names.AttrAvailabilityZone: aws.StringValue(node.AvailabilityZone), "create_time": aws.TimeValue(node.CreateTime).Format(time.RFC3339), - "endpoint": flattenEndpoint(node.Endpoint), + names.AttrEndpoint: flattenEndpoint(node.Endpoint), names.AttrName: aws.StringValue(node.Name), }) } diff --git a/internal/service/memorydb/cluster_data_source.go b/internal/service/memorydb/cluster_data_source.go index 4e61f4ff813..edaaec6ae9e 100644 --- a/internal/service/memorydb/cluster_data_source.go +++ b/internal/service/memorydb/cluster_data_source.go @@ -120,7 +120,7 @@ func DataSourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint": endpointSchema(), + names.AttrEndpoint: endpointSchema(), names.AttrName: { Type: schema.TypeString, Computed: true, diff --git a/internal/service/memorydb/service_package_gen.go b/internal/service/memorydb/service_package_gen.go index 8abee8710d0..6defd26d6f9 100644 --- a/internal/service/memorydb/service_package_gen.go +++ b/internal/service/memorydb/service_package_gen.go @@ -113,7 +113,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*memorydb_sdkv1.MemoryDB, error) { sess := config["session"].(*session_sdkv1.Session) - return memorydb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return memorydb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From ba6127ba2048bacbce46455b4f5a4c178cdc17a1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:56 -0400 Subject: [PATCH 0657/1490] meta: Use constant for endpoint strings --- internal/service/meta/region_data_source.go | 2 +- internal/service/meta/region_data_source_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/meta/region_data_source.go b/internal/service/meta/region_data_source.go index c947bb2a393..c597e87e7c3 100644 --- a/internal/service/meta/region_data_source.go +++ b/internal/service/meta/region_data_source.go @@ -41,7 +41,7 @@ func (d *dataSourceRegion) Schema(ctx context.Context, req datasource.SchemaRequ names.AttrDescription: schema.StringAttribute{ Computed: true, }, - "endpoint": schema.StringAttribute{ + names.AttrEndpoint: schema.StringAttribute{ Optional: true, Computed: true, }, diff --git a/internal/service/meta/region_data_source_test.go b/internal/service/meta/region_data_source_test.go index d3401dbfc52..acbdc1222e5 100644 --- a/internal/service/meta/region_data_source_test.go +++ b/internal/service/meta/region_data_source_test.go @@ -96,7 +96,7 @@ func TestAccMetaRegionDataSource_basic(t *testing.T) { Config: testAccRegionDataSourceConfig_empty, Check: resource.ComposeTestCheckFunc( resource.TestMatchResourceAttr(dataSourceName, names.AttrDescription, regexache.MustCompile(`^.+$`)), - acctest.CheckResourceAttrRegionalHostnameService(dataSourceName, "endpoint", ec2.EndpointsID), + acctest.CheckResourceAttrRegionalHostnameService(dataSourceName, names.AttrEndpoint, ec2.EndpointsID), resource.TestCheckResourceAttr(dataSourceName, names.AttrName, acctest.Region()), ), }, @@ -117,7 +117,7 @@ func TestAccMetaRegionDataSource_endpoint(t *testing.T) { Config: testAccRegionDataSourceConfig_endpoint(), Check: resource.ComposeTestCheckFunc( resource.TestMatchResourceAttr(dataSourceName, names.AttrDescription, regexache.MustCompile(`^.+$`)), - resource.TestMatchResourceAttr(dataSourceName, "endpoint", regexache.MustCompile(fmt.Sprintf("^%s\\.[^.]+\\.%s$", ec2.EndpointsID, acctest.PartitionDNSSuffix()))), + resource.TestMatchResourceAttr(dataSourceName, names.AttrEndpoint, regexache.MustCompile(fmt.Sprintf("^%s\\.[^.]+\\.%s$", ec2.EndpointsID, acctest.PartitionDNSSuffix()))), resource.TestMatchResourceAttr(dataSourceName, names.AttrName, regexache.MustCompile(`^.+$`)), ), }, @@ -138,7 +138,7 @@ func TestAccMetaRegionDataSource_endpointAndName(t *testing.T) { Config: testAccRegionDataSourceConfig_endpointAndName(), Check: resource.ComposeTestCheckFunc( resource.TestMatchResourceAttr(dataSourceName, names.AttrDescription, regexache.MustCompile(`^.+$`)), - resource.TestMatchResourceAttr(dataSourceName, "endpoint", regexache.MustCompile(fmt.Sprintf("^ec2\\.[^.]+\\.%s$", acctest.PartitionDNSSuffix()))), + resource.TestMatchResourceAttr(dataSourceName, names.AttrEndpoint, regexache.MustCompile(fmt.Sprintf("^ec2\\.[^.]+\\.%s$", acctest.PartitionDNSSuffix()))), resource.TestMatchResourceAttr(dataSourceName, names.AttrName, regexache.MustCompile(`^.+$`)), ), }, @@ -159,7 +159,7 @@ func TestAccMetaRegionDataSource_name(t *testing.T) { Config: testAccRegionDataSourceConfig_name(), Check: resource.ComposeTestCheckFunc( resource.TestMatchResourceAttr(dataSourceName, names.AttrDescription, regexache.MustCompile(`^.+$`)), - resource.TestMatchResourceAttr(dataSourceName, "endpoint", regexache.MustCompile(fmt.Sprintf("^ec2\\.[^.]+\\.%s$", acctest.PartitionDNSSuffix()))), + resource.TestMatchResourceAttr(dataSourceName, names.AttrEndpoint, regexache.MustCompile(fmt.Sprintf("^ec2\\.[^.]+\\.%s$", acctest.PartitionDNSSuffix()))), resource.TestMatchResourceAttr(dataSourceName, names.AttrName, regexache.MustCompile(`^.+$`)), ), }, From 5c3b9a12e2f2971e40370caa8f2742642f51c2f2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:56 -0400 Subject: [PATCH 0658/1490] mq: Use constant for endpoint strings --- internal/service/mq/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/mq/service_package_gen.go b/internal/service/mq/service_package_gen.go index 690b73a62c1..6b026fc01a2 100644 --- a/internal/service/mq/service_package_gen.go +++ b/internal/service/mq/service_package_gen.go @@ -72,7 +72,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return mq_sdkv2.NewFromConfig(cfg, func(o *mq_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 26b95bbba7b100dd3c531dd8828f27698215e477 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:56 -0400 Subject: [PATCH 0659/1490] mwaa: Use constant for endpoint strings --- internal/service/mwaa/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/mwaa/service_package_gen.go b/internal/service/mwaa/service_package_gen.go index 9f9e1dd45f5..8f01235e87e 100644 --- a/internal/service/mwaa/service_package_gen.go +++ b/internal/service/mwaa/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return mwaa_sdkv2.NewFromConfig(cfg, func(o *mwaa_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 66f50e6ceb86f5d02016b7fc8276b2234b814021 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:56 -0400 Subject: [PATCH 0660/1490] neptune: Use constant for endpoint strings --- internal/service/neptune/cluster.go | 4 ++-- internal/service/neptune/cluster_endpoint.go | 4 ++-- internal/service/neptune/cluster_instance.go | 4 ++-- internal/service/neptune/cluster_test.go | 2 +- internal/service/neptune/service_package_gen.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/neptune/cluster.go b/internal/service/neptune/cluster.go index f5b102ee4eb..523cd51b76f 100644 --- a/internal/service/neptune/cluster.go +++ b/internal/service/neptune/cluster.go @@ -134,7 +134,7 @@ func ResourceCluster() *schema.Resource { }, false), }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -548,7 +548,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("copy_tags_to_snapshot", dbc.CopyTagsToSnapshot) d.Set("deletion_protection", dbc.DeletionProtection) d.Set("enable_cloudwatch_logs_exports", aws.StringValueSlice(dbc.EnabledCloudwatchLogsExports)) - d.Set("endpoint", dbc.Endpoint) + d.Set(names.AttrEndpoint, dbc.Endpoint) d.Set(names.AttrEngineVersion, dbc.EngineVersion) d.Set("engine", dbc.Engine) d.Set("hosted_zone_id", dbc.HostedZoneId) diff --git a/internal/service/neptune/cluster_endpoint.go b/internal/service/neptune/cluster_endpoint.go index 9b399a21c51..a5f3e0d0592 100644 --- a/internal/service/neptune/cluster_endpoint.go +++ b/internal/service/neptune/cluster_endpoint.go @@ -57,7 +57,7 @@ func ResourceClusterEndpoint() *schema.Resource { ForceNew: true, ValidateFunc: validIdentifier, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -149,7 +149,7 @@ func resourceClusterEndpointRead(ctx context.Context, d *schema.ResourceData, me d.Set(names.AttrARN, ep.DBClusterEndpointArn) d.Set("cluster_endpoint_identifier", ep.DBClusterEndpointIdentifier) d.Set(names.AttrClusterIdentifier, ep.DBClusterIdentifier) - d.Set("endpoint", ep.Endpoint) + d.Set(names.AttrEndpoint, ep.Endpoint) d.Set("endpoint_type", ep.CustomEndpointType) d.Set("excluded_members", aws.StringValueSlice(ep.ExcludedMembers)) d.Set("static_members", aws.StringValueSlice(ep.StaticMembers)) diff --git a/internal/service/neptune/cluster_instance.go b/internal/service/neptune/cluster_instance.go index b6d1ebf0260..68efb73da2c 100644 --- a/internal/service/neptune/cluster_instance.go +++ b/internal/service/neptune/cluster_instance.go @@ -80,7 +80,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -297,7 +297,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me port := int(aws.Int64Value(db.Endpoint.Port)) d.Set("address", address) - d.Set("endpoint", fmt.Sprintf("%s:%d", address, port)) + d.Set(names.AttrEndpoint, fmt.Sprintf("%s:%d", address, port)) d.Set(names.AttrPort, port) } diff --git a/internal/service/neptune/cluster_test.go b/internal/service/neptune/cluster_test.go index 301af662c98..dec8a59d336 100644 --- a/internal/service/neptune/cluster_test.go +++ b/internal/service/neptune/cluster_test.go @@ -66,7 +66,7 @@ func TestAccNeptuneCluster_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "copy_tags_to_snapshot", "false"), resource.TestCheckResourceAttr(resourceName, "deletion_protection", "false"), resource.TestCheckResourceAttr(resourceName, "enable_cloudwatch_logs_exports.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "engine", "neptune"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckNoResourceAttr(resourceName, "final_snapshot_identifier"), diff --git a/internal/service/neptune/service_package_gen.go b/internal/service/neptune/service_package_gen.go index 48d6dec4bcb..cb71b041191 100644 --- a/internal/service/neptune/service_package_gen.go +++ b/internal/service/neptune/service_package_gen.go @@ -113,7 +113,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*neptune_sdkv1.Neptune, error) { sess := config["session"].(*session_sdkv1.Session) - return neptune_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return neptune_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 8ed4bf4dee162b18888d21cc9168b4aa06224a28 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:56 -0400 Subject: [PATCH 0661/1490] neptunegraph: Use constant for endpoint strings --- internal/service/neptunegraph/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/neptunegraph/service_package_gen.go b/internal/service/neptunegraph/service_package_gen.go index 97ded8f074a..af2ad99c076 100644 --- a/internal/service/neptunegraph/service_package_gen.go +++ b/internal/service/neptunegraph/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return neptunegraph_sdkv2.NewFromConfig(cfg, func(o *neptunegraph_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 62d7b7ea99709c6610ce7104c66fef128be07922 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:56 -0400 Subject: [PATCH 0662/1490] networkfirewall: Use constant for endpoint strings --- internal/service/networkfirewall/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/networkfirewall/service_package_gen.go b/internal/service/networkfirewall/service_package_gen.go index a5dc061962f..346befbcd41 100644 --- a/internal/service/networkfirewall/service_package_gen.go +++ b/internal/service/networkfirewall/service_package_gen.go @@ -85,7 +85,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*networkfirewall_sdkv1.NetworkFirewall, error) { sess := config["session"].(*session_sdkv1.Session) - return networkfirewall_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return networkfirewall_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From eed1497c9bfe6eb1845d5a9f550c03217dfb46e0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:57 -0400 Subject: [PATCH 0663/1490] networkmanager: Use constant for endpoint strings --- internal/service/networkmanager/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/networkmanager/service_package_gen.go b/internal/service/networkmanager/service_package_gen.go index 0425baf5825..cb2f2423cfd 100644 --- a/internal/service/networkmanager/service_package_gen.go +++ b/internal/service/networkmanager/service_package_gen.go @@ -205,7 +205,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*networkmanager_sdkv1.NetworkManager, error) { sess := config["session"].(*session_sdkv1.Session) - return networkmanager_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return networkmanager_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From c5001f39e2529a93660680b523536891caef1e64 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:57 -0400 Subject: [PATCH 0664/1490] oam: Use constant for endpoint strings --- internal/service/oam/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/oam/service_package_gen.go b/internal/service/oam/service_package_gen.go index 48bf3b9a225..4b2fe5aa84f 100644 --- a/internal/service/oam/service_package_gen.go +++ b/internal/service/oam/service_package_gen.go @@ -77,7 +77,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return oam_sdkv2.NewFromConfig(cfg, func(o *oam_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From e7a355fea5fddca233213b9cf3bca2defaa9d7d5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:57 -0400 Subject: [PATCH 0665/1490] opensearch: Use constant for endpoint strings --- internal/service/opensearch/domain.go | 10 +++++----- internal/service/opensearch/domain_data_source.go | 8 ++++---- internal/service/opensearch/outbound_connection.go | 4 ++-- internal/service/opensearch/service_package_gen.go | 2 +- internal/service/opensearch/vpc_endpoint.go | 4 ++-- internal/service/opensearch/vpc_endpoint_test.go | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/service/opensearch/domain.go b/internal/service/opensearch/domain.go index f3f0814aad7..173128a54f1 100644 --- a/internal/service/opensearch/domain.go +++ b/internal/service/opensearch/domain.go @@ -454,7 +454,7 @@ func ResourceDomain() *schema.Resource { }, }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -903,7 +903,7 @@ func resourceDomainRead(ctx context.Context, d *schema.ResourceData, meta interf } endpoints := flex.FlattenStringMap(ds.Endpoints) - d.Set("endpoint", endpoints["vpc"]) + d.Set(names.AttrEndpoint, endpoints["vpc"]) d.Set("dashboard_endpoint", getDashboardEndpoint(d)) d.Set("kibana_endpoint", getKibanaEndpoint(d)) if ds.Endpoint != nil { @@ -911,7 +911,7 @@ func resourceDomainRead(ctx context.Context, d *schema.ResourceData, meta interf } } else { if ds.Endpoint != nil { - d.Set("endpoint", ds.Endpoint) + d.Set(names.AttrEndpoint, ds.Endpoint) d.Set("dashboard_endpoint", getDashboardEndpoint(d)) d.Set("kibana_endpoint", getKibanaEndpoint(d)) } @@ -1176,11 +1176,11 @@ func suppressEquivalentKMSKeyIDs(k, old, new string, d *schema.ResourceData) boo } func getDashboardEndpoint(d *schema.ResourceData) string { - return d.Get("endpoint").(string) + "/_dashboards" + return d.Get(names.AttrEndpoint).(string) + "/_dashboards" } func getKibanaEndpoint(d *schema.ResourceData) string { - return d.Get("endpoint").(string) + "/_plugin/kibana/" + return d.Get(names.AttrEndpoint).(string) + "/_plugin/kibana/" } func suppressComputedDedicatedMaster(k, old, new string, d *schema.ResourceData) bool { diff --git a/internal/service/opensearch/domain_data_source.go b/internal/service/opensearch/domain_data_source.go index 4830b80feea..ae22a123c14 100644 --- a/internal/service/opensearch/domain_data_source.go +++ b/internal/service/opensearch/domain_data_source.go @@ -269,7 +269,7 @@ func DataSourceDomain() *schema.Resource { }, }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -452,7 +452,7 @@ func dataSourceDomainRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrARN, ds.ARN) d.Set("domain_id", ds.DomainId) - d.Set("endpoint", ds.Endpoint) + d.Set(names.AttrEndpoint, ds.Endpoint) d.Set("dashboard_endpoint", getDashboardEndpoint(d)) d.Set("kibana_endpoint", getKibanaEndpoint(d)) @@ -496,7 +496,7 @@ func dataSourceDomainRead(ctx context.Context, d *schema.ResourceData, meta inte } endpoints := flex.FlattenStringMap(ds.Endpoints) - if err := d.Set("endpoint", endpoints["vpc"]); err != nil { + if err := d.Set(names.AttrEndpoint, endpoints["vpc"]); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoint: %s", err) } d.Set("dashboard_endpoint", getDashboardEndpoint(d)) @@ -506,7 +506,7 @@ func dataSourceDomainRead(ctx context.Context, d *schema.ResourceData, meta inte } } else { if ds.Endpoint != nil { - d.Set("endpoint", ds.Endpoint) + d.Set(names.AttrEndpoint, ds.Endpoint) d.Set("dashboard_endpoint", getDashboardEndpoint(d)) d.Set("kibana_endpoint", getKibanaEndpoint(d)) } diff --git a/internal/service/opensearch/outbound_connection.go b/internal/service/opensearch/outbound_connection.go index 6525d43a9b1..02b3e6feef8 100644 --- a/internal/service/opensearch/outbound_connection.go +++ b/internal/service/opensearch/outbound_connection.go @@ -105,7 +105,7 @@ func ResourceOutboundConnection() *schema.Resource { }, }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -387,7 +387,7 @@ func flattenOutboundConnectionConnectionProperties(cProperties *opensearchservic } return []interface{}{map[string]interface{}{ "cross_cluster_search": flattenOutboundConnectionCrossClusterSearchConnectionProperties(cProperties.CrossClusterSearch), - "endpoint": aws.StringValue(cProperties.Endpoint), + names.AttrEndpoint: aws.StringValue(cProperties.Endpoint), }} } diff --git a/internal/service/opensearch/service_package_gen.go b/internal/service/opensearch/service_package_gen.go index 3ea5db8805f..fbf9eb0a2bf 100644 --- a/internal/service/opensearch/service_package_gen.go +++ b/internal/service/opensearch/service_package_gen.go @@ -81,7 +81,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*opensearchservice_sdkv1.OpenSearchService, error) { sess := config["session"].(*session_sdkv1.Session) - return opensearchservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return opensearchservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { diff --git a/internal/service/opensearch/vpc_endpoint.go b/internal/service/opensearch/vpc_endpoint.go index 6c51039fd88..9fdff135e49 100644 --- a/internal/service/opensearch/vpc_endpoint.go +++ b/internal/service/opensearch/vpc_endpoint.go @@ -48,7 +48,7 @@ func ResourceVPCEndpoint() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -126,7 +126,7 @@ func resourceVPCEndpointRead(ctx context.Context, d *schema.ResourceData, meta i } d.Set("domain_arn", endpoint.DomainArn) - d.Set("endpoint", endpoint.Endpoint) + d.Set(names.AttrEndpoint, endpoint.Endpoint) if endpoint.VpcOptions != nil { if err := d.Set("vpc_options", []interface{}{flattenVPCDerivedInfo(endpoint.VpcOptions)}); err != nil { return diag.Errorf("setting vpc_options: %s", err) diff --git a/internal/service/opensearch/vpc_endpoint_test.go b/internal/service/opensearch/vpc_endpoint_test.go index 9f762f3e563..5699323545b 100644 --- a/internal/service/opensearch/vpc_endpoint_test.go +++ b/internal/service/opensearch/vpc_endpoint_test.go @@ -118,7 +118,7 @@ func TestAccOpenSearchVPCEndpoint_basic(t *testing.T) { Config: testAccVPCEndpointConfig_basic(rName, domainName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVPCEndpointExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "vpc_options.#", "1"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.availability_zones.#", "2"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.security_group_ids.#", "1"), @@ -185,7 +185,7 @@ func TestAccOpenSearchVPCEndpoint_update(t *testing.T) { Config: testAccVPCEndpointConfig_basic(rName, domainName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVPCEndpointExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "vpc_options.#", "1"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.availability_zones.#", "2"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.security_group_ids.#", "1"), @@ -197,7 +197,7 @@ func TestAccOpenSearchVPCEndpoint_update(t *testing.T) { Config: testAccVPCEndpointConfig_updated(rName, domainName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVPCEndpointExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "vpc_options.#", "1"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.availability_zones.#", "2"), resource.TestCheckResourceAttr(resourceName, "vpc_options.0.security_group_ids.#", "2"), From 83187819e6bd57b09eea642b2322a9250ba89677 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:57 -0400 Subject: [PATCH 0666/1490] opensearchserverless: Use constant for endpoint strings --- internal/service/opensearchserverless/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/opensearchserverless/service_package_gen.go b/internal/service/opensearchserverless/service_package_gen.go index 48028dacc97..26b12a17b34 100644 --- a/internal/service/opensearchserverless/service_package_gen.go +++ b/internal/service/opensearchserverless/service_package_gen.go @@ -89,7 +89,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return opensearchserverless_sdkv2.NewFromConfig(cfg, func(o *opensearchserverless_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 1c0bbd24338f053efa603af8cdfb0265e087000c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:57 -0400 Subject: [PATCH 0667/1490] opsworks: Use constant for endpoint strings --- internal/service/opsworks/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/opsworks/service_package_gen.go b/internal/service/opsworks/service_package_gen.go index caacb1388b1..22e96e8466a 100644 --- a/internal/service/opsworks/service_package_gen.go +++ b/internal/service/opsworks/service_package_gen.go @@ -154,7 +154,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*opsworks_sdkv1.OpsWorks, error) { sess := config["session"].(*session_sdkv1.Session) - return opsworks_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return opsworks_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 2402f69e126062ffd985e20c7bd5bd97f8bbda18 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:57 -0400 Subject: [PATCH 0668/1490] organizations: Use constant for endpoint strings --- internal/service/organizations/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/organizations/service_package_gen.go b/internal/service/organizations/service_package_gen.go index b2e019ae308..223eeafc09f 100644 --- a/internal/service/organizations/service_package_gen.go +++ b/internal/service/organizations/service_package_gen.go @@ -130,7 +130,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*organizations_sdkv1.Organizations, error) { sess := config["session"].(*session_sdkv1.Session) - return organizations_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return organizations_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From c74d681a8da289d0ae71e7ba98256ee7d0312dd0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:58 -0400 Subject: [PATCH 0669/1490] osis: Use constant for endpoint strings --- internal/service/osis/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/osis/service_package_gen.go b/internal/service/osis/service_package_gen.go index d894ebf0cb2..580a962c855 100644 --- a/internal/service/osis/service_package_gen.go +++ b/internal/service/osis/service_package_gen.go @@ -47,7 +47,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return osis_sdkv2.NewFromConfig(cfg, func(o *osis_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 8b5b28804f91c6a27a0b713d4e308768529b8a59 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:58 -0400 Subject: [PATCH 0670/1490] outposts: Use constant for endpoint strings --- internal/service/outposts/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/outposts/service_package_gen.go b/internal/service/outposts/service_package_gen.go index 5176468c563..dfaab3e6bbc 100644 --- a/internal/service/outposts/service_package_gen.go +++ b/internal/service/outposts/service_package_gen.go @@ -72,7 +72,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*outposts_sdkv1.Outposts, error) { sess := config["session"].(*session_sdkv1.Session) - return outposts_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return outposts_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 6e38fb723f4c7a4c814bbf930cd5ebe8a7462304 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:58 -0400 Subject: [PATCH 0671/1490] paymentcryptography: Use constant for endpoint strings --- internal/service/paymentcryptography/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/paymentcryptography/service_package_gen.go b/internal/service/paymentcryptography/service_package_gen.go index 639656009be..a2909b537c5 100644 --- a/internal/service/paymentcryptography/service_package_gen.go +++ b/internal/service/paymentcryptography/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return paymentcryptography_sdkv2.NewFromConfig(cfg, func(o *paymentcryptography_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 8d9fe9689e4f958b1f03cc7c8ee6f9093ae6b619 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:58 -0400 Subject: [PATCH 0672/1490] pcaconnectorad: Use constant for endpoint strings --- internal/service/pcaconnectorad/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/pcaconnectorad/service_package_gen.go b/internal/service/pcaconnectorad/service_package_gen.go index ce08516cbe9..be5fd48e2c7 100644 --- a/internal/service/pcaconnectorad/service_package_gen.go +++ b/internal/service/pcaconnectorad/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return pcaconnectorad_sdkv2.NewFromConfig(cfg, func(o *pcaconnectorad_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 0fa3af2cc466e2fbe2b2dfd725eeb188ad5be08c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:58 -0400 Subject: [PATCH 0673/1490] pinpoint: Use constant for endpoint strings --- internal/service/pinpoint/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/pinpoint/service_package_gen.go b/internal/service/pinpoint/service_package_gen.go index 6361c23af89..eb26332bc91 100644 --- a/internal/service/pinpoint/service_package_gen.go +++ b/internal/service/pinpoint/service_package_gen.go @@ -88,7 +88,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*pinpoint_sdkv1.Pinpoint, error) { sess := config["session"].(*session_sdkv1.Session) - return pinpoint_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return pinpoint_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From c24cd06bb6567d468ea17e7d08e1793bc11c9412 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:58 -0400 Subject: [PATCH 0674/1490] pipes: Use constant for endpoint strings --- internal/service/pipes/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/pipes/service_package_gen.go b/internal/service/pipes/service_package_gen.go index dd72d77ddde..66e93f39460 100644 --- a/internal/service/pipes/service_package_gen.go +++ b/internal/service/pipes/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return pipes_sdkv2.NewFromConfig(cfg, func(o *pipes_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From af16251e9a99b3606d51f37722421d94f9d60c87 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:58 -0400 Subject: [PATCH 0675/1490] polly: Use constant for endpoint strings --- internal/service/polly/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/polly/service_package_gen.go b/internal/service/polly/service_package_gen.go index 4391a3cc545..ba502fcc146 100644 --- a/internal/service/polly/service_package_gen.go +++ b/internal/service/polly/service_package_gen.go @@ -44,7 +44,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return polly_sdkv2.NewFromConfig(cfg, func(o *polly_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 5652c212ff9e9aae77d6f0983565762797181b27 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:58 -0400 Subject: [PATCH 0676/1490] pricing: Use constant for endpoint strings --- internal/service/pricing/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/pricing/service_package_gen.go b/internal/service/pricing/service_package_gen.go index bf36d86f220..6a53a6aacff 100644 --- a/internal/service/pricing/service_package_gen.go +++ b/internal/service/pricing/service_package_gen.go @@ -44,7 +44,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return pricing_sdkv2.NewFromConfig(cfg, func(o *pricing_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From d178045712eac73abc6782d21128dddcf57efe93 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:59 -0400 Subject: [PATCH 0677/1490] qbusiness: Use constant for endpoint strings --- internal/service/qbusiness/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/qbusiness/service_package_gen.go b/internal/service/qbusiness/service_package_gen.go index f7d3e36fd86..305ced4eb91 100644 --- a/internal/service/qbusiness/service_package_gen.go +++ b/internal/service/qbusiness/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return qbusiness_sdkv2.NewFromConfig(cfg, func(o *qbusiness_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From f7bda8a566020dd9980e75c30cb737b0ff20a4e0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:59 -0400 Subject: [PATCH 0678/1490] qldb: Use constant for endpoint strings --- internal/service/qldb/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/qldb/service_package_gen.go b/internal/service/qldb/service_package_gen.go index a2c32e01922..a472f0eaa8d 100644 --- a/internal/service/qldb/service_package_gen.go +++ b/internal/service/qldb/service_package_gen.go @@ -61,7 +61,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return qldb_sdkv2.NewFromConfig(cfg, func(o *qldb_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 3032808b0443f66eebfdf0ab7dc46a6a01e0f6a5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:59 -0400 Subject: [PATCH 0679/1490] quicksight: Use constant for endpoint strings --- internal/service/quicksight/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/quicksight/service_package_gen.go b/internal/service/quicksight/service_package_gen.go index a9514e4132a..fd5154881f9 100644 --- a/internal/service/quicksight/service_package_gen.go +++ b/internal/service/quicksight/service_package_gen.go @@ -172,7 +172,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*quicksight_sdkv1.QuickSight, error) { sess := config["session"].(*session_sdkv1.Session) - return quicksight_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return quicksight_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From e84400342ae5f6a9b97d3ff926b8b30f05c6e128 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:59 -0400 Subject: [PATCH 0680/1490] ram: Use constant for endpoint strings --- internal/service/ram/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ram/service_package_gen.go b/internal/service/ram/service_package_gen.go index 6dba67ad28b..54e328b8f7b 100644 --- a/internal/service/ram/service_package_gen.go +++ b/internal/service/ram/service_package_gen.go @@ -75,7 +75,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ram_sdkv1.RAM, error) { sess := config["session"].(*session_sdkv1.Session) - return ram_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return ram_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From cceeef3946ccb1a75cc8a170ab484e5db9ca8e1c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:59 -0400 Subject: [PATCH 0681/1490] rbin: Use constant for endpoint strings --- internal/service/rbin/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/rbin/service_package_gen.go b/internal/service/rbin/service_package_gen.go index 68d8492d161..9c4761b1b27 100644 --- a/internal/service/rbin/service_package_gen.go +++ b/internal/service/rbin/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return rbin_sdkv2.NewFromConfig(cfg, func(o *rbin_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From fa2e8a5f4db591a66d252748023cfb372e4eeee1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:36:59 -0400 Subject: [PATCH 0682/1490] rds: Use constant for endpoint strings --- internal/service/rds/cluster.go | 4 ++-- internal/service/rds/cluster_data_source.go | 4 ++-- internal/service/rds/cluster_endpoint.go | 4 ++-- internal/service/rds/cluster_endpoint_test.go | 4 ++-- internal/service/rds/cluster_instance.go | 4 ++-- internal/service/rds/cluster_migrate.go | 2 +- internal/service/rds/instance.go | 4 ++-- internal/service/rds/instance_data_source.go | 6 +++--- internal/service/rds/instance_data_source_test.go | 6 +++--- internal/service/rds/instance_migrate.go | 4 ++-- internal/service/rds/instance_test.go | 2 +- internal/service/rds/proxy.go | 4 ++-- internal/service/rds/proxy_data_source.go | 4 ++-- internal/service/rds/proxy_data_source_test.go | 2 +- internal/service/rds/proxy_endpoint.go | 4 ++-- internal/service/rds/proxy_endpoint_test.go | 2 +- internal/service/rds/proxy_target.go | 4 ++-- internal/service/rds/proxy_target_test.go | 4 ++-- internal/service/rds/proxy_test.go | 2 +- internal/service/rds/service_package_gen.go | 4 ++-- 20 files changed, 37 insertions(+), 37 deletions(-) diff --git a/internal/service/rds/cluster.go b/internal/service/rds/cluster.go index eb6a91d57c6..ff9e78350c3 100644 --- a/internal/service/rds/cluster.go +++ b/internal/service/rds/cluster.go @@ -206,7 +206,7 @@ func ResourceCluster() *schema.Resource { ValidateFunc: validation.StringInSlice(ClusterExportableLogType_Values(), false), }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -1203,7 +1203,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("endpoint", dbc.Endpoint) + d.Set(names.AttrEndpoint, dbc.Endpoint) d.Set("engine", dbc.Engine) d.Set("engine_mode", dbc.EngineMode) clusterSetResourceDataEngineVersionFromCluster(d, dbc) diff --git a/internal/service/rds/cluster_data_source.go b/internal/service/rds/cluster_data_source.go index 366f6fc8605..c0ab010976f 100644 --- a/internal/service/rds/cluster_data_source.go +++ b/internal/service/rds/cluster_data_source.go @@ -72,7 +72,7 @@ func DataSourceCluster() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -208,7 +208,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("db_subnet_group_name", dbc.DBSubnetGroup) d.Set("db_system_id", dbc.DBSystemId) d.Set("enabled_cloudwatch_logs_exports", aws.StringValueSlice(dbc.EnabledCloudwatchLogsExports)) - d.Set("endpoint", dbc.Endpoint) + d.Set(names.AttrEndpoint, dbc.Endpoint) d.Set("engine", dbc.Engine) d.Set("engine_mode", dbc.EngineMode) d.Set(names.AttrEngineVersion, dbc.EngineVersion) diff --git a/internal/service/rds/cluster_endpoint.go b/internal/service/rds/cluster_endpoint.go index 686f78a66e5..2e18c7d6bfe 100644 --- a/internal/service/rds/cluster_endpoint.go +++ b/internal/service/rds/cluster_endpoint.go @@ -61,7 +61,7 @@ func ResourceClusterEndpoint() *schema.Resource { "ANY", }, false), }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -143,7 +143,7 @@ func resourceClusterEndpointRead(ctx context.Context, d *schema.ResourceData, me d.Set("cluster_endpoint_identifier", clusterEp.DBClusterEndpointIdentifier) d.Set(names.AttrClusterIdentifier, clusterEp.DBClusterIdentifier) d.Set("custom_endpoint_type", clusterEp.CustomEndpointType) - d.Set("endpoint", clusterEp.Endpoint) + d.Set(names.AttrEndpoint, clusterEp.Endpoint) d.Set("excluded_members", aws.StringValueSlice(clusterEp.ExcludedMembers)) d.Set("static_members", aws.StringValueSlice(clusterEp.StaticMembers)) diff --git a/internal/service/rds/cluster_endpoint_test.go b/internal/service/rds/cluster_endpoint_test.go index 7b87cb46a77..f6ec2d5e8fd 100644 --- a/internal/service/rds/cluster_endpoint_test.go +++ b/internal/service/rds/cluster_endpoint_test.go @@ -48,9 +48,9 @@ func TestAccRDSClusterEndpoint_basic(t *testing.T) { testAccCheckClusterEndpointExists(ctx, defaultResourceName, &customEndpoint), testAccCheckClusterEndpointAttributes(&customEndpoint), acctest.MatchResourceAttrRegionalARN(readerResourceName, names.AttrARN, "rds", regexache.MustCompile(`cluster-endpoint:.+`)), - resource.TestCheckResourceAttrSet(readerResourceName, "endpoint"), + resource.TestCheckResourceAttrSet(readerResourceName, names.AttrEndpoint), acctest.MatchResourceAttrRegionalARN(defaultResourceName, names.AttrARN, "rds", regexache.MustCompile(`cluster-endpoint:.+`)), - resource.TestCheckResourceAttrSet(defaultResourceName, "endpoint"), + resource.TestCheckResourceAttrSet(defaultResourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(defaultResourceName, "tags.%", "0"), resource.TestCheckResourceAttr(readerResourceName, "tags.%", "0"), ), diff --git a/internal/service/rds/cluster_instance.go b/internal/service/rds/cluster_instance.go index fb6b09a3db8..0268561f151 100644 --- a/internal/service/rds/cluster_instance.go +++ b/internal/service/rds/cluster_instance.go @@ -104,7 +104,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -390,7 +390,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me } if db.Endpoint != nil { - d.Set("endpoint", db.Endpoint.Address) + d.Set(names.AttrEndpoint, db.Endpoint.Address) d.Set(names.AttrPort, db.Endpoint.Port) } diff --git a/internal/service/rds/cluster_migrate.go b/internal/service/rds/cluster_migrate.go index f4f604602da..2e0a77bace4 100644 --- a/internal/service/rds/cluster_migrate.go +++ b/internal/service/rds/cluster_migrate.go @@ -130,7 +130,7 @@ func resourceClusterResourceV0() *schema.Resource { Optional: true, Default: false, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go index 1b513840eba..8787f46f9e5 100644 --- a/internal/service/rds/instance.go +++ b/internal/service/rds/instance.go @@ -292,7 +292,7 @@ func ResourceInstance() *schema.Resource { ValidateFunc: validation.StringInSlice(InstanceExportableLogType_Values(), false), }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -1937,7 +1937,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte if v.Endpoint != nil { d.Set("address", v.Endpoint.Address) if v.Endpoint.Address != nil && v.Endpoint.Port != nil { - d.Set("endpoint", fmt.Sprintf("%s:%d", aws.StringValue(v.Endpoint.Address), aws.Int64Value(v.Endpoint.Port))) + d.Set(names.AttrEndpoint, fmt.Sprintf("%s:%d", aws.StringValue(v.Endpoint.Address), aws.Int64Value(v.Endpoint.Port))) } d.Set("hosted_zone_id", v.Endpoint.HostedZoneId) d.Set(names.AttrPort, v.Endpoint.Port) diff --git a/internal/service/rds/instance_data_source.go b/internal/service/rds/instance_data_source.go index 6d189007594..7375f9a1bd3 100644 --- a/internal/service/rds/instance_data_source.go +++ b/internal/service/rds/instance_data_source.go @@ -88,7 +88,7 @@ func DataSourceInstance() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -311,12 +311,12 @@ func dataSourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta in // The endpoint might not be shown for instances whose status is creating. if dbEndpoint := instance.Endpoint; dbEndpoint != nil { d.Set("address", dbEndpoint.Address) - d.Set("endpoint", fmt.Sprintf("%s:%d", aws.StringValue(dbEndpoint.Address), aws.Int64Value(dbEndpoint.Port))) + d.Set(names.AttrEndpoint, fmt.Sprintf("%s:%d", aws.StringValue(dbEndpoint.Address), aws.Int64Value(dbEndpoint.Port))) d.Set("hosted_zone_id", dbEndpoint.HostedZoneId) d.Set(names.AttrPort, dbEndpoint.Port) } else { d.Set("address", nil) - d.Set("endpoint", nil) + d.Set(names.AttrEndpoint, nil) d.Set("hosted_zone_id", nil) d.Set(names.AttrPort, nil) } diff --git a/internal/service/rds/instance_data_source_test.go b/internal/service/rds/instance_data_source_test.go index b4fc826c406..9087b5f483e 100644 --- a/internal/service/rds/instance_data_source_test.go +++ b/internal/service/rds/instance_data_source_test.go @@ -39,7 +39,7 @@ func TestAccRDSInstanceDataSource_basic(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, "enabled_cloudwatch_logs_exports.#", resourceName, "enabled_cloudwatch_logs_exports.#"), - resource.TestCheckResourceAttrPair(dataSourceName, "endpoint", resourceName, "endpoint"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), resource.TestCheckResourceAttrPair(dataSourceName, "hosted_zone_id", resourceName, "hosted_zone_id"), resource.TestCheckResourceAttrPair(dataSourceName, "iops", resourceName, "iops"), @@ -83,7 +83,7 @@ func TestAccRDSInstanceDataSource_ManagedMasterPassword_managed(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "db_instance_class", resourceName, "instance_class"), resource.TestCheckResourceAttrPair(dataSourceName, "db_name", resourceName, "db_name"), resource.TestCheckResourceAttrPair(dataSourceName, "db_subnet_group", resourceName, "db_subnet_group_name"), - resource.TestCheckResourceAttrPair(dataSourceName, "endpoint", resourceName, "endpoint"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), resource.TestCheckResourceAttrPair(dataSourceName, "hosted_zone_id", resourceName, "hosted_zone_id"), resource.TestCheckResourceAttrPair(dataSourceName, "iops", resourceName, "iops"), @@ -130,7 +130,7 @@ func TestAccRDSInstanceDataSource_tags(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, "enabled_cloudwatch_logs_exports.#", resourceName, "enabled_cloudwatch_logs_exports.#"), - resource.TestCheckResourceAttrPair(dataSourceName, "endpoint", resourceName, "endpoint"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), resource.TestCheckResourceAttrPair(dataSourceName, "hosted_zone_id", resourceName, "hosted_zone_id"), resource.TestCheckResourceAttrPair(dataSourceName, "iops", resourceName, "iops"), diff --git a/internal/service/rds/instance_migrate.go b/internal/service/rds/instance_migrate.go index 69ecc7cab5f..f8b916d32a7 100644 --- a/internal/service/rds/instance_migrate.go +++ b/internal/service/rds/instance_migrate.go @@ -261,7 +261,7 @@ func resourceInstanceResourceV0() *schema.Resource { Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -551,7 +551,7 @@ func resourceInstanceResourceV1() *schema.Resource { ValidateFunc: validation.StringInSlice(InstanceExportableLogType_Values(), false), }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/rds/instance_test.go b/internal/service/rds/instance_test.go index 6366d319e85..e46a0384d8a 100644 --- a/internal/service/rds/instance_test.go +++ b/internal/service/rds/instance_test.go @@ -68,7 +68,7 @@ func TestAccRDSInstance_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "dedicated_log_volume", "false"), resource.TestCheckResourceAttr(resourceName, "deletion_protection", "false"), resource.TestCheckResourceAttr(resourceName, "enabled_cloudwatch_logs_exports.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "endpoint"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "engine", tfrds.InstanceEngineMySQL), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttrSet(resourceName, "hosted_zone_id"), diff --git a/internal/service/rds/proxy.go b/internal/service/rds/proxy.go index daa84b1b607..95832131a9a 100644 --- a/internal/service/rds/proxy.go +++ b/internal/service/rds/proxy.go @@ -93,7 +93,7 @@ func resourceProxy() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -213,7 +213,7 @@ func resourceProxyRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set(names.AttrRoleARN, dbProxy.RoleArn) d.Set("vpc_subnet_ids", dbProxy.VpcSubnetIds) d.Set(names.AttrVPCSecurityGroupIDs, dbProxy.VpcSecurityGroupIds) - d.Set("endpoint", dbProxy.Endpoint) + d.Set(names.AttrEndpoint, dbProxy.Endpoint) return diags } diff --git a/internal/service/rds/proxy_data_source.go b/internal/service/rds/proxy_data_source.go index 0831df8aad4..4f0dc9cb216 100644 --- a/internal/service/rds/proxy_data_source.go +++ b/internal/service/rds/proxy_data_source.go @@ -59,7 +59,7 @@ func dataSourceProxy() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -116,7 +116,7 @@ func dataSourceProxyRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set(names.AttrARN, dbProxy.DBProxyArn) d.Set("auth", flattenUserAuthConfigInfos(dbProxy.Auth)) d.Set("debug_logging", dbProxy.DebugLogging) - d.Set("endpoint", dbProxy.Endpoint) + d.Set(names.AttrEndpoint, dbProxy.Endpoint) d.Set("engine_family", dbProxy.EngineFamily) d.Set("idle_client_timeout", dbProxy.IdleClientTimeout) d.Set("require_tls", dbProxy.RequireTLS) diff --git a/internal/service/rds/proxy_data_source_test.go b/internal/service/rds/proxy_data_source_test.go index b02ec1c0893..e614974350f 100644 --- a/internal/service/rds/proxy_data_source_test.go +++ b/internal/service/rds/proxy_data_source_test.go @@ -33,7 +33,7 @@ func TestAccRDSProxyDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, "auth.#", resourceName, "auth.#"), resource.TestCheckResourceAttrPair(dataSourceName, "debug_logging", resourceName, "debug_logging"), - resource.TestCheckResourceAttrPair(dataSourceName, "endpoint", resourceName, "endpoint"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), resource.TestCheckResourceAttrPair(dataSourceName, "engine_family", resourceName, "engine_family"), resource.TestCheckResourceAttrPair(dataSourceName, "idle_client_timeout", resourceName, "idle_client_timeout"), resource.TestCheckResourceAttrPair(dataSourceName, "require_tls", resourceName, "require_tls"), diff --git a/internal/service/rds/proxy_endpoint.go b/internal/service/rds/proxy_endpoint.go index 4989e851eb6..55a81894186 100644 --- a/internal/service/rds/proxy_endpoint.go +++ b/internal/service/rds/proxy_endpoint.go @@ -66,7 +66,7 @@ func resourceProxyEndpoint() *schema.Resource { ForceNew: true, ValidateFunc: validIdentifier, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -160,7 +160,7 @@ func resourceProxyEndpointRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrARN, dbProxyEndpoint.DBProxyEndpointArn) d.Set("db_proxy_endpoint_name", dbProxyEndpoint.DBProxyEndpointName) d.Set("db_proxy_name", dbProxyEndpoint.DBProxyName) - d.Set("endpoint", dbProxyEndpoint.Endpoint) + d.Set(names.AttrEndpoint, dbProxyEndpoint.Endpoint) d.Set("is_default", dbProxyEndpoint.IsDefault) d.Set("target_role", dbProxyEndpoint.TargetRole) d.Set(names.AttrVPCID, dbProxyEndpoint.VpcId) diff --git a/internal/service/rds/proxy_endpoint_test.go b/internal/service/rds/proxy_endpoint_test.go index 6643e858fc9..a90ad6118d6 100644 --- a/internal/service/rds/proxy_endpoint_test.go +++ b/internal/service/rds/proxy_endpoint_test.go @@ -51,7 +51,7 @@ func TestAccRDSProxyEndpoint_basic(t *testing.T) { resource.TestCheckTypeSetElemAttrPair(resourceName, "vpc_subnet_ids.*", "aws_subnet.test.1", names.AttrID), resource.TestCheckResourceAttr(resourceName, "vpc_security_group_ids.#", "1"), resource.TestCheckResourceAttrPair(resourceName, names.AttrVPCID, "aws_vpc.test", names.AttrID), - resource.TestMatchResourceAttr(resourceName, "endpoint", regexache.MustCompile(`^[\w\-\.]+\.rds\.amazonaws\.com$`)), + resource.TestMatchResourceAttr(resourceName, names.AttrEndpoint, regexache.MustCompile(`^[\w\-\.]+\.rds\.amazonaws\.com$`)), resource.TestCheckResourceAttr(resourceName, "is_default", "false"), resource.TestCheckResourceAttr(resourceName, "tags.#", "0"), ), diff --git a/internal/service/rds/proxy_target.go b/internal/service/rds/proxy_target.go index 1ff48084671..dd8d04bed82 100644 --- a/internal/service/rds/proxy_target.go +++ b/internal/service/rds/proxy_target.go @@ -62,7 +62,7 @@ func resourceProxyTarget() *schema.Resource { ForceNew: true, ValidateFunc: validIdentifier, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -162,7 +162,7 @@ func resourceProxyTargetRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("db_cluster_identifier", dbProxyTarget.RdsResourceId) } d.Set("db_proxy_name", dbProxyName) - d.Set("endpoint", dbProxyTarget.Endpoint) + d.Set(names.AttrEndpoint, dbProxyTarget.Endpoint) d.Set(names.AttrPort, dbProxyTarget.Port) d.Set("rds_resource_id", dbProxyTarget.RdsResourceId) d.Set("target_arn", dbProxyTarget.TargetArn) diff --git a/internal/service/rds/proxy_target_test.go b/internal/service/rds/proxy_target_test.go index 06124ec3681..062b8ce73ce 100644 --- a/internal/service/rds/proxy_target_test.go +++ b/internal/service/rds/proxy_target_test.go @@ -39,7 +39,7 @@ func TestAccRDSProxyTarget_instance(t *testing.T) { Config: testAccProxyTargetConfig_instance(rName), Check: resource.ComposeTestCheckFunc( testAccCheckProxyTargetExists(ctx, resourceName, &dbProxyTarget), - resource.TestCheckResourceAttrPair(resourceName, "endpoint", "aws_db_instance.test", "address"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEndpoint, "aws_db_instance.test", "address"), resource.TestCheckResourceAttrPair(resourceName, names.AttrPort, "aws_db_instance.test", names.AttrPort), resource.TestCheckResourceAttr(resourceName, "rds_resource_id", rName), resource.TestCheckResourceAttr(resourceName, "target_arn", ""), @@ -76,7 +76,7 @@ func TestAccRDSProxyTarget_cluster(t *testing.T) { Config: testAccProxyTargetConfig_cluster(rName), Check: resource.ComposeTestCheckFunc( testAccCheckProxyTargetExists(ctx, resourceName, &dbProxyTarget), - resource.TestCheckResourceAttr(resourceName, "endpoint", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpoint, ""), resource.TestCheckResourceAttrPair(resourceName, names.AttrPort, "aws_rds_cluster.test", names.AttrPort), resource.TestCheckResourceAttr(resourceName, "rds_resource_id", rName), resource.TestCheckResourceAttr(resourceName, "target_arn", ""), diff --git a/internal/service/rds/proxy_test.go b/internal/service/rds/proxy_test.go index a39ad685022..a9d7b8c6908 100644 --- a/internal/service/rds/proxy_test.go +++ b/internal/service/rds/proxy_test.go @@ -53,7 +53,7 @@ func TestAccRDSProxy_basic(t *testing.T) { "iam_auth": "DISABLED", }), resource.TestCheckResourceAttr(resourceName, "debug_logging", "false"), - resource.TestMatchResourceAttr(resourceName, "endpoint", regexache.MustCompile(`^[\w\-\.]+\.rds\.amazonaws\.com$`)), + resource.TestMatchResourceAttr(resourceName, names.AttrEndpoint, regexache.MustCompile(`^[\w\-\.]+\.rds\.amazonaws\.com$`)), resource.TestCheckResourceAttr(resourceName, "idle_client_timeout", "1800"), resource.TestCheckResourceAttr(resourceName, "require_tls", "true"), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), diff --git a/internal/service/rds/service_package_gen.go b/internal/service/rds/service_package_gen.go index 38c1c56e53e..8f8beed1280 100644 --- a/internal/service/rds/service_package_gen.go +++ b/internal/service/rds/service_package_gen.go @@ -269,7 +269,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*rds_sdkv1.RDS, error) { sess := config["session"].(*session_sdkv1.Session) - return rds_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return rds_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -277,7 +277,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return rds_sdkv2.NewFromConfig(cfg, func(o *rds_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From adb78c575724926a28aee8d7f9b087c1bf7b2053 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:00 -0400 Subject: [PATCH 0683/1490] redshift: Use constant for endpoint strings --- internal/service/redshift/cluster.go | 8 ++++---- internal/service/redshift/cluster_data_source.go | 4 ++-- internal/service/redshift/cluster_data_source_test.go | 2 +- internal/service/redshift/service_package_gen.go | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/redshift/cluster.go b/internal/service/redshift/cluster.go index a2725e97c86..00bd3789b37 100644 --- a/internal/service/redshift/cluster.go +++ b/internal/service/redshift/cluster.go @@ -185,7 +185,7 @@ func resourceCluster() *schema.Resource { Optional: true, Default: false, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Optional: true, Computed: true, @@ -720,16 +720,16 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter })) d.Set("dns_name", nil) - d.Set("endpoint", nil) + d.Set(names.AttrEndpoint, nil) d.Set(names.AttrPort, nil) if endpoint := rsc.Endpoint; endpoint != nil { if address := aws.StringValue(endpoint.Address); address != "" { d.Set("dns_name", address) if port := aws.Int64Value(endpoint.Port); port != 0 { - d.Set("endpoint", fmt.Sprintf("%s:%d", address, port)) + d.Set(names.AttrEndpoint, fmt.Sprintf("%s:%d", address, port)) d.Set(names.AttrPort, port) } else { - d.Set("endpoint", address) + d.Set(names.AttrEndpoint, address) } } } diff --git a/internal/service/redshift/cluster_data_source.go b/internal/service/redshift/cluster_data_source.go index ba9af5f85ac..921e5320037 100644 --- a/internal/service/redshift/cluster_data_source.go +++ b/internal/service/redshift/cluster_data_source.go @@ -126,7 +126,7 @@ func dataSourceCluster() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -261,7 +261,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int } d.Set("encrypted", rsc.Encrypted) if rsc.Endpoint != nil { - d.Set("endpoint", rsc.Endpoint.Address) + d.Set(names.AttrEndpoint, rsc.Endpoint.Address) d.Set(names.AttrPort, rsc.Endpoint.Port) } d.Set("enhanced_vpc_routing", rsc.EnhancedVpcRouting) diff --git a/internal/service/redshift/cluster_data_source_test.go b/internal/service/redshift/cluster_data_source_test.go index 3ca1e9812cf..923eb2a56c7 100644 --- a/internal/service/redshift/cluster_data_source_test.go +++ b/internal/service/redshift/cluster_data_source_test.go @@ -41,7 +41,7 @@ func TestAccRedshiftClusterDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet(dataSourceName, "cluster_version"), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrDatabaseName), resource.TestCheckResourceAttrSet(dataSourceName, "encrypted"), - resource.TestCheckResourceAttrSet(dataSourceName, "endpoint"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrEndpoint), resource.TestCheckResourceAttrSet(dataSourceName, "master_username"), resource.TestCheckResourceAttrSet(dataSourceName, "multi_az"), resource.TestCheckResourceAttrSet(dataSourceName, "node_type"), diff --git a/internal/service/redshift/service_package_gen.go b/internal/service/redshift/service_package_gen.go index 7c24d5e611c..a5d46cec940 100644 --- a/internal/service/redshift/service_package_gen.go +++ b/internal/service/redshift/service_package_gen.go @@ -216,7 +216,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*redshift_sdkv1.Redshift, error) { sess := config["session"].(*session_sdkv1.Session) - return redshift_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return redshift_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -224,7 +224,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return redshift_sdkv2.NewFromConfig(cfg, func(o *redshift_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From cfcac97fc3408a7ba53771dec3c009563a01e06f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:00 -0400 Subject: [PATCH 0684/1490] redshiftdata: Use constant for endpoint strings --- internal/service/redshiftdata/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/redshiftdata/service_package_gen.go b/internal/service/redshiftdata/service_package_gen.go index a93e557b81e..d88b2979553 100644 --- a/internal/service/redshiftdata/service_package_gen.go +++ b/internal/service/redshiftdata/service_package_gen.go @@ -44,7 +44,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return redshiftdata_sdkv2.NewFromConfig(cfg, func(o *redshiftdata_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 1e5236d8891a8633c61d9af82d94faf7f875704e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:00 -0400 Subject: [PATCH 0685/1490] redshiftserverless: Use constant for endpoint strings --- internal/service/redshiftserverless/service_package_gen.go | 4 ++-- internal/service/redshiftserverless/workgroup.go | 4 ++-- internal/service/redshiftserverless/workgroup_data_source.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/redshiftserverless/service_package_gen.go b/internal/service/redshiftserverless/service_package_gen.go index 2dc41c8b41c..58748a8387a 100644 --- a/internal/service/redshiftserverless/service_package_gen.go +++ b/internal/service/redshiftserverless/service_package_gen.go @@ -99,7 +99,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*redshiftserverless_sdkv1.RedshiftServerless, error) { sess := config["session"].(*session_sdkv1.Session) - return redshiftserverless_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return redshiftserverless_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -107,7 +107,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return redshiftserverless_sdkv2.NewFromConfig(cfg, func(o *redshiftserverless_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil diff --git a/internal/service/redshiftserverless/workgroup.go b/internal/service/redshiftserverless/workgroup.go index 9fe21f2c0a1..8aba7672eae 100644 --- a/internal/service/redshiftserverless/workgroup.go +++ b/internal/service/redshiftserverless/workgroup.go @@ -94,7 +94,7 @@ func resourceWorkgroup() *schema.Resource { }, }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -285,7 +285,7 @@ func resourceWorkgroupRead(ctx context.Context, d *schema.ResourceData, meta int if err := d.Set("config_parameter", flattenConfigParameters(out.ConfigParameters)); err != nil { return sdkdiag.AppendErrorf(diags, "setting config_parameter: %s", err) } - if err := d.Set("endpoint", []interface{}{flattenEndpoint(out.Endpoint)}); err != nil { + if err := d.Set(names.AttrEndpoint, []interface{}{flattenEndpoint(out.Endpoint)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoint: %s", err) } d.Set("enhanced_vpc_routing", out.EnhancedVpcRouting) diff --git a/internal/service/redshiftserverless/workgroup_data_source.go b/internal/service/redshiftserverless/workgroup_data_source.go index 5d762fa4fcd..5182b1eb828 100644 --- a/internal/service/redshiftserverless/workgroup_data_source.go +++ b/internal/service/redshiftserverless/workgroup_data_source.go @@ -23,7 +23,7 @@ func dataSourceWorkgroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -131,7 +131,7 @@ func dataSourceWorkgroupRead(ctx context.Context, d *schema.ResourceData, meta i d.SetId(workgroupName) d.Set(names.AttrARN, resource.WorkgroupArn) - if err := d.Set("endpoint", []interface{}{flattenEndpoint(resource.Endpoint)}); err != nil { + if err := d.Set(names.AttrEndpoint, []interface{}{flattenEndpoint(resource.Endpoint)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoint: %s", err) } d.Set("enhanced_vpc_routing", resource.EnhancedVpcRouting) From 5ba33b15bb657a853cd6849d05fdcd3fda9f4fce Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:00 -0400 Subject: [PATCH 0686/1490] rekognition: Use constant for endpoint strings --- internal/service/rekognition/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/rekognition/service_package_gen.go b/internal/service/rekognition/service_package_gen.go index c028401fcf0..d64afcf5049 100644 --- a/internal/service/rekognition/service_package_gen.go +++ b/internal/service/rekognition/service_package_gen.go @@ -51,7 +51,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return rekognition_sdkv2.NewFromConfig(cfg, func(o *rekognition_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 9fdc6bf418a45e3072bf8e6df37544aecb1c7920 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:00 -0400 Subject: [PATCH 0687/1490] resourceexplorer2: Use constant for endpoint strings --- internal/service/resourceexplorer2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/resourceexplorer2/service_package_gen.go b/internal/service/resourceexplorer2/service_package_gen.go index 791784763d8..045897472a0 100644 --- a/internal/service/resourceexplorer2/service_package_gen.go +++ b/internal/service/resourceexplorer2/service_package_gen.go @@ -59,7 +59,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return resourceexplorer2_sdkv2.NewFromConfig(cfg, func(o *resourceexplorer2_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 30fe7e11e719979674f33ecd2684ae8cce4dc516 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:01 -0400 Subject: [PATCH 0688/1490] resourcegroups: Use constant for endpoint strings --- internal/service/resourcegroups/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/resourcegroups/service_package_gen.go b/internal/service/resourcegroups/service_package_gen.go index 904579b48cc..99b44378093 100644 --- a/internal/service/resourcegroups/service_package_gen.go +++ b/internal/service/resourcegroups/service_package_gen.go @@ -53,7 +53,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return resourcegroups_sdkv2.NewFromConfig(cfg, func(o *resourcegroups_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From bde313ff381354efdda450a06a3ce5fa38c5cf40 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:01 -0400 Subject: [PATCH 0689/1490] resourcegroupstaggingapi: Use constant for endpoint strings --- .../service/resourcegroupstaggingapi/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/resourcegroupstaggingapi/service_package_gen.go b/internal/service/resourcegroupstaggingapi/service_package_gen.go index ccd8189215c..705b59d25b6 100644 --- a/internal/service/resourcegroupstaggingapi/service_package_gen.go +++ b/internal/service/resourcegroupstaggingapi/service_package_gen.go @@ -44,7 +44,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return resourcegroupstaggingapi_sdkv2.NewFromConfig(cfg, func(o *resourcegroupstaggingapi_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 6dda215f8060a06a3229f285c3b7f2f7deb5cc9d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:01 -0400 Subject: [PATCH 0690/1490] rolesanywhere: Use constant for endpoint strings --- internal/service/rolesanywhere/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/rolesanywhere/service_package_gen.go b/internal/service/rolesanywhere/service_package_gen.go index 4e4d0b1f68c..0c7211b9e14 100644 --- a/internal/service/rolesanywhere/service_package_gen.go +++ b/internal/service/rolesanywhere/service_package_gen.go @@ -56,7 +56,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return rolesanywhere_sdkv2.NewFromConfig(cfg, func(o *rolesanywhere_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 478d99d5fbef60c2f4d91f5f7c620dfa4d5cb27a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:01 -0400 Subject: [PATCH 0691/1490] route53: Use constant for endpoint strings --- internal/service/route53/service_package.go | 3 ++- .../service/route53/traffic_policy_document_data_source.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/route53/service_package.go b/internal/service/route53/service_package.go index 8f3f345c4b4..c0a7636a96d 100644 --- a/internal/service/route53/service_package.go +++ b/internal/service/route53/service_package.go @@ -10,12 +10,13 @@ import ( endpoints_sdkv1 "github.com/aws/aws-sdk-go/aws/endpoints" session_sdkv1 "github.com/aws/aws-sdk-go/aws/session" route53_sdkv1 "github.com/aws/aws-sdk-go/service/route53" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, m map[string]any) (*route53_sdkv1.Route53, error) { sess := m["session"].(*session_sdkv1.Session) - config := &aws_sdkv1.Config{Endpoint: aws_sdkv1.String(m["endpoint"].(string))} + config := &aws_sdkv1.Config{Endpoint: aws_sdkv1.String(m[names.AttrEndpoint].(string))} // Force "global" services to correct Regions. switch m["partition"].(string) { diff --git a/internal/service/route53/traffic_policy_document_data_source.go b/internal/service/route53/traffic_policy_document_data_source.go index 63c164ed045..59aec873966 100644 --- a/internal/service/route53/traffic_policy_document_data_source.go +++ b/internal/service/route53/traffic_policy_document_data_source.go @@ -21,7 +21,7 @@ func DataSourceTrafficPolicyDocument() *schema.Resource { ReadWithoutTimeout: dataSourceTrafficPolicyDocumentRead, Schema: map[string]*schema.Schema{ - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -267,7 +267,7 @@ func DataSourceTrafficPolicyDocument() *schema.Resource { func dataSourceTrafficPolicyDocumentRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { trafficDoc := &Route53TrafficPolicyDoc{} - if v, ok := d.GetOk("endpoint"); ok { + if v, ok := d.GetOk(names.AttrEndpoint); ok { trafficDoc.Endpoints = expandDataTrafficPolicyEndpointsDoc(v.(*schema.Set).List()) } if v, ok := d.GetOk("record_type"); ok { From 40ec3c07d0da330882580ebbd9b2217594790710 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:01 -0400 Subject: [PATCH 0692/1490] route53domains: Use constant for endpoint strings --- internal/service/route53domains/service_package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/route53domains/service_package.go b/internal/service/route53domains/service_package.go index bbe432ace7a..4dff9868091 100644 --- a/internal/service/route53domains/service_package.go +++ b/internal/service/route53domains/service_package.go @@ -16,7 +16,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return route53domains.NewFromConfig(cfg, func(o *route53domains.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } else if config["partition"].(string) == names.StandardPartitionID { // Route 53 Domains is only available in AWS Commercial us-east-1 Region. From 297262311bbe26fed4cf2337b6bb51dc2edf86f2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:01 -0400 Subject: [PATCH 0693/1490] route53profiles: Use constant for endpoint strings --- internal/service/route53profiles/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/route53profiles/service_package_gen.go b/internal/service/route53profiles/service_package_gen.go index 1a83796277f..0b748f325be 100644 --- a/internal/service/route53profiles/service_package_gen.go +++ b/internal/service/route53profiles/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return route53profiles_sdkv2.NewFromConfig(cfg, func(o *route53profiles_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 6b879cdbc919d69ed12749592a4dbad1fa4301ec Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:01 -0400 Subject: [PATCH 0694/1490] route53recoverycontrolconfig: Use constant for endpoint strings --- internal/service/route53recoverycontrolconfig/cluster.go | 4 ++-- .../service/route53recoverycontrolconfig/service_package.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/route53recoverycontrolconfig/cluster.go b/internal/service/route53recoverycontrolconfig/cluster.go index 174ded11e64..7218156eee9 100644 --- a/internal/service/route53recoverycontrolconfig/cluster.go +++ b/internal/service/route53recoverycontrolconfig/cluster.go @@ -38,7 +38,7 @@ func ResourceCluster() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -183,7 +183,7 @@ func flattenClusterEndpoint(ce *r53rcc.ClusterEndpoint) map[string]interface{} { tfMap := map[string]interface{}{} if v := ce.Endpoint; v != nil { - tfMap["endpoint"] = aws.StringValue(v) + tfMap[names.AttrEndpoint] = aws.StringValue(v) } if v := ce.Region; v != nil { diff --git a/internal/service/route53recoverycontrolconfig/service_package.go b/internal/service/route53recoverycontrolconfig/service_package.go index f4acf4f25b4..1bdd0178c4b 100644 --- a/internal/service/route53recoverycontrolconfig/service_package.go +++ b/internal/service/route53recoverycontrolconfig/service_package.go @@ -10,12 +10,13 @@ import ( endpoints_sdkv1 "github.com/aws/aws-sdk-go/aws/endpoints" session_sdkv1 "github.com/aws/aws-sdk-go/aws/session" route53recoverycontrolconfig_sdkv1 "github.com/aws/aws-sdk-go/service/route53recoverycontrolconfig" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, m map[string]any) (*route53recoverycontrolconfig_sdkv1.Route53RecoveryControlConfig, error) { sess := m["session"].(*session_sdkv1.Session) - config := &aws_sdkv1.Config{Endpoint: aws_sdkv1.String(m["endpoint"].(string))} + config := &aws_sdkv1.Config{Endpoint: aws_sdkv1.String(m[names.AttrEndpoint].(string))} // Force "global" services to correct Regions. if m["partition"].(string) == endpoints_sdkv1.AwsPartitionID { From b5dfa5a6c607928833c02ca4cf0087636f5dc55f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:02 -0400 Subject: [PATCH 0695/1490] route53recoveryreadiness: Use constant for endpoint strings --- internal/service/route53recoveryreadiness/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/route53recoveryreadiness/service_package.go b/internal/service/route53recoveryreadiness/service_package.go index 3cd81fccabe..ce7b00b4e4e 100644 --- a/internal/service/route53recoveryreadiness/service_package.go +++ b/internal/service/route53recoveryreadiness/service_package.go @@ -10,12 +10,13 @@ import ( endpoints_sdkv1 "github.com/aws/aws-sdk-go/aws/endpoints" session_sdkv1 "github.com/aws/aws-sdk-go/aws/session" route53recoveryreadiness_sdkv1 "github.com/aws/aws-sdk-go/service/route53recoveryreadiness" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, m map[string]any) (*route53recoveryreadiness_sdkv1.Route53RecoveryReadiness, error) { sess := m["session"].(*session_sdkv1.Session) - config := &aws_sdkv1.Config{Endpoint: aws_sdkv1.String(m["endpoint"].(string))} + config := &aws_sdkv1.Config{Endpoint: aws_sdkv1.String(m[names.AttrEndpoint].(string))} // Force "global" services to correct Regions. if m["partition"].(string) == endpoints_sdkv1.AwsPartitionID { From c231c9651bef3b9b7c86a2a2913016daacdbb998 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:02 -0400 Subject: [PATCH 0696/1490] route53resolver: Use constant for endpoint strings --- internal/service/route53resolver/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/route53resolver/service_package_gen.go b/internal/service/route53resolver/service_package_gen.go index f321c778a17..fbb9f9d3d78 100644 --- a/internal/service/route53resolver/service_package_gen.go +++ b/internal/service/route53resolver/service_package_gen.go @@ -149,7 +149,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*route53resolver_sdkv1.Route53Resolver, error) { sess := config["session"].(*session_sdkv1.Session) - return route53resolver_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return route53resolver_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 3539bab3dbe4b0d5956683603f666bb46917bc38 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:02 -0400 Subject: [PATCH 0697/1490] rum: Use constant for endpoint strings --- internal/service/rum/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/rum/service_package_gen.go b/internal/service/rum/service_package_gen.go index aea67bc8226..90594706c2c 100644 --- a/internal/service/rum/service_package_gen.go +++ b/internal/service/rum/service_package_gen.go @@ -52,7 +52,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*cloudwatchrum_sdkv1.CloudWatchRUM, error) { sess := config["session"].(*session_sdkv1.Session) - return cloudwatchrum_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return cloudwatchrum_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 1859a4b298fb6987729a94bf74fdae05f386257c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:02 -0400 Subject: [PATCH 0698/1490] s3: Use constant for endpoint strings --- internal/service/s3/service_package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/s3/service_package.go b/internal/service/s3/service_package.go index 44376534a4f..a1fe57d34cf 100644 --- a/internal/service/s3/service_package.go +++ b/internal/service/s3/service_package.go @@ -19,7 +19,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return s3.NewFromConfig(cfg, func(o *s3.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } else if o.Region == names.USEast1RegionID && config["s3_us_east_1_regional_endpoint"].(string) != "regional" { // Maintain the AWS SDK for Go v1 default of using the global endpoint in us-east-1. From e1737c483c410e7429d1dc97a050787cd34ef633 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:02 -0400 Subject: [PATCH 0699/1490] s3control: Use constant for endpoint strings --- internal/service/s3control/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/s3control/service_package_gen.go b/internal/service/s3control/service_package_gen.go index 60d3c1a4e3f..fd959e3ee3a 100644 --- a/internal/service/s3control/service_package_gen.go +++ b/internal/service/s3control/service_package_gen.go @@ -119,7 +119,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return s3control_sdkv2.NewFromConfig(cfg, func(o *s3control_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 77b5011b156a8b658f4f124f79af9a09d2204990 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:02 -0400 Subject: [PATCH 0700/1490] s3outposts: Use constant for endpoint strings --- internal/service/s3outposts/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/s3outposts/service_package_gen.go b/internal/service/s3outposts/service_package_gen.go index 74b107c3dfe..fe4136c59fa 100644 --- a/internal/service/s3outposts/service_package_gen.go +++ b/internal/service/s3outposts/service_package_gen.go @@ -44,7 +44,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*s3outposts_sdkv1.S3Outposts, error) { sess := config["session"].(*session_sdkv1.Session) - return s3outposts_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return s3outposts_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From febdb9737ad8b555235d4c3c920ef26a13438ca6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:02 -0400 Subject: [PATCH 0701/1490] sagemaker: Use constant for endpoint strings --- internal/service/sagemaker/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/sagemaker/service_package_gen.go b/internal/service/sagemaker/service_package_gen.go index 833f0f7d148..d4471fdbc6a 100644 --- a/internal/service/sagemaker/service_package_gen.go +++ b/internal/service/sagemaker/service_package_gen.go @@ -244,7 +244,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*sagemaker_sdkv1.SageMaker, error) { sess := config["session"].(*session_sdkv1.Session) - return sagemaker_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return sagemaker_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 7d5559fd86a08b393098dbffbca9e14b1ee9c2bc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:02 -0400 Subject: [PATCH 0702/1490] scheduler: Use constant for endpoint strings --- internal/service/scheduler/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/scheduler/service_package_gen.go b/internal/service/scheduler/service_package_gen.go index 2ff0410f8c4..1fda8f9e1d7 100644 --- a/internal/service/scheduler/service_package_gen.go +++ b/internal/service/scheduler/service_package_gen.go @@ -52,7 +52,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return scheduler_sdkv2.NewFromConfig(cfg, func(o *scheduler_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 99428ab8fa00c0e2af243b203c170d78f47512d2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:03 -0400 Subject: [PATCH 0703/1490] schemas: Use constant for endpoint strings --- internal/service/schemas/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/schemas/service_package_gen.go b/internal/service/schemas/service_package_gen.go index 4a117b90130..8ff26e78522 100644 --- a/internal/service/schemas/service_package_gen.go +++ b/internal/service/schemas/service_package_gen.go @@ -68,7 +68,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*schemas_sdkv1.Schemas, error) { sess := config["session"].(*session_sdkv1.Session) - return schemas_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return schemas_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From d2879a933609ea5927dfc93798e99267f46ff8bf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:03 -0400 Subject: [PATCH 0704/1490] secretsmanager: Use constant for endpoint strings --- internal/service/secretsmanager/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/secretsmanager/service_package_gen.go b/internal/service/secretsmanager/service_package_gen.go index 244d5968cfe..e1b2b88622f 100644 --- a/internal/service/secretsmanager/service_package_gen.go +++ b/internal/service/secretsmanager/service_package_gen.go @@ -89,7 +89,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return secretsmanager_sdkv2.NewFromConfig(cfg, func(o *secretsmanager_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From a0e4770de6fe23388115405d23d8c3f7f4f8368d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:03 -0400 Subject: [PATCH 0705/1490] securityhub: Use constant for endpoint strings --- internal/service/securityhub/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/securityhub/service_package_gen.go b/internal/service/securityhub/service_package_gen.go index 3a06a5c0ee2..4e062d3c3d8 100644 --- a/internal/service/securityhub/service_package_gen.go +++ b/internal/service/securityhub/service_package_gen.go @@ -113,7 +113,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return securityhub_sdkv2.NewFromConfig(cfg, func(o *securityhub_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From ae61cbf4fc7e4ff413b2757b405c8e37d86728a4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:03 -0400 Subject: [PATCH 0706/1490] securitylake: Use constant for endpoint strings --- internal/service/securitylake/service_package_gen.go | 2 +- internal/service/securitylake/subscriber_notification.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/securitylake/service_package_gen.go b/internal/service/securitylake/service_package_gen.go index 8a34aef2401..3feed04f914 100644 --- a/internal/service/securitylake/service_package_gen.go +++ b/internal/service/securitylake/service_package_gen.go @@ -66,7 +66,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return securitylake_sdkv2.NewFromConfig(cfg, func(o *securitylake_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil diff --git a/internal/service/securitylake/subscriber_notification.go b/internal/service/securitylake/subscriber_notification.go index e2b09c16bc9..d0efe03809d 100644 --- a/internal/service/securitylake/subscriber_notification.go +++ b/internal/service/securitylake/subscriber_notification.go @@ -92,7 +92,7 @@ func (r *subscriberNotificationResource) Schema(ctx context.Context, req resourc Optional: true, Sensitive: true, }, - "endpoint": schema.StringAttribute{ + names.AttrEndpoint: schema.StringAttribute{ Required: true, }, "http_method": schema.StringAttribute{ From e3d59ed55328eba314b89f7244ad9fd697ce8e1c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:03 -0400 Subject: [PATCH 0707/1490] serverlessrepo: Use constant for endpoint strings --- internal/service/serverlessrepo/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/serverlessrepo/service_package_gen.go b/internal/service/serverlessrepo/service_package_gen.go index 3639a275c06..b743a152a24 100644 --- a/internal/service/serverlessrepo/service_package_gen.go +++ b/internal/service/serverlessrepo/service_package_gen.go @@ -51,7 +51,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*serverlessapplicationrepository_sdkv1.ServerlessApplicationRepository, error) { sess := config["session"].(*session_sdkv1.Session) - return serverlessapplicationrepository_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return serverlessapplicationrepository_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From ca1302ab2e9fd6c1d52d9001e2ca59d44234c60a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:03 -0400 Subject: [PATCH 0708/1490] servicecatalog: Use constant for endpoint strings --- internal/service/servicecatalog/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/servicecatalog/service_package_gen.go b/internal/service/servicecatalog/service_package_gen.go index bb0eb4609cd..902f4f3d4b7 100644 --- a/internal/service/servicecatalog/service_package_gen.go +++ b/internal/service/servicecatalog/service_package_gen.go @@ -123,7 +123,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*servicecatalog_sdkv1.ServiceCatalog, error) { sess := config["session"].(*session_sdkv1.Session) - return servicecatalog_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return servicecatalog_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 141048d4ff3b379eb2ad072034718ba9f14b16c1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:03 -0400 Subject: [PATCH 0709/1490] servicecatalogappregistry: Use constant for endpoint strings --- .../service/servicecatalogappregistry/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/servicecatalogappregistry/service_package_gen.go b/internal/service/servicecatalogappregistry/service_package_gen.go index 5cdf7f7de0c..4a06e5a5a47 100644 --- a/internal/service/servicecatalogappregistry/service_package_gen.go +++ b/internal/service/servicecatalogappregistry/service_package_gen.go @@ -49,7 +49,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return servicecatalogappregistry_sdkv2.NewFromConfig(cfg, func(o *servicecatalogappregistry_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 7e4ca5fef8c2d1c40aecd051938973612f06527a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:04 -0400 Subject: [PATCH 0710/1490] servicediscovery: Use constant for endpoint strings --- internal/service/servicediscovery/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/servicediscovery/service_package_gen.go b/internal/service/servicediscovery/service_package_gen.go index aa1476bcf69..2eec43776bc 100644 --- a/internal/service/servicediscovery/service_package_gen.go +++ b/internal/service/servicediscovery/service_package_gen.go @@ -89,7 +89,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*servicediscovery_sdkv1.ServiceDiscovery, error) { sess := config["session"].(*session_sdkv1.Session) - return servicediscovery_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return servicediscovery_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 9f0456f7c1ee606e94ee728e1601428d90773785 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:04 -0400 Subject: [PATCH 0711/1490] servicequotas: Use constant for endpoint strings --- internal/service/servicequotas/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/servicequotas/service_package_gen.go b/internal/service/servicequotas/service_package_gen.go index 2654bb122e4..e24d9ae91e1 100644 --- a/internal/service/servicequotas/service_package_gen.go +++ b/internal/service/servicequotas/service_package_gen.go @@ -67,7 +67,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return servicequotas_sdkv2.NewFromConfig(cfg, func(o *servicequotas_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 85bbc7454492cdbc6736cf55ddffa80683670307 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:04 -0400 Subject: [PATCH 0712/1490] ses: Use constant for endpoint strings --- internal/service/ses/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ses/service_package_gen.go b/internal/service/ses/service_package_gen.go index 1bf148b99b6..bdb9010445c 100644 --- a/internal/service/ses/service_package_gen.go +++ b/internal/service/ses/service_package_gen.go @@ -109,7 +109,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ses_sdkv1.SES, error) { sess := config["session"].(*session_sdkv1.Session) - return ses_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return ses_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From a71fab676289d0a746d28e6f6cd88c23d60b1791 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:04 -0400 Subject: [PATCH 0713/1490] sesv2: Use constant for endpoint strings --- internal/service/sesv2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/sesv2/service_package_gen.go b/internal/service/sesv2/service_package_gen.go index fcbf2b0a87c..e7c7ac9130a 100644 --- a/internal/service/sesv2/service_package_gen.go +++ b/internal/service/sesv2/service_package_gen.go @@ -118,7 +118,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return sesv2_sdkv2.NewFromConfig(cfg, func(o *sesv2_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From de64c8658f3abb99006b36f5a0a67d30bb4c06e0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:04 -0400 Subject: [PATCH 0714/1490] sfn: Use constant for endpoint strings --- internal/service/sfn/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/sfn/service_package_gen.go b/internal/service/sfn/service_package_gen.go index 212df1d75d0..dd6bbbce419 100644 --- a/internal/service/sfn/service_package_gen.go +++ b/internal/service/sfn/service_package_gen.go @@ -77,7 +77,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*sfn_sdkv1.SFN, error) { sess := config["session"].(*session_sdkv1.Session) - return sfn_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return sfn_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From f4f038b459e19485c9a7b34d9cd000faea28e5ac Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:04 -0400 Subject: [PATCH 0715/1490] shield: Use constant for endpoint strings --- internal/service/shield/service_package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/shield/service_package.go b/internal/service/shield/service_package.go index 2db99253d07..1f29d39f93d 100644 --- a/internal/service/shield/service_package.go +++ b/internal/service/shield/service_package.go @@ -21,7 +21,7 @@ func (p *servicePackage) NewClient(_ context.Context, config map[string]any) (*s } return shield.NewFromConfig(cfg, func(o *shield.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } }), nil From c47b782deaa5dba3c7931dda3135abae3adf7828 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:04 -0400 Subject: [PATCH 0716/1490] signer: Use constant for endpoint strings --- internal/service/signer/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/signer/service_package_gen.go b/internal/service/signer/service_package_gen.go index 73fef577821..66d620c93d8 100644 --- a/internal/service/signer/service_package_gen.go +++ b/internal/service/signer/service_package_gen.go @@ -65,7 +65,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return signer_sdkv2.NewFromConfig(cfg, func(o *signer_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 9fae9e9e516c013320a9574073fd28dbd4490890 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:05 -0400 Subject: [PATCH 0717/1490] simpledb: Use constant for endpoint strings --- internal/service/simpledb/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/simpledb/service_package_gen.go b/internal/service/simpledb/service_package_gen.go index 3bb1625ebd7..2a7372ac5db 100644 --- a/internal/service/simpledb/service_package_gen.go +++ b/internal/service/simpledb/service_package_gen.go @@ -43,7 +43,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*simpledb_sdkv1.SimpleDB, error) { sess := config["session"].(*session_sdkv1.Session) - return simpledb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return simpledb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From d2a4ad947d623eb8e6e339e8a8a2cd214e529b42 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:05 -0400 Subject: [PATCH 0718/1490] sns: Use constant for endpoint strings --- internal/service/sns/service_package_gen.go | 2 +- internal/service/sns/topic_subscription.go | 6 +++--- internal/service/sns/topic_subscription_test.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/sns/service_package_gen.go b/internal/service/sns/service_package_gen.go index d0865104bb0..45accd374f3 100644 --- a/internal/service/sns/service_package_gen.go +++ b/internal/service/sns/service_package_gen.go @@ -73,7 +73,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return sns_sdkv2.NewFromConfig(cfg, func(o *sns_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil diff --git a/internal/service/sns/topic_subscription.go b/internal/service/sns/topic_subscription.go index aa3ea3d48c2..0bfae0a0633 100644 --- a/internal/service/sns/topic_subscription.go +++ b/internal/service/sns/topic_subscription.go @@ -56,7 +56,7 @@ var ( return json }, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -141,7 +141,7 @@ var ( names.AttrARN: subscriptionAttributeNameSubscriptionARN, "confirmation_was_authenticated": subscriptionAttributeNameConfirmationWasAuthenticated, "delivery_policy": subscriptionAttributeNameDeliveryPolicy, - "endpoint": subscriptionAttributeNameEndpoint, + names.AttrEndpoint: subscriptionAttributeNameEndpoint, "filter_policy": subscriptionAttributeNameFilterPolicy, "filter_policy_scope": subscriptionAttributeNameFilterPolicyScope, names.AttrOwnerID: subscriptionAttributeNameOwner, @@ -189,7 +189,7 @@ func resourceTopicSubscriptionCreate(ctx context.Context, d *schema.ResourceData protocol := d.Get(names.AttrProtocol).(string) input := &sns.SubscribeInput{ Attributes: attributes, - Endpoint: aws.String(d.Get("endpoint").(string)), + Endpoint: aws.String(d.Get(names.AttrEndpoint).(string)), Protocol: aws.String(protocol), ReturnSubscriptionArn: true, // even if not confirmed, will get ARN TopicArn: aws.String(d.Get("topic_arn").(string)), diff --git a/internal/service/sns/topic_subscription_test.go b/internal/service/sns/topic_subscription_test.go index b89e4498bdd..73edcde3883 100644 --- a/internal/service/sns/topic_subscription_test.go +++ b/internal/service/sns/topic_subscription_test.go @@ -91,7 +91,7 @@ func TestAccSNSTopicSubscription_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "confirmation_timeout_in_minutes", "1"), resource.TestCheckResourceAttr(resourceName, "confirmation_was_authenticated", "true"), resource.TestCheckResourceAttr(resourceName, "delivery_policy", ""), - resource.TestCheckResourceAttrPair(resourceName, "endpoint", "aws_sqs_queue.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEndpoint, "aws_sqs_queue.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "endpoint_auto_confirms", "false"), resource.TestCheckResourceAttr(resourceName, "filter_policy", ""), resource.TestCheckResourceAttr(resourceName, "filter_policy_scope", ""), @@ -608,7 +608,7 @@ func TestAccSNSTopicSubscription_email(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "sns", regexache.MustCompile(fmt.Sprintf("%s:.+", rName))), resource.TestCheckResourceAttr(resourceName, "confirmation_was_authenticated", "false"), resource.TestCheckResourceAttr(resourceName, "delivery_policy", ""), - resource.TestCheckResourceAttr(resourceName, "endpoint", acctest.DefaultEmailAddress), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpoint, acctest.DefaultEmailAddress), resource.TestCheckResourceAttr(resourceName, "filter_policy", ""), resource.TestCheckResourceAttr(resourceName, "pending_confirmation", "true"), resource.TestCheckResourceAttr(resourceName, names.AttrProtocol, "email"), @@ -638,7 +638,7 @@ func TestAccSNSTopicSubscription_firehose(t *testing.T) { testAccCheckTopicSubscriptionExists(ctx, resourceName, &attributes), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "sns", regexache.MustCompile(fmt.Sprintf("%s:.+", rName))), resource.TestCheckResourceAttr(resourceName, "delivery_policy", ""), - resource.TestCheckResourceAttrPair(resourceName, "endpoint", "aws_kinesis_firehose_delivery_stream.test_stream", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEndpoint, "aws_kinesis_firehose_delivery_stream.test_stream", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "filter_policy", ""), resource.TestCheckResourceAttr(resourceName, names.AttrProtocol, "firehose"), resource.TestCheckResourceAttr(resourceName, "raw_message_delivery", "false"), From 9542c8b18bbc717b542ff3b72eeae94591791ef7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:05 -0400 Subject: [PATCH 0719/1490] sqs: Use constant for endpoint strings --- internal/service/sqs/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/sqs/service_package_gen.go b/internal/service/sqs/service_package_gen.go index 8669c6a47f6..b5f28885fb4 100644 --- a/internal/service/sqs/service_package_gen.go +++ b/internal/service/sqs/service_package_gen.go @@ -69,7 +69,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return sqs_sdkv2.NewFromConfig(cfg, func(o *sqs_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 788ec781cead600fea9380cf65f2947976355a5d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:05 -0400 Subject: [PATCH 0720/1490] ssm: Use constant for endpoint strings --- internal/service/ssm/service_package_gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ssm/service_package_gen.go b/internal/service/ssm/service_package_gen.go index a67e9f2eaf4..e162a6b740b 100644 --- a/internal/service/ssm/service_package_gen.go +++ b/internal/service/ssm/service_package_gen.go @@ -138,7 +138,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ssm_sdkv1.SSM, error) { sess := config["session"].(*session_sdkv1.Session) - return ssm_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return ssm_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -146,7 +146,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return ssm_sdkv2.NewFromConfig(cfg, func(o *ssm_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 69b2017ab7219fa07d69e66bb4c8618c5faf904b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:05 -0400 Subject: [PATCH 0721/1490] ssmcontacts: Use constant for endpoint strings --- internal/service/ssmcontacts/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ssmcontacts/service_package_gen.go b/internal/service/ssmcontacts/service_package_gen.go index 2d32b3a1793..4e2ddae2bb0 100644 --- a/internal/service/ssmcontacts/service_package_gen.go +++ b/internal/service/ssmcontacts/service_package_gen.go @@ -84,7 +84,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return ssmcontacts_sdkv2.NewFromConfig(cfg, func(o *ssmcontacts_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 420dfde46e67ab533e4bcd5989d9ae1a52e13873 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:05 -0400 Subject: [PATCH 0722/1490] ssmincidents: Use constant for endpoint strings --- internal/service/ssmincidents/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ssmincidents/service_package_gen.go b/internal/service/ssmincidents/service_package_gen.go index e5b343c1d70..a3726c38453 100644 --- a/internal/service/ssmincidents/service_package_gen.go +++ b/internal/service/ssmincidents/service_package_gen.go @@ -65,7 +65,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return ssmincidents_sdkv2.NewFromConfig(cfg, func(o *ssmincidents_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 064dc95129591aeaa1d6b4ec1569f6346411e7a5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:05 -0400 Subject: [PATCH 0723/1490] ssmsap: Use constant for endpoint strings --- internal/service/ssmsap/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ssmsap/service_package_gen.go b/internal/service/ssmsap/service_package_gen.go index 8f5decbb3d6..81b5a64f1c8 100644 --- a/internal/service/ssmsap/service_package_gen.go +++ b/internal/service/ssmsap/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return ssmsap_sdkv2.NewFromConfig(cfg, func(o *ssmsap_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From c38c40e92291c4bd4cbba419e162ff5cc9f18653 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:06 -0400 Subject: [PATCH 0724/1490] sso: Use constant for endpoint strings --- internal/service/sso/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/sso/service_package_gen.go b/internal/service/sso/service_package_gen.go index 1b5fd2afd13..c617eec14bc 100644 --- a/internal/service/sso/service_package_gen.go +++ b/internal/service/sso/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return sso_sdkv2.NewFromConfig(cfg, func(o *sso_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 1584b7794aa11da80f204f2574e1fa0801c0ddb6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:06 -0400 Subject: [PATCH 0725/1490] ssoadmin: Use constant for endpoint strings --- internal/service/ssoadmin/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/ssoadmin/service_package.go b/internal/service/ssoadmin/service_package.go index c9c3df9fba8..c83dfbb8504 100644 --- a/internal/service/ssoadmin/service_package.go +++ b/internal/service/ssoadmin/service_package.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/ssoadmin/types" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -19,7 +20,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return ssoadmin.NewFromConfig(cfg, func(o *ssoadmin.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } From 514fcef0ad32ab2fc551205a1bd30d82599543b1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:06 -0400 Subject: [PATCH 0726/1490] storagegateway: Use constant for endpoint strings --- internal/service/storagegateway/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/storagegateway/service_package_gen.go b/internal/service/storagegateway/service_package_gen.go index 968f64686b3..1943022b7b6 100644 --- a/internal/service/storagegateway/service_package_gen.go +++ b/internal/service/storagegateway/service_package_gen.go @@ -113,7 +113,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*storagegateway_sdkv1.StorageGateway, error) { sess := config["session"].(*session_sdkv1.Session) - return storagegateway_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return storagegateway_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From b70be0f677b44cbd681c833979779f0b685a43ff Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:06 -0400 Subject: [PATCH 0727/1490] sts: Use constant for endpoint strings --- internal/service/sts/service_package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/sts/service_package.go b/internal/service/sts/service_package.go index 13dea08c226..2a472a5080d 100644 --- a/internal/service/sts/service_package.go +++ b/internal/service/sts/service_package.go @@ -8,6 +8,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/sts" + "github.com/hashicorp/terraform-provider-aws/names" ) // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -15,7 +16,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws.Config)) return sts.NewFromConfig(cfg, func(o *sts.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws.String(endpoint) } From f4a05757ed659778317f12bcbdb6b6accaca70a6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:06 -0400 Subject: [PATCH 0728/1490] swf: Use constant for endpoint strings --- internal/service/swf/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/swf/service_package_gen.go b/internal/service/swf/service_package_gen.go index 7136a6f1cf1..d2ad8ee1cdb 100644 --- a/internal/service/swf/service_package_gen.go +++ b/internal/service/swf/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return swf_sdkv2.NewFromConfig(cfg, func(o *swf_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From af098100c1f176910d04a06b700e4c4f5b085334 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:06 -0400 Subject: [PATCH 0729/1490] synthetics: Use constant for endpoint strings --- internal/service/synthetics/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/synthetics/service_package_gen.go b/internal/service/synthetics/service_package_gen.go index cc5b546bc46..b1b318630e8 100644 --- a/internal/service/synthetics/service_package_gen.go +++ b/internal/service/synthetics/service_package_gen.go @@ -61,7 +61,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return synthetics_sdkv2.NewFromConfig(cfg, func(o *synthetics_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 87318198d12f2449d6e3be69b7b64c9de996d2fd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:06 -0400 Subject: [PATCH 0730/1490] timestreamwrite: Use constant for endpoint strings --- internal/service/timestreamwrite/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/timestreamwrite/service_package_gen.go b/internal/service/timestreamwrite/service_package_gen.go index e07220ecb86..009e2581d65 100644 --- a/internal/service/timestreamwrite/service_package_gen.go +++ b/internal/service/timestreamwrite/service_package_gen.go @@ -56,7 +56,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return timestreamwrite_sdkv2.NewFromConfig(cfg, func(o *timestreamwrite_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From a6f36d772d01aeb47c935933b33d67f89ec518d2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:07 -0400 Subject: [PATCH 0731/1490] transcribe: Use constant for endpoint strings --- internal/service/transcribe/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/transcribe/service_package_gen.go b/internal/service/transcribe/service_package_gen.go index 0ca933ba00e..ed5a079cc66 100644 --- a/internal/service/transcribe/service_package_gen.go +++ b/internal/service/transcribe/service_package_gen.go @@ -72,7 +72,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return transcribe_sdkv2.NewFromConfig(cfg, func(o *transcribe_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 85e10b66ccd2fc6f846d728601c4eb668ae39047 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:07 -0400 Subject: [PATCH 0732/1490] transfer: Use constant for endpoint strings --- internal/service/transfer/server.go | 4 ++-- internal/service/transfer/server_data_source.go | 4 ++-- internal/service/transfer/server_data_source_test.go | 6 +++--- internal/service/transfer/server_test.go | 4 ++-- internal/service/transfer/service_package_gen.go | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/transfer/server.go b/internal/service/transfer/server.go index 893a911107e..c5668f3851d 100644 --- a/internal/service/transfer/server.go +++ b/internal/service/transfer/server.go @@ -74,7 +74,7 @@ func resourceServer() *schema.Resource { Default: transfer.DomainS3, ValidateFunc: validation.StringInSlice(transfer.Domain_Values(), false), }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -491,7 +491,7 @@ func resourceServerRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("directory_id", "") } d.Set("domain", output.Domain) - d.Set("endpoint", meta.(*conns.AWSClient).RegionalHostname(ctx, fmt.Sprintf("%s.server.transfer", d.Id()))) + d.Set(names.AttrEndpoint, meta.(*conns.AWSClient).RegionalHostname(ctx, fmt.Sprintf("%s.server.transfer", d.Id()))) if output.EndpointDetails != nil { securityGroupIDs := make([]*string, 0) diff --git a/internal/service/transfer/server_data_source.go b/internal/service/transfer/server_data_source.go index 55d3536d336..1dee73dfbc7 100644 --- a/internal/service/transfer/server_data_source.go +++ b/internal/service/transfer/server_data_source.go @@ -31,7 +31,7 @@ func DataSourceServer() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint": { + names.AttrEndpoint: { Type: schema.TypeString, Computed: true, }, @@ -99,7 +99,7 @@ func dataSourceServerRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrARN, output.Arn) d.Set("certificate", output.Certificate) d.Set("domain", output.Domain) - d.Set("endpoint", meta.(*conns.AWSClient).RegionalHostname(ctx, fmt.Sprintf("%s.server.transfer", serverID))) + d.Set(names.AttrEndpoint, meta.(*conns.AWSClient).RegionalHostname(ctx, fmt.Sprintf("%s.server.transfer", serverID))) d.Set("endpoint_type", output.EndpointType) d.Set("identity_provider_type", output.IdentityProviderType) if output.IdentityProviderDetails != nil { diff --git a/internal/service/transfer/server_data_source_test.go b/internal/service/transfer/server_data_source_test.go index f35810cbc69..58c05f64251 100644 --- a/internal/service/transfer/server_data_source_test.go +++ b/internal/service/transfer/server_data_source_test.go @@ -28,7 +28,7 @@ func testAccServerDataSource_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(datasourceName, "domain", resourceName, "domain"), - resource.TestCheckResourceAttrPair(datasourceName, "endpoint", resourceName, "endpoint"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), resource.TestCheckResourceAttrPair(datasourceName, "identity_provider_type", resourceName, "identity_provider_type"), resource.TestCheckResourceAttrPair(datasourceName, "logging_role", resourceName, "logging_role"), resource.TestCheckResourceAttrPair(datasourceName, "structured_log_destinations.#", resourceName, "structured_log_destinations.#"), @@ -54,7 +54,7 @@ func testAccServerDataSource_Service_managed(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(datasourceName, "certificate", resourceName, "certificate"), - resource.TestCheckResourceAttrPair(datasourceName, "endpoint", resourceName, "endpoint"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), resource.TestCheckResourceAttrPair(datasourceName, "endpoint_type", resourceName, "endpoint_type"), resource.TestCheckResourceAttrPair(datasourceName, "identity_provider_type", resourceName, "identity_provider_type"), resource.TestCheckResourceAttrPair(datasourceName, "invocation_role", resourceName, "invocation_role"), @@ -83,7 +83,7 @@ func testAccServerDataSource_apigateway(t *testing.T) { Config: testAccServerDataSourceConfig_apigateway(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(datasourceName, "endpoint", resourceName, "endpoint"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), resource.TestCheckResourceAttrPair(datasourceName, "identity_provider_type", resourceName, "identity_provider_type"), resource.TestCheckResourceAttrPair(datasourceName, "invocation_role", resourceName, "invocation_role"), resource.TestCheckResourceAttrPair(datasourceName, "logging_role", resourceName, "logging_role"), diff --git a/internal/service/transfer/server_test.go b/internal/service/transfer/server_test.go index 1491a212f81..0d492be49c1 100644 --- a/internal/service/transfer/server_test.go +++ b/internal/service/transfer/server_test.go @@ -53,7 +53,7 @@ func testAccServer_basic(t *testing.T) { testAccCheckServerExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "transfer", regexache.MustCompile(`server/.+`)), resource.TestCheckResourceAttr(resourceName, "certificate", ""), - acctest.MatchResourceAttrRegionalHostname(resourceName, "endpoint", "server.transfer", regexache.MustCompile(`s-[0-9a-z]+`)), + acctest.MatchResourceAttrRegionalHostname(resourceName, names.AttrEndpoint, "server.transfer", regexache.MustCompile(`s-[0-9a-z]+`)), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "0"), resource.TestCheckResourceAttr(resourceName, "endpoint_type", "PUBLIC"), resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), @@ -94,7 +94,7 @@ func testAccServer_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "transfer", regexache.MustCompile(`server/.+`)), resource.TestCheckResourceAttr(resourceName, "certificate", ""), resource.TestCheckResourceAttr(resourceName, "domain", "S3"), - acctest.MatchResourceAttrRegionalHostname(resourceName, "endpoint", "server.transfer", regexache.MustCompile(`s-[0-9a-z]+`)), + acctest.MatchResourceAttrRegionalHostname(resourceName, names.AttrEndpoint, "server.transfer", regexache.MustCompile(`s-[0-9a-z]+`)), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "0"), resource.TestCheckResourceAttr(resourceName, "endpoint_type", "PUBLIC"), resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), diff --git a/internal/service/transfer/service_package_gen.go b/internal/service/transfer/service_package_gen.go index de6a92c163a..ba957544356 100644 --- a/internal/service/transfer/service_package_gen.go +++ b/internal/service/transfer/service_package_gen.go @@ -116,7 +116,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*transfer_sdkv1.Transfer, error) { sess := config["session"].(*session_sdkv1.Session) - return transfer_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return transfer_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } // NewClient returns a new AWS SDK for Go v2 client for this service package's AWS API. @@ -124,7 +124,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return transfer_sdkv2.NewFromConfig(cfg, func(o *transfer_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From cc6724dcfc98dbbdd769fef15c95226831510816 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:07 -0400 Subject: [PATCH 0733/1490] verifiedpermissions: Use constant for endpoint strings --- internal/service/verifiedpermissions/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/verifiedpermissions/service_package_gen.go b/internal/service/verifiedpermissions/service_package_gen.go index 6213f171433..69e8978183e 100644 --- a/internal/service/verifiedpermissions/service_package_gen.go +++ b/internal/service/verifiedpermissions/service_package_gen.go @@ -61,7 +61,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return verifiedpermissions_sdkv2.NewFromConfig(cfg, func(o *verifiedpermissions_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From af1446e651ea4029936b1d981a688623bbf7467f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:07 -0400 Subject: [PATCH 0734/1490] vpclattice: Use constant for endpoint strings --- internal/service/vpclattice/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/vpclattice/service_package_gen.go b/internal/service/vpclattice/service_package_gen.go index e681ca63980..ef974170fa5 100644 --- a/internal/service/vpclattice/service_package_gen.go +++ b/internal/service/vpclattice/service_package_gen.go @@ -144,7 +144,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return vpclattice_sdkv2.NewFromConfig(cfg, func(o *vpclattice_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 0b1850d5c06409e02ece3a6407dfac54784e5771 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:07 -0400 Subject: [PATCH 0735/1490] waf: Use constant for endpoint strings --- internal/service/waf/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/waf/service_package_gen.go b/internal/service/waf/service_package_gen.go index 5cdfe37efe4..297cf9a4ff2 100644 --- a/internal/service/waf/service_package_gen.go +++ b/internal/service/waf/service_package_gen.go @@ -125,7 +125,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*waf_sdkv1.WAF, error) { sess := config["session"].(*session_sdkv1.Session) - return waf_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return waf_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From aa8d24a19b4099adbf5ecef4d970730f2da9948d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:07 -0400 Subject: [PATCH 0736/1490] wafregional: Use constant for endpoint strings --- internal/service/wafregional/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/wafregional/service_package_gen.go b/internal/service/wafregional/service_package_gen.go index dd13aa840c8..d08718fadea 100644 --- a/internal/service/wafregional/service_package_gen.go +++ b/internal/service/wafregional/service_package_gen.go @@ -143,7 +143,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*wafregional_sdkv1.WAFRegional, error) { sess := config["session"].(*session_sdkv1.Session) - return wafregional_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return wafregional_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From c7610e7840d1620212ff737250dfc0e6a2d9e6b7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:07 -0400 Subject: [PATCH 0737/1490] wafv2: Use constant for endpoint strings --- internal/service/wafv2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/wafv2/service_package_gen.go b/internal/service/wafv2/service_package_gen.go index 004ea25735e..1f2d464c570 100644 --- a/internal/service/wafv2/service_package_gen.go +++ b/internal/service/wafv2/service_package_gen.go @@ -103,7 +103,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return wafv2_sdkv2.NewFromConfig(cfg, func(o *wafv2_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 7be37c79cf2da0e2a1885186ffeed06824a1e66b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:08 -0400 Subject: [PATCH 0738/1490] wellarchitected: Use constant for endpoint strings --- internal/service/wellarchitected/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/wellarchitected/service_package_gen.go b/internal/service/wellarchitected/service_package_gen.go index 12277106afd..efc03a4a8b5 100644 --- a/internal/service/wellarchitected/service_package_gen.go +++ b/internal/service/wellarchitected/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return wellarchitected_sdkv2.NewFromConfig(cfg, func(o *wellarchitected_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 27e4c13f892d7807a03e42d2d27dbe2f6cfa9498 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:08 -0400 Subject: [PATCH 0739/1490] worklink: Use constant for endpoint strings --- internal/service/worklink/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/worklink/service_package_gen.go b/internal/service/worklink/service_package_gen.go index 5c5e8b0041b..3ad422ff67a 100644 --- a/internal/service/worklink/service_package_gen.go +++ b/internal/service/worklink/service_package_gen.go @@ -48,7 +48,7 @@ func (p *servicePackage) ServicePackageName() string { func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*worklink_sdkv1.WorkLink, error) { sess := config["session"].(*session_sdkv1.Session) - return worklink_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return worklink_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } func ServicePackage(ctx context.Context) conns.ServicePackage { From 761d10c6a9062fbf2976c948b4945e1d339a59b8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:08 -0400 Subject: [PATCH 0740/1490] workspaces: Use constant for endpoint strings --- internal/service/workspaces/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/workspaces/service_package_gen.go b/internal/service/workspaces/service_package_gen.go index 1e4801cd144..537f5812ce7 100644 --- a/internal/service/workspaces/service_package_gen.go +++ b/internal/service/workspaces/service_package_gen.go @@ -89,7 +89,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return workspaces_sdkv2.NewFromConfig(cfg, func(o *workspaces_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 226a684b6b5ba84de4b8172d5e7fcb0884e562d4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:08 -0400 Subject: [PATCH 0741/1490] workspacesweb: Use constant for endpoint strings --- internal/service/workspacesweb/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/workspacesweb/service_package_gen.go b/internal/service/workspacesweb/service_package_gen.go index 61d59da6bf7..45ba8cd8c8f 100644 --- a/internal/service/workspacesweb/service_package_gen.go +++ b/internal/service/workspacesweb/service_package_gen.go @@ -39,7 +39,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return workspacesweb_sdkv2.NewFromConfig(cfg, func(o *workspacesweb_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From f5c466bd39780e81175937c32f2f2548431a329a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:37:08 -0400 Subject: [PATCH 0742/1490] xray: Use constant for endpoint strings --- internal/service/xray/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/xray/service_package_gen.go b/internal/service/xray/service_package_gen.go index 4f674c9095d..ddce6a34896 100644 --- a/internal/service/xray/service_package_gen.go +++ b/internal/service/xray/service_package_gen.go @@ -60,7 +60,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return xray_sdkv2.NewFromConfig(cfg, func(o *xray_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 12474ad0cf1740cca6bf403516640265140121bb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:44:34 -0400 Subject: [PATCH 0743/1490] generate: Use const over literal --- internal/generate/servicepackage/file.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/generate/servicepackage/file.tmpl b/internal/generate/servicepackage/file.tmpl index 98e858d2788..5083fea5e83 100644 --- a/internal/generate/servicepackage/file.tmpl +++ b/internal/generate/servicepackage/file.tmpl @@ -143,7 +143,7 @@ func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) ( cfg := *(config["aws_sdkv2_config"].(*aws_sdkv2.Config)) return {{ .GoV2Package }}_sdkv2.NewFromConfig(cfg, func(o *{{ .GoV2Package }}_sdkv2.Options) { - if endpoint := config["endpoint"].(string); endpoint != "" { + if endpoint := config[names.AttrEndpoint].(string); endpoint != "" { o.BaseEndpoint = aws_sdkv2.String(endpoint) } }), nil From 32fcbcf69d536a973c4085abdb77217e39f91032 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:23 -0400 Subject: [PATCH 0744/1490] ci: Prefer constant for string literals --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 532f1060794..4177f9f9f90 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1255,3 +1255,13 @@ rules: - pattern: '"endpoint"' severity: ERROR fix: "names.AttrEndpoint" + - id: literal-session-string-constant + languages: [go] + message: Use the constant `names.AttrSession` for the string literal "session" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"session"' + severity: ERROR + fix: "names.AttrSession" From 787120e149bc2439c90ccff94004be3182f282a2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:23 -0400 Subject: [PATCH 0745/1490] names: Add constant for string literals --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 6ea9bf869f5..09da975971e 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -48,6 +48,7 @@ const ( AttrSecretKey = "secret_key" AttrSecurityGroupIDs = "security_group_ids" AttrSecurityGroups = "security_groups" + AttrSession = "session" AttrSharedConfigFiles = "shared_config_files" AttrSkipCredentialsValidation = "skip_credentials_validation" AttrSkipRequestingAccountID = "skip_requesting_account_id" From 2fac4f5d0e69df9f56aa86a39822c1480ce9c04a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:24 -0400 Subject: [PATCH 0746/1490] servicepackage: Use constants for strings --- internal/generate/servicepackage/file.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/generate/servicepackage/file.tmpl b/internal/generate/servicepackage/file.tmpl index 5083fea5e83..e9d43302000 100644 --- a/internal/generate/servicepackage/file.tmpl +++ b/internal/generate/servicepackage/file.tmpl @@ -131,9 +131,9 @@ func (p *servicePackage) ServicePackageName() string { {{if eq .SDKVersion "1" "1,2" }} // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*{{ .GoV1Package }}_sdkv1.{{ .GoV1ClientTypeName }}, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) - return {{ .GoV1Package }}_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config["endpoint"].(string))})), nil + return {{ .GoV1Package }}_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } {{- end }} From 23e304e84897b6840ab9f575523213db98c158a0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:24 -0400 Subject: [PATCH 0747/1490] appautoscaling: Use constants for strings --- internal/service/appautoscaling/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appautoscaling/service_package_gen.go b/internal/service/appautoscaling/service_package_gen.go index 98575caec35..d142c9cb731 100644 --- a/internal/service/appautoscaling/service_package_gen.go +++ b/internal/service/appautoscaling/service_package_gen.go @@ -55,7 +55,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*applicationautoscaling_sdkv1.ApplicationAutoScaling, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return applicationautoscaling_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From cad7b42ae56bba137e6638126c9111df60744eb3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:24 -0400 Subject: [PATCH 0748/1490] applicationinsights: Use constants for strings --- internal/service/applicationinsights/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/applicationinsights/service_package_gen.go b/internal/service/applicationinsights/service_package_gen.go index 031dbf31bde..1eb52f405ac 100644 --- a/internal/service/applicationinsights/service_package_gen.go +++ b/internal/service/applicationinsights/service_package_gen.go @@ -46,7 +46,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*applicationinsights_sdkv1.ApplicationInsights, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return applicationinsights_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 823408e49800650c15f3ca5c05400923e2bee46e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:24 -0400 Subject: [PATCH 0749/1490] appmesh: Use constants for strings --- internal/service/appmesh/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appmesh/service_package_gen.go b/internal/service/appmesh/service_package_gen.go index e9fc9d4b2e1..8bb146e9b8a 100644 --- a/internal/service/appmesh/service_package_gen.go +++ b/internal/service/appmesh/service_package_gen.go @@ -130,7 +130,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*appmesh_sdkv1.AppMesh, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return appmesh_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 394d0bdf246ccd1819e6d73cff02ca74b93f250a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:24 -0400 Subject: [PATCH 0750/1490] appstream: Use constants for strings --- internal/service/appstream/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appstream/service_package_gen.go b/internal/service/appstream/service_package_gen.go index 33dfb3539b0..baa6e298d0b 100644 --- a/internal/service/appstream/service_package_gen.go +++ b/internal/service/appstream/service_package_gen.go @@ -78,7 +78,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*appstream_sdkv1.AppStream, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return appstream_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From ca6125aaad2681b40490c9d2604907be0d464165 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:24 -0400 Subject: [PATCH 0751/1490] appsync: Use constants for strings --- internal/service/appsync/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/appsync/service_package_gen.go b/internal/service/appsync/service_package_gen.go index e1fe120a54d..9dd5c3b7abb 100644 --- a/internal/service/appsync/service_package_gen.go +++ b/internal/service/appsync/service_package_gen.go @@ -79,7 +79,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*appsync_sdkv1.AppSync, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return appsync_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From e3da8361f6dec8d2d4c7ead74ac4f7d1b240e1c2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:25 -0400 Subject: [PATCH 0752/1490] backup: Use constants for strings --- internal/service/backup/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/backup/service_package_gen.go b/internal/service/backup/service_package_gen.go index 3c33428890e..354cf840efa 100644 --- a/internal/service/backup/service_package_gen.go +++ b/internal/service/backup/service_package_gen.go @@ -115,7 +115,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*backup_sdkv1.Backup, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return backup_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 6547500b99c14d107820f242673f721fa8994098 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:25 -0400 Subject: [PATCH 0753/1490] batch: Use constants for strings --- internal/service/batch/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/batch/service_package_gen.go b/internal/service/batch/service_package_gen.go index 3143b00152f..e2668e419f9 100644 --- a/internal/service/batch/service_package_gen.go +++ b/internal/service/batch/service_package_gen.go @@ -90,7 +90,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*batch_sdkv1.Batch, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return batch_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 27eab404776d7ce3549e3e5f5f577ec1f449323a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:25 -0400 Subject: [PATCH 0754/1490] chime: Use constants for strings --- internal/service/chime/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/chime/service_package_gen.go b/internal/service/chime/service_package_gen.go index eb5ae80b7cd..5045077b411 100644 --- a/internal/service/chime/service_package_gen.go +++ b/internal/service/chime/service_package_gen.go @@ -70,7 +70,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*chime_sdkv1.Chime, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return chime_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From b97d098f6b8b214a860186e7e6d39ab5e6ea4865 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:25 -0400 Subject: [PATCH 0755/1490] cognitoidp: Use constants for strings --- internal/service/cognitoidp/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cognitoidp/service_package_gen.go b/internal/service/cognitoidp/service_package_gen.go index c1bc5f2f999..c0ec4b1529e 100644 --- a/internal/service/cognitoidp/service_package_gen.go +++ b/internal/service/cognitoidp/service_package_gen.go @@ -123,7 +123,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*cognitoidentityprovider_sdkv1.CognitoIdentityProvider, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return cognitoidentityprovider_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 5851c73fa531f9a0a7d73aefac4b24deecf7c9d6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:25 -0400 Subject: [PATCH 0756/1490] connect: Use constants for strings --- internal/service/connect/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/connect/service_package_gen.go b/internal/service/connect/service_package_gen.go index f3c21ac0a12..120b71a0cec 100644 --- a/internal/service/connect/service_package_gen.go +++ b/internal/service/connect/service_package_gen.go @@ -211,7 +211,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*connect_sdkv1.Connect, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return connect_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 5487ffd366c4861e2b646f47dfbeb52767a63abd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:25 -0400 Subject: [PATCH 0757/1490] dataexchange: Use constants for strings --- internal/service/dataexchange/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/dataexchange/service_package_gen.go b/internal/service/dataexchange/service_package_gen.go index 7e3b04c95b1..152bfaf9f3c 100644 --- a/internal/service/dataexchange/service_package_gen.go +++ b/internal/service/dataexchange/service_package_gen.go @@ -54,7 +54,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*dataexchange_sdkv1.DataExchange, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return dataexchange_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 76819b48f9037b1d14d5d2b4f300be3743d12716 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:25 -0400 Subject: [PATCH 0758/1490] datapipeline: Use constants for strings --- internal/service/datapipeline/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/datapipeline/service_package_gen.go b/internal/service/datapipeline/service_package_gen.go index 992734106d3..5203d024853 100644 --- a/internal/service/datapipeline/service_package_gen.go +++ b/internal/service/datapipeline/service_package_gen.go @@ -59,7 +59,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*datapipeline_sdkv1.DataPipeline, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return datapipeline_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 2029311334a0f1b58552f2441b6aa5ba82752b7f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:25 -0400 Subject: [PATCH 0759/1490] detective: Use constants for strings --- internal/service/detective/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/detective/service_package_gen.go b/internal/service/detective/service_package_gen.go index c8540b1d5bb..997f19165a8 100644 --- a/internal/service/detective/service_package_gen.go +++ b/internal/service/detective/service_package_gen.go @@ -62,7 +62,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*detective_sdkv1.Detective, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return detective_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From c1ab41ba72e255291176be0d6558a17bde639d7e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:26 -0400 Subject: [PATCH 0760/1490] devicefarm: Use constants for strings --- internal/service/devicefarm/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/devicefarm/service_package_gen.go b/internal/service/devicefarm/service_package_gen.go index 4d502817067..fc44e0a97a6 100644 --- a/internal/service/devicefarm/service_package_gen.go +++ b/internal/service/devicefarm/service_package_gen.go @@ -82,7 +82,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*devicefarm_sdkv1.DeviceFarm, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return devicefarm_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 29c0150111b11ef838109b1a88445e4970150513 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:26 -0400 Subject: [PATCH 0761/1490] directconnect: Use constants for strings --- internal/service/directconnect/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/directconnect/service_package_gen.go b/internal/service/directconnect/service_package_gen.go index 8dc55779c67..9a4a5608362 100644 --- a/internal/service/directconnect/service_package_gen.go +++ b/internal/service/directconnect/service_package_gen.go @@ -167,7 +167,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*directconnect_sdkv1.DirectConnect, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return directconnect_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 4b8a2bb7fe7e51113a267bacb642586a25392a9f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:26 -0400 Subject: [PATCH 0762/1490] dlm: Use constants for strings --- internal/service/dlm/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/dlm/service_package_gen.go b/internal/service/dlm/service_package_gen.go index 66ffff5d2ce..5464fc7161e 100644 --- a/internal/service/dlm/service_package_gen.go +++ b/internal/service/dlm/service_package_gen.go @@ -46,7 +46,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*dlm_sdkv1.DLM, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return dlm_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 8ecfc8e77788423ccb8557b71afe4acca622a5d3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:26 -0400 Subject: [PATCH 0763/1490] dms: Use constants for strings --- internal/service/dms/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/dms/service_package_gen.go b/internal/service/dms/service_package_gen.go index ec98d3a5ecc..897c40833bd 100644 --- a/internal/service/dms/service_package_gen.go +++ b/internal/service/dms/service_package_gen.go @@ -123,7 +123,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*databasemigrationservice_sdkv1.DatabaseMigrationService, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return databasemigrationservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 9adabfa569b387a45248621afce3c56b801a3715 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:26 -0400 Subject: [PATCH 0764/1490] docdb: Use constants for strings --- internal/service/docdb/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/docdb/service_package_gen.go b/internal/service/docdb/service_package_gen.go index 306d01fd928..06dc9e09960 100644 --- a/internal/service/docdb/service_package_gen.go +++ b/internal/service/docdb/service_package_gen.go @@ -95,7 +95,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*docdb_sdkv1.DocDB, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return docdb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 325d0b2d62816370d3d6d27fba53fffa8b928f15 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:26 -0400 Subject: [PATCH 0765/1490] ds: Use constants for strings --- internal/service/ds/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ds/service_package_gen.go b/internal/service/ds/service_package_gen.go index 72a67be6b0f..bcee382bf8d 100644 --- a/internal/service/ds/service_package_gen.go +++ b/internal/service/ds/service_package_gen.go @@ -83,7 +83,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*directoryservice_sdkv1.DirectoryService, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return directoryservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From ec2a615ea6064c4de7b3eac5ce015edb16527112 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:26 -0400 Subject: [PATCH 0766/1490] ec2: Use constants for strings --- internal/service/ec2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ec2/service_package_gen.go b/internal/service/ec2/service_package_gen.go index 4ab3abea782..f3674fc3626 100644 --- a/internal/service/ec2/service_package_gen.go +++ b/internal/service/ec2/service_package_gen.go @@ -1220,7 +1220,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ec2_sdkv1.EC2, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return ec2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 0f7aa386de487d9de85e213f6ae23b56b9b49cf8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:27 -0400 Subject: [PATCH 0767/1490] ecs: Use constants for strings --- internal/service/ecs/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ecs/service_package_gen.go b/internal/service/ecs/service_package_gen.go index b261f6543ea..4b3b721ea21 100644 --- a/internal/service/ecs/service_package_gen.go +++ b/internal/service/ecs/service_package_gen.go @@ -115,7 +115,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ecs_sdkv1.ECS, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return ecs_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From c33881ad0270d6bb8a93cfa3907f6fa54649ee9e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:27 -0400 Subject: [PATCH 0768/1490] efs: Use constants for strings --- internal/service/efs/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/efs/service_package_gen.go b/internal/service/efs/service_package_gen.go index dc290d187b1..cd6e6af7d48 100644 --- a/internal/service/efs/service_package_gen.go +++ b/internal/service/efs/service_package_gen.go @@ -89,7 +89,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*efs_sdkv1.EFS, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return efs_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From a4063fce6f13420367e966a65da762b76a519962 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:27 -0400 Subject: [PATCH 0769/1490] elasticache: Use constants for strings --- internal/service/elasticache/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/elasticache/service_package_gen.go b/internal/service/elasticache/service_package_gen.go index 38ee64321e1..7d1a76c3337 100644 --- a/internal/service/elasticache/service_package_gen.go +++ b/internal/service/elasticache/service_package_gen.go @@ -127,7 +127,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*elasticache_sdkv1.ElastiCache, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return elasticache_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From f91c5aab51421661643ad1fb2c0ac75f5705eb80 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:27 -0400 Subject: [PATCH 0770/1490] elasticsearch: Use constants for strings --- internal/service/elasticsearch/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/elasticsearch/service_package_gen.go b/internal/service/elasticsearch/service_package_gen.go index cf24f6f09bb..65cfc297a45 100644 --- a/internal/service/elasticsearch/service_package_gen.go +++ b/internal/service/elasticsearch/service_package_gen.go @@ -63,7 +63,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*elasticsearchservice_sdkv1.ElasticsearchService, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return elasticsearchservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 46a6b6ddcd0fe6c61bda9f41b2d0b475101c4188 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:27 -0400 Subject: [PATCH 0771/1490] elastictranscoder: Use constants for strings --- internal/service/elastictranscoder/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/elastictranscoder/service_package_gen.go b/internal/service/elastictranscoder/service_package_gen.go index ede8fb9af6d..0bb29594624 100644 --- a/internal/service/elastictranscoder/service_package_gen.go +++ b/internal/service/elastictranscoder/service_package_gen.go @@ -46,7 +46,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*elastictranscoder_sdkv1.ElasticTranscoder, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return elastictranscoder_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 938b9298f90f6244483e980d415f615768a344d2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:27 -0400 Subject: [PATCH 0772/1490] elb: Use constants for strings --- internal/service/elb/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/elb/service_package_gen.go b/internal/service/elb/service_package_gen.go index 8583e662d88..35994d6292d 100644 --- a/internal/service/elb/service_package_gen.go +++ b/internal/service/elb/service_package_gen.go @@ -91,7 +91,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*elb_sdkv1.ELB, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return elb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 4dac8d0f695d05674b491486db782ca655745586 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:27 -0400 Subject: [PATCH 0773/1490] elbv2: Use constants for strings --- internal/service/elbv2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/elbv2/service_package_gen.go b/internal/service/elbv2/service_package_gen.go index 4b8fc24a368..99d63302da3 100644 --- a/internal/service/elbv2/service_package_gen.go +++ b/internal/service/elbv2/service_package_gen.go @@ -171,7 +171,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*elbv2_sdkv1.ELBV2, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return elbv2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 007557c1171a16607d9a6e67cfa14044fe03f7ef Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:28 -0400 Subject: [PATCH 0774/1490] emr: Use constants for strings --- internal/service/emr/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/emr/service_package_gen.go b/internal/service/emr/service_package_gen.go index f2c6b1442ef..effa1445db3 100644 --- a/internal/service/emr/service_package_gen.go +++ b/internal/service/emr/service_package_gen.go @@ -97,7 +97,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*emr_sdkv1.EMR, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return emr_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 4b4e7f73f910b9debd0d48ec32590db17082bec0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:28 -0400 Subject: [PATCH 0775/1490] emrcontainers: Use constants for strings --- internal/service/emrcontainers/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/emrcontainers/service_package_gen.go b/internal/service/emrcontainers/service_package_gen.go index bc79d117a84..a85f8f77289 100644 --- a/internal/service/emrcontainers/service_package_gen.go +++ b/internal/service/emrcontainers/service_package_gen.go @@ -59,7 +59,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*emrcontainers_sdkv1.EMRContainers, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return emrcontainers_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 006ae771defdfd66db5c27e3a6ca4ded2d85ba63 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:28 -0400 Subject: [PATCH 0776/1490] fsx: Use constants for strings --- internal/service/fsx/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/fsx/service_package_gen.go b/internal/service/fsx/service_package_gen.go index abb209756c3..ae2c8b3becb 100644 --- a/internal/service/fsx/service_package_gen.go +++ b/internal/service/fsx/service_package_gen.go @@ -155,7 +155,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*fsx_sdkv1.FSx, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return fsx_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From aabb3f26f7afbe68afc40d818e8cff680600b695 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:28 -0400 Subject: [PATCH 0777/1490] gamelift: Use constants for strings --- internal/service/gamelift/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/gamelift/service_package_gen.go b/internal/service/gamelift/service_package_gen.go index b6b8e6becba..3200832cb5a 100644 --- a/internal/service/gamelift/service_package_gen.go +++ b/internal/service/gamelift/service_package_gen.go @@ -86,7 +86,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*gamelift_sdkv1.GameLift, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return gamelift_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 6e6a826ee075a4de1b0fc06734585abeec2ae92c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:28 -0400 Subject: [PATCH 0778/1490] glue: Use constants for strings --- internal/service/glue/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/glue/service_package_gen.go b/internal/service/glue/service_package_gen.go index 6c11d045201..b94b0482375 100644 --- a/internal/service/glue/service_package_gen.go +++ b/internal/service/glue/service_package_gen.go @@ -175,7 +175,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*glue_sdkv1.Glue, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return glue_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 661feaf469f58710de3d3f575368eb898c2f2c82 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:28 -0400 Subject: [PATCH 0779/1490] grafana: Use constants for strings --- internal/service/grafana/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/grafana/service_package_gen.go b/internal/service/grafana/service_package_gen.go index a877706a7f9..517d29a5019 100644 --- a/internal/service/grafana/service_package_gen.go +++ b/internal/service/grafana/service_package_gen.go @@ -67,7 +67,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*managedgrafana_sdkv1.ManagedGrafana, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return managedgrafana_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From c6c388e02a5b184da13dd62b67d9d755a2637c97 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:28 -0400 Subject: [PATCH 0780/1490] greengrass: Use constants for strings --- internal/service/greengrass/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/greengrass/service_package_gen.go b/internal/service/greengrass/service_package_gen.go index b628d871594..bf737e3da5f 100644 --- a/internal/service/greengrass/service_package_gen.go +++ b/internal/service/greengrass/service_package_gen.go @@ -37,7 +37,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*greengrass_sdkv1.Greengrass, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return greengrass_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 6eca54b12a196e2a7759b3e79a5207b929e6427e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:29 -0400 Subject: [PATCH 0781/1490] guardduty: Use constants for strings --- internal/service/guardduty/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/guardduty/service_package_gen.go b/internal/service/guardduty/service_package_gen.go index 77ad40e9ce6..45933a2b4ad 100644 --- a/internal/service/guardduty/service_package_gen.go +++ b/internal/service/guardduty/service_package_gen.go @@ -111,7 +111,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*guardduty_sdkv1.GuardDuty, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return guardduty_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 615371644a330e5cff7f80fd2f1381e9d34116d1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:29 -0400 Subject: [PATCH 0782/1490] imagebuilder: Use constants for strings --- internal/service/imagebuilder/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/imagebuilder/service_package_gen.go b/internal/service/imagebuilder/service_package_gen.go index 5cfab40d7b7..926ed9e4ed8 100644 --- a/internal/service/imagebuilder/service_package_gen.go +++ b/internal/service/imagebuilder/service_package_gen.go @@ -158,7 +158,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*imagebuilder_sdkv1.Imagebuilder, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return imagebuilder_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From e01c313e7d86ced711ef34b943e92a3c841ae31d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:29 -0400 Subject: [PATCH 0783/1490] inspector: Use constants for strings --- internal/service/inspector/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/inspector/service_package_gen.go b/internal/service/inspector/service_package_gen.go index 42f109a4d80..b2fc287f526 100644 --- a/internal/service/inspector/service_package_gen.go +++ b/internal/service/inspector/service_package_gen.go @@ -59,7 +59,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*inspector_sdkv1.Inspector, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return inspector_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 4b59f9b2d2d1691bdff95ddbbc7083fc056ba13f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:29 -0400 Subject: [PATCH 0784/1490] iot: Use constants for strings --- internal/service/iot/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/iot/service_package_gen.go b/internal/service/iot/service_package_gen.go index 3e1c3724236..8f7fc166c63 100644 --- a/internal/service/iot/service_package_gen.go +++ b/internal/service/iot/service_package_gen.go @@ -160,7 +160,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*iot_sdkv1.IoT, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return iot_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 5d31a26890b654a655bdea2bebf6d58c007b8ab2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:29 -0400 Subject: [PATCH 0785/1490] iotanalytics: Use constants for strings --- internal/service/iotanalytics/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/iotanalytics/service_package_gen.go b/internal/service/iotanalytics/service_package_gen.go index f04a829d2f4..0c2b3befaa8 100644 --- a/internal/service/iotanalytics/service_package_gen.go +++ b/internal/service/iotanalytics/service_package_gen.go @@ -37,7 +37,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*iotanalytics_sdkv1.IoTAnalytics, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return iotanalytics_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From ba229ccef03c5241a7d2f1062e6312f226b8f1b5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:29 -0400 Subject: [PATCH 0786/1490] iotevents: Use constants for strings --- internal/service/iotevents/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/iotevents/service_package_gen.go b/internal/service/iotevents/service_package_gen.go index e19d8167fb9..66df38ece21 100644 --- a/internal/service/iotevents/service_package_gen.go +++ b/internal/service/iotevents/service_package_gen.go @@ -37,7 +37,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*iotevents_sdkv1.IoTEvents, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return iotevents_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From b56cfd2d0808811619232795f804ac3ff8f3c7c2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:29 -0400 Subject: [PATCH 0787/1490] ivs: Use constants for strings --- internal/service/ivs/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ivs/service_package_gen.go b/internal/service/ivs/service_package_gen.go index aabd4d31b79..14b5271be55 100644 --- a/internal/service/ivs/service_package_gen.go +++ b/internal/service/ivs/service_package_gen.go @@ -67,7 +67,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ivs_sdkv1.IVS, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return ivs_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From d0e1279636489f974fc046a2c7bc1364ae5420bd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:30 -0400 Subject: [PATCH 0788/1490] kafkaconnect: Use constants for strings --- internal/service/kafkaconnect/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/kafkaconnect/service_package_gen.go b/internal/service/kafkaconnect/service_package_gen.go index f9064d78026..f6f43640006 100644 --- a/internal/service/kafkaconnect/service_package_gen.go +++ b/internal/service/kafkaconnect/service_package_gen.go @@ -63,7 +63,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*kafkaconnect_sdkv1.KafkaConnect, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return kafkaconnect_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 6386fde06bcc727b07f006dd98a27ba4fa0f050c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:30 -0400 Subject: [PATCH 0789/1490] kinesisanalytics: Use constants for strings --- internal/service/kinesisanalytics/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/kinesisanalytics/service_package_gen.go b/internal/service/kinesisanalytics/service_package_gen.go index e10dc6ebf63..f0e4a5391fb 100644 --- a/internal/service/kinesisanalytics/service_package_gen.go +++ b/internal/service/kinesisanalytics/service_package_gen.go @@ -46,7 +46,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*kinesisanalytics_sdkv1.KinesisAnalytics, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return kinesisanalytics_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 1f4e68b66b3b722d663a0cbc7332691cc1119f14 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:30 -0400 Subject: [PATCH 0790/1490] kinesisanalyticsv2: Use constants for strings --- internal/service/kinesisanalyticsv2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/kinesisanalyticsv2/service_package_gen.go b/internal/service/kinesisanalyticsv2/service_package_gen.go index 9934c82c59f..ec7e972b788 100644 --- a/internal/service/kinesisanalyticsv2/service_package_gen.go +++ b/internal/service/kinesisanalyticsv2/service_package_gen.go @@ -50,7 +50,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*kinesisanalyticsv2_sdkv1.KinesisAnalyticsV2, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return kinesisanalyticsv2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From caa01bb55f9fdf975218c9dc6005610fd36a540d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:30 -0400 Subject: [PATCH 0791/1490] kinesisvideo: Use constants for strings --- internal/service/kinesisvideo/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/kinesisvideo/service_package_gen.go b/internal/service/kinesisvideo/service_package_gen.go index c87c68e191c..86097160aea 100644 --- a/internal/service/kinesisvideo/service_package_gen.go +++ b/internal/service/kinesisvideo/service_package_gen.go @@ -46,7 +46,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*kinesisvideo_sdkv1.KinesisVideo, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return kinesisvideo_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 15f10234442d87b2a05c5ff460ec45b09578173d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:30 -0400 Subject: [PATCH 0792/1490] lexmodels: Use constants for strings --- internal/service/lexmodels/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/lexmodels/service_package_gen.go b/internal/service/lexmodels/service_package_gen.go index 841771188d3..0cdb4a82c85 100644 --- a/internal/service/lexmodels/service_package_gen.go +++ b/internal/service/lexmodels/service_package_gen.go @@ -71,7 +71,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*lexmodelbuildingservice_sdkv1.LexModelBuildingService, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return lexmodelbuildingservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From d5ef0c63aae58f755cef24530984cdda588ba3b9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:30 -0400 Subject: [PATCH 0793/1490] licensemanager: Use constants for strings --- internal/service/licensemanager/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/licensemanager/service_package_gen.go b/internal/service/licensemanager/service_package_gen.go index 844b49b98f0..82b6315ff20 100644 --- a/internal/service/licensemanager/service_package_gen.go +++ b/internal/service/licensemanager/service_package_gen.go @@ -71,7 +71,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*licensemanager_sdkv1.LicenseManager, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return licensemanager_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 7c77917d3c49f3f471a56fdaa412357edeafb932 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:30 -0400 Subject: [PATCH 0794/1490] location: Use constants for strings --- internal/service/location/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/location/service_package_gen.go b/internal/service/location/service_package_gen.go index fb86837351a..6261d516c8e 100644 --- a/internal/service/location/service_package_gen.go +++ b/internal/service/location/service_package_gen.go @@ -111,7 +111,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*locationservice_sdkv1.LocationService, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return locationservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 2760caa5f0215192b5fe8dc17c9bc0fc995bcf99 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:31 -0400 Subject: [PATCH 0795/1490] macie2: Use constants for strings --- internal/service/macie2/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/macie2/service_package_gen.go b/internal/service/macie2/service_package_gen.go index c92d2a119aa..85a1de63ffb 100644 --- a/internal/service/macie2/service_package_gen.go +++ b/internal/service/macie2/service_package_gen.go @@ -78,7 +78,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*macie2_sdkv1.Macie2, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return macie2_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From c740dea62a6d30517e0d5d42acd2182583e71241 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:31 -0400 Subject: [PATCH 0796/1490] memorydb: Use constants for strings --- internal/service/memorydb/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/memorydb/service_package_gen.go b/internal/service/memorydb/service_package_gen.go index 6defd26d6f9..4b2878e5483 100644 --- a/internal/service/memorydb/service_package_gen.go +++ b/internal/service/memorydb/service_package_gen.go @@ -111,7 +111,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*memorydb_sdkv1.MemoryDB, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return memorydb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 94f8f9d6a5506f8160168c83465566762e67e7a8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:31 -0400 Subject: [PATCH 0797/1490] neptune: Use constants for strings --- internal/service/neptune/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/neptune/service_package_gen.go b/internal/service/neptune/service_package_gen.go index cb71b041191..60153f90d53 100644 --- a/internal/service/neptune/service_package_gen.go +++ b/internal/service/neptune/service_package_gen.go @@ -111,7 +111,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*neptune_sdkv1.Neptune, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return neptune_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 198bbb12c472b70983ed54decaa75682ae84b790 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:31 -0400 Subject: [PATCH 0798/1490] networkfirewall: Use constants for strings --- internal/service/networkfirewall/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/networkfirewall/service_package_gen.go b/internal/service/networkfirewall/service_package_gen.go index 346befbcd41..a6e3e9a249f 100644 --- a/internal/service/networkfirewall/service_package_gen.go +++ b/internal/service/networkfirewall/service_package_gen.go @@ -83,7 +83,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*networkfirewall_sdkv1.NetworkFirewall, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return networkfirewall_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From f30b3fccb7e7f477af8589c11fdaf696a38ad2df Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:31 -0400 Subject: [PATCH 0799/1490] networkmanager: Use constants for strings --- internal/service/networkmanager/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/networkmanager/service_package_gen.go b/internal/service/networkmanager/service_package_gen.go index cb2f2423cfd..0012e2cfa9e 100644 --- a/internal/service/networkmanager/service_package_gen.go +++ b/internal/service/networkmanager/service_package_gen.go @@ -203,7 +203,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*networkmanager_sdkv1.NetworkManager, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return networkmanager_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From c41218aa8ee20212e4e7664e0adfa1ad9714272a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:31 -0400 Subject: [PATCH 0800/1490] opensearch: Use constants for strings --- internal/service/opensearch/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/opensearch/service_package_gen.go b/internal/service/opensearch/service_package_gen.go index fbf9eb0a2bf..0335801181c 100644 --- a/internal/service/opensearch/service_package_gen.go +++ b/internal/service/opensearch/service_package_gen.go @@ -79,7 +79,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*opensearchservice_sdkv1.OpenSearchService, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return opensearchservice_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From eeb29a1d45ae63d4a1aa90111dc21ff6c6e1835a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:31 -0400 Subject: [PATCH 0801/1490] opsworks: Use constants for strings --- internal/service/opsworks/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/opsworks/service_package_gen.go b/internal/service/opsworks/service_package_gen.go index 22e96e8466a..293e01cd09d 100644 --- a/internal/service/opsworks/service_package_gen.go +++ b/internal/service/opsworks/service_package_gen.go @@ -152,7 +152,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*opsworks_sdkv1.OpsWorks, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return opsworks_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 5017961e77fc93ced1d174334c9616a7f4b0f5ba Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:31 -0400 Subject: [PATCH 0802/1490] organizations: Use constants for strings --- internal/service/organizations/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/organizations/service_package_gen.go b/internal/service/organizations/service_package_gen.go index 223eeafc09f..dd67f40e3c8 100644 --- a/internal/service/organizations/service_package_gen.go +++ b/internal/service/organizations/service_package_gen.go @@ -128,7 +128,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*organizations_sdkv1.Organizations, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return organizations_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From d4a5a924d8c84af8e664888032828e473f72198a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:32 -0400 Subject: [PATCH 0803/1490] outposts: Use constants for strings --- internal/service/outposts/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/outposts/service_package_gen.go b/internal/service/outposts/service_package_gen.go index dfaab3e6bbc..305e629fd6b 100644 --- a/internal/service/outposts/service_package_gen.go +++ b/internal/service/outposts/service_package_gen.go @@ -70,7 +70,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*outposts_sdkv1.Outposts, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return outposts_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 3565e35435be1b26dc6e48c8f30a8889e90ec0ce Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:32 -0400 Subject: [PATCH 0804/1490] pinpoint: Use constants for strings --- internal/service/pinpoint/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/pinpoint/service_package_gen.go b/internal/service/pinpoint/service_package_gen.go index eb26332bc91..1a9e8ddf3b7 100644 --- a/internal/service/pinpoint/service_package_gen.go +++ b/internal/service/pinpoint/service_package_gen.go @@ -86,7 +86,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*pinpoint_sdkv1.Pinpoint, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return pinpoint_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 73b9deac1127275e771a34ce962072bec3f6c680 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:32 -0400 Subject: [PATCH 0805/1490] quicksight: Use constants for strings --- internal/service/quicksight/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/quicksight/service_package_gen.go b/internal/service/quicksight/service_package_gen.go index fd5154881f9..dce1b21f6b1 100644 --- a/internal/service/quicksight/service_package_gen.go +++ b/internal/service/quicksight/service_package_gen.go @@ -170,7 +170,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*quicksight_sdkv1.QuickSight, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return quicksight_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From fa33c76eca4566eeccb44081307afc085bd77119 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:32 -0400 Subject: [PATCH 0806/1490] ram: Use constants for strings --- internal/service/ram/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ram/service_package_gen.go b/internal/service/ram/service_package_gen.go index 54e328b8f7b..80ca1a9a40e 100644 --- a/internal/service/ram/service_package_gen.go +++ b/internal/service/ram/service_package_gen.go @@ -73,7 +73,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ram_sdkv1.RAM, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return ram_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 1d0f058b70f35440406805717128ccc335ca7bbd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:32 -0400 Subject: [PATCH 0807/1490] rds: Use constants for strings --- internal/service/rds/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/rds/service_package_gen.go b/internal/service/rds/service_package_gen.go index 8f8beed1280..b9a32d93d79 100644 --- a/internal/service/rds/service_package_gen.go +++ b/internal/service/rds/service_package_gen.go @@ -267,7 +267,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*rds_sdkv1.RDS, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return rds_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 5ac04b94ad79bd7bd4e28388fb927df845591d1a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:32 -0400 Subject: [PATCH 0808/1490] redshift: Use constants for strings --- internal/service/redshift/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/redshift/service_package_gen.go b/internal/service/redshift/service_package_gen.go index a5d46cec940..94e2d574653 100644 --- a/internal/service/redshift/service_package_gen.go +++ b/internal/service/redshift/service_package_gen.go @@ -214,7 +214,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*redshift_sdkv1.Redshift, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return redshift_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From a04cf5b19166b7dc653228fccff915ec7a88d720 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:32 -0400 Subject: [PATCH 0809/1490] redshiftserverless: Use constants for strings --- internal/service/redshiftserverless/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/redshiftserverless/service_package_gen.go b/internal/service/redshiftserverless/service_package_gen.go index 58748a8387a..2299389f69b 100644 --- a/internal/service/redshiftserverless/service_package_gen.go +++ b/internal/service/redshiftserverless/service_package_gen.go @@ -97,7 +97,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*redshiftserverless_sdkv1.RedshiftServerless, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return redshiftserverless_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 01d6d04b8744b7875b5c867d6bb73179c10057ea Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:33 -0400 Subject: [PATCH 0810/1490] route53: Use constants for strings --- internal/service/route53/service_package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/route53/service_package.go b/internal/service/route53/service_package.go index c0a7636a96d..9fa349bc7a6 100644 --- a/internal/service/route53/service_package.go +++ b/internal/service/route53/service_package.go @@ -15,7 +15,7 @@ import ( // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, m map[string]any) (*route53_sdkv1.Route53, error) { - sess := m["session"].(*session_sdkv1.Session) + sess := m[names.AttrSession].(*session_sdkv1.Session) config := &aws_sdkv1.Config{Endpoint: aws_sdkv1.String(m[names.AttrEndpoint].(string))} // Force "global" services to correct Regions. From de1b43c692095ee2b55196e25a7f310ba50a1f3e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:33 -0400 Subject: [PATCH 0811/1490] route53recoverycontrolconfig: Use constants for strings --- .../service/route53recoverycontrolconfig/service_package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/route53recoverycontrolconfig/service_package.go b/internal/service/route53recoverycontrolconfig/service_package.go index 1bdd0178c4b..2e143c3e191 100644 --- a/internal/service/route53recoverycontrolconfig/service_package.go +++ b/internal/service/route53recoverycontrolconfig/service_package.go @@ -15,7 +15,7 @@ import ( // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, m map[string]any) (*route53recoverycontrolconfig_sdkv1.Route53RecoveryControlConfig, error) { - sess := m["session"].(*session_sdkv1.Session) + sess := m[names.AttrSession].(*session_sdkv1.Session) config := &aws_sdkv1.Config{Endpoint: aws_sdkv1.String(m[names.AttrEndpoint].(string))} // Force "global" services to correct Regions. From 9283e31d8d1f9ff082c0a137da6a47f5182e1953 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:33 -0400 Subject: [PATCH 0812/1490] route53recoveryreadiness: Use constants for strings --- internal/service/route53recoveryreadiness/service_package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/route53recoveryreadiness/service_package.go b/internal/service/route53recoveryreadiness/service_package.go index ce7b00b4e4e..dc3447b3cf6 100644 --- a/internal/service/route53recoveryreadiness/service_package.go +++ b/internal/service/route53recoveryreadiness/service_package.go @@ -15,7 +15,7 @@ import ( // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, m map[string]any) (*route53recoveryreadiness_sdkv1.Route53RecoveryReadiness, error) { - sess := m["session"].(*session_sdkv1.Session) + sess := m[names.AttrSession].(*session_sdkv1.Session) config := &aws_sdkv1.Config{Endpoint: aws_sdkv1.String(m[names.AttrEndpoint].(string))} // Force "global" services to correct Regions. From f25dab7eda7862908acb21dfdf579f152b8d6b0d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:33 -0400 Subject: [PATCH 0813/1490] route53resolver: Use constants for strings --- internal/service/route53resolver/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/route53resolver/service_package_gen.go b/internal/service/route53resolver/service_package_gen.go index fbb9f9d3d78..8bf3fad37ac 100644 --- a/internal/service/route53resolver/service_package_gen.go +++ b/internal/service/route53resolver/service_package_gen.go @@ -147,7 +147,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*route53resolver_sdkv1.Route53Resolver, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return route53resolver_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From c6a30270ec2c77fbe383e84c851442e5ac01ad04 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:33 -0400 Subject: [PATCH 0814/1490] rum: Use constants for strings --- internal/service/rum/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/rum/service_package_gen.go b/internal/service/rum/service_package_gen.go index 90594706c2c..145749360e3 100644 --- a/internal/service/rum/service_package_gen.go +++ b/internal/service/rum/service_package_gen.go @@ -50,7 +50,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*cloudwatchrum_sdkv1.CloudWatchRUM, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return cloudwatchrum_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 573c91df5bcd3093db53a14aec5ff089342b680f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:33 -0400 Subject: [PATCH 0815/1490] s3outposts: Use constants for strings --- internal/service/s3outposts/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/s3outposts/service_package_gen.go b/internal/service/s3outposts/service_package_gen.go index fe4136c59fa..2cac2ed0478 100644 --- a/internal/service/s3outposts/service_package_gen.go +++ b/internal/service/s3outposts/service_package_gen.go @@ -42,7 +42,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*s3outposts_sdkv1.S3Outposts, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return s3outposts_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 5a7be379ca1c5e21ce44c17bb4892dbbaefbbe4c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:33 -0400 Subject: [PATCH 0816/1490] sagemaker: Use constants for strings --- internal/service/sagemaker/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/sagemaker/service_package_gen.go b/internal/service/sagemaker/service_package_gen.go index d4471fdbc6a..3675238bd25 100644 --- a/internal/service/sagemaker/service_package_gen.go +++ b/internal/service/sagemaker/service_package_gen.go @@ -242,7 +242,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*sagemaker_sdkv1.SageMaker, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return sagemaker_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From fb3c8cf10c157df870a80d8e04857b7b94929539 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:33 -0400 Subject: [PATCH 0817/1490] schemas: Use constants for strings --- internal/service/schemas/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/schemas/service_package_gen.go b/internal/service/schemas/service_package_gen.go index 8ff26e78522..711f7520c16 100644 --- a/internal/service/schemas/service_package_gen.go +++ b/internal/service/schemas/service_package_gen.go @@ -66,7 +66,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*schemas_sdkv1.Schemas, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return schemas_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 51adef9f40b3a5a99a200ec4f28a31e7a2b71b88 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:34 -0400 Subject: [PATCH 0818/1490] serverlessrepo: Use constants for strings --- internal/service/serverlessrepo/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/serverlessrepo/service_package_gen.go b/internal/service/serverlessrepo/service_package_gen.go index b743a152a24..37c9e268bbd 100644 --- a/internal/service/serverlessrepo/service_package_gen.go +++ b/internal/service/serverlessrepo/service_package_gen.go @@ -49,7 +49,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*serverlessapplicationrepository_sdkv1.ServerlessApplicationRepository, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return serverlessapplicationrepository_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From bdfbef60f51d4b3aa43459b00bbed9cda812f4e5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:34 -0400 Subject: [PATCH 0819/1490] servicecatalog: Use constants for strings --- internal/service/servicecatalog/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/servicecatalog/service_package_gen.go b/internal/service/servicecatalog/service_package_gen.go index 902f4f3d4b7..85f08018b82 100644 --- a/internal/service/servicecatalog/service_package_gen.go +++ b/internal/service/servicecatalog/service_package_gen.go @@ -121,7 +121,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*servicecatalog_sdkv1.ServiceCatalog, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return servicecatalog_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From add5e7428acab3889b79eb78558691e69ec8dee2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:34 -0400 Subject: [PATCH 0820/1490] servicediscovery: Use constants for strings --- internal/service/servicediscovery/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/servicediscovery/service_package_gen.go b/internal/service/servicediscovery/service_package_gen.go index 2eec43776bc..ba588df064c 100644 --- a/internal/service/servicediscovery/service_package_gen.go +++ b/internal/service/servicediscovery/service_package_gen.go @@ -87,7 +87,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*servicediscovery_sdkv1.ServiceDiscovery, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return servicediscovery_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 6c050f02c2af42c39bf9b8b0449374a550ad864c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:34 -0400 Subject: [PATCH 0821/1490] ses: Use constants for strings --- internal/service/ses/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ses/service_package_gen.go b/internal/service/ses/service_package_gen.go index bdb9010445c..8417643c12f 100644 --- a/internal/service/ses/service_package_gen.go +++ b/internal/service/ses/service_package_gen.go @@ -107,7 +107,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ses_sdkv1.SES, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return ses_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From d70ec2b35bfae8c311c4773721c6ce41579099af Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:34 -0400 Subject: [PATCH 0822/1490] sfn: Use constants for strings --- internal/service/sfn/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/sfn/service_package_gen.go b/internal/service/sfn/service_package_gen.go index dd6bbbce419..6c38661bc0b 100644 --- a/internal/service/sfn/service_package_gen.go +++ b/internal/service/sfn/service_package_gen.go @@ -75,7 +75,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*sfn_sdkv1.SFN, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return sfn_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From c1afe395c71014c55b0d75609cea6b30616051e5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:34 -0400 Subject: [PATCH 0823/1490] simpledb: Use constants for strings --- internal/service/simpledb/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/simpledb/service_package_gen.go b/internal/service/simpledb/service_package_gen.go index 2a7372ac5db..ba3389d9227 100644 --- a/internal/service/simpledb/service_package_gen.go +++ b/internal/service/simpledb/service_package_gen.go @@ -41,7 +41,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*simpledb_sdkv1.SimpleDB, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return simpledb_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 78377d9b049db0d5de1829f9321aac0b9725930c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:34 -0400 Subject: [PATCH 0824/1490] ssm: Use constants for strings --- internal/service/ssm/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ssm/service_package_gen.go b/internal/service/ssm/service_package_gen.go index e162a6b740b..c57d9aee2b2 100644 --- a/internal/service/ssm/service_package_gen.go +++ b/internal/service/ssm/service_package_gen.go @@ -136,7 +136,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*ssm_sdkv1.SSM, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return ssm_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 18544e0bd77486cd28339156cf2cabcc4f6a39d7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:35 -0400 Subject: [PATCH 0825/1490] storagegateway: Use constants for strings --- internal/service/storagegateway/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/storagegateway/service_package_gen.go b/internal/service/storagegateway/service_package_gen.go index 1943022b7b6..9fc0d58525b 100644 --- a/internal/service/storagegateway/service_package_gen.go +++ b/internal/service/storagegateway/service_package_gen.go @@ -111,7 +111,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*storagegateway_sdkv1.StorageGateway, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return storagegateway_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 3a6d488e3b449d428e2647e4ccef7515f6c55010 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:35 -0400 Subject: [PATCH 0826/1490] transfer: Use constants for strings --- internal/service/transfer/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/transfer/service_package_gen.go b/internal/service/transfer/service_package_gen.go index ba957544356..8ec65be96c0 100644 --- a/internal/service/transfer/service_package_gen.go +++ b/internal/service/transfer/service_package_gen.go @@ -114,7 +114,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*transfer_sdkv1.Transfer, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return transfer_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From d8f31d842091c11f5375443954d139197772e18e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:35 -0400 Subject: [PATCH 0827/1490] waf: Use constants for strings --- internal/service/waf/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/waf/service_package_gen.go b/internal/service/waf/service_package_gen.go index 297cf9a4ff2..23c3824715c 100644 --- a/internal/service/waf/service_package_gen.go +++ b/internal/service/waf/service_package_gen.go @@ -123,7 +123,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*waf_sdkv1.WAF, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return waf_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From d32ced50aa0fef239c7fc0c41bca133c4966fc72 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:35 -0400 Subject: [PATCH 0828/1490] wafregional: Use constants for strings --- internal/service/wafregional/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/wafregional/service_package_gen.go b/internal/service/wafregional/service_package_gen.go index d08718fadea..1206bba45ea 100644 --- a/internal/service/wafregional/service_package_gen.go +++ b/internal/service/wafregional/service_package_gen.go @@ -141,7 +141,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*wafregional_sdkv1.WAFRegional, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return wafregional_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 71d211cfd5064d6f78214be187d240e599aba721 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:35 -0400 Subject: [PATCH 0829/1490] wafv2: Use constants for strings --- internal/service/wafv2/rule_group_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/wafv2/rule_group_test.go b/internal/service/wafv2/rule_group_test.go index 9ae17966215..22213f37f6b 100644 --- a/internal/service/wafv2/rule_group_test.go +++ b/internal/service/wafv2/rule_group_test.go @@ -627,7 +627,7 @@ func TestAccWAFV2RuleGroup_ByteMatchStatement_fieldToMatch(t *testing.T) { "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.#": "1", "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.all.#": "0", "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.included_headers.#": "2", - "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.included_headers.0": "session", + "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.included_headers.0": names.AttrSession, "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.included_headers.1": "session-id", "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.excluded_headers.#": "0", "statement.0.byte_match_statement.0.field_to_match.0.ja3_fingerprint.#": "0", @@ -660,7 +660,7 @@ func TestAccWAFV2RuleGroup_ByteMatchStatement_fieldToMatch(t *testing.T) { "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.#": "1", "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.all.#": "0", "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.excluded_headers.#": "2", - "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.excluded_headers.0": "session", + "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.excluded_headers.0": names.AttrSession, "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.excluded_headers.1": "session-id", "statement.0.byte_match_statement.0.field_to_match.0.headers.0.match_pattern.0.included_headers.#": "0", "statement.0.byte_match_statement.0.field_to_match.0.ja3_fingerprint.#": "0", From e330179936bc08100bb10debc465b41db7309fc5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:57:35 -0400 Subject: [PATCH 0830/1490] worklink: Use constants for strings --- internal/service/worklink/service_package_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/worklink/service_package_gen.go b/internal/service/worklink/service_package_gen.go index 3ad422ff67a..561f123becf 100644 --- a/internal/service/worklink/service_package_gen.go +++ b/internal/service/worklink/service_package_gen.go @@ -46,7 +46,7 @@ func (p *servicePackage) ServicePackageName() string { // NewConn returns a new AWS SDK for Go v1 client for this service package's AWS API. func (p *servicePackage) NewConn(ctx context.Context, config map[string]any) (*worklink_sdkv1.WorkLink, error) { - sess := config["session"].(*session_sdkv1.Session) + sess := config[names.AttrSession].(*session_sdkv1.Session) return worklink_sdkv1.New(sess.Copy(&aws_sdkv1.Config{Endpoint: aws_sdkv1.String(config[names.AttrEndpoint].(string))})), nil } From 10ff2e456ec0a4be5011c91ffe55a5fb33d9e9e4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 9 May 2024 16:59:44 -0400 Subject: [PATCH 0831/1490] yaml: Whitespace --- .ci/.semgrep.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 4177f9f9f90..fc6a85a688a 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1264,4 +1264,4 @@ rules: patterns: - pattern: '"session"' severity: ERROR - fix: "names.AttrSession" + fix: "names.AttrSession" From ef68be156e96070110f1d670b46ea7d841b31464 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Thu, 9 May 2024 15:20:23 -0400 Subject: [PATCH 0832/1490] r/aws_bedrockagent_agent(doc): document prepare_agent argument, cleanup --- website/docs/r/bedrockagent_agent.html.markdown | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/website/docs/r/bedrockagent_agent.html.markdown b/website/docs/r/bedrockagent_agent.html.markdown index af3d02568dc..20a68500717 100644 --- a/website/docs/r/bedrockagent_agent.html.markdown +++ b/website/docs/r/bedrockagent_agent.html.markdown @@ -80,7 +80,8 @@ The following arguments are optional: * `description` - (Optional) Description of the agent. * `idle_session_ttl_in_seconds` - (Optional) TTL in seconds for the agent to idle. * `instruction` - (Optional) Instructions to tell agent what it should do. -* `prompt_override_configuration` (Optional) Prompt Override Configuration +* `prepare_agent` (Optional) Whether or not to prepare the agent after creation or modification. Defaults to `true`. +* `prompt_override_configuration` (Optional) Prompt override configuration. * `tags` - (Optional) Key-value tags for the place index. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### prompt_override_configuration @@ -105,7 +106,7 @@ The following arguments are required: * `parser_mode` - (Required) DEFAULT or OVERRIDDEN to control if the `override_lambda` is used. * `prompt_creation_mode` - (Required) DEFAULT or OVERRIDDEN to control if the default or provided `base_prompt_template` is used, * `prompt_state` - (Required) ENABLED or DISABLED to allow the agent to carry out the step in `prompt_type`. -* `prompt_type` - (Required) The step this prompt applies to. PRE_PROCESSING | ORCHESTRATION | POST_PROCESSING | KNOWLEDGE_BASE_RESPONSE_GENERATION +* `prompt_type` - (Required) The step this prompt applies to. Valid values are `PRE_PROCESSING`, `ORCHESTRATION`, `POST_PROCESSING`, and `KNOWLEDGE_BASE_RESPONSE_GENERATION`. * `inference_configuration` - (Required) Configures inference for the agent ### inference_configuration @@ -126,6 +127,7 @@ This resource exports the following attributes in addition to the arguments abov * `agent_arn` - ARN of the Agent. * `agent_id` - ID of the Agent. +* `id` - ID of the Agent. * `agent_version` - Version of the Agent. ## Timeouts @@ -138,17 +140,17 @@ This resource exports the following attributes in addition to the arguments abov ## Import -In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Agents for Amazon Bedrock Agent using the `example_id_arg`. For example: +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Agents for Amazon Bedrock Agent using the `id`. For example: ```terraform import { to = aws_bedrockagent_agent.example - id = "abcdef1234" + id = "agent-abcd1234" } ``` -Using `terraform import`, import Agents for Amazon Bedrock Agent using the `abcdef1234`. For example: +Using `terraform import`, import Agents for Amazon Bedrock Agent using the `id`. For example: ```console -% terraform import aws_bedrockagent_agent.example abcdef1234 +% terraform import aws_bedrockagent_agent.example agent-abcd1234 ``` From aa32010c3a6e11f49fc7689bc13f2adbe52538ec Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Thu, 9 May 2024 15:40:21 -0400 Subject: [PATCH 0833/1490] r/aws_bedrockagent_agent: use configured `prepare_agent` value This changes removes logic in the read operation which adjusted the `prepare_agent` argument based on whether or not the agent status was `Prepared`. Now the configured `prepare_agent` value is always used, regardless of the status of the agent. If omitted, the default value of `true` is inherited, meaning that by default agents will always be prepared as part of the create or update operation. The `prepare_agent` value is now also set to `true` when an agent is imported. ```console % make testacc PKG=bedrockagent TESTS=TestAccBedrockAgentAgent_ ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.22.2 test ./internal/service/bedrockagent/... -v -count 1 -parallel 20 -run='TestAccBedrockAgentAgent_' -timeout 360m --- PASS: TestAccBedrockAgentAgent_basic (19.66s) --- PASS: TestAccBedrockAgentAgent_full (19.67s) --- PASS: TestAccBedrockAgentAgent_tags (35.51s) --- PASS: TestAccBedrockAgentAgent_update (37.46s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/bedrockagent 42.493s ``` --- .changelog/37405.txt | 3 +++ internal/service/bedrockagent/agent.go | 10 +++++++--- internal/service/bedrockagent/agent_test.go | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 .changelog/37405.txt diff --git a/.changelog/37405.txt b/.changelog/37405.txt new file mode 100644 index 00000000000..ef647d65c11 --- /dev/null +++ b/.changelog/37405.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_bedrockagent_agent: Fix to use the configured `prepare_agent` value (or default value of `true` when omitted) for all create and update operations +``` diff --git a/internal/service/bedrockagent/agent.go b/internal/service/bedrockagent/agent.go index d0518045612..152acf06537 100644 --- a/internal/service/bedrockagent/agent.go +++ b/internal/service/bedrockagent/agent.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault" @@ -55,7 +56,6 @@ func newAgentResource(context.Context) (resource.ResourceWithConfigure, error) { type agentResource struct { framework.ResourceWithConfigure - framework.WithImportByID framework.WithTimeouts } @@ -249,8 +249,6 @@ func (r *agentResource) Read(ctx context.Context, request resource.ReadRequest, return } - data.PrepareAgent = types.BoolValue(agent.AgentStatus == awstypes.AgentStatusPrepared) - response.Diagnostics.Append(response.State.Set(ctx, &data)...) } @@ -366,6 +364,12 @@ func (r *agentResource) Delete(ctx context.Context, request resource.DeleteReque } } +func (r *agentResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root(names.AttrID), req.ID)...) + // Set prepare_agent to default value on import + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("prepare_agent"), true)...) +} + func (r *agentResource) ModifyPlan(ctx context.Context, request resource.ModifyPlanRequest, response *resource.ModifyPlanResponse) { r.SetTagsAll(ctx, request, response) } diff --git a/internal/service/bedrockagent/agent_test.go b/internal/service/bedrockagent/agent_test.go index f44ca5e77f5..19975f58e3c 100644 --- a/internal/service/bedrockagent/agent_test.go +++ b/internal/service/bedrockagent/agent_test.go @@ -38,6 +38,7 @@ func TestAccBedrockAgentAgent_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "agent_name", rName), resource.TestCheckResourceAttr(resourceName, "prompt_override_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "basic claude"), + resource.TestCheckResourceAttr(resourceName, "prepare_agent", "true"), ), }, { From 5547244bd442dfe407ed988802b25234c27720ad Mon Sep 17 00:00:00 2001 From: changelogbot Date: Thu, 9 May 2024 23:05:33 +0000 Subject: [PATCH 0834/1490] Update CHANGELOG.md for #37405 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9fb58b34e0..dbbd3bb28ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ BUG FIXES: * data-source/aws_resourceexplorer2_search: Fix 401 unauthorized error due to missing `view_arn` in the AWS API request ([#36778](https://github.com/hashicorp/terraform-provider-aws/issues/36778)) * data-source/aws_resourceexplorer2_search: Fix panic caused by bad mappping between Terraform and AWS schemas ([#36778](https://github.com/hashicorp/terraform-provider-aws/issues/36778)) * data-source/aws_resourceexplorer2_search: Fix state persistence and data types ([#36778](https://github.com/hashicorp/terraform-provider-aws/issues/36778)) +* resource/aws_bedrockagent_agent: Fix to use the configured `prepare_agent` value (or default value of `true` when omitted) for all create and update operations ([#37405](https://github.com/hashicorp/terraform-provider-aws/issues/37405)) * resource/aws_elasticsearch_domain: Fix handling of unset `auto_tune_options.rollback_on_disable` argument ([#37394](https://github.com/hashicorp/terraform-provider-aws/issues/37394)) * resource/aws_fsx_ontap_storage_virtual_machine: Correctly set `tags` and `tags_all` on resource Read ([#37353](https://github.com/hashicorp/terraform-provider-aws/issues/37353)) * resource/aws_fsx_openzfs_file_system: Correctly set `tags` and `tags_all` on resource Read ([#37353](https://github.com/hashicorp/terraform-provider-aws/issues/37353)) From 706cb40410e57a51c081da5fde0bae6fa8692198 Mon Sep 17 00:00:00 2001 From: changelogbot Date: Fri, 10 May 2024 01:00:26 +0000 Subject: [PATCH 0835/1490] Update CHANGELOG.md after v5.49.0 --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbbd3bb28ee..b3eb8a0129a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ -## 5.49.0 (Unreleased) +## 5.50.0 (Unreleased) +## 5.49.0 (May 10, 2024) FEATURES: From cef813b7295b089f6ad4b4c0417e5be782d29ba2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:42 -0400 Subject: [PATCH 0836/1490] ci: Prefer constant for string literal "hosted_zone_id" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index fc6a85a688a..bfdc6eda1d1 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1265,3 +1265,13 @@ rules: - pattern: '"session"' severity: ERROR fix: "names.AttrSession" + - id: literal-hosted_zone_id-string-constant + languages: [go] + message: Use the constant `names.AttrHostedZoneID` for the string literal "hosted_zone_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"hosted_zone_id"' + severity: ERROR + fix: "names.AttrHostedZoneID" From 2f6164edd9c960f71f94afc77e22ce24c5a4d0bd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:43 -0400 Subject: [PATCH 0837/1490] names: Add constant for string literal "hosted_zone_id" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 09da975971e..025f9d30a54 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -23,6 +23,7 @@ const ( AttrEndpoint = "endpoint" AttrEndpoints = "endpoints" AttrEngineVersion = "engine_version" + AttrHostedZoneID = "hosted_zone_id" AttrID = "id" // Should be explicitly declared only for Framework resources AttrInstanceID = "instance_id" AttrInstanceType = "instance_type" From 79c686882eea7b6be7cfe963923a2c98d0bf4dd8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:43 -0400 Subject: [PATCH 0838/1490] apigatewayv2: Use constant for hosted_zone_id strings --- internal/service/apigatewayv2/domain_name.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/apigatewayv2/domain_name.go b/internal/service/apigatewayv2/domain_name.go index 4e273c79903..c31f3c00106 100644 --- a/internal/service/apigatewayv2/domain_name.go +++ b/internal/service/apigatewayv2/domain_name.go @@ -77,7 +77,7 @@ func resourceDomainName() *schema.Resource { Required: true, ValidateFunc: validation.StringInSlice(enum.Slice(awstypes.EndpointTypeRegional), true), }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -366,7 +366,7 @@ func flattenDomainNameConfiguration(apiObject awstypes.DomainNameConfiguration) tfMap["endpoint_type"] = string(apiObject.EndpointType) if v := apiObject.HostedZoneId; v != nil { - tfMap["hosted_zone_id"] = aws.ToString(v) + tfMap[names.AttrHostedZoneID] = aws.ToString(v) } tfMap["security_policy"] = string(apiObject.SecurityPolicy) From c27f5a9e9574db037035adea0bae2e50d64de4eb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:43 -0400 Subject: [PATCH 0839/1490] appsync: Use constant for hosted_zone_id strings --- internal/service/appsync/domain_name.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/appsync/domain_name.go b/internal/service/appsync/domain_name.go index 59305848fa7..94e103582b6 100644 --- a/internal/service/appsync/domain_name.go +++ b/internal/service/appsync/domain_name.go @@ -53,7 +53,7 @@ func ResourceDomainName() *schema.Resource { Required: true, ForceNew: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -99,7 +99,7 @@ func resourceDomainNameRead(ctx context.Context, d *schema.ResourceData, meta in d.Set(names.AttrDomainName, domainName.DomainName) d.Set(names.AttrDescription, domainName.Description) d.Set("certificate_arn", domainName.CertificateArn) - d.Set("hosted_zone_id", domainName.HostedZoneId) + d.Set(names.AttrHostedZoneID, domainName.HostedZoneId) d.Set("appsync_domain_name", domainName.AppsyncDomainName) return diags From abcd747ffae2e842d1af8bcf2cc19b06058b5883 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:43 -0400 Subject: [PATCH 0840/1490] cloudfront: Use constant for hosted_zone_id strings --- internal/service/cloudfront/distribution.go | 4 ++-- internal/service/cloudfront/distribution_data_source.go | 4 ++-- internal/service/cloudfront/distribution_data_source_test.go | 2 +- internal/service/cloudfront/distribution_test.go | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/cloudfront/distribution.go b/internal/service/cloudfront/distribution.go index 7049d8d5b85..7c7b7cb14fe 100644 --- a/internal/service/cloudfront/distribution.go +++ b/internal/service/cloudfront/distribution.go @@ -287,7 +287,7 @@ func resourceDistribution() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -923,7 +923,7 @@ func resourceDistributionRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrEnabled, distributionConfig.Enabled) d.Set("etag", output.ETag) d.Set("http_version", distributionConfig.HttpVersion) - d.Set("hosted_zone_id", meta.(*conns.AWSClient).CloudFrontDistributionHostedZoneID(ctx)) + d.Set(names.AttrHostedZoneID, meta.(*conns.AWSClient).CloudFrontDistributionHostedZoneID(ctx)) d.Set("in_progress_validation_batches", output.Distribution.InProgressInvalidationBatches) d.Set("is_ipv6_enabled", distributionConfig.IsIPV6Enabled) d.Set("last_modified_time", aws.String(output.Distribution.LastModifiedTime.String())) diff --git a/internal/service/cloudfront/distribution_data_source.go b/internal/service/cloudfront/distribution_data_source.go index 28fdd068e0e..3a0c04203d7 100644 --- a/internal/service/cloudfront/distribution_data_source.go +++ b/internal/service/cloudfront/distribution_data_source.go @@ -43,7 +43,7 @@ func dataSourceDistribution() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -93,7 +93,7 @@ func dataSourceDistributionRead(ctx context.Context, d *schema.ResourceData, met d.Set(names.AttrDomainName, distribution.DomainName) d.Set(names.AttrEnabled, distributionConfig.Enabled) d.Set("etag", output.ETag) - d.Set("hosted_zone_id", meta.(*conns.AWSClient).CloudFrontDistributionHostedZoneID(ctx)) + d.Set(names.AttrHostedZoneID, meta.(*conns.AWSClient).CloudFrontDistributionHostedZoneID(ctx)) d.Set("in_progress_validation_batches", distribution.InProgressInvalidationBatches) d.Set("last_modified_time", aws.String(distribution.LastModifiedTime.String())) d.Set(names.AttrStatus, distribution.Status) diff --git a/internal/service/cloudfront/distribution_data_source_test.go b/internal/service/cloudfront/distribution_data_source_test.go index 747a56e1581..70f066b938c 100644 --- a/internal/service/cloudfront/distribution_data_source_test.go +++ b/internal/service/cloudfront/distribution_data_source_test.go @@ -28,7 +28,7 @@ func TestAccCloudFrontDistributionDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDomainName, resourceName, names.AttrDomainName), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), - resource.TestCheckResourceAttrPair(dataSourceName, "hosted_zone_id", resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, "in_progress_validation_batches", resourceName, "in_progress_validation_batches"), resource.TestCheckResourceAttrPair(dataSourceName, "last_modified_time", resourceName, "last_modified_time"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrStatus, resourceName, names.AttrStatus), diff --git a/internal/service/cloudfront/distribution_test.go b/internal/service/cloudfront/distribution_test.go index 21326d1a279..a1a2d562a22 100644 --- a/internal/service/cloudfront/distribution_test.go +++ b/internal/service/cloudfront/distribution_test.go @@ -149,7 +149,7 @@ func TestAccCloudFrontDistribution_s3Origin(t *testing.T) { Config: testAccDistributionConfig_s3(rName), Check: resource.ComposeTestCheckFunc( testAccCheckDistributionExists(ctx, "aws_cloudfront_distribution.s3_distribution", &distribution), - resource.TestCheckResourceAttr("aws_cloudfront_distribution.s3_distribution", "hosted_zone_id", "Z2FDTNDATAQYW2"), + resource.TestCheckResourceAttr("aws_cloudfront_distribution.s3_distribution", names.AttrHostedZoneID, "Z2FDTNDATAQYW2"), ), }, { @@ -699,7 +699,7 @@ func TestAccCloudFrontDistribution_noOptionalItems(t *testing.T) { resource.TestMatchResourceAttr(resourceName, names.AttrDomainName, regexache.MustCompile(`^[0-9a-z]+\.cloudfront\.net$`)), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "true"), resource.TestMatchResourceAttr(resourceName, "etag", regexache.MustCompile(`^[0-9A-Z]+$`)), - resource.TestCheckResourceAttr(resourceName, "hosted_zone_id", "Z2FDTNDATAQYW2"), + resource.TestCheckResourceAttr(resourceName, names.AttrHostedZoneID, "Z2FDTNDATAQYW2"), resource.TestCheckResourceAttrSet(resourceName, "http_version"), resource.TestCheckResourceAttr(resourceName, "is_ipv6_enabled", "false"), resource.TestCheckResourceAttr(resourceName, "logging_config.#", "0"), From 5dd9a6fb1e863e7e67920a60ac2275645cfe45df Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:43 -0400 Subject: [PATCH 0841/1490] docdb: Use constant for hosted_zone_id strings --- internal/service/docdb/cluster.go | 4 ++-- internal/service/docdb/cluster_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/docdb/cluster.go b/internal/service/docdb/cluster.go index 15f7fad6c61..3ff6ccc78dd 100644 --- a/internal/service/docdb/cluster.go +++ b/internal/service/docdb/cluster.go @@ -171,7 +171,7 @@ func ResourceCluster() *schema.Resource { Optional: true, ValidateFunc: validGlobalCusterIdentifier, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -513,7 +513,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set(names.AttrEndpoint, dbc.Endpoint) d.Set(names.AttrEngineVersion, dbc.EngineVersion) d.Set("engine", dbc.Engine) - d.Set("hosted_zone_id", dbc.HostedZoneId) + d.Set(names.AttrHostedZoneID, dbc.HostedZoneId) d.Set(names.AttrKMSKeyID, dbc.KmsKeyId) d.Set("master_username", dbc.MasterUsername) d.Set(names.AttrPort, dbc.Port) diff --git a/internal/service/docdb/cluster_test.go b/internal/service/docdb/cluster_test.go index ce85507b604..e38ebe0b0d8 100644 --- a/internal/service/docdb/cluster_test.go +++ b/internal/service/docdb/cluster_test.go @@ -69,7 +69,7 @@ func TestAccDocDBCluster_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckNoResourceAttr(resourceName, "final_snapshot_identifier"), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", ""), - resource.TestCheckResourceAttrSet(resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "master_password", "avoid-plaintext-passwords"), resource.TestCheckResourceAttr(resourceName, "master_username", "tfacctest"), @@ -797,7 +797,7 @@ func TestAccDocDBCluster_updateEngineMajorVersion(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrEngineVersion, "4.0.0"), resource.TestCheckNoResourceAttr(resourceName, "final_snapshot_identifier"), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", ""), - resource.TestCheckResourceAttrSet(resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "master_password", "avoid-plaintext-passwords"), resource.TestCheckResourceAttr(resourceName, "master_username", "tfacctest"), From 464fad81003b0f39bfed5d6f34677bb4f957f450 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:43 -0400 Subject: [PATCH 0842/1490] ec2: Use constant for hosted_zone_id strings --- internal/service/ec2/vpc_endpoint.go | 4 ++-- internal/service/ec2/vpc_endpoint_data_source.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/ec2/vpc_endpoint.go b/internal/service/ec2/vpc_endpoint.go index d03220f308e..e6709086d26 100644 --- a/internal/service/ec2/vpc_endpoint.go +++ b/internal/service/ec2/vpc_endpoint.go @@ -71,7 +71,7 @@ func ResourceVPCEndpoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -542,7 +542,7 @@ func flattenDNSEntry(apiObject *ec2.DnsEntry) map[string]interface{} { } if v := apiObject.HostedZoneId; v != nil { - tfMap["hosted_zone_id"] = aws.StringValue(v) + tfMap[names.AttrHostedZoneID] = aws.StringValue(v) } return tfMap diff --git a/internal/service/ec2/vpc_endpoint_data_source.go b/internal/service/ec2/vpc_endpoint_data_source.go index 588ad9e7d68..5e34bc683c5 100644 --- a/internal/service/ec2/vpc_endpoint_data_source.go +++ b/internal/service/ec2/vpc_endpoint_data_source.go @@ -49,7 +49,7 @@ func DataSourceVPCEndpoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, From 6c957134360135b302571b29075df9586651c320 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:44 -0400 Subject: [PATCH 0843/1490] globalaccelerator: Use constant for hosted_zone_id strings --- internal/service/globalaccelerator/accelerator.go | 4 ++-- internal/service/globalaccelerator/accelerator_data_source.go | 2 +- .../service/globalaccelerator/accelerator_data_source_test.go | 4 ++-- internal/service/globalaccelerator/accelerator_test.go | 2 +- .../service/globalaccelerator/custom_routing_accelerator.go | 4 ++-- .../custom_routing_accelerator_data_source.go | 4 ++-- .../custom_routing_accelerator_data_source_test.go | 4 ++-- .../globalaccelerator/custom_routing_accelerator_test.go | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/globalaccelerator/accelerator.go b/internal/service/globalaccelerator/accelerator.go index a68af27a001..71f02796257 100644 --- a/internal/service/globalaccelerator/accelerator.go +++ b/internal/service/globalaccelerator/accelerator.go @@ -85,7 +85,7 @@ func resourceAccelerator() *schema.Resource { Optional: true, Default: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -205,7 +205,7 @@ func resourceAcceleratorRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("dns_name", accelerator.DnsName) d.Set("dual_stack_dns_name", accelerator.DualStackDnsName) d.Set(names.AttrEnabled, accelerator.Enabled) - d.Set("hosted_zone_id", meta.(*conns.AWSClient).GlobalAcceleratorHostedZoneID(ctx)) + d.Set(names.AttrHostedZoneID, meta.(*conns.AWSClient).GlobalAcceleratorHostedZoneID(ctx)) d.Set("ip_address_type", accelerator.IpAddressType) if err := d.Set("ip_sets", flattenIPSets(accelerator.IpSets)); err != nil { return sdkdiag.AppendErrorf(diags, "setting ip_sets: %s", err) diff --git a/internal/service/globalaccelerator/accelerator_data_source.go b/internal/service/globalaccelerator/accelerator_data_source.go index 50f78d9dcef..57ae310d8e9 100644 --- a/internal/service/globalaccelerator/accelerator_data_source.go +++ b/internal/service/globalaccelerator/accelerator_data_source.go @@ -62,7 +62,7 @@ func (d *acceleratorDataSource) Schema(ctx context.Context, request datasource.S names.AttrEnabled: schema.BoolAttribute{ Computed: true, }, - "hosted_zone_id": schema.StringAttribute{ + names.AttrHostedZoneID: schema.StringAttribute{ Computed: true, }, names.AttrID: schema.StringAttribute{ diff --git a/internal/service/globalaccelerator/accelerator_data_source_test.go b/internal/service/globalaccelerator/accelerator_data_source_test.go index 1ce8a8b4a5d..0ac4f6989ca 100644 --- a/internal/service/globalaccelerator/accelerator_data_source_test.go +++ b/internal/service/globalaccelerator/accelerator_data_source_test.go @@ -35,7 +35,7 @@ func TestAccGlobalAcceleratorAcceleratorDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSource1Name, "dns_name", resourceName, "dns_name"), resource.TestCheckResourceAttrPair(dataSource1Name, "dual_stack_dns_name", resourceName, "dual_stack_dns_name"), resource.TestCheckResourceAttrPair(dataSource1Name, names.AttrEnabled, resourceName, names.AttrEnabled), - resource.TestCheckResourceAttrPair(dataSource1Name, "hosted_zone_id", resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrPair(dataSource1Name, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSource1Name, "ip_address_type", resourceName, "ip_address_type"), resource.TestCheckResourceAttrPair(dataSource1Name, "ip_sets.#", resourceName, "ip_sets.#"), resource.TestCheckResourceAttrPair(dataSource1Name, "ip_sets.0.ip_addresses.#", resourceName, "ip_sets.0.ip_addresses.#"), @@ -52,7 +52,7 @@ func TestAccGlobalAcceleratorAcceleratorDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSource2Name, "dns_name", resourceName, "dns_name"), resource.TestCheckResourceAttrPair(dataSource2Name, "dual_stack_dns_name", resourceName, "dual_stack_dns_name"), resource.TestCheckResourceAttrPair(dataSource2Name, names.AttrEnabled, resourceName, names.AttrEnabled), - resource.TestCheckResourceAttrPair(dataSource2Name, "hosted_zone_id", resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrPair(dataSource2Name, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSource2Name, "ip_address_type", resourceName, "ip_address_type"), resource.TestCheckResourceAttrPair(dataSource2Name, "ip_sets.#", resourceName, "ip_sets.#"), resource.TestCheckResourceAttrPair(dataSource2Name, "ip_sets.0.ip_addresses.#", resourceName, "ip_sets.0.ip_addresses.#"), diff --git a/internal/service/globalaccelerator/accelerator_test.go b/internal/service/globalaccelerator/accelerator_test.go index c0b328effef..bbda1ffb4e0 100644 --- a/internal/service/globalaccelerator/accelerator_test.go +++ b/internal/service/globalaccelerator/accelerator_test.go @@ -48,7 +48,7 @@ func TestAccGlobalAcceleratorAccelerator_basic(t *testing.T) { resource.TestMatchResourceAttr(resourceName, "dns_name", dnsNameRegex), resource.TestCheckResourceAttr(resourceName, "dual_stack_dns_name", ""), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "true"), - resource.TestCheckResourceAttr(resourceName, "hosted_zone_id", "Z2BJ6XQ5FK7U4H"), + resource.TestCheckResourceAttr(resourceName, names.AttrHostedZoneID, "Z2BJ6XQ5FK7U4H"), resource.TestCheckResourceAttr(resourceName, "ip_address_type", "IPV4"), resource.TestCheckResourceAttr(resourceName, "ip_addresses.#", "0"), resource.TestCheckResourceAttr(resourceName, "ip_sets.#", "1"), diff --git a/internal/service/globalaccelerator/custom_routing_accelerator.go b/internal/service/globalaccelerator/custom_routing_accelerator.go index 6108d06f89c..d7f108a9f43 100644 --- a/internal/service/globalaccelerator/custom_routing_accelerator.go +++ b/internal/service/globalaccelerator/custom_routing_accelerator.go @@ -81,7 +81,7 @@ func resourceCustomRoutingAccelerator() *schema.Resource { Optional: true, Default: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -198,7 +198,7 @@ func resourceCustomRoutingAcceleratorRead(ctx context.Context, d *schema.Resourc d.Set("dns_name", accelerator.DnsName) d.Set(names.AttrEnabled, accelerator.Enabled) - d.Set("hosted_zone_id", meta.(*conns.AWSClient).GlobalAcceleratorHostedZoneID(ctx)) + d.Set(names.AttrHostedZoneID, meta.(*conns.AWSClient).GlobalAcceleratorHostedZoneID(ctx)) d.Set("ip_address_type", accelerator.IpAddressType) if err := d.Set("ip_sets", flattenIPSets(accelerator.IpSets)); err != nil { return sdkdiag.AppendErrorf(diags, "setting ip_sets: %s", err) diff --git a/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go b/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go index c6688341db7..1e6fe6612c8 100644 --- a/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go +++ b/internal/service/globalaccelerator/custom_routing_accelerator_data_source.go @@ -56,7 +56,7 @@ func dataSourceCustomRoutingAccelerator() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -127,7 +127,7 @@ func dataSourceCustomRoutingAcceleratorRead(ctx context.Context, d *schema.Resou d.Set(names.AttrARN, accelerator.AcceleratorArn) d.Set("dns_name", accelerator.DnsName) d.Set(names.AttrEnabled, accelerator.Enabled) - d.Set("hosted_zone_id", meta.(*conns.AWSClient).GlobalAcceleratorHostedZoneID(ctx)) + d.Set(names.AttrHostedZoneID, meta.(*conns.AWSClient).GlobalAcceleratorHostedZoneID(ctx)) d.Set("ip_address_type", accelerator.IpAddressType) if err := d.Set("ip_sets", flattenIPSets(accelerator.IpSets)); err != nil { return sdkdiag.AppendErrorf(diags, "setting ip_sets: %s", err) diff --git a/internal/service/globalaccelerator/custom_routing_accelerator_data_source_test.go b/internal/service/globalaccelerator/custom_routing_accelerator_data_source_test.go index 494db66dc2c..ba10dde45b8 100644 --- a/internal/service/globalaccelerator/custom_routing_accelerator_data_source_test.go +++ b/internal/service/globalaccelerator/custom_routing_accelerator_data_source_test.go @@ -31,7 +31,7 @@ func TestAccGlobalAcceleratorCustomRoutingAcceleratorDataSource_basic(t *testing resource.TestCheckResourceAttrPair(dataSource1Name, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSource1Name, names.AttrEnabled, resourceName, names.AttrEnabled), resource.TestCheckResourceAttrPair(dataSource1Name, "dns_name", resourceName, "dns_name"), - resource.TestCheckResourceAttrPair(dataSource1Name, "hosted_zone_id", resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrPair(dataSource1Name, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSource1Name, "ip_sets.#", resourceName, "ip_sets.#"), resource.TestCheckResourceAttrPair(dataSource1Name, "ip_sets.0.ip_addresses.#", resourceName, "ip_sets.0.ip_addresses.#"), resource.TestCheckResourceAttrPair(dataSource1Name, "ip_sets.0.ip_addresses.0", resourceName, "ip_sets.0.ip_addresses.0"), @@ -41,7 +41,7 @@ func TestAccGlobalAcceleratorCustomRoutingAcceleratorDataSource_basic(t *testing resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrEnabled, resourceName, names.AttrEnabled), resource.TestCheckResourceAttrPair(dataSourceName2, "dns_name", resourceName, "dns_name"), - resource.TestCheckResourceAttrPair(dataSourceName2, "hosted_zone_id", resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName2, "ip_sets.#", resourceName, "ip_sets.#"), resource.TestCheckResourceAttrPair(dataSourceName2, "ip_sets.0.ip_addresses.#", resourceName, "ip_sets.0.ip_addresses.#"), resource.TestCheckResourceAttrPair(dataSourceName2, "ip_sets.0.ip_addresses.0", resourceName, "ip_sets.0.ip_addresses.0"), diff --git a/internal/service/globalaccelerator/custom_routing_accelerator_test.go b/internal/service/globalaccelerator/custom_routing_accelerator_test.go index fdcc1275433..e773810d863 100644 --- a/internal/service/globalaccelerator/custom_routing_accelerator_test.go +++ b/internal/service/globalaccelerator/custom_routing_accelerator_test.go @@ -42,7 +42,7 @@ func TestAccGlobalAcceleratorCustomRoutingAccelerator_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "attributes.0.flow_logs_s3_prefix", ""), resource.TestMatchResourceAttr(resourceName, "dns_name", dnsNameRegex), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "true"), - resource.TestCheckResourceAttr(resourceName, "hosted_zone_id", "Z2BJ6XQ5FK7U4H"), + resource.TestCheckResourceAttr(resourceName, names.AttrHostedZoneID, "Z2BJ6XQ5FK7U4H"), resource.TestCheckResourceAttr(resourceName, "ip_address_type", "IPV4"), resource.TestCheckResourceAttr(resourceName, "ip_addresses.#", "0"), resource.TestCheckResourceAttr(resourceName, "ip_sets.#", "1"), From 16bde9818a063aea1b339b90a3245a9c74f45d3f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:44 -0400 Subject: [PATCH 0844/1490] neptune: Use constant for hosted_zone_id strings --- internal/service/neptune/cluster.go | 4 ++-- internal/service/neptune/cluster_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/neptune/cluster.go b/internal/service/neptune/cluster.go index 523cd51b76f..c7641f837c6 100644 --- a/internal/service/neptune/cluster.go +++ b/internal/service/neptune/cluster.go @@ -173,7 +173,7 @@ func ResourceCluster() *schema.Resource { Optional: true, ValidateFunc: validGlobalCusterIdentifier, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -551,7 +551,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set(names.AttrEndpoint, dbc.Endpoint) d.Set(names.AttrEngineVersion, dbc.EngineVersion) d.Set("engine", dbc.Engine) - d.Set("hosted_zone_id", dbc.HostedZoneId) + d.Set(names.AttrHostedZoneID, dbc.HostedZoneId) d.Set("iam_database_authentication_enabled", dbc.IAMDatabaseAuthenticationEnabled) var iamRoles []string for _, v := range dbc.AssociatedRoles { diff --git a/internal/service/neptune/cluster_test.go b/internal/service/neptune/cluster_test.go index dec8a59d336..23c520a1709 100644 --- a/internal/service/neptune/cluster_test.go +++ b/internal/service/neptune/cluster_test.go @@ -71,7 +71,7 @@ func TestAccNeptuneCluster_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckNoResourceAttr(resourceName, "final_snapshot_identifier"), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", ""), - resource.TestCheckResourceAttrSet(resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttr(resourceName, "iam_database_authentication_enabled", "false"), resource.TestCheckResourceAttr(resourceName, "iam_roles.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyARN, ""), From ceb9a53122874fa468f64a1da3188cf6b3450aeb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:44 -0400 Subject: [PATCH 0845/1490] rds: Use constant for hosted_zone_id strings --- internal/service/rds/cluster.go | 4 ++-- internal/service/rds/cluster_data_source.go | 4 ++-- internal/service/rds/cluster_data_source_test.go | 4 ++-- internal/service/rds/cluster_migrate.go | 2 +- internal/service/rds/cluster_test.go | 2 +- internal/service/rds/instance.go | 8 ++++---- internal/service/rds/instance_data_source.go | 6 +++--- internal/service/rds/instance_data_source_test.go | 6 +++--- internal/service/rds/instance_migrate.go | 6 +++--- internal/service/rds/instance_test.go | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/internal/service/rds/cluster.go b/internal/service/rds/cluster.go index ff9e78350c3..64020f658d7 100644 --- a/internal/service/rds/cluster.go +++ b/internal/service/rds/cluster.go @@ -257,7 +257,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -1207,7 +1207,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("engine", dbc.Engine) d.Set("engine_mode", dbc.EngineMode) clusterSetResourceDataEngineVersionFromCluster(d, dbc) - d.Set("hosted_zone_id", dbc.HostedZoneId) + d.Set(names.AttrHostedZoneID, dbc.HostedZoneId) d.Set("iam_database_authentication_enabled", dbc.IAMDatabaseAuthenticationEnabled) var iamRoleARNs []string for _, v := range dbc.AssociatedRoles { diff --git a/internal/service/rds/cluster_data_source.go b/internal/service/rds/cluster_data_source.go index c0ab010976f..b725126d8ee 100644 --- a/internal/service/rds/cluster_data_source.go +++ b/internal/service/rds/cluster_data_source.go @@ -92,7 +92,7 @@ func DataSourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -212,7 +212,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("engine", dbc.Engine) d.Set("engine_mode", dbc.EngineMode) d.Set(names.AttrEngineVersion, dbc.EngineVersion) - d.Set("hosted_zone_id", dbc.HostedZoneId) + d.Set(names.AttrHostedZoneID, dbc.HostedZoneId) d.Set("iam_database_authentication_enabled", dbc.IAMDatabaseAuthenticationEnabled) var iamRoleARNs []string for _, v := range dbc.AssociatedRoles { diff --git a/internal/service/rds/cluster_data_source_test.go b/internal/service/rds/cluster_data_source_test.go index 1de1325ddf3..125780d217a 100644 --- a/internal/service/rds/cluster_data_source_test.go +++ b/internal/service/rds/cluster_data_source_test.go @@ -37,7 +37,7 @@ func TestAccRDSClusterDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), resource.TestCheckResourceAttrPair(dataSourceName, "engine_mode", resourceName, "engine_mode"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngineVersion, resourceName, names.AttrEngineVersion), - resource.TestCheckResourceAttrPair(dataSourceName, "hosted_zone_id", resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, "master_username"), resource.TestCheckResourceAttrPair(dataSourceName, "network_type", resourceName, "network_type"), resource.TestCheckResourceAttrPair(dataSourceName, "tags.%", resourceName, "tags.%"), @@ -71,7 +71,7 @@ func TestAccRDSClusterDataSource_ManagedMasterPassword_managed(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), resource.TestCheckResourceAttrPair(dataSourceName, "engine_mode", resourceName, "engine_mode"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEngineVersion, resourceName, names.AttrEngineVersion), - resource.TestCheckResourceAttrPair(dataSourceName, "hosted_zone_id", resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, "master_username"), resource.TestCheckResourceAttrPair(dataSourceName, "master_user_secret.0.kms_key_id", resourceName, "master_user_secret.0.kms_key_id"), resource.TestCheckResourceAttrPair(dataSourceName, "master_user_secret.0.secret_arn", resourceName, "master_user_secret.0.secret_arn"), diff --git a/internal/service/rds/cluster_migrate.go b/internal/service/rds/cluster_migrate.go index 2e0a77bace4..ed1771e530d 100644 --- a/internal/service/rds/cluster_migrate.go +++ b/internal/service/rds/cluster_migrate.go @@ -162,7 +162,7 @@ func resourceClusterResourceV0() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/rds/cluster_test.go b/internal/service/rds/cluster_test.go index 0c8a63e17ee..6ae55ff4f28 100644 --- a/internal/service/rds/cluster_test.go +++ b/internal/service/rds/cluster_test.go @@ -90,7 +90,7 @@ func TestAccRDSCluster_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "engine", tfrds.ClusterEngineAuroraMySQL), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, "global_cluster_identifier", ""), - resource.TestCheckResourceAttrSet(resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttr(resourceName, "network_type", "IPV4"), resource.TestCheckResourceAttrSet(resourceName, "reader_endpoint"), resource.TestCheckResourceAttr(resourceName, "scaling_configuration.#", "0"), diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go index 8787f46f9e5..25be105dba7 100644 --- a/internal/service/rds/instance.go +++ b/internal/service/rds/instance.go @@ -325,7 +325,7 @@ func ResourceInstance() *schema.Resource { validation.StringDoesNotMatch(regexache.MustCompile(`-$`), "cannot end in a hyphen"), ), }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -381,7 +381,7 @@ func ResourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -1939,7 +1939,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte if v.Endpoint.Address != nil && v.Endpoint.Port != nil { d.Set(names.AttrEndpoint, fmt.Sprintf("%s:%d", aws.StringValue(v.Endpoint.Address), aws.Int64Value(v.Endpoint.Port))) } - d.Set("hosted_zone_id", v.Endpoint.HostedZoneId) + d.Set(names.AttrHostedZoneID, v.Endpoint.HostedZoneId) d.Set(names.AttrPort, v.Endpoint.Port) } @@ -3022,7 +3022,7 @@ func flattenEndpoint(apiObject *rds.Endpoint) map[string]interface{} { } if v := apiObject.HostedZoneId; v != nil { - tfMap["hosted_zone_id"] = aws.StringValue(v) + tfMap[names.AttrHostedZoneID] = aws.StringValue(v) } if v := apiObject.Port; v != nil { diff --git a/internal/service/rds/instance_data_source.go b/internal/service/rds/instance_data_source.go index 7375f9a1bd3..beea5284efe 100644 --- a/internal/service/rds/instance_data_source.go +++ b/internal/service/rds/instance_data_source.go @@ -100,7 +100,7 @@ func DataSourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -312,12 +312,12 @@ func dataSourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta in if dbEndpoint := instance.Endpoint; dbEndpoint != nil { d.Set("address", dbEndpoint.Address) d.Set(names.AttrEndpoint, fmt.Sprintf("%s:%d", aws.StringValue(dbEndpoint.Address), aws.Int64Value(dbEndpoint.Port))) - d.Set("hosted_zone_id", dbEndpoint.HostedZoneId) + d.Set(names.AttrHostedZoneID, dbEndpoint.HostedZoneId) d.Set(names.AttrPort, dbEndpoint.Port) } else { d.Set("address", nil) d.Set(names.AttrEndpoint, nil) - d.Set("hosted_zone_id", nil) + d.Set(names.AttrHostedZoneID, nil) d.Set(names.AttrPort, nil) } diff --git a/internal/service/rds/instance_data_source_test.go b/internal/service/rds/instance_data_source_test.go index 9087b5f483e..79cae0788ab 100644 --- a/internal/service/rds/instance_data_source_test.go +++ b/internal/service/rds/instance_data_source_test.go @@ -41,7 +41,7 @@ func TestAccRDSInstanceDataSource_basic(t *testing.T) { 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, "hosted_zone_id", resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, "iops", resourceName, "iops"), resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, "username"), resource.TestCheckResourceAttrPair(dataSourceName, "max_allocated_storage", resourceName, "max_allocated_storage"), @@ -85,7 +85,7 @@ func TestAccRDSInstanceDataSource_ManagedMasterPassword_managed(t *testing.T) { 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, "hosted_zone_id", resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, "iops", resourceName, "iops"), resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, "username"), resource.TestCheckResourceAttrPair(dataSourceName, "master_user_secret.0.kms_key_id", resourceName, "master_user_secret.0.kms_key_id"), @@ -132,7 +132,7 @@ func TestAccRDSInstanceDataSource_tags(t *testing.T) { 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, "hosted_zone_id", resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, "iops", resourceName, "iops"), resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, "username"), resource.TestCheckResourceAttrPair(dataSourceName, "max_allocated_storage", resourceName, "max_allocated_storage"), diff --git a/internal/service/rds/instance_migrate.go b/internal/service/rds/instance_migrate.go index f8b916d32a7..0441ce68490 100644 --- a/internal/service/rds/instance_migrate.go +++ b/internal/service/rds/instance_migrate.go @@ -266,7 +266,7 @@ func resourceInstanceResourceV0() *schema.Resource { Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -584,7 +584,7 @@ func resourceInstanceResourceV1() *schema.Resource { validation.StringDoesNotMatch(regexache.MustCompile(`-$`), "cannot end in a hyphen"), ), }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -640,7 +640,7 @@ func resourceInstanceResourceV1() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/rds/instance_test.go b/internal/service/rds/instance_test.go index e46a0384d8a..9835f535dd7 100644 --- a/internal/service/rds/instance_test.go +++ b/internal/service/rds/instance_test.go @@ -71,7 +71,7 @@ func TestAccRDSInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "engine", tfrds.InstanceEngineMySQL), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), - resource.TestCheckResourceAttrSet(resourceName, "hosted_zone_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttr(resourceName, "iam_database_authentication_enabled", "false"), resource.TestCheckResourceAttrPair(resourceName, names.AttrID, resourceName, "resource_id"), resource.TestCheckResourceAttr(resourceName, "identifier", rName), From c7152aa1ab7a4e9bc79026a17fb214c524511c49 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:45 -0400 Subject: [PATCH 0846/1490] route53: Use constant for hosted_zone_id strings --- internal/service/route53/hosted_zone_dnssec.go | 7 ++++--- .../service/route53/hosted_zone_dnssec_test.go | 2 +- internal/service/route53/key_signing_key.go | 16 ++++++++-------- internal/service/route53/key_signing_key_test.go | 2 +- internal/service/route53/sweep.go | 2 +- .../service/route53/traffic_policy_instance.go | 6 +++--- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/internal/service/route53/hosted_zone_dnssec.go b/internal/service/route53/hosted_zone_dnssec.go index ff63d07ea1e..4c90ec02d28 100644 --- a/internal/service/route53/hosted_zone_dnssec.go +++ b/internal/service/route53/hosted_zone_dnssec.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_route53_hosted_zone_dnssec") @@ -31,7 +32,7 @@ func ResourceHostedZoneDNSSEC() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -53,7 +54,7 @@ func resourceHostedZoneDNSSECCreate(ctx context.Context, d *schema.ResourceData, var diags diag.Diagnostics conn := meta.(*conns.AWSClient).Route53Conn(ctx) - hostedZoneID := d.Get("hosted_zone_id").(string) + hostedZoneID := d.Get(names.AttrHostedZoneID).(string) signingStatus := d.Get("signing_status").(string) d.SetId(hostedZoneID) @@ -110,7 +111,7 @@ func resourceHostedZoneDNSSECRead(ctx context.Context, d *schema.ResourceData, m return diags } - d.Set("hosted_zone_id", d.Id()) + d.Set(names.AttrHostedZoneID, d.Id()) if hostedZoneDnssec.Status != nil { d.Set("signing_status", hostedZoneDnssec.Status.ServeSignature) diff --git a/internal/service/route53/hosted_zone_dnssec_test.go b/internal/service/route53/hosted_zone_dnssec_test.go index ffb51f64a8b..97b5ea5969f 100644 --- a/internal/service/route53/hosted_zone_dnssec_test.go +++ b/internal/service/route53/hosted_zone_dnssec_test.go @@ -38,7 +38,7 @@ func TestAccRoute53HostedZoneDNSSEC_basic(t *testing.T) { Config: testAccHostedZoneDNSSECConfig_basic(rName, domainName), Check: resource.ComposeAggregateTestCheckFunc( testAccHostedZoneDNSSECExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "hosted_zone_id", route53ZoneResourceName, names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrHostedZoneID, route53ZoneResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, "signing_status", tfroute53.ServeSignatureSigning), ), }, diff --git a/internal/service/route53/key_signing_key.go b/internal/service/route53/key_signing_key.go index 060b0bfc1f8..828d358456c 100644 --- a/internal/service/route53/key_signing_key.go +++ b/internal/service/route53/key_signing_key.go @@ -58,7 +58,7 @@ func ResourceKeySigningKey() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -110,7 +110,7 @@ func resourceKeySigningKeyCreate(ctx context.Context, d *schema.ResourceData, me var diags diag.Diagnostics conn := meta.(*conns.AWSClient).Route53Conn(ctx) - hostedZoneID := d.Get("hosted_zone_id").(string) + hostedZoneID := d.Get(names.AttrHostedZoneID).(string) name := d.Get(names.AttrName).(string) status := d.Get(names.AttrStatus).(string) @@ -190,7 +190,7 @@ func resourceKeySigningKeyRead(ctx context.Context, d *schema.ResourceData, meta d.Set("dnskey_record", keySigningKey.DNSKEYRecord) d.Set("ds_record", keySigningKey.DSRecord) d.Set("flag", keySigningKey.Flag) - d.Set("hosted_zone_id", hostedZoneID) + d.Set(names.AttrHostedZoneID, hostedZoneID) d.Set("key_management_service_arn", keySigningKey.KmsArn) d.Set("key_tag", keySigningKey.KeyTag) d.Set(names.AttrName, keySigningKey.Name) @@ -214,7 +214,7 @@ func resourceKeySigningKeyUpdate(ctx context.Context, d *schema.ResourceData, me return sdkdiag.AppendErrorf(diags, "updating Route 53 Key Signing Key (%s) status: unknown status (%s)", d.Id(), status) case KeySigningKeyStatusActive: input := &route53.ActivateKeySigningKeyInput{ - HostedZoneId: aws.String(d.Get("hosted_zone_id").(string)), + HostedZoneId: aws.String(d.Get(names.AttrHostedZoneID).(string)), Name: aws.String(d.Get(names.AttrName).(string)), } @@ -231,7 +231,7 @@ func resourceKeySigningKeyUpdate(ctx context.Context, d *schema.ResourceData, me } case KeySigningKeyStatusInactive: input := &route53.DeactivateKeySigningKeyInput{ - HostedZoneId: aws.String(d.Get("hosted_zone_id").(string)), + HostedZoneId: aws.String(d.Get(names.AttrHostedZoneID).(string)), Name: aws.String(d.Get(names.AttrName).(string)), } @@ -248,7 +248,7 @@ func resourceKeySigningKeyUpdate(ctx context.Context, d *schema.ResourceData, me } } - if _, err := waitKeySigningKeyStatusUpdated(ctx, conn, d.Get("hosted_zone_id").(string), d.Get(names.AttrName).(string), status); err != nil { + if _, err := waitKeySigningKeyStatusUpdated(ctx, conn, d.Get(names.AttrHostedZoneID).(string), d.Get(names.AttrName).(string), status); err != nil { return sdkdiag.AppendErrorf(diags, "waiting for Route 53 Key Signing Key (%s) status (%s): %s", d.Id(), status, err) } } @@ -264,7 +264,7 @@ func resourceKeySigningKeyDelete(ctx context.Context, d *schema.ResourceData, me if status == KeySigningKeyStatusActive || status == KeySigningKeyStatusActionNeeded { input := &route53.DeactivateKeySigningKeyInput{ - HostedZoneId: aws.String(d.Get("hosted_zone_id").(string)), + HostedZoneId: aws.String(d.Get(names.AttrHostedZoneID).(string)), Name: aws.String(d.Get(names.AttrName).(string)), } @@ -282,7 +282,7 @@ func resourceKeySigningKeyDelete(ctx context.Context, d *schema.ResourceData, me } input := &route53.DeleteKeySigningKeyInput{ - HostedZoneId: aws.String(d.Get("hosted_zone_id").(string)), + HostedZoneId: aws.String(d.Get(names.AttrHostedZoneID).(string)), Name: aws.String(d.Get(names.AttrName).(string)), } diff --git a/internal/service/route53/key_signing_key_test.go b/internal/service/route53/key_signing_key_test.go index 26084b18ad4..55bfb61a007 100644 --- a/internal/service/route53/key_signing_key_test.go +++ b/internal/service/route53/key_signing_key_test.go @@ -47,7 +47,7 @@ func TestAccRoute53KeySigningKey_basic(t *testing.T) { resource.TestMatchResourceAttr(resourceName, "dnskey_record", regexache.MustCompile(`^257 [0-9]+ [0-9]+ [0-9A-Za-z+/]+={0,3}$`)), resource.TestMatchResourceAttr(resourceName, "ds_record", regexache.MustCompile(`^[0-9]+ [0-9]+ [0-9]+ [0-9A-F]+$`)), resource.TestCheckResourceAttr(resourceName, "flag", "257"), - resource.TestCheckResourceAttrPair(resourceName, "hosted_zone_id", route53ZoneResourceName, names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrHostedZoneID, route53ZoneResourceName, names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "key_management_service_arn", kmsKeyResourceName, names.AttrARN), resource.TestMatchResourceAttr(resourceName, "key_tag", regexache.MustCompile(`^[0-9]+$`)), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), diff --git a/internal/service/route53/sweep.go b/internal/service/route53/sweep.go index e886e924234..28f0d6bceb7 100644 --- a/internal/service/route53/sweep.go +++ b/internal/service/route53/sweep.go @@ -166,7 +166,7 @@ func sweepKeySigningKeys(region string) error { r := ResourceKeySigningKey() d := r.Data(nil) d.SetId(id) - d.Set("hosted_zone_id", id) + d.Set(names.AttrHostedZoneID, id) d.Set(names.AttrName, dns.Name) d.Set(names.AttrStatus, dns.Status) diff --git a/internal/service/route53/traffic_policy_instance.go b/internal/service/route53/traffic_policy_instance.go index ca55a3d6595..a52fc867362 100644 --- a/internal/service/route53/traffic_policy_instance.go +++ b/internal/service/route53/traffic_policy_instance.go @@ -32,7 +32,7 @@ func ResourceTrafficPolicyInstance() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -72,7 +72,7 @@ func resourceTrafficPolicyInstanceCreate(ctx context.Context, d *schema.Resource name := d.Get(names.AttrName).(string) input := &route53.CreateTrafficPolicyInstanceInput{ - HostedZoneId: aws.String(d.Get("hosted_zone_id").(string)), + HostedZoneId: aws.String(d.Get(names.AttrHostedZoneID).(string)), Name: aws.String(name), TrafficPolicyId: aws.String(d.Get("traffic_policy_id").(string)), TrafficPolicyVersion: aws.Int64(int64(d.Get("traffic_policy_version").(int))), @@ -112,7 +112,7 @@ func resourceTrafficPolicyInstanceRead(ctx context.Context, d *schema.ResourceDa return diag.Errorf("reading Route53 Traffic Policy Instance (%s): %s", d.Id(), err) } - d.Set("hosted_zone_id", trafficPolicyInstance.HostedZoneId) + d.Set(names.AttrHostedZoneID, trafficPolicyInstance.HostedZoneId) d.Set(names.AttrName, strings.TrimSuffix(aws.StringValue(trafficPolicyInstance.Name), ".")) d.Set("traffic_policy_id", trafficPolicyInstance.TrafficPolicyId) d.Set("traffic_policy_version", trafficPolicyInstance.TrafficPolicyVersion) From 2d4db8136014754c786a141e2f31b0869674ad4f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:45 -0400 Subject: [PATCH 0847/1490] s3: Use constant for hosted_zone_id strings --- internal/service/s3/bucket.go | 4 ++-- internal/service/s3/bucket_data_source.go | 4 ++-- internal/service/s3/bucket_data_source_test.go | 2 +- internal/service/s3/bucket_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index 6f89ca79b18..abd30b1347b 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -192,7 +192,7 @@ func resourceBucket() *schema.Resource { }, }, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -1132,7 +1132,7 @@ func resourceBucketRead(ctx context.Context, d *schema.ResourceData, meta interf if err != nil { log.Printf("[WARN] %s", err) } else { - d.Set("hosted_zone_id", hostedZoneID) + d.Set(names.AttrHostedZoneID, hostedZoneID) } if _, ok := d.GetOk("website"); ok { diff --git a/internal/service/s3/bucket_data_source.go b/internal/service/s3/bucket_data_source.go index b20a4d8ef67..10ceae523e1 100644 --- a/internal/service/s3/bucket_data_source.go +++ b/internal/service/s3/bucket_data_source.go @@ -39,7 +39,7 @@ func dataSourceBucket() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -96,7 +96,7 @@ func dataSourceBucketRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("bucket_domain_name", awsClient.PartitionHostname(ctx, bucket+".s3")) d.Set("bucket_regional_domain_name", bucketRegionalDomainName(bucket, region)) if hostedZoneID, err := hostedZoneIDForRegion(region); err == nil { - d.Set("hosted_zone_id", hostedZoneID) + d.Set(names.AttrHostedZoneID, hostedZoneID) } else { log.Printf("[WARN] HostedZoneIDForRegion: %s", err) } diff --git a/internal/service/s3/bucket_data_source_test.go b/internal/service/s3/bucket_data_source_test.go index c27f7ed4a90..44e3bdfddc7 100644 --- a/internal/service/s3/bucket_data_source_test.go +++ b/internal/service/s3/bucket_data_source_test.go @@ -34,7 +34,7 @@ func TestAccS3BucketDataSource_basic(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, names.AttrRegion, region), testAccCheckBucketDomainName(ctx, dataSourceName, "bucket_domain_name", rName), resource.TestCheckResourceAttr(dataSourceName, "bucket_regional_domain_name", testAccBucketRegionalDomainName(rName, region)), - resource.TestCheckResourceAttr(dataSourceName, "hosted_zone_id", hostedZoneID), + resource.TestCheckResourceAttr(dataSourceName, names.AttrHostedZoneID, hostedZoneID), resource.TestCheckNoResourceAttr(dataSourceName, "website_endpoint"), ), }, diff --git a/internal/service/s3/bucket_test.go b/internal/service/s3/bucket_test.go index 7f4b979f5f8..be48f0a9ca5 100644 --- a/internal/service/s3/bucket_test.go +++ b/internal/service/s3/bucket_test.go @@ -80,7 +80,7 @@ func TestAccS3Bucket_Basic_basic(t *testing.T) { names.AttrType: "CanonicalUser", "uri": "", }), - resource.TestCheckResourceAttr(resourceName, "hosted_zone_id", hostedZoneID), + resource.TestCheckResourceAttr(resourceName, names.AttrHostedZoneID, hostedZoneID), resource.TestCheckResourceAttr(resourceName, "lifecycle_rule.#", "0"), resource.TestCheckResourceAttr(resourceName, "logging.#", "0"), resource.TestCheckResourceAttr(resourceName, "object_lock_configuration.#", "0"), From 09f263e0a1d3c2786700b6b7b771df1145297da4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:41:45 -0400 Subject: [PATCH 0848/1490] vpclattice: Use constant for hosted_zone_id strings --- internal/service/vpclattice/service.go | 4 ++-- internal/service/vpclattice/service_data_source.go | 2 +- .../service/vpclattice/service_network_service_association.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/vpclattice/service.go b/internal/service/vpclattice/service.go index b881643f894..eff2f8945dd 100644 --- a/internal/service/vpclattice/service.go +++ b/internal/service/vpclattice/service.go @@ -77,7 +77,7 @@ func resourceService() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, @@ -343,7 +343,7 @@ func flattenDNSEntry(apiObject *types.DnsEntry) map[string]interface{} { } if v := apiObject.HostedZoneId; v != nil { - tfMap["hosted_zone_id"] = aws.ToString(v) + tfMap[names.AttrHostedZoneID] = aws.ToString(v) } return tfMap diff --git a/internal/service/vpclattice/service_data_source.go b/internal/service/vpclattice/service_data_source.go index 0bdc9591a6e..2a5230000a0 100644 --- a/internal/service/vpclattice/service_data_source.go +++ b/internal/service/vpclattice/service_data_source.go @@ -50,7 +50,7 @@ func dataSourceService() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/vpclattice/service_network_service_association.go b/internal/service/vpclattice/service_network_service_association.go index b1a5ae56efd..397c09c7404 100644 --- a/internal/service/vpclattice/service_network_service_association.go +++ b/internal/service/vpclattice/service_network_service_association.go @@ -67,7 +67,7 @@ func resourceServiceNetworkServiceAssociation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "hosted_zone_id": { + names.AttrHostedZoneID: { Type: schema.TypeString, Computed: true, }, From a5bd6a63ab38ede164776ffaf64156ee94236e5b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:44:38 -0400 Subject: [PATCH 0849/1490] ci: Prefer constant for string literal "device_name" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index bfdc6eda1d1..178bdbc3268 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1275,3 +1275,13 @@ rules: - pattern: '"hosted_zone_id"' severity: ERROR fix: "names.AttrHostedZoneID" + - id: literal-device_name-string-constant + languages: [go] + message: Use the constant `names.AttrDeviceName` for the string literal "device_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"device_name"' + severity: ERROR + fix: "names.AttrDeviceName" From 286b2dfc003303446b5431ed6f69caeebe7ffe0f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:44:38 -0400 Subject: [PATCH 0850/1490] names: Add constant for string literal "device_name" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 025f9d30a54..dd145c17590 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -18,6 +18,7 @@ const ( AttrDatabaseName = "database_name" AttrDeleteOnTermination = "delete_on_termination" AttrDescription = "description" + AttrDeviceName = "device_name" AttrDomainName = "domain_name" AttrEnabled = "enabled" AttrEndpoint = "endpoint" From b5d1ee834dc68f3fc2137666c453c710adead90a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:44:39 -0400 Subject: [PATCH 0851/1490] autoscaling: Use constant for device_name strings --- .../autoscaling/launch_configuration.go | 12 +++--- .../launch_configuration_data_source.go | 4 +- .../autoscaling/launch_configuration_test.go | 42 +++++++++---------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/internal/service/autoscaling/launch_configuration.go b/internal/service/autoscaling/launch_configuration.go index 5070e8bde4d..27623d775d3 100644 --- a/internal/service/autoscaling/launch_configuration.go +++ b/internal/service/autoscaling/launch_configuration.go @@ -66,7 +66,7 @@ func resourceLaunchConfiguration() *schema.Resource { Default: true, ForceNew: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -133,7 +133,7 @@ func resourceLaunchConfiguration() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -493,7 +493,7 @@ func resourceLaunchConfigurationRead(ctx context.Context, d *schema.ResourceData continue } - configuredEBSBlockDevices[tfMap["device_name"].(string)] = tfMap + configuredEBSBlockDevices[tfMap[names.AttrDeviceName].(string)] = tfMap } } @@ -540,7 +540,7 @@ func expandBlockDeviceMappingForEBSBlockDevice(tfMap map[string]interface{}) aws Ebs: &awstypes.Ebs{}, } - if v, ok := tfMap["device_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDeviceName].(string); ok && v != "" { apiObject.DeviceName = aws.String(v) } @@ -580,7 +580,7 @@ func expandBlockDeviceMappingForEBSBlockDevice(tfMap map[string]interface{}) aws func expandBlockDeviceMappingForEphemeralBlockDevice(tfMap map[string]interface{}) awstypes.BlockDeviceMapping { apiObject := awstypes.BlockDeviceMapping{} - if v, ok := tfMap["device_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDeviceName].(string); ok && v != "" { apiObject.DeviceName = aws.String(v) } @@ -700,7 +700,7 @@ func flattenBlockDeviceMappings(apiObjects []awstypes.BlockDeviceMapping, rootDe } if v := apiObject.DeviceName; v != nil { - tfMap["device_name"] = aws.ToString(v) + tfMap[names.AttrDeviceName] = aws.ToString(v) } if v := apiObject.VirtualName; v != nil { diff --git a/internal/service/autoscaling/launch_configuration_data_source.go b/internal/service/autoscaling/launch_configuration_data_source.go index c2d339f448b..8a94dddae34 100644 --- a/internal/service/autoscaling/launch_configuration_data_source.go +++ b/internal/service/autoscaling/launch_configuration_data_source.go @@ -36,7 +36,7 @@ func dataSourceLaunchConfiguration() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, @@ -84,7 +84,7 @@ func dataSourceLaunchConfiguration() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/autoscaling/launch_configuration_test.go b/internal/service/autoscaling/launch_configuration_test.go index 8d9b8715762..a5a47b1206b 100644 --- a/internal/service/autoscaling/launch_configuration_test.go +++ b/internal/service/autoscaling/launch_configuration_test.go @@ -167,19 +167,19 @@ func TestAccAutoScalingLaunchConfiguration_withBlockDevices(t *testing.T) { testAccCheckLaunchConfigurationExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sdb", - "volume_size": "9", + names.AttrDeviceName: "/dev/sdb", + "volume_size": "9", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sdc", - "iops": "100", - "volume_size": "10", - "volume_type": "io1", + names.AttrDeviceName: "/dev/sdc", + "iops": "100", + "volume_size": "10", + "volume_type": "io1", }), resource.TestCheckResourceAttr(resourceName, "ephemeral_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ephemeral_block_device.*", map[string]string{ - "device_name": "/dev/sde", - "virtual_name": "ephemeral0", + names.AttrDeviceName: "/dev/sde", + "virtual_name": "ephemeral0", }), resource.TestCheckResourceAttr(resourceName, "root_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "root_block_device.*", map[string]string{ @@ -375,11 +375,11 @@ func TestAccAutoScalingLaunchConfiguration_withGP3(t *testing.T) { testAccCheckLaunchConfigurationExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sdb", - "encrypted": "true", - "throughput": "150", - "volume_size": "9", - "volume_type": "gp3", + names.AttrDeviceName: "/dev/sdb", + "encrypted": "true", + "throughput": "150", + "volume_size": "9", + "volume_type": "gp3", }), resource.TestCheckResourceAttr(resourceName, "root_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "root_block_device.*", map[string]string{ @@ -415,9 +415,9 @@ func TestAccAutoScalingLaunchConfiguration_encryptedEBSBlockDevice(t *testing.T) testAccCheckLaunchConfigurationExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sdb", - "encrypted": "true", - "volume_size": "9", + names.AttrDeviceName: "/dev/sdb", + "encrypted": "true", + "volume_size": "9", }), resource.TestCheckResourceAttr(resourceName, "root_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "root_block_device.*", map[string]string{ @@ -437,9 +437,9 @@ func TestAccAutoScalingLaunchConfiguration_encryptedEBSBlockDevice(t *testing.T) testAccCheckLaunchConfigurationExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sdb", - "encrypted": "true", - "volume_size": "10", + names.AttrDeviceName: "/dev/sdb", + "encrypted": "true", + "volume_size": "10", }), resource.TestCheckResourceAttr(resourceName, "root_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "root_block_device.*", map[string]string{ @@ -501,8 +501,8 @@ func TestAccAutoScalingLaunchConfiguration_EBS_noDevice(t *testing.T) { testAccCheckLaunchConfigurationExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sda2", - "no_device": "true", + names.AttrDeviceName: "/dev/sda2", + "no_device": "true", }), ), }, From 899ea58233c646c170a7fe24ff6ce48fdfa66b57 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:44:39 -0400 Subject: [PATCH 0852/1490] ec2: Use constant for device_name strings --- internal/service/ec2/ebs_volume_attachment.go | 10 ++-- .../service/ec2/ebs_volume_attachment_test.go | 14 ++--- internal/service/ec2/ec2_ami.go | 16 ++--- internal/service/ec2/ec2_ami_copy.go | 8 +-- internal/service/ec2/ec2_ami_data_source.go | 8 +-- internal/service/ec2/ec2_ami_from_instance.go | 8 +-- internal/service/ec2/ec2_ami_test.go | 16 ++--- internal/service/ec2/ec2_instance.go | 18 +++--- .../service/ec2/ec2_instance_data_source.go | 8 +-- internal/service/ec2/ec2_instance_migrate.go | 4 +- internal/service/ec2/ec2_instance_test.go | 58 +++++++++---------- internal/service/ec2/ec2_launch_template.go | 6 +- .../ec2/ec2_launch_template_data_source.go | 2 +- .../service/ec2/ec2_spot_fleet_request.go | 16 ++--- .../ec2/ec2_spot_fleet_request_test.go | 10 ++-- .../service/ec2/vpnsite_customer_gateway.go | 6 +- .../vpnsite_customer_gateway_data_source.go | 4 +- ...nsite_customer_gateway_data_source_test.go | 4 +- .../ec2/vpnsite_customer_gateway_test.go | 4 +- 19 files changed, 110 insertions(+), 110 deletions(-) diff --git a/internal/service/ec2/ebs_volume_attachment.go b/internal/service/ec2/ebs_volume_attachment.go index 9b50490f75c..f50609e099f 100644 --- a/internal/service/ec2/ebs_volume_attachment.go +++ b/internal/service/ec2/ebs_volume_attachment.go @@ -48,7 +48,7 @@ func ResourceVolumeAttachment() *schema.Resource { volumeID := idParts[1] instanceID := idParts[2] d.SetId(volumeAttachmentID(deviceName, volumeID, instanceID)) - d.Set("device_name", deviceName) + d.Set(names.AttrDeviceName, deviceName) d.Set(names.AttrInstanceID, instanceID) d.Set("volume_id", volumeID) @@ -62,7 +62,7 @@ func ResourceVolumeAttachment() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -96,7 +96,7 @@ func ResourceVolumeAttachment() *schema.Resource { func resourceVolumeAttachmentCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics conn := meta.(*conns.AWSClient).EC2Client(ctx) - deviceName := d.Get("device_name").(string) + deviceName := d.Get(names.AttrDeviceName).(string) instanceID := d.Get(names.AttrInstanceID).(string) volumeID := d.Get("volume_id").(string) @@ -137,7 +137,7 @@ func resourceVolumeAttachmentCreate(ctx context.Context, d *schema.ResourceData, func resourceVolumeAttachmentRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics conn := meta.(*conns.AWSClient).EC2Client(ctx) - deviceName := d.Get("device_name").(string) + deviceName := d.Get(names.AttrDeviceName).(string) instanceID := d.Get(names.AttrInstanceID).(string) volumeID := d.Get("volume_id").(string) @@ -164,7 +164,7 @@ func resourceVolumeAttachmentDelete(ctx context.Context, d *schema.ResourceData, return diags } - deviceName := d.Get("device_name").(string) + deviceName := d.Get(names.AttrDeviceName).(string) instanceID := d.Get(names.AttrInstanceID).(string) volumeID := d.Get("volume_id").(string) diff --git a/internal/service/ec2/ebs_volume_attachment_test.go b/internal/service/ec2/ebs_volume_attachment_test.go index 237440e6c35..e02b164056e 100644 --- a/internal/service/ec2/ebs_volume_attachment_test.go +++ b/internal/service/ec2/ebs_volume_attachment_test.go @@ -36,7 +36,7 @@ func TestAccEC2EBSVolumeAttachment_basic(t *testing.T) { Config: testAccEBSVolumeAttachmentConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckVolumeAttachmentExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "device_name", "/dev/sdh"), + resource.TestCheckResourceAttr(resourceName, names.AttrDeviceName, "/dev/sdh"), ), }, { @@ -64,7 +64,7 @@ func TestAccEC2EBSVolumeAttachment_skipDestroy(t *testing.T) { Config: testAccEBSVolumeAttachmentConfig_skipDestroy(rName), Check: resource.ComposeTestCheckFunc( testAccCheckVolumeAttachmentExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "device_name", "/dev/sdh"), + resource.TestCheckResourceAttr(resourceName, names.AttrDeviceName, "/dev/sdh"), ), }, { @@ -113,7 +113,7 @@ func TestAccEC2EBSVolumeAttachment_attachStopped(t *testing.T) { Config: testAccEBSVolumeAttachmentConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckVolumeAttachmentExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "device_name", "/dev/sdh"), + resource.TestCheckResourceAttr(resourceName, names.AttrDeviceName, "/dev/sdh"), ), }, { @@ -217,7 +217,7 @@ func TestAccEC2EBSVolumeAttachment_stopInstance(t *testing.T) { Config: testAccEBSVolumeAttachmentConfig_stopInstance(rName), Check: resource.ComposeTestCheckFunc( testAccCheckVolumeAttachmentExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "device_name", "/dev/sdh"), + resource.TestCheckResourceAttr(resourceName, names.AttrDeviceName, "/dev/sdh"), ), }, { @@ -246,7 +246,7 @@ func testAccCheckVolumeAttachmentExists(ctx context.Context, n string) resource. conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Client(ctx) - _, err := tfec2.FindEBSVolumeAttachment(ctx, conn, rs.Primary.Attributes["volume_id"], rs.Primary.Attributes[names.AttrInstanceID], rs.Primary.Attributes["device_name"]) + _, err := tfec2.FindEBSVolumeAttachment(ctx, conn, rs.Primary.Attributes["volume_id"], rs.Primary.Attributes[names.AttrInstanceID], rs.Primary.Attributes[names.AttrDeviceName]) return err } @@ -286,7 +286,7 @@ func testAccCheckVolumeAttachmentDestroy(ctx context.Context) resource.TestCheck continue } - _, err := tfec2.FindEBSVolumeAttachment(ctx, conn, rs.Primary.Attributes["volume_id"], rs.Primary.Attributes[names.AttrInstanceID], rs.Primary.Attributes["device_name"]) + _, err := tfec2.FindEBSVolumeAttachment(ctx, conn, rs.Primary.Attributes["volume_id"], rs.Primary.Attributes[names.AttrInstanceID], rs.Primary.Attributes[names.AttrDeviceName]) if tfresource.NotFound(err) { continue @@ -410,6 +410,6 @@ func testAccVolumeAttachmentImportStateIDFunc(resourceName string) resource.Impo if !ok { return "", fmt.Errorf("Not found: %s", resourceName) } - return fmt.Sprintf("%s:%s:%s", rs.Primary.Attributes["device_name"], rs.Primary.Attributes["volume_id"], rs.Primary.Attributes[names.AttrInstanceID]), nil + return fmt.Sprintf("%s:%s:%s", rs.Primary.Attributes[names.AttrDeviceName], rs.Primary.Attributes["volume_id"], rs.Primary.Attributes[names.AttrInstanceID]), nil } } diff --git a/internal/service/ec2/ec2_ami.go b/internal/service/ec2/ec2_ami.go index 39e9b566a4f..4ea36a5a3a2 100644 --- a/internal/service/ec2/ec2_ami.go +++ b/internal/service/ec2/ec2_ami.go @@ -103,7 +103,7 @@ func ResourceAMI() *schema.Resource { Default: true, ForceNew: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -153,7 +153,7 @@ func ResourceAMI() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["snapshot_id"].(string))) return create.StringHashcode(buf.String()) }, @@ -170,7 +170,7 @@ func ResourceAMI() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, }, @@ -183,7 +183,7 @@ func ResourceAMI() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["virtual_name"].(string))) return create.StringHashcode(buf.String()) }, @@ -614,7 +614,7 @@ func expandBlockDeviceMappingForAMIEBSBlockDevice(tfMap map[string]interface{}) apiObject.Ebs.DeleteOnTermination = aws.Bool(v) } - if v, ok := tfMap["device_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDeviceName].(string); ok && v != "" { apiObject.DeviceName = aws.String(v) } @@ -690,7 +690,7 @@ func flattenBlockDeviceMappingForAMIEBSBlockDevice(apiObject *ec2.BlockDeviceMap } if v := apiObject.DeviceName; v != nil { - tfMap["device_name"] = aws.StringValue(v) + tfMap[names.AttrDeviceName] = aws.StringValue(v) } if v := apiObject.Ebs.Encrypted; v != nil { @@ -753,7 +753,7 @@ func expandBlockDeviceMappingForAMIEphemeralBlockDevice(tfMap map[string]interfa apiObject := &ec2.BlockDeviceMapping{} - if v, ok := tfMap["device_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDeviceName].(string); ok && v != "" { apiObject.DeviceName = aws.String(v) } @@ -798,7 +798,7 @@ func flattenBlockDeviceMappingForAMIEphemeralBlockDevice(apiObject *ec2.BlockDev tfMap := map[string]interface{}{} if v := apiObject.DeviceName; v != nil { - tfMap["device_name"] = aws.StringValue(v) + tfMap[names.AttrDeviceName] = aws.StringValue(v) } if v := apiObject.VirtualName; v != nil { diff --git a/internal/service/ec2/ec2_ami_copy.go b/internal/service/ec2/ec2_ami_copy.go index 4d7141fe75d..7f308a448db 100644 --- a/internal/service/ec2/ec2_ami_copy.go +++ b/internal/service/ec2/ec2_ami_copy.go @@ -86,7 +86,7 @@ func ResourceAMICopy() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, @@ -123,7 +123,7 @@ func ResourceAMICopy() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["snapshot_id"].(string))) return create.StringHashcode(buf.String()) }, @@ -145,7 +145,7 @@ func ResourceAMICopy() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, @@ -158,7 +158,7 @@ func ResourceAMICopy() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["virtual_name"].(string))) return create.StringHashcode(buf.String()) }, diff --git a/internal/service/ec2/ec2_ami_data_source.go b/internal/service/ec2/ec2_ami_data_source.go index f325debdd36..cfa188b9f47 100644 --- a/internal/service/ec2/ec2_ami_data_source.go +++ b/internal/service/ec2/ec2_ami_data_source.go @@ -50,7 +50,7 @@ func DataSourceAMI() *schema.Resource { Set: amiBlockDeviceMappingHash, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, @@ -355,8 +355,8 @@ func flattenAMIBlockDeviceMappings(m []*ec2.BlockDeviceMapping) *schema.Set { } for _, v := range m { mapping := map[string]interface{}{ - "device_name": aws.StringValue(v.DeviceName), - "virtual_name": aws.StringValue(v.VirtualName), + names.AttrDeviceName: aws.StringValue(v.DeviceName), + "virtual_name": aws.StringValue(v.VirtualName), } if v.Ebs != nil { @@ -425,7 +425,7 @@ func amiBlockDeviceMappingHash(v interface{}) int { var buf bytes.Buffer // All keys added in alphabetical order. m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) if d, ok := m["ebs"]; ok { if len(d.(map[string]interface{})) > 0 { e := d.(map[string]interface{}) diff --git a/internal/service/ec2/ec2_ami_from_instance.go b/internal/service/ec2/ec2_ami_from_instance.go index d64a70e78c8..73169e49fc1 100644 --- a/internal/service/ec2/ec2_ami_from_instance.go +++ b/internal/service/ec2/ec2_ami_from_instance.go @@ -80,7 +80,7 @@ func ResourceAMIFromInstance() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, @@ -117,7 +117,7 @@ func ResourceAMIFromInstance() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["snapshot_id"].(string))) return create.StringHashcode(buf.String()) }, @@ -133,7 +133,7 @@ func ResourceAMIFromInstance() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, @@ -146,7 +146,7 @@ func ResourceAMIFromInstance() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["virtual_name"].(string))) return create.StringHashcode(buf.String()) }, diff --git a/internal/service/ec2/ec2_ami_test.go b/internal/service/ec2/ec2_ami_test.go index b19f61345ad..13075fc1398 100644 --- a/internal/service/ec2/ec2_ami_test.go +++ b/internal/service/ec2/ec2_ami_test.go @@ -44,7 +44,7 @@ func TestAccEC2AMI_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", - "device_name": "/dev/sda1", + names.AttrDeviceName: "/dev/sda1", "encrypted": "false", "iops": "0", "throughput": "0", @@ -242,7 +242,7 @@ func TestAccEC2AMI_ephemeralBlockDevices(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", - "device_name": "/dev/sda1", + names.AttrDeviceName: "/dev/sda1", "encrypted": "false", "iops": "0", "throughput": "0", @@ -253,12 +253,12 @@ func TestAccEC2AMI_ephemeralBlockDevices(t *testing.T) { resource.TestCheckTypeSetElemAttrPair(resourceName, "ebs_block_device.*.snapshot_id", snapshotResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, "ena_support", "true"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ephemeral_block_device.*", map[string]string{ - "device_name": "/dev/sdb", - "virtual_name": "ephemeral0", + names.AttrDeviceName: "/dev/sdb", + "virtual_name": "ephemeral0", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ephemeral_block_device.*", map[string]string{ - "device_name": "/dev/sdc", - "virtual_name": "ephemeral1", + names.AttrDeviceName: "/dev/sdc", + "virtual_name": "ephemeral1", }), resource.TestCheckResourceAttr(resourceName, "kernel_id", ""), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -306,7 +306,7 @@ func TestAccEC2AMI_gp3BlockDevice(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", - "device_name": "/dev/sda1", + names.AttrDeviceName: "/dev/sda1", "encrypted": "false", "iops": "0", "throughput": "0", @@ -317,7 +317,7 @@ func TestAccEC2AMI_gp3BlockDevice(t *testing.T) { resource.TestCheckTypeSetElemAttrPair(resourceName, "ebs_block_device.*.snapshot_id", snapshotResourceName, names.AttrID), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "false", - "device_name": "/dev/sdb", + names.AttrDeviceName: "/dev/sdb", "encrypted": "true", "iops": "100", "throughput": "500", diff --git a/internal/service/ec2/ec2_instance.go b/internal/service/ec2/ec2_instance.go index 78edc53e285..84b609b4e48 100644 --- a/internal/service/ec2/ec2_instance.go +++ b/internal/service/ec2/ec2_instance.go @@ -236,7 +236,7 @@ func ResourceInstance() *schema.Resource { Default: true, ForceNew: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -297,7 +297,7 @@ func ResourceInstance() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["snapshot_id"].(string))) return create.StringHashcode(buf.String()) }, @@ -331,7 +331,7 @@ func ResourceInstance() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, }, @@ -348,7 +348,7 @@ func ResourceInstance() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["virtual_name"].(string))) if v, ok := m["no_device"].(bool); ok && v { buf.WriteString(fmt.Sprintf("%t-", v)) @@ -698,7 +698,7 @@ func ResourceInstance() *schema.Resource { Optional: true, Default: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, @@ -1092,7 +1092,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in continue } - volID := getVolIDByDeviceName(instance, bd["device_name"].(string)) + volID := getVolIDByDeviceName(instance, bd[names.AttrDeviceName].(string)) if volID == "" { continue } @@ -2351,7 +2351,7 @@ func readBlockDevicesFromInstance(ctx context.Context, d *schema.ResourceData, m bd["throughput"] = aws.Int64Value(vol.Throughput) } if instanceBd.DeviceName != nil { - bd["device_name"] = aws.StringValue(instanceBd.DeviceName) + bd[names.AttrDeviceName] = aws.StringValue(instanceBd.DeviceName) } if v, ok := d.GetOk("volume_tags"); !ok || v == nil || len(v.(map[string]interface{})) == 0 { if ds { @@ -2597,7 +2597,7 @@ func readBlockDeviceMappingsFromConfig(ctx context.Context, d *schema.ResourceDa } blockDevices = append(blockDevices, &ec2.BlockDeviceMapping{ - DeviceName: aws.String(bd["device_name"].(string)), + DeviceName: aws.String(bd[names.AttrDeviceName].(string)), Ebs: ebs, }) } @@ -2608,7 +2608,7 @@ func readBlockDeviceMappingsFromConfig(ctx context.Context, d *schema.ResourceDa for _, v := range vL { bd := v.(map[string]interface{}) bdm := &ec2.BlockDeviceMapping{ - DeviceName: aws.String(bd["device_name"].(string)), + DeviceName: aws.String(bd[names.AttrDeviceName].(string)), VirtualName: aws.String(bd["virtual_name"].(string)), } if v, ok := bd["no_device"].(bool); ok && v { diff --git a/internal/service/ec2/ec2_instance_data_source.go b/internal/service/ec2/ec2_instance_data_source.go index 789a2df1a65..a2c8de2042a 100644 --- a/internal/service/ec2/ec2_instance_data_source.go +++ b/internal/service/ec2/ec2_instance_data_source.go @@ -79,7 +79,7 @@ func DataSourceInstance() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, @@ -122,7 +122,7 @@ func DataSourceInstance() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["snapshot_id"].(string))) return create.StringHashcode(buf.String()) }, @@ -148,7 +148,7 @@ func DataSourceInstance() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, }, @@ -317,7 +317,7 @@ func DataSourceInstance() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/ec2/ec2_instance_migrate.go b/internal/service/ec2/ec2_instance_migrate.go index 180682516f8..811972f06d6 100644 --- a/internal/service/ec2/ec2_instance_migrate.go +++ b/internal/service/ec2/ec2_instance_migrate.go @@ -79,11 +79,11 @@ func ReadV0BlockDevices(is *terraform.InstanceState) (map[string]map[string]stri func WriteV1BlockDevice( is *terraform.InstanceState, oldBd map[string]string) { - code := create.StringHashcode(oldBd["device_name"]) + code := create.StringHashcode(oldBd[names.AttrDeviceName]) bdType := "ebs_block_device" if vn, ok := oldBd["virtual_name"]; ok && strings.HasPrefix(vn, "ephemeral") { bdType = "ephemeral_block_device" - } else if dn, ok := oldBd["device_name"]; ok && dn == "/dev/sda1" { + } else if dn, ok := oldBd[names.AttrDeviceName]; ok && dn == "/dev/sda1" { bdType = "root_block_device" } diff --git a/internal/service/ec2/ec2_instance_test.go b/internal/service/ec2/ec2_instance_test.go index 783ca5dac8c..4cbf2c201ef 100644 --- a/internal/service/ec2/ec2_instance_test.go +++ b/internal/service/ec2/ec2_instance_test.go @@ -789,47 +789,47 @@ func TestAccEC2Instance_blockDevices(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "root_block_device.0.volume_type", "gp2"), resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "5"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sdb", - "volume_size": "9", - "volume_type": "gp2", + names.AttrDeviceName: "/dev/sdb", + "volume_size": "9", + "volume_type": "gp2", }), resource.TestMatchTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]*regexp.Regexp{ "volume_id": regexache.MustCompile("vol-[0-9a-z]+"), }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sdc", - "volume_size": "10", - "volume_type": "io1", - "iops": "100", + names.AttrDeviceName: "/dev/sdc", + "volume_size": "10", + "volume_type": "io1", + "iops": "100", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sdf", - "volume_size": "10", - "volume_type": "gp3", - "throughput": "300", + names.AttrDeviceName: "/dev/sdf", + "volume_size": "10", + "volume_type": "gp3", + "throughput": "300", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sdg", - "volume_size": "10", - "volume_type": "gp3", - "throughput": "300", - "iops": "4000", + names.AttrDeviceName: "/dev/sdg", + "volume_size": "10", + "volume_type": "gp3", + "throughput": "300", + "iops": "4000", }), resource.TestMatchTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]*regexp.Regexp{ "volume_id": regexache.MustCompile("vol-[0-9a-z]+"), }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "device_name": "/dev/sdd", - "encrypted": "true", - "volume_size": "12", + names.AttrDeviceName: "/dev/sdd", + "encrypted": "true", + "volume_size": "12", }), resource.TestMatchTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]*regexp.Regexp{ "volume_id": regexache.MustCompile("vol-[0-9a-z]+"), }), resource.TestCheckResourceAttr(resourceName, "ephemeral_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ephemeral_block_device.*", map[string]string{ - "device_name": "/dev/sde", - "virtual_name": "ephemeral0", + names.AttrDeviceName: "/dev/sde", + "virtual_name": "ephemeral0", }), testCheck(), ), @@ -924,12 +924,12 @@ func TestAccEC2Instance_noAMIEphemeralDevices(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "0"), resource.TestCheckResourceAttr(resourceName, "ephemeral_block_device.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ephemeral_block_device.*", map[string]string{ - "device_name": "/dev/sdb", - "no_device": "true", + names.AttrDeviceName: "/dev/sdb", + "no_device": "true", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ephemeral_block_device.*", map[string]string{ - "device_name": "/dev/sdc", - "no_device": "true", + names.AttrDeviceName: "/dev/sdc", + "no_device": "true", }), testCheck(), ), @@ -2868,7 +2868,7 @@ func TestAccEC2Instance_EBSRootDevice_multipleDynamicEBSBlockDevices(t *testing. resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "3"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", - "device_name": "/dev/sdd", + names.AttrDeviceName: "/dev/sdd", "encrypted": "false", "iops": "100", "volume_size": "10", @@ -2876,7 +2876,7 @@ func TestAccEC2Instance_EBSRootDevice_multipleDynamicEBSBlockDevices(t *testing. }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", - "device_name": "/dev/sdc", + names.AttrDeviceName: "/dev/sdc", "encrypted": "false", "iops": "100", "volume_size": "10", @@ -2884,7 +2884,7 @@ func TestAccEC2Instance_EBSRootDevice_multipleDynamicEBSBlockDevices(t *testing. }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", - "device_name": "/dev/sdb", + names.AttrDeviceName: "/dev/sdb", "encrypted": "false", "iops": "100", "volume_size": "10", @@ -5709,7 +5709,7 @@ func testAccCheckDetachVolumes(ctx context.Context, instance *ec2.Instance) reso r := tfec2.ResourceVolumeAttachment() d := r.Data(nil) - d.Set("device_name", deviceName) + d.Set(names.AttrDeviceName, deviceName) d.Set(names.AttrInstanceID, instanceID) d.Set("volume_id", volumeID) diff --git a/internal/service/ec2/ec2_launch_template.go b/internal/service/ec2/ec2_launch_template.go index 6d2cc98ac48..3edd67a970c 100644 --- a/internal/service/ec2/ec2_launch_template.go +++ b/internal/service/ec2/ec2_launch_template.go @@ -53,7 +53,7 @@ func ResourceLaunchTemplate() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Optional: true, }, @@ -1325,7 +1325,7 @@ func expandLaunchTemplateBlockDeviceMappingRequest(tfMap map[string]interface{}) apiObject.Ebs = expandLaunchTemplateEBSBlockDeviceRequest(v[0].(map[string]interface{})) } - if v, ok := tfMap["device_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDeviceName].(string); ok && v != "" { apiObject.DeviceName = aws.String(v) } @@ -2351,7 +2351,7 @@ func flattenLaunchTemplateBlockDeviceMapping(apiObject *ec2.LaunchTemplateBlockD tfMap := map[string]interface{}{} if v := apiObject.DeviceName; v != nil { - tfMap["device_name"] = aws.StringValue(v) + tfMap[names.AttrDeviceName] = aws.StringValue(v) } if v := apiObject.Ebs; 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 f7ee34587cf..6bf73c3831e 100644 --- a/internal/service/ec2/ec2_launch_template_data_source.go +++ b/internal/service/ec2/ec2_launch_template_data_source.go @@ -40,7 +40,7 @@ func DataSourceLaunchTemplate() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/ec2/ec2_spot_fleet_request.go b/internal/service/ec2/ec2_spot_fleet_request.go index 5b7564445f5..2bf4429e8e2 100644 --- a/internal/service/ec2/ec2_spot_fleet_request.go +++ b/internal/service/ec2/ec2_spot_fleet_request.go @@ -143,7 +143,7 @@ func ResourceSpotFleetRequest() *schema.Resource { Default: true, ForceNew: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -207,7 +207,7 @@ func ResourceSpotFleetRequest() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, }, @@ -1373,7 +1373,7 @@ func readSpotFleetBlockDeviceMappingsFromConfig(ctx context.Context, d map[strin } blockDevices = append(blockDevices, &ec2.BlockDeviceMapping{ - DeviceName: aws.String(bd["device_name"].(string)), + DeviceName: aws.String(bd[names.AttrDeviceName].(string)), Ebs: ebs, }) } @@ -1384,7 +1384,7 @@ func readSpotFleetBlockDeviceMappingsFromConfig(ctx context.Context, d map[strin for _, v := range vL { bd := v.(map[string]interface{}) blockDevices = append(blockDevices, &ec2.BlockDeviceMapping{ - DeviceName: aws.String(bd["device_name"].(string)), + DeviceName: aws.String(bd[names.AttrDeviceName].(string)), VirtualName: aws.String(bd["virtual_name"].(string)), }) } @@ -1972,7 +1972,7 @@ func ebsBlockDevicesToSet(bdm []*ec2.BlockDeviceMapping, rootDevName *string) *s continue } - m["device_name"] = aws.StringValue(val.DeviceName) + m[names.AttrDeviceName] = aws.StringValue(val.DeviceName) } if ebs.DeleteOnTermination != nil { @@ -2023,7 +2023,7 @@ func ephemeralBlockDevicesToSet(bdm []*ec2.BlockDeviceMapping) *schema.Set { m["virtual_name"] = aws.StringValue(val.VirtualName) if val.DeviceName != nil { - m["device_name"] = aws.StringValue(val.DeviceName) + m[names.AttrDeviceName] = aws.StringValue(val.DeviceName) } set.Add(m) @@ -2079,7 +2079,7 @@ func rootBlockDeviceToSet(bdm []*ec2.BlockDeviceMapping, rootDevName *string) *s func hashEphemeralBlockDevice(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["virtual_name"].(string))) return create.StringHashcode(buf.String()) } @@ -2107,7 +2107,7 @@ func hashLaunchSpecification(v interface{}) int { func hashEBSBlockDevice(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - if name, ok := m["device_name"]; ok { + if name, ok := m[names.AttrDeviceName]; ok { buf.WriteString(fmt.Sprintf("%s-", name.(string))) } if id, ok := m["snapshot_id"]; ok { diff --git a/internal/service/ec2/ec2_spot_fleet_request_test.go b/internal/service/ec2/ec2_spot_fleet_request_test.go index 3a2743648f4..2a79e9162be 100644 --- a/internal/service/ec2/ec2_spot_fleet_request_test.go +++ b/internal/service/ec2/ec2_spot_fleet_request_test.go @@ -1410,11 +1410,11 @@ func TestAccEC2SpotFleetRequest_LaunchSpecification_ebsBlockDeviceGP3(t *testing Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSpotFleetRequestExists(ctx, resourceName, &config), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "launch_specification.*.ebs_block_device.*", map[string]string{ - "device_name": "/dev/xvdcz", - "iops": "4000", - "throughput": "500", - "volume_size": "15", - "volume_type": "gp3", + names.AttrDeviceName: "/dev/xvdcz", + "iops": "4000", + "throughput": "500", + "volume_size": "15", + "volume_type": "gp3", }), ), }, diff --git a/internal/service/ec2/vpnsite_customer_gateway.go b/internal/service/ec2/vpnsite_customer_gateway.go index a275968ed8f..31acdbf29a2 100644 --- a/internal/service/ec2/vpnsite_customer_gateway.go +++ b/internal/service/ec2/vpnsite_customer_gateway.go @@ -54,7 +54,7 @@ func resourceCustomerGateway() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -104,7 +104,7 @@ func resourceCustomerGatewayCreate(ctx context.Context, d *schema.ResourceData, input.CertificateArn = aws.String(v.(string)) } - if v, ok := d.GetOk("device_name"); ok { + if v, ok := d.GetOk(names.AttrDeviceName); ok { input.DeviceName = aws.String(v.(string)) } @@ -154,7 +154,7 @@ func resourceCustomerGatewayRead(ctx context.Context, d *schema.ResourceData, me d.Set(names.AttrARN, arn) d.Set("bgp_asn", customerGateway.BgpAsn) d.Set("certificate_arn", customerGateway.CertificateArn) - d.Set("device_name", customerGateway.DeviceName) + d.Set(names.AttrDeviceName, customerGateway.DeviceName) d.Set("ip_address", customerGateway.IpAddress) d.Set(names.AttrType, customerGateway.Type) diff --git a/internal/service/ec2/vpnsite_customer_gateway_data_source.go b/internal/service/ec2/vpnsite_customer_gateway_data_source.go index 4669f2b61a6..e689d49f512 100644 --- a/internal/service/ec2/vpnsite_customer_gateway_data_source.go +++ b/internal/service/ec2/vpnsite_customer_gateway_data_source.go @@ -43,7 +43,7 @@ func dataSourceCustomerGateway() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, @@ -110,7 +110,7 @@ func dataSourceCustomerGatewayRead(ctx context.Context, d *schema.ResourceData, d.Set("bgp_asn", nil) } d.Set("certificate_arn", cgw.CertificateArn) - d.Set("device_name", cgw.DeviceName) + d.Set(names.AttrDeviceName, cgw.DeviceName) d.Set("ip_address", cgw.IpAddress) d.Set(names.AttrType, cgw.Type) diff --git a/internal/service/ec2/vpnsite_customer_gateway_data_source_test.go b/internal/service/ec2/vpnsite_customer_gateway_data_source_test.go index 336b7a87574..3ff246e1224 100644 --- a/internal/service/ec2/vpnsite_customer_gateway_data_source_test.go +++ b/internal/service/ec2/vpnsite_customer_gateway_data_source_test.go @@ -33,7 +33,7 @@ func TestAccSiteVPNCustomerGatewayDataSource_filter(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, names.AttrARN, dataSourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "bgp_asn", dataSourceName, "bgp_asn"), resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", dataSourceName, "certificate_arn"), - resource.TestCheckResourceAttrPair(resourceName, "device_name", dataSourceName, "device_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDeviceName, dataSourceName, names.AttrDeviceName), resource.TestCheckResourceAttrPair(resourceName, "ip_address", dataSourceName, "ip_address"), resource.TestCheckResourceAttrPair(resourceName, "tags.%", dataSourceName, "tags.%"), resource.TestCheckResourceAttrPair(resourceName, names.AttrType, dataSourceName, names.AttrType), @@ -63,7 +63,7 @@ func TestAccSiteVPNCustomerGatewayDataSource_id(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, names.AttrARN, dataSourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "bgp_asn", dataSourceName, "bgp_asn"), resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", dataSourceName, "certificate_arn"), - resource.TestCheckResourceAttrPair(resourceName, "device_name", dataSourceName, "device_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDeviceName, dataSourceName, names.AttrDeviceName), resource.TestCheckResourceAttrPair(resourceName, "ip_address", dataSourceName, "ip_address"), resource.TestCheckResourceAttrPair(resourceName, "tags.%", dataSourceName, "tags.%"), resource.TestCheckResourceAttrPair(resourceName, names.AttrType, dataSourceName, names.AttrType), diff --git a/internal/service/ec2/vpnsite_customer_gateway_test.go b/internal/service/ec2/vpnsite_customer_gateway_test.go index 80f7f081c9d..2d81963cd17 100644 --- a/internal/service/ec2/vpnsite_customer_gateway_test.go +++ b/internal/service/ec2/vpnsite_customer_gateway_test.go @@ -41,7 +41,7 @@ func TestAccSiteVPNCustomerGateway_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`customer-gateway/cgw-.+`)), resource.TestCheckResourceAttr(resourceName, "bgp_asn", strconv.Itoa(rBgpAsn)), resource.TestCheckResourceAttr(resourceName, "certificate_arn", ""), - resource.TestCheckResourceAttr(resourceName, "device_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrDeviceName, ""), resource.TestCheckResourceAttr(resourceName, "ip_address", "172.0.0.1"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "ipsec.1"), @@ -140,7 +140,7 @@ func TestAccSiteVPNCustomerGateway_deviceName(t *testing.T) { Config: testAccSiteVPNCustomerGatewayConfig_deviceName(rName, rBgpAsn), Check: resource.ComposeTestCheckFunc( testAccCheckCustomerGatewayExists(ctx, resourceName, &gateway), - resource.TestCheckResourceAttr(resourceName, "device_name", "test"), + resource.TestCheckResourceAttr(resourceName, names.AttrDeviceName, "test"), ), }, { From ace13bb70f4ab2eeabed0f3d9077679006ebc7a9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:44:39 -0400 Subject: [PATCH 0853/1490] ecs: Use constant for device_name strings --- internal/service/ecs/task_definition.go | 8 ++++---- internal/service/ecs/task_execution_data_source.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/ecs/task_definition.go b/internal/service/ecs/task_definition.go index 9c3793bc26f..da6c0ff6b99 100644 --- a/internal/service/ecs/task_definition.go +++ b/internal/service/ecs/task_definition.go @@ -140,7 +140,7 @@ func ResourceTaskDefinition() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -820,8 +820,8 @@ func flattenInferenceAccelerators(list []*ecs.InferenceAccelerator) []map[string result := make([]map[string]interface{}, 0, len(list)) for _, iAcc := range list { l := map[string]interface{}{ - "device_name": aws.StringValue(iAcc.DeviceName), - "device_type": aws.StringValue(iAcc.DeviceType), + names.AttrDeviceName: aws.StringValue(iAcc.DeviceName), + "device_type": aws.StringValue(iAcc.DeviceType), } result = append(result, l) @@ -834,7 +834,7 @@ func expandInferenceAccelerators(configured []interface{}) []*ecs.InferenceAccel for _, lRaw := range configured { data := lRaw.(map[string]interface{}) l := &ecs.InferenceAccelerator{ - DeviceName: aws.String(data["device_name"].(string)), + DeviceName: aws.String(data[names.AttrDeviceName].(string)), DeviceType: aws.String(data["device_type"].(string)), } iAccs = append(iAccs, l) diff --git a/internal/service/ecs/task_execution_data_source.go b/internal/service/ecs/task_execution_data_source.go index 48daff9101a..5491d841ee3 100644 --- a/internal/service/ecs/task_execution_data_source.go +++ b/internal/service/ecs/task_execution_data_source.go @@ -185,7 +185,7 @@ func DataSourceTaskExecution() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Optional: true, }, @@ -406,7 +406,7 @@ func expandInferenceAcceleratorOverrides(tfSet *schema.Set) []*ecs.InferenceAcce for _, item := range tfSet.List() { tfMap := item.(map[string]interface{}) iao := &ecs.InferenceAcceleratorOverride{ - DeviceName: aws.String(tfMap["device_name"].(string)), + DeviceName: aws.String(tfMap[names.AttrDeviceName].(string)), DeviceType: aws.String(tfMap["device_type"].(string)), } apiObject = append(apiObject, iao) From 3ad31d276a8b363cc744b301302afc88dffdbb93 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:44:40 -0400 Subject: [PATCH 0854/1490] imagebuilder: Use constant for device_name strings --- internal/service/imagebuilder/container_recipe.go | 2 +- .../service/imagebuilder/container_recipe_data_source.go | 2 +- internal/service/imagebuilder/image_recipe.go | 6 +++--- internal/service/imagebuilder/image_recipe_data_source.go | 2 +- internal/service/imagebuilder/image_recipe_test.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/imagebuilder/container_recipe.go b/internal/service/imagebuilder/container_recipe.go index eb97eaf4230..a16712a7575 100644 --- a/internal/service/imagebuilder/container_recipe.go +++ b/internal/service/imagebuilder/container_recipe.go @@ -121,7 +121,7 @@ func ResourceContainerRecipe() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, 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 4fa72697527..3e3d37f1b38 100644 --- a/internal/service/imagebuilder/container_recipe_data_source.go +++ b/internal/service/imagebuilder/container_recipe_data_source.go @@ -85,7 +85,7 @@ func DataSourceContainerRecipe() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/imagebuilder/image_recipe.go b/internal/service/imagebuilder/image_recipe.go index 366abd676b4..9c3f821f1c7 100644 --- a/internal/service/imagebuilder/image_recipe.go +++ b/internal/service/imagebuilder/image_recipe.go @@ -46,7 +46,7 @@ func ResourceImageRecipe() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -521,7 +521,7 @@ func expandInstanceBlockDeviceMapping(tfMap map[string]interface{}) *imagebuilde apiObject := &imagebuilder.InstanceBlockDeviceMapping{} - if v, ok := tfMap["device_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDeviceName].(string); ok && v != "" { apiObject.DeviceName = aws.String(v) } @@ -704,7 +704,7 @@ func flattenInstanceBlockDeviceMapping(apiObject *imagebuilder.InstanceBlockDevi tfMap := map[string]interface{}{} if v := apiObject.DeviceName; v != nil { - tfMap["device_name"] = aws.StringValue(v) + tfMap[names.AttrDeviceName] = aws.StringValue(v) } if v := apiObject.Ebs; v != nil { diff --git a/internal/service/imagebuilder/image_recipe_data_source.go b/internal/service/imagebuilder/image_recipe_data_source.go index 4f901ddb869..a7a3e311578 100644 --- a/internal/service/imagebuilder/image_recipe_data_source.go +++ b/internal/service/imagebuilder/image_recipe_data_source.go @@ -33,7 +33,7 @@ func DataSourceImageRecipe() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/imagebuilder/image_recipe_test.go b/internal/service/imagebuilder/image_recipe_test.go index f1e2d58eac1..a91b77bab2e 100644 --- a/internal/service/imagebuilder/image_recipe_test.go +++ b/internal/service/imagebuilder/image_recipe_test.go @@ -99,7 +99,7 @@ func TestAccImageBuilderImageRecipe_BlockDeviceMapping_deviceName(t *testing.T) testAccCheckImageRecipeExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "block_device_mapping.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "block_device_mapping.*", map[string]string{ - "device_name": "/dev/xvdb", + names.AttrDeviceName: "/dev/xvdb", }), ), }, From d25638096fbf95031fc5adad8998e8104aee6dbb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:44:40 -0400 Subject: [PATCH 0855/1490] kinesisvideo: Use constant for device_name strings --- internal/service/kinesisvideo/stream.go | 8 ++++---- internal/service/kinesisvideo/stream_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/kinesisvideo/stream.go b/internal/service/kinesisvideo/stream.go index 72ef58e5049..0524aa53de8 100644 --- a/internal/service/kinesisvideo/stream.go +++ b/internal/service/kinesisvideo/stream.go @@ -62,7 +62,7 @@ func ResourceStream() *schema.Resource { Default: 0, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.All( @@ -109,7 +109,7 @@ func resourceStreamCreate(ctx context.Context, d *schema.ResourceData, meta inte Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("device_name"); ok { + if v, ok := d.GetOk(names.AttrDeviceName); ok { input.DeviceName = aws.String(v.(string)) } @@ -165,7 +165,7 @@ func resourceStreamRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrName, resp.StreamInfo.StreamName) d.Set("data_retention_in_hours", resp.StreamInfo.DataRetentionInHours) - d.Set("device_name", resp.StreamInfo.DeviceName) + d.Set(names.AttrDeviceName, resp.StreamInfo.DeviceName) d.Set(names.AttrKMSKeyID, resp.StreamInfo.KmsKeyId) d.Set("media_type", resp.StreamInfo.MediaType) d.Set(names.AttrARN, resp.StreamInfo.StreamARN) @@ -186,7 +186,7 @@ func resourceStreamUpdate(ctx context.Context, d *schema.ResourceData, meta inte CurrentVersion: aws.String(d.Get(names.AttrVersion).(string)), } - if v, ok := d.GetOk("device_name"); ok { + if v, ok := d.GetOk(names.AttrDeviceName); ok { updateOpts.DeviceName = aws.String(v.(string)) } diff --git a/internal/service/kinesisvideo/stream_test.go b/internal/service/kinesisvideo/stream_test.go index 547a595d171..e387405c1af 100644 --- a/internal/service/kinesisvideo/stream_test.go +++ b/internal/service/kinesisvideo/stream_test.go @@ -86,7 +86,7 @@ func TestAccKinesisVideoStream_options(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "kinesisvideo", regexache.MustCompile(fmt.Sprintf("stream/terraform-kinesis-video-stream-test-%d/.+", rInt))), resource.TestCheckResourceAttr(resourceName, "data_retention_in_hours", "1"), resource.TestCheckResourceAttr(resourceName, "media_type", "video/h264"), - resource.TestCheckResourceAttr(resourceName, "device_name", fmt.Sprintf("kinesis-video-device-name-%s", rName1)), + resource.TestCheckResourceAttr(resourceName, names.AttrDeviceName, fmt.Sprintf("kinesis-video-device-name-%s", rName1)), resource.TestCheckResourceAttrPair( resourceName, names.AttrKMSKeyID, kmsResourceName, names.AttrID), @@ -97,7 +97,7 @@ func TestAccKinesisVideoStream_options(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckStreamExists(ctx, resourceName, &stream), resource.TestCheckResourceAttr(resourceName, "media_type", "video/h120"), - resource.TestCheckResourceAttr(resourceName, "device_name", fmt.Sprintf("kinesis-video-device-name-%s", rName2)), + resource.TestCheckResourceAttr(resourceName, names.AttrDeviceName, fmt.Sprintf("kinesis-video-device-name-%s", rName2)), ), }, { From 2862bce88a6a0afc2d7bf7fa82a02ef54d1dea14 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:44:40 -0400 Subject: [PATCH 0856/1490] opsworks: Use constant for device_name strings --- internal/service/opsworks/instance.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/opsworks/instance.go b/internal/service/opsworks/instance.go index 6c6ac7ae2fb..4aa118dfa13 100644 --- a/internal/service/opsworks/instance.go +++ b/internal/service/opsworks/instance.go @@ -313,7 +313,7 @@ func ResourceInstance() *schema.Resource { ForceNew: true, }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -351,7 +351,7 @@ func ResourceInstance() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["snapshot_id"].(string))) return create.StringHashcode(buf.String()) }, @@ -363,7 +363,7 @@ func ResourceInstance() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, }, @@ -377,7 +377,7 @@ func ResourceInstance() *schema.Resource { Set: func(v interface{}) int { var buf bytes.Buffer m := v.(map[string]interface{}) - buf.WriteString(fmt.Sprintf("%s-", m["device_name"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrDeviceName].(string))) buf.WriteString(fmt.Sprintf("%s-", m["virtual_name"].(string))) return create.StringHashcode(buf.String()) }, @@ -656,7 +656,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in } blockDevices = append(blockDevices, &opsworks.BlockDeviceMapping{ - DeviceName: aws.String(bd["device_name"].(string)), + DeviceName: aws.String(bd[names.AttrDeviceName].(string)), Ebs: ebs, }) } @@ -667,7 +667,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in for _, v := range vL { bd := v.(map[string]interface{}) blockDevices = append(blockDevices, &opsworks.BlockDeviceMapping{ - DeviceName: aws.String(bd["device_name"].(string)), + DeviceName: aws.String(bd[names.AttrDeviceName].(string)), VirtualName: aws.String(bd["virtual_name"].(string)), }) } @@ -1003,7 +1003,7 @@ func readBlockDevices(instance *opsworks.Instance) map[string]interface{} { blockDevices["root"] = bd } else { if bdm.DeviceName != nil { - bd["device_name"] = aws.StringValue(bdm.DeviceName) + bd[names.AttrDeviceName] = aws.StringValue(bdm.DeviceName) } if bdm.VirtualName != nil { bd["virtual_name"] = aws.StringValue(bdm.VirtualName) From 4e659a5103d752216a212c214dd82cecb8c406d1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:44:40 -0400 Subject: [PATCH 0857/1490] pipes: Use constant for device_name strings --- internal/service/pipes/target_parameters.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/pipes/target_parameters.go b/internal/service/pipes/target_parameters.go index f4c56004344..034984bdd13 100644 --- a/internal/service/pipes/target_parameters.go +++ b/internal/service/pipes/target_parameters.go @@ -414,7 +414,7 @@ func targetParametersSchema() *schema.Schema { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Optional: true, }, @@ -1529,7 +1529,7 @@ func expandECSInferenceAcceleratorOverride(tfMap map[string]interface{}) *types. apiObject := &types.EcsInferenceAcceleratorOverride{} - if v, ok := tfMap["device_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDeviceName].(string); ok && v != "" { apiObject.DeviceName = aws.String(v) } @@ -2398,7 +2398,7 @@ func flattenECSInferenceAcceleratorOverride(apiObject types.EcsInferenceAccelera tfMap := map[string]interface{}{} if v := apiObject.DeviceName; v != nil { - tfMap["device_name"] = aws.ToString(v) + tfMap[names.AttrDeviceName] = aws.ToString(v) } if v := apiObject.DeviceType; v != nil { From 154ed70755ac11ce0c0788020844fe3367160e26 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:44:40 -0400 Subject: [PATCH 0858/1490] sagemaker: Use constant for device_name strings --- internal/service/sagemaker/device.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/sagemaker/device.go b/internal/service/sagemaker/device.go index 6197b834d6c..7229c959ace 100644 --- a/internal/service/sagemaker/device.go +++ b/internal/service/sagemaker/device.go @@ -62,7 +62,7 @@ func ResourceDevice() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(1, 40), }, - "device_name": { + names.AttrDeviceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -187,7 +187,7 @@ func expandDevice(l []interface{}) []*sagemaker.Device { m := l[0].(map[string]interface{}) config := &sagemaker.Device{ - DeviceName: aws.String(m["device_name"].(string)), + DeviceName: aws.String(m[names.AttrDeviceName].(string)), } if v, ok := m[names.AttrDescription].(string); ok && v != "" { @@ -207,7 +207,7 @@ func flattenDevice(config *sagemaker.DescribeDeviceOutput) []map[string]interfac } m := map[string]interface{}{ - "device_name": aws.StringValue(config.DeviceName), + names.AttrDeviceName: aws.StringValue(config.DeviceName), } if config.Description != nil { From 39ed2f8af7bf6343eec22f5d6d344a7c28b511cf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:47:35 -0400 Subject: [PATCH 0859/1490] ci: Prefer constant for string literal "catalog_id" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 178bdbc3268..9d167ed5564 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1285,3 +1285,13 @@ rules: - pattern: '"device_name"' severity: ERROR fix: "names.AttrDeviceName" + - id: literal-catalog_id-string-constant + languages: [go] + message: Use the constant `names.AttrCatalogID` for the string literal "catalog_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"catalog_id"' + severity: ERROR + fix: "names.AttrCatalogID" From 63ecd16fbe64444c4d13a5d6736a018594493f3f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:47:35 -0400 Subject: [PATCH 0860/1490] names: Add constant for string literal "catalog_id" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index dd145c17590..132c65ce9e8 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -12,6 +12,7 @@ const ( AttrAvailabilityZones = "availability_zones" AttrBucket = "bucket" AttrBucketName = "bucket_name" + AttrCatalogID = "catalog_id" AttrClusterIdentifier = "cluster_identifier" AttrCreatedAt = "created_at" AttrCreatedDate = "created_date" From 49a6fb79128a0e8a003a51f4c2bf65578985983d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:47:36 -0400 Subject: [PATCH 0861/1490] firehose: Use constant for catalog_id strings --- internal/service/firehose/delivery_stream.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index 42d35597e97..8d9c71d9e8b 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -656,7 +656,7 @@ func resourceDeliveryStream() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -2206,7 +2206,7 @@ func expandSchemaConfiguration(l []interface{}) *types.SchemaConfiguration { VersionId: aws.String(m["version_id"].(string)), } - if v, ok := m["catalog_id"].(string); ok && v != "" { + if v, ok := m[names.AttrCatalogID].(string); ok && v != "" { config.CatalogId = aws.String(v) } if v, ok := m[names.AttrRegion].(string); ok && v != "" { @@ -3695,7 +3695,7 @@ func flattenSchemaConfiguration(sc *types.SchemaConfiguration) []map[string]inte } m := map[string]interface{}{ - "catalog_id": aws.ToString(sc.CatalogId), + names.AttrCatalogID: aws.ToString(sc.CatalogId), names.AttrDatabaseName: aws.ToString(sc.DatabaseName), names.AttrRegion: aws.ToString(sc.Region), names.AttrRoleARN: aws.ToString(sc.RoleARN), From 8925652afd917a8d950bc9a7cb5d97bf53f85a6b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:47:36 -0400 Subject: [PATCH 0862/1490] glue: Use constant for catalog_id strings --- internal/service/glue/catalog_database.go | 14 +++++++------- internal/service/glue/catalog_database_test.go | 6 +++--- internal/service/glue/catalog_table.go | 10 +++++----- internal/service/glue/catalog_table_data_source.go | 6 +++--- .../service/glue/catalog_table_data_source_test.go | 2 +- internal/service/glue/catalog_table_test.go | 4 ++-- internal/service/glue/connection.go | 6 +++--- internal/service/glue/connection_data_source.go | 4 ++-- .../service/glue/connection_data_source_test.go | 2 +- .../glue/data_catalog_encryption_settings.go | 5 +++-- ...data_catalog_encryption_settings_data_source.go | 7 ++++--- ...catalog_encryption_settings_data_source_test.go | 2 +- internal/service/glue/data_quality_ruleset.go | 6 +++--- internal/service/glue/data_quality_ruleset_test.go | 2 +- internal/service/glue/ml_transform.go | 6 +++--- internal/service/glue/partition.go | 4 ++-- internal/service/glue/partition_index.go | 4 ++-- internal/service/glue/partition_test.go | 2 +- internal/service/glue/sweep.go | 2 +- internal/service/glue/user_defined_function.go | 4 ++-- 20 files changed, 50 insertions(+), 48 deletions(-) diff --git a/internal/service/glue/catalog_database.go b/internal/service/glue/catalog_database.go index 8dba03078be..92be69c06ad 100644 --- a/internal/service/glue/catalog_database.go +++ b/internal/service/glue/catalog_database.go @@ -44,7 +44,7 @@ func ResourceCatalogDatabase() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -131,7 +131,7 @@ func ResourceCatalogDatabase() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Required: true, }, @@ -279,7 +279,7 @@ func resourceCatalogDatabaseRead(ctx context.Context, d *schema.ResourceData, me }.String() d.Set(names.AttrARN, databaseArn) d.Set(names.AttrName, database.Name) - d.Set("catalog_id", database.CatalogId) + d.Set(names.AttrCatalogID, database.CatalogId) d.Set(names.AttrDescription, database.Description) d.Set("location_uri", database.LocationUri) d.Set(names.AttrParameters, aws.StringValueMap(database.Parameters)) @@ -314,7 +314,7 @@ func resourceCatalogDatabaseDelete(ctx context.Context, d *schema.ResourceData, log.Printf("[DEBUG] Glue Catalog Database: %s", d.Id()) _, err := conn.DeleteDatabaseWithContext(ctx, &glue.DeleteDatabaseInput{ Name: aws.String(d.Get(names.AttrName).(string)), - CatalogId: aws.String(d.Get("catalog_id").(string)), + CatalogId: aws.String(d.Get(names.AttrCatalogID).(string)), }) if tfawserr.ErrCodeEquals(err, glue.ErrCodeEntityNotFoundException) { return diags @@ -335,7 +335,7 @@ func ReadCatalogID(id string) (catalogID string, name string, err error) { } func createCatalogID(d *schema.ResourceData, accountid string) (catalogID string) { - if rawCatalogID, ok := d.GetOkExists("catalog_id"); ok { + if rawCatalogID, ok := d.GetOkExists(names.AttrCatalogID); ok { catalogID = rawCatalogID.(string) } else { catalogID = accountid @@ -368,7 +368,7 @@ func expandDatabaseTargetDatabase(tfMap map[string]interface{}) *glue.DatabaseId apiObject := &glue.DatabaseIdentifier{} - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -409,7 +409,7 @@ func flattenDatabaseTargetDatabase(apiObject *glue.DatabaseIdentifier) map[strin tfMap := map[string]interface{}{} if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.StringValue(v) + tfMap[names.AttrCatalogID] = aws.StringValue(v) } if v := apiObject.DatabaseName; v != nil { diff --git a/internal/service/glue/catalog_database_test.go b/internal/service/glue/catalog_database_test.go index dc1f62687e9..5a260a7f30d 100644 --- a/internal/service/glue/catalog_database_test.go +++ b/internal/service/glue/catalog_database_test.go @@ -138,7 +138,7 @@ func TestAccGlueCatalogDatabase_targetDatabase(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckCatalogDatabaseExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "target_database.#", "1"), - resource.TestCheckResourceAttrPair(resourceName, "target_database.0.catalog_id", "aws_glue_catalog_database.test2", "catalog_id"), + resource.TestCheckResourceAttrPair(resourceName, "target_database.0.catalog_id", "aws_glue_catalog_database.test2", names.AttrCatalogID), resource.TestCheckResourceAttrPair(resourceName, "target_database.0.database_name", "aws_glue_catalog_database.test2", names.AttrName), resource.TestCheckResourceAttr(resourceName, "target_database.0.region", ""), ), @@ -154,7 +154,7 @@ func TestAccGlueCatalogDatabase_targetDatabase(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckCatalogDatabaseExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "target_database.#", "1"), - resource.TestCheckResourceAttrPair(resourceName, "target_database.0.catalog_id", "aws_glue_catalog_database.test2", "catalog_id"), + resource.TestCheckResourceAttrPair(resourceName, "target_database.0.catalog_id", "aws_glue_catalog_database.test2", names.AttrCatalogID), resource.TestCheckResourceAttrPair(resourceName, "target_database.0.database_name", "aws_glue_catalog_database.test2", names.AttrName), resource.TestCheckResourceAttr(resourceName, "target_database.0.region", ""), ), @@ -181,7 +181,7 @@ func TestAccGlueCatalogDatabase_targetDatabaseWithRegion(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckCatalogDatabaseExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "target_database.#", "1"), - resource.TestCheckResourceAttrPair(resourceName, "target_database.0.catalog_id", "aws_glue_catalog_database.test2", "catalog_id"), + resource.TestCheckResourceAttrPair(resourceName, "target_database.0.catalog_id", "aws_glue_catalog_database.test2", names.AttrCatalogID), resource.TestCheckResourceAttrPair(resourceName, "target_database.0.database_name", "aws_glue_catalog_database.test2", names.AttrName), resource.TestCheckResourceAttr(resourceName, "target_database.0.region", acctest.AlternateRegion()), ), diff --git a/internal/service/glue/catalog_table.go b/internal/service/glue/catalog_table.go index aaa7a7acf2b..6d34e161c99 100644 --- a/internal/service/glue/catalog_table.go +++ b/internal/service/glue/catalog_table.go @@ -42,7 +42,7 @@ func ResourceCatalogTable() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -331,7 +331,7 @@ func ResourceCatalogTable() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Required: true, }, @@ -452,7 +452,7 @@ func resourceCatalogTableRead(ctx context.Context, d *schema.ResourceData, meta Resource: fmt.Sprintf("table/%s/%s", dbName, aws.StringValue(table.Name)), }.String() d.Set(names.AttrARN, tableArn) - d.Set("catalog_id", catalogID) + d.Set(names.AttrCatalogID, catalogID) d.Set(names.AttrDatabaseName, dbName) d.Set(names.AttrDescription, table.Description) d.Set(names.AttrName, table.Name) @@ -1112,7 +1112,7 @@ func expandTableTargetTable(tfMap map[string]interface{}) *glue.TableIdentifier apiObject := &glue.TableIdentifier{} - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -1139,7 +1139,7 @@ func flattenTableTargetTable(apiObject *glue.TableIdentifier) map[string]interfa tfMap := map[string]interface{}{} if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.StringValue(v) + tfMap[names.AttrCatalogID] = aws.StringValue(v) } if v := apiObject.DatabaseName; v != nil { diff --git a/internal/service/glue/catalog_table_data_source.go b/internal/service/glue/catalog_table_data_source.go index 20bcb35d97a..af678411770 100644 --- a/internal/service/glue/catalog_table_data_source.go +++ b/internal/service/glue/catalog_table_data_source.go @@ -31,7 +31,7 @@ func DataSourceCatalogTable() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -288,7 +288,7 @@ func DataSourceCatalogTable() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Computed: true, }, @@ -370,7 +370,7 @@ func dataSourceCatalogTableRead(ctx context.Context, d *schema.ResourceData, met d.Set(names.AttrARN, tableArn) d.Set(names.AttrName, table.Name) - d.Set("catalog_id", catalogID) + d.Set(names.AttrCatalogID, catalogID) d.Set(names.AttrDatabaseName, dbName) d.Set(names.AttrDescription, table.Description) d.Set("owner", table.Owner) diff --git a/internal/service/glue/catalog_table_data_source_test.go b/internal/service/glue/catalog_table_data_source_test.go index b3faf334bf0..95ab70673f9 100644 --- a/internal/service/glue/catalog_table_data_source_test.go +++ b/internal/service/glue/catalog_table_data_source_test.go @@ -30,7 +30,7 @@ func TestAccGlueCatalogTableDataSource_basic(t *testing.T) { Config: testAccCatalogTableDataSourceConfig_basic(dbName, tName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(datasourceName, "catalog_id", resourceName, "catalog_id"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrCatalogID, resourceName, names.AttrCatalogID), resource.TestCheckResourceAttrPair(datasourceName, names.AttrDatabaseName, resourceName, names.AttrDatabaseName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrDescription, resourceName, names.AttrDescription), resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), diff --git a/internal/service/glue/catalog_table_test.go b/internal/service/glue/catalog_table_test.go index c23ccd0e56f..5b33eaf8d11 100644 --- a/internal/service/glue/catalog_table_test.go +++ b/internal/service/glue/catalog_table_test.go @@ -49,7 +49,7 @@ func TestAccGlueCatalogTable_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, rName), resource.TestCheckResourceAttr(resourceName, "partition_keys.#", "0"), resource.TestCheckResourceAttr(resourceName, "target_table.#", "0"), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), resource.TestCheckResourceAttr(resourceName, "storage_descriptor.#", "0"), resource.TestCheckResourceAttr(resourceName, "partition_index.#", "0"), ), @@ -642,7 +642,7 @@ func TestAccGlueCatalogTable_targetTable(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckCatalogTableExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "target_table.#", "1"), - resource.TestCheckResourceAttrPair(resourceName, "target_table.0.catalog_id", "aws_glue_catalog_table.test2", "catalog_id"), + resource.TestCheckResourceAttrPair(resourceName, "target_table.0.catalog_id", "aws_glue_catalog_table.test2", names.AttrCatalogID), resource.TestCheckResourceAttrPair(resourceName, "target_table.0.database_name", "aws_glue_catalog_table.test2", names.AttrDatabaseName), resource.TestCheckResourceAttrPair(resourceName, "target_table.0.name", "aws_glue_catalog_table.test2", names.AttrName), ), diff --git a/internal/service/glue/connection.go b/internal/service/glue/connection.go index cfe9a16273c..54e0fb061f0 100644 --- a/internal/service/glue/connection.go +++ b/internal/service/glue/connection.go @@ -43,7 +43,7 @@ func ResourceConnection() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -116,7 +116,7 @@ func resourceConnectionCreate(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).GlueConn(ctx) var catalogID string - if v, ok := d.GetOkExists("catalog_id"); ok { + if v, ok := d.GetOkExists(names.AttrCatalogID); ok { catalogID = v.(string) } else { catalogID = meta.(*conns.AWSClient).AccountID @@ -169,7 +169,7 @@ func resourceConnectionRead(ctx context.Context, d *schema.ResourceData, meta in }.String() d.Set(names.AttrARN, connectionArn) - d.Set("catalog_id", catalogID) + d.Set(names.AttrCatalogID, catalogID) if err := d.Set("connection_properties", aws.StringValueMap(connection.ConnectionProperties)); err != nil { return sdkdiag.AppendErrorf(diags, "setting connection_properties: %s", err) } diff --git a/internal/service/glue/connection_data_source.go b/internal/service/glue/connection_data_source.go index 045b5c4ca5d..d1307f85778 100644 --- a/internal/service/glue/connection_data_source.go +++ b/internal/service/glue/connection_data_source.go @@ -34,7 +34,7 @@ func DataSourceConnection() *schema.Resource { Required: true, ValidateFunc: validation.NoZeroValues, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Computed: true, }, @@ -110,7 +110,7 @@ func dataSourceConnectionRead(ctx context.Context, d *schema.ResourceData, meta } d.SetId(id) - d.Set("catalog_id", catalogID) + d.Set(names.AttrCatalogID, catalogID) d.Set("connection_type", connection.ConnectionType) d.Set(names.AttrName, connection.Name) d.Set(names.AttrDescription, connection.Description) diff --git a/internal/service/glue/connection_data_source_test.go b/internal/service/glue/connection_data_source_test.go index f84c3886875..6bd3cfc088a 100644 --- a/internal/service/glue/connection_data_source_test.go +++ b/internal/service/glue/connection_data_source_test.go @@ -31,7 +31,7 @@ func TestAccGlueConnectionDataSource_basic(t *testing.T) { Config: testAccConnectionDataSourceConfig_basic(rName, jdbcConnectionUrl), Check: resource.ComposeTestCheckFunc( testAccConnectionCheckDataSource(datasourceName), - resource.TestCheckResourceAttrPair(datasourceName, "catalog_id", resourceName, "catalog_id"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrCatalogID, resourceName, names.AttrCatalogID), resource.TestCheckResourceAttrPair(datasourceName, "connection_type", resourceName, "connection_type"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), diff --git a/internal/service/glue/data_catalog_encryption_settings.go b/internal/service/glue/data_catalog_encryption_settings.go index 50c43a6079b..ad5a11cf54b 100644 --- a/internal/service/glue/data_catalog_encryption_settings.go +++ b/internal/service/glue/data_catalog_encryption_settings.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_glue_data_catalog_encryption_settings") @@ -29,7 +30,7 @@ func ResourceDataCatalogEncryptionSettings() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -127,7 +128,7 @@ func resourceDataCatalogEncryptionSettingsRead(ctx context.Context, d *schema.Re return sdkdiag.AppendErrorf(diags, "reading Glue Data Catalog Encryption Settings (%s): %s", d.Id(), err) } - d.Set("catalog_id", d.Id()) + d.Set(names.AttrCatalogID, d.Id()) if output.DataCatalogEncryptionSettings != nil { if err := d.Set("data_catalog_encryption_settings", []interface{}{flattenDataCatalogEncryptionSettings(output.DataCatalogEncryptionSettings)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting data_catalog_encryption_settings: %s", err) diff --git a/internal/service/glue/data_catalog_encryption_settings_data_source.go b/internal/service/glue/data_catalog_encryption_settings_data_source.go index 198193f7887..b41d7d96471 100644 --- a/internal/service/glue/data_catalog_encryption_settings_data_source.go +++ b/internal/service/glue/data_catalog_encryption_settings_data_source.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_glue_data_catalog_encryption_settings") @@ -19,7 +20,7 @@ func DataSourceDataCatalogEncryptionSettings() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceDataCatalogEncryptionSettingsRead, Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Required: true, }, @@ -76,7 +77,7 @@ func dataSourceDataCatalogEncryptionSettingsRead(ctx context.Context, d *schema. conn := meta.(*conns.AWSClient).GlueConn(ctx) - catalogID := d.Get("catalog_id").(string) + catalogID := d.Get(names.AttrCatalogID).(string) output, err := conn.GetDataCatalogEncryptionSettingsWithContext(ctx, &glue.GetDataCatalogEncryptionSettingsInput{ CatalogId: aws.String(catalogID), }) @@ -86,7 +87,7 @@ func dataSourceDataCatalogEncryptionSettingsRead(ctx context.Context, d *schema. } d.SetId(catalogID) - d.Set("catalog_id", d.Id()) + d.Set(names.AttrCatalogID, d.Id()) if output.DataCatalogEncryptionSettings != nil { if err := d.Set("data_catalog_encryption_settings", []interface{}{flattenDataCatalogEncryptionSettings(output.DataCatalogEncryptionSettings)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting data_catalog_encryption_settings: %s", err) diff --git a/internal/service/glue/data_catalog_encryption_settings_data_source_test.go b/internal/service/glue/data_catalog_encryption_settings_data_source_test.go index 80a0b2e5f75..510e5d5eb84 100644 --- a/internal/service/glue/data_catalog_encryption_settings_data_source_test.go +++ b/internal/service/glue/data_catalog_encryption_settings_data_source_test.go @@ -26,7 +26,7 @@ func testAccDataCatalogEncryptionSettingsDataSource_basic(t *testing.T) { { Config: testAccDataCatalogEncryptionSettingsDataSourceConfig_basic(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(dataSourceName, "catalog_id", resourceName, "catalog_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrCatalogID, resourceName, names.AttrCatalogID), resource.TestCheckResourceAttrPair(dataSourceName, "data_catalog_encryption_settings", resourceName, "data_catalog_encryption_settings"), ), }, diff --git a/internal/service/glue/data_quality_ruleset.go b/internal/service/glue/data_quality_ruleset.go index bfc2f72ed6e..21310d12a40 100644 --- a/internal/service/glue/data_quality_ruleset.go +++ b/internal/service/glue/data_quality_ruleset.go @@ -78,7 +78,7 @@ func ResourceDataQualityRuleset() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -225,7 +225,7 @@ func expandTargetTable(tfMap map[string]interface{}) *glue.DataQualityTargetTabl TableName: aws.String(tfMap["table_name"].(string)), } - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -243,7 +243,7 @@ func flattenTargetTable(apiObject *glue.DataQualityTargetTable) []interface{} { } if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.StringValue(v) + tfMap[names.AttrCatalogID] = aws.StringValue(v) } return []interface{}{tfMap} diff --git a/internal/service/glue/data_quality_ruleset_test.go b/internal/service/glue/data_quality_ruleset_test.go index e39e9ee6246..bee42f574ce 100644 --- a/internal/service/glue/data_quality_ruleset_test.go +++ b/internal/service/glue/data_quality_ruleset_test.go @@ -186,7 +186,7 @@ func TestAccGlueDataQualityRuleset_targetTableFull(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckDataQualityRulesetExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "target_table.#", "1"), - resource.TestCheckResourceAttrPair(resourceName, "target_table.0.catalog_id", "aws_glue_catalog_table.test", "catalog_id"), + resource.TestCheckResourceAttrPair(resourceName, "target_table.0.catalog_id", "aws_glue_catalog_table.test", names.AttrCatalogID), resource.TestCheckResourceAttrPair(resourceName, "target_table.0.database_name", "aws_glue_catalog_database.test", names.AttrName), resource.TestCheckResourceAttrPair(resourceName, "target_table.0.table_name", "aws_glue_catalog_table.test", names.AttrName), ), diff --git a/internal/service/glue/ml_transform.go b/internal/service/glue/ml_transform.go index a2d812e4ea7..474a74841b8 100644 --- a/internal/service/glue/ml_transform.go +++ b/internal/service/glue/ml_transform.go @@ -55,7 +55,7 @@ func ResourceMLTransform() *schema.Resource { Type: schema.TypeString, Required: true, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, }, @@ -392,7 +392,7 @@ func expandMLTransformInputRecordTables(l []interface{}) []*glue.Table { table.ConnectionName = aws.String(v) } - if v, ok := m["catalog_id"].(string); ok && v != "" { + if v, ok := m[names.AttrCatalogID].(string); ok && v != "" { table.CatalogId = aws.String(v) } @@ -416,7 +416,7 @@ func flattenMLTransformInputRecordTables(tables []*glue.Table) []interface{} { } if table.CatalogId != nil { - m["catalog_id"] = aws.StringValue(table.CatalogId) + m[names.AttrCatalogID] = aws.StringValue(table.CatalogId) } l = append(l, m) diff --git a/internal/service/glue/partition.go b/internal/service/glue/partition.go index ec7277b6965..70dca5051a4 100644 --- a/internal/service/glue/partition.go +++ b/internal/service/glue/partition.go @@ -32,7 +32,7 @@ func ResourcePartition() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -247,7 +247,7 @@ func resourcePartitionRead(ctx context.Context, d *schema.ResourceData, meta int } d.Set("table_name", partition.TableName) - d.Set("catalog_id", partition.CatalogId) + d.Set(names.AttrCatalogID, partition.CatalogId) d.Set(names.AttrDatabaseName, partition.DatabaseName) d.Set("partition_values", flex.FlattenStringList(partition.Values)) diff --git a/internal/service/glue/partition_index.go b/internal/service/glue/partition_index.go index 2566338edf0..2f8f92278eb 100644 --- a/internal/service/glue/partition_index.go +++ b/internal/service/glue/partition_index.go @@ -32,7 +32,7 @@ func ResourcePartitionIndex() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -135,7 +135,7 @@ func resourcePartitionIndexRead(ctx context.Context, d *schema.ResourceData, met } d.Set("table_name", tableName) - d.Set("catalog_id", catalogID) + d.Set(names.AttrCatalogID, catalogID) d.Set(names.AttrDatabaseName, dbName) if err := d.Set("partition_index", []map[string]interface{}{flattenPartitionIndex(partition)}); err != nil { diff --git a/internal/service/glue/partition_test.go b/internal/service/glue/partition_test.go index d97db9c7912..4199e0c212e 100644 --- a/internal/service/glue/partition_test.go +++ b/internal/service/glue/partition_test.go @@ -35,7 +35,7 @@ func TestAccGluePartition_basic(t *testing.T) { Config: testAccPartitionConfig_basic(rName, parValue), Check: resource.ComposeTestCheckFunc( testAccCheckPartitionExists(ctx, resourceName), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, rName), resource.TestCheckResourceAttr(resourceName, "partition_values.#", "1"), resource.TestCheckResourceAttr(resourceName, "partition_values.0", parValue), diff --git a/internal/service/glue/sweep.go b/internal/service/glue/sweep.go index 92715ce59e2..745f3e5bf92 100644 --- a/internal/service/glue/sweep.go +++ b/internal/service/glue/sweep.go @@ -106,7 +106,7 @@ func sweepCatalogDatabases(region string) error { d := r.Data(nil) d.SetId("unused") d.Set(names.AttrName, name) - d.Set("catalog_id", database.CatalogId) + d.Set(names.AttrCatalogID, database.CatalogId) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } diff --git a/internal/service/glue/user_defined_function.go b/internal/service/glue/user_defined_function.go index cad61c44142..d0819aa97dc 100644 --- a/internal/service/glue/user_defined_function.go +++ b/internal/service/glue/user_defined_function.go @@ -38,7 +38,7 @@ func ResourceUserDefinedFunction() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -180,7 +180,7 @@ func resourceUserDefinedFunctionRead(ctx context.Context, d *schema.ResourceData d.Set(names.AttrARN, udfArn) d.Set(names.AttrName, udf.FunctionName) - d.Set("catalog_id", catalogID) + d.Set(names.AttrCatalogID, catalogID) d.Set(names.AttrDatabaseName, dbName) d.Set("owner_type", udf.OwnerType) d.Set("owner_name", udf.OwnerName) From 9c7b6a18b72fa61974b723e0b6fb4a05878dd893 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:47:36 -0400 Subject: [PATCH 0863/1490] lakeformation: Use constant for catalog_id strings --- .../lakeformation/data_lake_settings.go | 9 ++-- .../data_lake_settings_data_source.go | 5 +- .../data_lake_settings_data_source_test.go | 4 +- .../lakeformation/data_lake_settings_test.go | 10 ++-- internal/service/lakeformation/lf_tag.go | 6 +-- internal/service/lakeformation/lf_tag_test.go | 14 +++--- internal/service/lakeformation/permissions.go | 48 +++++++++---------- .../lakeformation/permissions_data_source.go | 16 +++---- .../service/lakeformation/permissions_test.go | 14 +++--- .../service/lakeformation/resource_lf_tag.go | 12 ++--- .../lakeformation/resource_lf_tag_test.go | 10 ++-- .../service/lakeformation/resource_lf_tags.go | 22 ++++----- .../lakeformation/resource_lf_tags_test.go | 6 +-- 13 files changed, 89 insertions(+), 87 deletions(-) diff --git a/internal/service/lakeformation/data_lake_settings.go b/internal/service/lakeformation/data_lake_settings.go index bd454fe95d0..d4712576466 100644 --- a/internal/service/lakeformation/data_lake_settings.go +++ b/internal/service/lakeformation/data_lake_settings.go @@ -23,6 +23,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/flex" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_lakeformation_data_lake_settings") @@ -66,7 +67,7 @@ func ResourceDataLakeSettings() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -149,7 +150,7 @@ func resourceDataLakeSettingsCreate(ctx context.Context, d *schema.ResourceData, input := &lakeformation.PutDataLakeSettingsInput{} - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } @@ -230,7 +231,7 @@ func resourceDataLakeSettingsRead(ctx context.Context, d *schema.ResourceData, m input := &lakeformation.GetDataLakeSettingsInput{} - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } @@ -278,7 +279,7 @@ func resourceDataLakeSettingsDelete(ctx context.Context, d *schema.ResourceData, }, } - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } diff --git a/internal/service/lakeformation/data_lake_settings_data_source.go b/internal/service/lakeformation/data_lake_settings_data_source.go index b377fb60762..cb45f3de5a5 100644 --- a/internal/service/lakeformation/data_lake_settings_data_source.go +++ b/internal/service/lakeformation/data_lake_settings_data_source.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_lakeformation_data_lake_settings") @@ -45,7 +46,7 @@ func DataSourceDataLakeSettings() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, }, @@ -103,7 +104,7 @@ func dataSourceDataLakeSettingsRead(ctx context.Context, d *schema.ResourceData, input := &lakeformation.GetDataLakeSettingsInput{} - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } d.SetId(fmt.Sprintf("%d", create.StringHashcode(prettify(input)))) diff --git a/internal/service/lakeformation/data_lake_settings_data_source_test.go b/internal/service/lakeformation/data_lake_settings_data_source_test.go index fe454d42fd7..bb4cd960c25 100644 --- a/internal/service/lakeformation/data_lake_settings_data_source_test.go +++ b/internal/service/lakeformation/data_lake_settings_data_source_test.go @@ -24,7 +24,7 @@ func testAccDataLakeSettingsDataSource_basic(t *testing.T) { { Config: testAccDataLakeSettingsDataSourceConfig_basic, Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(resourceName, "catalog_id", "data.aws_caller_identity.current", names.AttrAccountID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCatalogID, "data.aws_caller_identity.current", names.AttrAccountID), resource.TestCheckResourceAttr(resourceName, "admins.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "admins.0", "data.aws_iam_session_context.current", "issuer_arn"), resource.TestCheckResourceAttr(resourceName, "allow_external_data_filtering", "false"), @@ -49,7 +49,7 @@ func testAccDataLakeSettingsDataSource_readOnlyAdmins(t *testing.T) { { Config: testAccDataLakeSettingsDataSourceConfig_readOnlyAdmins, Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(resourceName, "catalog_id", "data.aws_caller_identity.current", names.AttrAccountID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCatalogID, "data.aws_caller_identity.current", names.AttrAccountID), resource.TestCheckResourceAttr(resourceName, "read_only_admins.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "read_only_admins.0", "data.aws_iam_session_context.current", "issuer_arn"), ), diff --git a/internal/service/lakeformation/data_lake_settings_test.go b/internal/service/lakeformation/data_lake_settings_test.go index 8bac7e5cb9d..167c9d3ef3c 100644 --- a/internal/service/lakeformation/data_lake_settings_test.go +++ b/internal/service/lakeformation/data_lake_settings_test.go @@ -34,7 +34,7 @@ func testAccDataLakeSettings_basic(t *testing.T) { Config: testAccDataLakeSettingsConfig_basic, Check: resource.ComposeTestCheckFunc( testAccCheckDataLakeSettingsExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "catalog_id", "data.aws_caller_identity.current", names.AttrAccountID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCatalogID, "data.aws_caller_identity.current", names.AttrAccountID), resource.TestCheckResourceAttr(resourceName, "admins.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "admins.0", "data.aws_iam_session_context.current", "issuer_arn"), resource.TestCheckResourceAttr(resourceName, "create_database_default_permissions.#", "1"), @@ -133,8 +133,8 @@ func testAccCheckDataLakeSettingsDestroy(ctx context.Context) resource.TestCheck input := &lakeformation.GetDataLakeSettingsInput{} - if rs.Primary.Attributes["catalog_id"] != "" { - input.CatalogId = aws.String(rs.Primary.Attributes["catalog_id"]) + if rs.Primary.Attributes[names.AttrCatalogID] != "" { + input.CatalogId = aws.String(rs.Primary.Attributes[names.AttrCatalogID]) } output, err := conn.GetDataLakeSettings(ctx, input) @@ -171,8 +171,8 @@ func testAccCheckDataLakeSettingsExists(ctx context.Context, resourceName string input := &lakeformation.GetDataLakeSettingsInput{} - if rs.Primary.Attributes["catalog_id"] != "" { - input.CatalogId = aws.String(rs.Primary.Attributes["catalog_id"]) + if rs.Primary.Attributes[names.AttrCatalogID] != "" { + input.CatalogId = aws.String(rs.Primary.Attributes[names.AttrCatalogID]) } _, err := conn.GetDataLakeSettings(ctx, input) diff --git a/internal/service/lakeformation/lf_tag.go b/internal/service/lakeformation/lf_tag.go index f831f6c853e..aee9dfa43db 100644 --- a/internal/service/lakeformation/lf_tag.go +++ b/internal/service/lakeformation/lf_tag.go @@ -39,7 +39,7 @@ func ResourceLFTag() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -76,7 +76,7 @@ func resourceLFTagCreate(ctx context.Context, d *schema.ResourceData, meta inter tagValues := d.Get(names.AttrValues).(*schema.Set) var catalogID string - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { catalogID = v.(string) } else { catalogID = meta.(*conns.AWSClient).AccountID @@ -146,7 +146,7 @@ func resourceLFTagRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set(names.AttrKey, output.TagKey) d.Set(names.AttrValues, flex.FlattenStringValueSet(output.TagValues)) - d.Set("catalog_id", output.CatalogId) + d.Set(names.AttrCatalogID, output.CatalogId) return diags } diff --git a/internal/service/lakeformation/lf_tag_test.go b/internal/service/lakeformation/lf_tag_test.go index c9bb4189d14..04d2598de60 100644 --- a/internal/service/lakeformation/lf_tag_test.go +++ b/internal/service/lakeformation/lf_tag_test.go @@ -94,7 +94,7 @@ func testAccLFTag_basic(t *testing.T) { testAccCheckLFTagExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrKey, rName), resource.TestCheckResourceAttr(resourceName, "values.0", names.AttrValue), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), ), }, { @@ -123,7 +123,7 @@ func testAccLFTag_TagKey_complex(t *testing.T) { testAccCheckLFTagExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrKey, rName), resource.TestCheckResourceAttr(resourceName, "values.0", names.AttrValue), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), ), }, }, @@ -171,7 +171,7 @@ func testAccLFTag_Values(t *testing.T) { testAccCheckLFTagExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrKey, rName), resource.TestCheckResourceAttr(resourceName, "values.0", "value1"), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), ), }, { @@ -188,7 +188,7 @@ func testAccLFTag_Values(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "values.0", "value1"), resource.TestCheckTypeSetElemAttr(resourceName, "values.*", "value3"), testAccCheckLFTagValuesLen(ctx, resourceName, 2), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), ), }, }, @@ -217,7 +217,7 @@ func testAccLFTag_Values_overFifty(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrKey, rName), resource.TestCheckResourceAttr(resourceName, "values.0", "value1"), testAccCheckLFTagValuesLen(ctx, resourceName, len(generatedValues)), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), ), }, { @@ -228,7 +228,7 @@ func testAccLFTag_Values_overFifty(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "values.0", "value1"), testAccCheckLFTagValuesLen(ctx, resourceName, len(generatedValues2)), resource.TestCheckTypeSetElemAttr(resourceName, "values.*", "value59"), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), ), }, { @@ -238,7 +238,7 @@ func testAccLFTag_Values_overFifty(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrKey, rName), resource.TestCheckResourceAttr(resourceName, "values.0", "value1"), testAccCheckLFTagValuesLen(ctx, resourceName, len(generatedValues)-1), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), ), }, }, diff --git a/internal/service/lakeformation/permissions.go b/internal/service/lakeformation/permissions.go index 6d4243be8a4..aecb6e0566b 100644 --- a/internal/service/lakeformation/permissions.go +++ b/internal/service/lakeformation/permissions.go @@ -36,7 +36,7 @@ func ResourcePermissions() *schema.Resource { DeleteWithoutTimeout: resourcePermissionsDelete, Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -108,7 +108,7 @@ func ResourcePermissions() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Computed: true, ForceNew: true, @@ -136,7 +136,7 @@ func ResourcePermissions() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Computed: true, ForceNew: true, @@ -169,7 +169,7 @@ func ResourcePermissions() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -212,7 +212,7 @@ func ResourcePermissions() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -296,7 +296,7 @@ func ResourcePermissions() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Computed: true, ForceNew: true, @@ -349,7 +349,7 @@ func ResourcePermissions() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Computed: true, ForceNew: true, @@ -428,7 +428,7 @@ func resourcePermissionsCreate(ctx context.Context, d *schema.ResourceData, meta Resource: &awstypes.Resource{}, } - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } @@ -522,7 +522,7 @@ func resourcePermissionsRead(ctx context.Context, d *schema.ResourceData, meta i Resource: &awstypes.Resource{}, } - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } @@ -748,7 +748,7 @@ func resourcePermissionsDelete(ctx context.Context, d *schema.ResourceData, meta Resource: &awstypes.Resource{}, } - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } @@ -908,7 +908,7 @@ func ExpandDataLocationResource(tfMap map[string]interface{}) *awstypes.DataLoca apiObject := &awstypes.DataLocationResource{} - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -927,7 +927,7 @@ func flattenDataLocationResource(apiObject *awstypes.DataLocationResource) map[s tfMap := map[string]interface{}{} if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.ToString(v) + tfMap[names.AttrCatalogID] = aws.ToString(v) } if v := apiObject.ResourceArn; v != nil { @@ -944,7 +944,7 @@ func ExpandDatabaseResource(tfMap map[string]interface{}) *awstypes.DatabaseReso apiObject := &awstypes.DatabaseResource{} - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -963,7 +963,7 @@ func flattenDatabaseResource(apiObject *awstypes.DatabaseResource) map[string]in tfMap := map[string]interface{}{} if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.ToString(v) + tfMap[names.AttrCatalogID] = aws.ToString(v) } if v := apiObject.Name; v != nil { @@ -980,7 +980,7 @@ func ExpandLFTagPolicyResource(tfMap map[string]interface{}) *awstypes.LFTagPoli apiObject := &awstypes.LFTagPolicyResource{} - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -1019,7 +1019,7 @@ func flattenLFTagPolicyResource(apiObject *awstypes.LFTagPolicyResource) map[str tfMap := map[string]interface{}{} if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.ToString(v) + tfMap[names.AttrCatalogID] = aws.ToString(v) } if v := apiObject.Expression; v != nil { @@ -1061,7 +1061,7 @@ func ExpandLFTagKeyResource(tfMap map[string]interface{}) *awstypes.LFTagKeyReso apiObject := &awstypes.LFTagKeyResource{} - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -1084,7 +1084,7 @@ func flattenLFTagKeyResource(apiObject *awstypes.LFTagKeyResource) map[string]in tfMap := map[string]interface{}{} if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.ToString(v) + tfMap[names.AttrCatalogID] = aws.ToString(v) } if v := apiObject.TagKey; v != nil { @@ -1105,7 +1105,7 @@ func ExpandTableResource(tfMap map[string]interface{}) *awstypes.TableResource { apiObject := &awstypes.TableResource{} - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -1131,7 +1131,7 @@ func ExpandTableWithColumnsResourceAsTable(tfMap map[string]interface{}) *awstyp apiObject := &awstypes.TableResource{} - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -1154,7 +1154,7 @@ func flattenTableResource(apiObject *awstypes.TableResource) map[string]interfac tfMap := map[string]interface{}{} if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.ToString(v) + tfMap[names.AttrCatalogID] = aws.ToString(v) } if v := apiObject.DatabaseName; v != nil { @@ -1181,7 +1181,7 @@ func expandTableColumnsResource(tfMap map[string]interface{}) *awstypes.TableWit apiObject := &awstypes.TableWithColumnsResource{} - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -1222,7 +1222,7 @@ func flattenTableColumnsResource(apiObject *awstypes.TableWithColumnsResource) m tfMap := map[string]interface{}{} if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.ToString(v) + tfMap[names.AttrCatalogID] = aws.ToString(v) } tfMap["column_names"] = flex.FlattenStringValueSet(apiObject.ColumnNames) @@ -1254,7 +1254,7 @@ func flattenTableColumnsResourceAsTable(apiObject *awstypes.TableWithColumnsReso tfMap := map[string]interface{}{} if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.ToString(v) + tfMap[names.AttrCatalogID] = aws.ToString(v) } if v := apiObject.DatabaseName; v != nil { diff --git a/internal/service/lakeformation/permissions_data_source.go b/internal/service/lakeformation/permissions_data_source.go index 35582ca553f..e4b7c1d5be8 100644 --- a/internal/service/lakeformation/permissions_data_source.go +++ b/internal/service/lakeformation/permissions_data_source.go @@ -29,7 +29,7 @@ func DataSourcePermissions() *schema.Resource { ReadWithoutTimeout: dataSourcePermissionsRead, Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidAccountID, @@ -77,7 +77,7 @@ func DataSourcePermissions() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -93,7 +93,7 @@ func DataSourcePermissions() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -113,7 +113,7 @@ func DataSourcePermissions() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -142,7 +142,7 @@ func DataSourcePermissions() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -205,7 +205,7 @@ func DataSourcePermissions() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -235,7 +235,7 @@ func DataSourcePermissions() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -287,7 +287,7 @@ func dataSourcePermissionsRead(ctx context.Context, d *schema.ResourceData, meta Resource: &awstypes.Resource{}, } - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } diff --git a/internal/service/lakeformation/permissions_test.go b/internal/service/lakeformation/permissions_test.go index 76482b36823..86b1781ada1 100644 --- a/internal/service/lakeformation/permissions_test.go +++ b/internal/service/lakeformation/permissions_test.go @@ -869,7 +869,7 @@ func permissionCountForResource(ctx context.Context, conn *lakeformation.Client, noResource := true - if v, ok := rs.Primary.Attributes["catalog_id"]; ok && v != "" { + if v, ok := rs.Primary.Attributes[names.AttrCatalogID]; ok && v != "" { input.CatalogId = aws.String(v) noResource = false @@ -885,7 +885,7 @@ func permissionCountForResource(ctx context.Context, conn *lakeformation.Client, tfMap := map[string]interface{}{} if v := rs.Primary.Attributes["data_location.0.catalog_id"]; v != "" { - tfMap["catalog_id"] = v + tfMap[names.AttrCatalogID] = v } if v := rs.Primary.Attributes["data_location.0.arn"]; v != "" { @@ -901,7 +901,7 @@ func permissionCountForResource(ctx context.Context, conn *lakeformation.Client, tfMap := map[string]interface{}{} if v := rs.Primary.Attributes["database.0.catalog_id"]; v != "" { - tfMap["catalog_id"] = v + tfMap[names.AttrCatalogID] = v } if v := rs.Primary.Attributes["database.0.name"]; v != "" { @@ -917,7 +917,7 @@ func permissionCountForResource(ctx context.Context, conn *lakeformation.Client, tfMap := map[string]interface{}{} if v := rs.Primary.Attributes["lf_tag.0.catalog_id"]; v != "" { - tfMap["catalog_id"] = v + tfMap[names.AttrCatalogID] = v } if v := rs.Primary.Attributes["lf_tag.0.key"]; v != "" { @@ -941,7 +941,7 @@ func permissionCountForResource(ctx context.Context, conn *lakeformation.Client, tfMap := map[string]interface{}{} if v := rs.Primary.Attributes["lf_tag_policy.0.catalog_id"]; v != "" { - tfMap["catalog_id"] = v + tfMap[names.AttrCatalogID] = v } if v := rs.Primary.Attributes["lf_tag_policy.0.resource_type"]; v != "" { @@ -983,7 +983,7 @@ func permissionCountForResource(ctx context.Context, conn *lakeformation.Client, tfMap := map[string]interface{}{} if v := rs.Primary.Attributes["table.0.catalog_id"]; v != "" { - tfMap["catalog_id"] = v + tfMap[names.AttrCatalogID] = v } if v := rs.Primary.Attributes["table.0.database_name"]; v != "" { @@ -1009,7 +1009,7 @@ func permissionCountForResource(ctx context.Context, conn *lakeformation.Client, tfMap := map[string]interface{}{} if v := rs.Primary.Attributes["table_with_columns.0.catalog_id"]; v != "" { - tfMap["catalog_id"] = v + tfMap[names.AttrCatalogID] = v } if v := rs.Primary.Attributes["table_with_columns.0.database_name"]; v != "" { diff --git a/internal/service/lakeformation/resource_lf_tag.go b/internal/service/lakeformation/resource_lf_tag.go index d4fe6455257..df72d6bacb1 100644 --- a/internal/service/lakeformation/resource_lf_tag.go +++ b/internal/service/lakeformation/resource_lf_tag.go @@ -66,8 +66,8 @@ func (r *resourceResourceLFTag) Metadata(_ context.Context, req resource.Metadat func (r *resourceResourceLFTag) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "catalog_id": catalogIDSchemaOptional(), - names.AttrID: framework.IDAttribute(), + names.AttrCatalogID: catalogIDSchemaOptional(), + names.AttrID: framework.IDAttribute(), }, Blocks: map[string]schema.Block{ "database": schema.ListNestedBlock{ @@ -80,7 +80,7 @@ func (r *resourceResourceLFTag) Schema(ctx context.Context, req resource.SchemaR }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "catalog_id": catalogIDSchemaOptional(), + names.AttrCatalogID: catalogIDSchemaOptional(), names.AttrName: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ @@ -101,7 +101,7 @@ func (r *resourceResourceLFTag) Schema(ctx context.Context, req resource.SchemaR }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "catalog_id": catalogIDSchemaOptionalComputed(), + names.AttrCatalogID: catalogIDSchemaOptionalComputed(), names.AttrKey: schema.StringAttribute{ Required: true, Validators: []validator.String{ @@ -134,7 +134,7 @@ func (r *resourceResourceLFTag) Schema(ctx context.Context, req resource.SchemaR }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "catalog_id": catalogIDSchemaOptional(), + names.AttrCatalogID: catalogIDSchemaOptional(), names.AttrDatabaseName: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ @@ -178,7 +178,7 @@ func (r *resourceResourceLFTag) Schema(ctx context.Context, req resource.SchemaR }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "catalog_id": catalogIDSchemaOptional(), + names.AttrCatalogID: catalogIDSchemaOptional(), "column_names": schema.SetAttribute{ CustomType: fwtypes.SetOfStringType, Optional: true, diff --git a/internal/service/lakeformation/resource_lf_tag_test.go b/internal/service/lakeformation/resource_lf_tag_test.go index 65c89a20931..1b6f4ef63c9 100644 --- a/internal/service/lakeformation/resource_lf_tag_test.go +++ b/internal/service/lakeformation/resource_lf_tag_test.go @@ -54,7 +54,7 @@ func testAccResourceLFTag_basic(t *testing.T) { Config: testAccResourceLFTagConfig_basic(rName, []string{names.AttrValue}, names.AttrValue), Check: resource.ComposeTestCheckFunc( testAccCheckResourceLFTagExists(ctx, resourceName, &resourcelftag), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), resource.TestCheckResourceAttr(resourceName, "lf_tag.0.key", rName), resource.TestCheckResourceAttr(resourceName, "lf_tag.0.value", names.AttrValue), ), @@ -160,7 +160,7 @@ func lfTagsDisappearsStateFunc(ctx context.Context, state *tfsdk.State, is *terr var lfdata tflakeformation.ResourceResourceLFTagData var lt tflakeformation.LFTag - if v, ok := is.Attributes["catalog_id"]; ok { + if v, ok := is.Attributes[names.AttrCatalogID]; ok { lfdata.CatalogID = fwflex.StringValueToFramework(ctx, v) } @@ -180,7 +180,7 @@ func lfTagsDisappearsStateFunc(ctx context.Context, state *tfsdk.State, is *terr lfdata.LFTag = fwtypes.NewListNestedObjectValueOfPtrMust[tflakeformation.LFTag](ctx, <) - if err := fwdiag.DiagnosticsError(state.SetAttribute(ctx, path.Root("catalog_id"), lfdata.Database)); err != nil { + if err := fwdiag.DiagnosticsError(state.SetAttribute(ctx, path.Root(names.AttrCatalogID), lfdata.Database)); err != nil { log.Printf("[WARN] %s", err) } @@ -209,7 +209,7 @@ func testAccCheckResourceLFTagDestroy(ctx context.Context) resource.TestCheckFun ShowAssignedLFTags: aws.Bool(true), } - if v, ok := rs.Primary.Attributes["catalog_id"]; ok { + if v, ok := rs.Primary.Attributes[names.AttrCatalogID]; ok { input.CatalogId = aws.String(v) } @@ -318,7 +318,7 @@ func testAccCheckResourceLFTagExists(ctx context.Context, name string, resourcel ShowAssignedLFTags: aws.Bool(true), } - if v, ok := rs.Primary.Attributes["catalog_id"]; ok { + if v, ok := rs.Primary.Attributes[names.AttrCatalogID]; ok { input.CatalogId = aws.String(v) } diff --git a/internal/service/lakeformation/resource_lf_tags.go b/internal/service/lakeformation/resource_lf_tags.go index de7b5b9f2a8..28fc1df2465 100644 --- a/internal/service/lakeformation/resource_lf_tags.go +++ b/internal/service/lakeformation/resource_lf_tags.go @@ -42,7 +42,7 @@ func ResourceResourceLFTags() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Computed: true, ForceNew: true, @@ -62,7 +62,7 @@ func ResourceResourceLFTags() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Computed: true, ForceNew: true, @@ -83,7 +83,7 @@ func ResourceResourceLFTags() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, ForceNew: true, Optional: true, @@ -118,7 +118,7 @@ func ResourceResourceLFTags() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Computed: true, ForceNew: true, @@ -166,7 +166,7 @@ func ResourceResourceLFTags() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "catalog_id": { + names.AttrCatalogID: { Type: schema.TypeString, Computed: true, ForceNew: true, @@ -231,7 +231,7 @@ func resourceResourceLFTagsCreate(ctx context.Context, d *schema.ResourceData, m input := &lakeformation.AddLFTagsToResourceInput{} - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } @@ -302,7 +302,7 @@ func resourceResourceLFTagsRead(ctx context.Context, d *schema.ResourceData, met ShowAssignedLFTags: aws.Bool(true), } - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } @@ -334,7 +334,7 @@ func resourceResourceLFTagsDelete(ctx context.Context, d *schema.ResourceData, m input := &lakeformation.RemoveLFTagsFromResourceInput{} - if v, ok := d.GetOk("catalog_id"); ok { + if v, ok := d.GetOk(names.AttrCatalogID); ok { input.CatalogId = aws.String(v.(string)) } @@ -465,7 +465,7 @@ func lfTagsHash(v interface{}) int { var buf bytes.Buffer buf.WriteString(m[names.AttrKey].(string)) buf.WriteString(m[names.AttrValue].(string)) - buf.WriteString(m["catalog_id"].(string)) + buf.WriteString(m[names.AttrCatalogID].(string)) return create.StringHashcode(buf.String()) } @@ -477,7 +477,7 @@ func expandLFTagPair(tfMap map[string]interface{}) awstypes.LFTagPair { apiObject := awstypes.LFTagPair{} - if v, ok := tfMap["catalog_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { apiObject.CatalogId = aws.String(v) } @@ -526,7 +526,7 @@ func flattenLFTagPair(apiObject awstypes.LFTagPair) map[string]interface{} { tfMap := map[string]interface{}{} if v := apiObject.CatalogId; v != nil { - tfMap["catalog_id"] = aws.ToString(v) + tfMap[names.AttrCatalogID] = aws.ToString(v) } if v := apiObject.TagKey; v != nil { diff --git a/internal/service/lakeformation/resource_lf_tags_test.go b/internal/service/lakeformation/resource_lf_tags_test.go index 69d585d3e35..a4d31da47bc 100644 --- a/internal/service/lakeformation/resource_lf_tags_test.go +++ b/internal/service/lakeformation/resource_lf_tags_test.go @@ -43,7 +43,7 @@ func testAccResourceLFTags_basic(t *testing.T) { names.AttrKey: rName, names.AttrValue: "copse", }), - acctest.CheckResourceAttrAccountID(resourceName, "catalog_id"), + acctest.CheckResourceAttrAccountID(resourceName, names.AttrCatalogID), ), }, }, @@ -324,7 +324,7 @@ func testAccCheckDatabaseLFTagsDestroy(ctx context.Context) resource.TestCheckFu ShowAssignedLFTags: aws.Bool(true), } - if v, ok := rs.Primary.Attributes["catalog_id"]; ok { + if v, ok := rs.Primary.Attributes[names.AttrCatalogID]; ok { input.CatalogId = aws.String(v) } @@ -431,7 +431,7 @@ func testAccCheckDatabaseLFTagsExists(ctx context.Context, resourceName string) ShowAssignedLFTags: aws.Bool(true), } - if v, ok := rs.Primary.Attributes["catalog_id"]; ok { + if v, ok := rs.Primary.Attributes[names.AttrCatalogID]; ok { input.CatalogId = aws.String(v) } From 6d6d3bf85bf7eeda4d5e4f3e8ba6f4e8cf395ac9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:47:37 -0400 Subject: [PATCH 0864/1490] sagemaker: Use constant for catalog_id strings --- internal/service/sagemaker/feature_group_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/sagemaker/feature_group_test.go b/internal/service/sagemaker/feature_group_test.go index 12fb98748f8..3e224ac779d 100644 --- a/internal/service/sagemaker/feature_group_test.go +++ b/internal/service/sagemaker/feature_group_test.go @@ -427,7 +427,7 @@ func TestAccSageMakerFeatureGroup_Offline_providedCatalog(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "offline_store_config.0.s3_storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "offline_store_config.0.s3_storage_config.0.s3_uri", fmt.Sprintf("s3://%s/prefix/", rName)), resource.TestCheckResourceAttr(resourceName, "offline_store_config.0.data_catalog_config.#", "1"), - resource.TestCheckResourceAttrPair(resourceName, "offline_store_config.0.data_catalog_config.0.catalog", glueTableResourceName, "catalog_id"), + resource.TestCheckResourceAttrPair(resourceName, "offline_store_config.0.data_catalog_config.0.catalog", glueTableResourceName, names.AttrCatalogID), resource.TestCheckResourceAttrPair(resourceName, "offline_store_config.0.data_catalog_config.0.database", glueTableResourceName, names.AttrDatabaseName), resource.TestCheckResourceAttrPair(resourceName, "offline_store_config.0.data_catalog_config.0.table_name", glueTableResourceName, names.AttrName), ), From f91a832bfffaeb9dc6f8617ac2cb491253ff893d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:50:23 -0400 Subject: [PATCH 0865/1490] ci: Prefer constant for string literal "bucket_prefix" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 9d167ed5564..c036afaec30 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1295,3 +1295,13 @@ rules: - pattern: '"catalog_id"' severity: ERROR fix: "names.AttrCatalogID" + - id: literal-bucket_prefix-string-constant + languages: [go] + message: Use the constant `names.AttrBucketPrefix` for the string literal "bucket_prefix" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"bucket_prefix"' + severity: ERROR + fix: "names.AttrBucketPrefix" From aee0cc5c922c3eab1c8af4e6b61e9e13f40ec80a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:50:23 -0400 Subject: [PATCH 0866/1490] names: Add constant for string literal "bucket_prefix" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 132c65ce9e8..f2dd25bf194 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -12,6 +12,7 @@ const ( AttrAvailabilityZones = "availability_zones" AttrBucket = "bucket" AttrBucketName = "bucket_name" + AttrBucketPrefix = "bucket_prefix" AttrCatalogID = "catalog_id" AttrClusterIdentifier = "cluster_identifier" AttrCreatedAt = "created_at" From 9fa32732ed49add2614256fc1c7eb08d7878589e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:50:23 -0400 Subject: [PATCH 0867/1490] appflow: Use constant for bucket_prefix strings --- internal/service/appflow/connector_profile.go | 12 ++-- internal/service/appflow/flow.go | 58 +++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/internal/service/appflow/connector_profile.go b/internal/service/appflow/connector_profile.go index 94659d67cf8..bf6831d23ee 100644 --- a/internal/service/appflow/connector_profile.go +++ b/internal/service/appflow/connector_profile.go @@ -1102,7 +1102,7 @@ func resourceConnectorProfile() *schema.Resource { validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), ), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -1308,7 +1308,7 @@ func resourceConnectorProfile() *schema.Resource { validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), ), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -2072,7 +2072,7 @@ func expandRedshiftConnectorProfileProperties(m map[string]interface{}) *types.R DatabaseName: aws.String(m[names.AttrDatabaseName].(string)), } - if v, ok := m["bucket_prefix"].(string); ok && v != "" { + if v, ok := m[names.AttrBucketPrefix].(string); ok && v != "" { properties.BucketPrefix = aws.String(v) } @@ -2158,7 +2158,7 @@ func expandSnowflakeConnectorProfileProperties(m map[string]interface{}) *types. properties.AccountName = aws.String(v) } - if v, ok := m["bucket_prefix"].(string); ok && v != "" { + if v, ok := m[names.AttrBucketPrefix].(string); ok && v != "" { properties.BucketPrefix = aws.String(v) } @@ -2297,7 +2297,7 @@ func flattenRedshiftConnectorProfileProperties(properties *types.RedshiftConnect m[names.AttrBucketName] = aws.ToString(properties.BucketName) if properties.BucketPrefix != nil { - m["bucket_prefix"] = aws.ToString(properties.BucketPrefix) + m[names.AttrBucketPrefix] = aws.ToString(properties.BucketPrefix) } if properties.DatabaseUrl != nil { @@ -2369,7 +2369,7 @@ func flattenSnowflakeConnectorProfileProperties(properties *types.SnowflakeConne m[names.AttrBucketName] = aws.ToString(properties.BucketName) if properties.BucketPrefix != nil { - m["bucket_prefix"] = aws.ToString(properties.BucketPrefix) + m[names.AttrBucketPrefix] = aws.ToString(properties.BucketPrefix) } if properties.Region != nil { diff --git a/internal/service/appflow/flow.go b/internal/service/appflow/flow.go index dddd336486e..f2b9df8f3a8 100644 --- a/internal/service/appflow/flow.go +++ b/internal/service/appflow/flow.go @@ -112,7 +112,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -176,7 +176,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -213,7 +213,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -258,7 +258,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -284,7 +284,7 @@ func resourceFlow() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -300,7 +300,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -337,7 +337,7 @@ func resourceFlow() *schema.Resource { Required: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, Computed: true, @@ -424,7 +424,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -474,7 +474,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -510,7 +510,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -532,7 +532,7 @@ func resourceFlow() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -548,7 +548,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -584,7 +584,7 @@ func resourceFlow() *schema.Resource { Required: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`^(upsolver-appflow)\S*`), "must start with 'upsolver-appflow' and can not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -656,7 +656,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -876,7 +876,7 @@ func resourceFlow() *schema.Resource { ForceNew: true, ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(3, 63)), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -1508,7 +1508,7 @@ func expandErrorHandlingConfig(tfMap map[string]interface{}) *types.ErrorHandlin a.BucketName = aws.String(v) } - if v, ok := tfMap["bucket_prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrBucketPrefix].(string); ok && v != "" { a.BucketPrefix = aws.String(v) } @@ -1783,7 +1783,7 @@ func expandRedshiftDestinationProperties(tfMap map[string]interface{}) *types.Re a := &types.RedshiftDestinationProperties{} - if v, ok := tfMap["bucket_prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrBucketPrefix].(string); ok && v != "" { a.BucketPrefix = aws.String(v) } @@ -1813,7 +1813,7 @@ func expandS3DestinationProperties(tfMap map[string]interface{}) *types.S3Destin a.BucketName = aws.String(v) } - if v, ok := tfMap["bucket_prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrBucketPrefix].(string); ok && v != "" { a.BucketPrefix = aws.String(v) } @@ -1917,7 +1917,7 @@ func expandSuccessResponseHandlingConfig(tfMap map[string]interface{}) *types.Su a.BucketName = aws.String(v) } - if v, ok := tfMap["bucket_prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrBucketPrefix].(string); ok && v != "" { a.BucketPrefix = aws.String(v) } @@ -1931,7 +1931,7 @@ func expandSnowflakeDestinationProperties(tfMap map[string]interface{}) *types.S a := &types.SnowflakeDestinationProperties{} - if v, ok := tfMap["bucket_prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrBucketPrefix].(string); ok && v != "" { a.BucketPrefix = aws.String(v) } @@ -1961,7 +1961,7 @@ func expandUpsolverDestinationProperties(tfMap map[string]interface{}) *types.Up a.BucketName = aws.String(v) } - if v, ok := tfMap["bucket_prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrBucketPrefix].(string); ok && v != "" { a.BucketPrefix = aws.String(v) } @@ -2251,7 +2251,7 @@ func expandS3SourceProperties(tfMap map[string]interface{}) *types.S3SourcePrope a.BucketName = aws.String(v) } - if v, ok := tfMap["bucket_prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrBucketPrefix].(string); ok && v != "" { a.BucketPrefix = aws.String(v) } @@ -2637,7 +2637,7 @@ func flattenErrorHandlingConfig(errorHandlingConfig *types.ErrorHandlingConfig) } if v := errorHandlingConfig.BucketPrefix; v != nil { - m["bucket_prefix"] = aws.ToString(v) + m[names.AttrBucketPrefix] = aws.ToString(v) } m["fail_on_first_destination_error"] = errorHandlingConfig.FailOnFirstDestinationError @@ -2877,7 +2877,7 @@ func flattenRedshiftDestinationProperties(redshiftDestinationProperties *types.R m := map[string]interface{}{} if v := redshiftDestinationProperties.BucketPrefix; v != nil { - m["bucket_prefix"] = aws.ToString(v) + m[names.AttrBucketPrefix] = aws.ToString(v) } if v := redshiftDestinationProperties.ErrorHandlingConfig; v != nil { @@ -2907,7 +2907,7 @@ func flattenS3DestinationProperties(s3DestinationProperties *types.S3Destination } if v := s3DestinationProperties.BucketPrefix; v != nil { - m["bucket_prefix"] = aws.ToString(v) + m[names.AttrBucketPrefix] = aws.ToString(v) } if v := s3DestinationProperties.S3OutputFormatConfig; v != nil { @@ -3003,7 +3003,7 @@ func flattenSuccessResponseHandlingConfig(successResponseHandlingConfig *types.S } if v := successResponseHandlingConfig.BucketPrefix; v != nil { - m["bucket_prefix"] = aws.ToString(v) + m[names.AttrBucketPrefix] = aws.ToString(v) } return m @@ -3017,7 +3017,7 @@ func flattenSnowflakeDestinationProperties(snowflakeDestinationProperties *types m := map[string]interface{}{} if v := snowflakeDestinationProperties.BucketPrefix; v != nil { - m["bucket_prefix"] = aws.ToString(v) + m[names.AttrBucketPrefix] = aws.ToString(v) } if v := snowflakeDestinationProperties.ErrorHandlingConfig; v != nil { @@ -3047,7 +3047,7 @@ func flattenUpsolverDestinationProperties(upsolverDestinationProperties *types.U } if v := upsolverDestinationProperties.BucketPrefix; v != nil { - m["bucket_prefix"] = aws.ToString(v) + m[names.AttrBucketPrefix] = aws.ToString(v) } if v := upsolverDestinationProperties.S3OutputFormatConfig; v != nil { @@ -3331,7 +3331,7 @@ func flattenS3SourceProperties(s3SourceProperties *types.S3SourceProperties) map } if v := s3SourceProperties.BucketPrefix; v != nil { - m["bucket_prefix"] = aws.ToString(v) + m[names.AttrBucketPrefix] = aws.ToString(v) } if v := s3SourceProperties.S3InputFormatConfig; v != nil { From c42650fd963b3fb57dc2a4777568331f558606c5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:50:23 -0400 Subject: [PATCH 0868/1490] connect: Use constant for bucket_prefix strings --- internal/service/connect/instance_storage_config.go | 8 ++++---- .../connect/instance_storage_config_data_source.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/connect/instance_storage_config.go b/internal/service/connect/instance_storage_config.go index 16705d305bd..44a99a853d8 100644 --- a/internal/service/connect/instance_storage_config.go +++ b/internal/service/connect/instance_storage_config.go @@ -139,7 +139,7 @@ func ResourceInstanceStorageConfig() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 128), }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 128), @@ -414,7 +414,7 @@ func exapandS3Config(tfList []interface{}) *connect.S3Config { result := &connect.S3Config{ BucketName: aws.String(tfMap[names.AttrBucketName].(string)), - BucketPrefix: aws.String(tfMap["bucket_prefix"].(string)), + BucketPrefix: aws.String(tfMap[names.AttrBucketPrefix].(string)), } if v, ok := tfMap["encryption_config"].([]interface{}); ok && len(v) > 0 { @@ -516,8 +516,8 @@ func flattenS3Config(apiObject *connect.S3Config) []interface{} { } values := map[string]interface{}{ - names.AttrBucketName: aws.StringValue(apiObject.BucketName), - "bucket_prefix": aws.StringValue(apiObject.BucketPrefix), + names.AttrBucketName: aws.StringValue(apiObject.BucketName), + names.AttrBucketPrefix: aws.StringValue(apiObject.BucketPrefix), } if v := apiObject.EncryptionConfig; v != nil { diff --git a/internal/service/connect/instance_storage_config_data_source.go b/internal/service/connect/instance_storage_config_data_source.go index 71c32e132b4..5524b975de8 100644 --- a/internal/service/connect/instance_storage_config_data_source.go +++ b/internal/service/connect/instance_storage_config_data_source.go @@ -107,7 +107,7 @@ func DataSourceInstanceStorageConfig() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Computed: true, }, From d2244cdf61099717635af1c61691e4af8e5c04db Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:50:23 -0400 Subject: [PATCH 0869/1490] elb: Use constant for bucket_prefix strings --- internal/service/elb/flex.go | 2 +- internal/service/elb/load_balancer.go | 4 ++-- internal/service/elb/load_balancer_data_source.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/elb/flex.go b/internal/service/elb/flex.go index a42605a47a7..c685a6e5cd0 100644 --- a/internal/service/elb/flex.go +++ b/internal/service/elb/flex.go @@ -27,7 +27,7 @@ func flattenAccessLog(l *elb.AccessLog) []map[string]interface{} { } if l.S3BucketPrefix != nil { - r["bucket_prefix"] = aws.StringValue(l.S3BucketPrefix) + r[names.AttrBucketPrefix] = aws.StringValue(l.S3BucketPrefix) } if l.EmitInterval != nil { diff --git a/internal/service/elb/load_balancer.go b/internal/service/elb/load_balancer.go index 8ad27889f19..9d74ed412ee 100644 --- a/internal/service/elb/load_balancer.go +++ b/internal/service/elb/load_balancer.go @@ -77,7 +77,7 @@ func ResourceLoadBalancer() *schema.Resource { Type: schema.TypeString, Required: true, }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, }, @@ -554,7 +554,7 @@ func resourceLoadBalancerUpdate(ctx context.Context, d *schema.ResourceData, met Enabled: aws.Bool(l[names.AttrEnabled].(bool)), EmitInterval: aws.Int64(int64(l["interval"].(int))), S3BucketName: aws.String(l[names.AttrBucket].(string)), - S3BucketPrefix: aws.String(l["bucket_prefix"].(string)), + S3BucketPrefix: aws.String(l[names.AttrBucketPrefix].(string)), } } else if len(logs) == 0 { // disable access logs diff --git a/internal/service/elb/load_balancer_data_source.go b/internal/service/elb/load_balancer_data_source.go index 1fe7b76480e..1db3d1eb304 100644 --- a/internal/service/elb/load_balancer_data_source.go +++ b/internal/service/elb/load_balancer_data_source.go @@ -48,7 +48,7 @@ func DataSourceLoadBalancer() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Computed: true, }, From 19c7dadef3a47f0aa0f2ec9cf44ff34416c52e51 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:50:24 -0400 Subject: [PATCH 0870/1490] internetmonitor: Use constant for bucket_prefix strings --- internal/service/internetmonitor/monitor.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/internetmonitor/monitor.go b/internal/service/internetmonitor/monitor.go index 736493113f2..66702263dbb 100644 --- a/internal/service/internetmonitor/monitor.go +++ b/internal/service/internetmonitor/monitor.go @@ -82,7 +82,7 @@ func resourceMonitor() *schema.Resource { Type: schema.TypeString, Required: true, }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, }, @@ -455,7 +455,7 @@ func expandS3Config(tfList []interface{}) *types.S3Config { apiObject.BucketName = aws.String(v) } - if v, ok := tfMap["bucket_prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrBucketPrefix].(string); ok && v != "" { apiObject.BucketPrefix = aws.String(v) } @@ -502,7 +502,7 @@ func flattenS3Config(apiObject *types.S3Config) []interface{} { } if apiObject.BucketPrefix != nil { - tfMap["bucket_prefix"] = aws.ToString(apiObject.BucketPrefix) + tfMap[names.AttrBucketPrefix] = aws.ToString(apiObject.BucketPrefix) } return []interface{}{tfMap} From 4ef82ee36d64bf5794f648061265540f0f1bcb1d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:50:24 -0400 Subject: [PATCH 0871/1490] rds: Use constant for bucket_prefix strings --- internal/service/rds/cluster.go | 4 ++-- internal/service/rds/cluster_migrate.go | 2 +- internal/service/rds/instance.go | 4 ++-- internal/service/rds/instance_migrate.go | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/rds/cluster.go b/internal/service/rds/cluster.go index 64020f658d7..132b6ce36ba 100644 --- a/internal/service/rds/cluster.go +++ b/internal/service/rds/cluster.go @@ -415,7 +415,7 @@ func ResourceCluster() *schema.Resource { Required: true, ForceNew: true, }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -723,7 +723,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int MasterUsername: aws.String(d.Get("master_username").(string)), S3BucketName: aws.String(tfMap[names.AttrBucketName].(string)), S3IngestionRoleArn: aws.String(tfMap["ingestion_role"].(string)), - S3Prefix: aws.String(tfMap["bucket_prefix"].(string)), + S3Prefix: aws.String(tfMap[names.AttrBucketPrefix].(string)), SourceEngine: aws.String(tfMap["source_engine"].(string)), SourceEngineVersion: aws.String(tfMap["source_engine_version"].(string)), Tags: getTagsIn(ctx), diff --git a/internal/service/rds/cluster_migrate.go b/internal/service/rds/cluster_migrate.go index ed1771e530d..c38dc206e88 100644 --- a/internal/service/rds/cluster_migrate.go +++ b/internal/service/rds/cluster_migrate.go @@ -295,7 +295,7 @@ func resourceClusterResourceV0() *schema.Resource { Required: true, ForceNew: true, }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ForceNew: true, diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go index 25be105dba7..4351fa00eb2 100644 --- a/internal/service/rds/instance.go +++ b/internal/service/rds/instance.go @@ -593,7 +593,7 @@ func ResourceInstance() *schema.Resource { Required: true, ForceNew: true, }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -971,7 +971,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), S3BucketName: aws.String(tfMap[names.AttrBucketName].(string)), S3IngestionRoleArn: aws.String(tfMap["ingestion_role"].(string)), - S3Prefix: aws.String(tfMap["bucket_prefix"].(string)), + 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)), diff --git a/internal/service/rds/instance_migrate.go b/internal/service/rds/instance_migrate.go index 0441ce68490..449d28e72ec 100644 --- a/internal/service/rds/instance_migrate.go +++ b/internal/service/rds/instance_migrate.go @@ -208,7 +208,7 @@ func resourceInstanceResourceV0() *schema.Resource { Required: true, ForceNew: true, }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -848,7 +848,7 @@ func resourceInstanceResourceV1() *schema.Resource { Required: true, ForceNew: true, }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, ForceNew: true, From 2299fbd5bbfc09cd0a5b339e3b79aabc61dd67bb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:50:24 -0400 Subject: [PATCH 0872/1490] s3: Use constant for bucket_prefix strings --- internal/service/s3/bucket.go | 8 ++++---- internal/service/s3/bucket_test.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index abd30b1347b..35261febc26 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -92,7 +92,7 @@ func resourceBucket() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ConflictsWith: []string{"bucket_prefix"}, + ConflictsWith: []string{names.AttrBucketPrefix}, ValidateFunc: validation.All( validation.StringLenBetween(0, 63), validation.StringDoesNotMatch(directoryBucketNameRegex, `must not be in the format [bucket_name]--[azid]--x-s3. Use the aws_s3_directory_bucket resource to manage S3 Express buckets`), @@ -102,7 +102,7 @@ func resourceBucket() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "bucket_prefix": { + names.AttrBucketPrefix: { Type: schema.TypeString, Optional: true, Computed: true, @@ -709,7 +709,7 @@ func resourceBucketCreate(ctx context.Context, d *schema.ResourceData, meta inte var diags diag.Diagnostics conn := meta.(*conns.AWSClient).S3Client(ctx) - bucket := create.Name(d.Get(names.AttrBucket).(string), d.Get("bucket_prefix").(string)) + bucket := create.Name(d.Get(names.AttrBucket).(string), d.Get(names.AttrBucketPrefix).(string)) region := meta.(*conns.AWSClient).Region if err := validBucketName(bucket, region); err != nil { @@ -804,7 +804,7 @@ func resourceBucketRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrARN, arn) d.Set(names.AttrBucket, d.Id()) d.Set("bucket_domain_name", meta.(*conns.AWSClient).PartitionHostname(ctx, d.Id()+".s3")) - d.Set("bucket_prefix", create.NamePrefixFromName(d.Id())) + d.Set(names.AttrBucketPrefix, create.NamePrefixFromName(d.Id())) // // Bucket Policy. diff --git a/internal/service/s3/bucket_test.go b/internal/service/s3/bucket_test.go index be48f0a9ca5..4f88a8036c3 100644 --- a/internal/service/s3/bucket_test.go +++ b/internal/service/s3/bucket_test.go @@ -70,7 +70,7 @@ func TestAccS3Bucket_Basic_basic(t *testing.T) { acctest.CheckResourceAttrGlobalARNNoAccount(resourceName, names.AttrARN, "s3", rName), resource.TestCheckResourceAttr(resourceName, names.AttrBucket, rName), testAccCheckBucketDomainName(ctx, resourceName, "bucket_domain_name", rName), - resource.TestCheckResourceAttr(resourceName, "bucket_prefix", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrBucketPrefix, ""), resource.TestCheckResourceAttr(resourceName, "bucket_regional_domain_name", testAccBucketRegionalDomainName(rName, region)), resource.TestCheckResourceAttr(resourceName, "cors_rule.#", "0"), resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), @@ -131,7 +131,7 @@ func TestAccS3Bucket_Basic_emptyString(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckBucketExists(ctx, resourceName), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrBucket), - resource.TestCheckResourceAttr(resourceName, "bucket_prefix", id.UniqueIdPrefix), + resource.TestCheckResourceAttr(resourceName, names.AttrBucketPrefix, id.UniqueIdPrefix), ), }, { @@ -159,7 +159,7 @@ func TestAccS3Bucket_Basic_nameGenerated(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckBucketExists(ctx, resourceName), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrBucket), - resource.TestCheckResourceAttr(resourceName, "bucket_prefix", id.UniqueIdPrefix), + resource.TestCheckResourceAttr(resourceName, names.AttrBucketPrefix, id.UniqueIdPrefix), ), }, { @@ -187,7 +187,7 @@ func TestAccS3Bucket_Basic_namePrefix(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckBucketExists(ctx, resourceName), acctest.CheckResourceAttrNameFromPrefix(resourceName, names.AttrBucket, "tf-test-"), - resource.TestCheckResourceAttr(resourceName, "bucket_prefix", "tf-test-"), + resource.TestCheckResourceAttr(resourceName, names.AttrBucketPrefix, "tf-test-"), ), }, { From 8453ac193d73cb1922c1390653299d877e206991 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:53:42 -0400 Subject: [PATCH 0873/1490] ci: Prefer constant for string literal "encrypted" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index c036afaec30..b2501de4de8 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1305,3 +1305,13 @@ rules: - pattern: '"bucket_prefix"' severity: ERROR fix: "names.AttrBucketPrefix" + - id: literal-encrypted-string-constant + languages: [go] + message: Use the constant `names.AttrEncrypted` for the string literal "encrypted" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"encrypted"' + severity: ERROR + fix: "names.AttrEncrypted" From a24bf5dd670e056dd250ea60ad50572cba05feee Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:53:42 -0400 Subject: [PATCH 0874/1490] names: Add constant for string literal "encrypted" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index f2dd25bf194..6bcd5566065 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -23,6 +23,7 @@ const ( AttrDeviceName = "device_name" AttrDomainName = "domain_name" AttrEnabled = "enabled" + AttrEncrypted = "encrypted" AttrEndpoint = "endpoint" AttrEndpoints = "endpoints" AttrEngineVersion = "engine_version" From 35cde9495ff770882684a7d4382efb264182c765 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:53:42 -0400 Subject: [PATCH 0875/1490] autoscaling: Use constant for encrypted strings --- internal/service/autoscaling/launch_configuration.go | 10 +++++----- .../autoscaling/launch_configuration_data_source.go | 4 ++-- .../service/autoscaling/launch_configuration_test.go | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/autoscaling/launch_configuration.go b/internal/service/autoscaling/launch_configuration.go index 27623d775d3..3e6c85c0568 100644 --- a/internal/service/autoscaling/launch_configuration.go +++ b/internal/service/autoscaling/launch_configuration.go @@ -71,7 +71,7 @@ func resourceLaunchConfiguration() *schema.Resource { Required: true, ForceNew: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -241,7 +241,7 @@ func resourceLaunchConfiguration() *schema.Resource { Default: true, ForceNew: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -550,7 +550,7 @@ func expandBlockDeviceMappingForEBSBlockDevice(tfMap map[string]interface{}) aws apiObject.Ebs.DeleteOnTermination = aws.Bool(v) } - if v, ok := tfMap["encrypted"].(bool); ok && v { + if v, ok := tfMap[names.AttrEncrypted].(bool); ok && v { apiObject.Ebs.Encrypted = aws.Bool(v) } @@ -604,7 +604,7 @@ func expandBlockDeviceMappingForRootBlockDevice(tfMap map[string]interface{}) aw apiObject.Ebs.DeleteOnTermination = aws.Bool(v) } - if v, ok := tfMap["encrypted"].(bool); ok && v { + if v, ok := tfMap[names.AttrEncrypted].(bool); ok && v { apiObject.Ebs.Encrypted = aws.Bool(v) } @@ -673,7 +673,7 @@ func flattenBlockDeviceMappings(apiObjects []awstypes.BlockDeviceMapping, rootDe if v := apiObject.Ebs; v != nil { if v := v.Encrypted; v != nil { - tfMap["encrypted"] = aws.ToBool(v) + tfMap[names.AttrEncrypted] = aws.ToBool(v) } if v := v.Iops; v != nil { diff --git a/internal/service/autoscaling/launch_configuration_data_source.go b/internal/service/autoscaling/launch_configuration_data_source.go index 8a94dddae34..786fa443078 100644 --- a/internal/service/autoscaling/launch_configuration_data_source.go +++ b/internal/service/autoscaling/launch_configuration_data_source.go @@ -40,7 +40,7 @@ func dataSourceLaunchConfiguration() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -148,7 +148,7 @@ func dataSourceLaunchConfiguration() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, diff --git a/internal/service/autoscaling/launch_configuration_test.go b/internal/service/autoscaling/launch_configuration_test.go index a5a47b1206b..dbede5a46b9 100644 --- a/internal/service/autoscaling/launch_configuration_test.go +++ b/internal/service/autoscaling/launch_configuration_test.go @@ -286,9 +286,9 @@ func TestAccAutoScalingLaunchConfiguration_encryptedRootBlockDevice(t *testing.T testAccCheckLaunchConfigurationExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "root_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "root_block_device.*", map[string]string{ - "encrypted": "true", - "volume_size": "11", - "volume_type": "gp2", + names.AttrEncrypted: "true", + "volume_size": "11", + "volume_type": "gp2", }), ), }, @@ -376,7 +376,7 @@ func TestAccAutoScalingLaunchConfiguration_withGP3(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeviceName: "/dev/sdb", - "encrypted": "true", + names.AttrEncrypted: "true", "throughput": "150", "volume_size": "9", "volume_type": "gp3", @@ -416,7 +416,7 @@ func TestAccAutoScalingLaunchConfiguration_encryptedEBSBlockDevice(t *testing.T) resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeviceName: "/dev/sdb", - "encrypted": "true", + names.AttrEncrypted: "true", "volume_size": "9", }), resource.TestCheckResourceAttr(resourceName, "root_block_device.#", "1"), @@ -438,7 +438,7 @@ func TestAccAutoScalingLaunchConfiguration_encryptedEBSBlockDevice(t *testing.T) resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeviceName: "/dev/sdb", - "encrypted": "true", + names.AttrEncrypted: "true", "volume_size": "10", }), resource.TestCheckResourceAttr(resourceName, "root_block_device.#", "1"), From b3d6e3f9aee04b3833261e4fa2a9bfe007e0e6c0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:53:42 -0400 Subject: [PATCH 0876/1490] dlm: Use constant for encrypted strings --- internal/service/dlm/lifecycle_policy.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/dlm/lifecycle_policy.go b/internal/service/dlm/lifecycle_policy.go index ffdca4d52bb..f3994f2a93b 100644 --- a/internal/service/dlm/lifecycle_policy.go +++ b/internal/service/dlm/lifecycle_policy.go @@ -83,7 +83,7 @@ func ResourceLifecyclePolicy() *schema.Resource { Optional: true, ValidateFunc: verify.ValidARN, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Default: false, @@ -307,7 +307,7 @@ func ResourceLifecyclePolicy() *schema.Resource { }, }, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Required: true, }, @@ -829,7 +829,7 @@ func expandActionCrossRegionCopyRuleEncryptionConfiguration(l []interface{}) *dl m := l[0].(map[string]interface{}) config := &dlm.EncryptionConfiguration{ - Encrypted: aws.Bool(m["encrypted"].(bool)), + Encrypted: aws.Bool(m[names.AttrEncrypted].(bool)), } if v, ok := m["cmk_arn"].(string); ok && v != "" { @@ -844,8 +844,8 @@ func flattenActionCrossRegionCopyRuleEncryptionConfiguration(rule *dlm.Encryptio } m := map[string]interface{}{ - "encrypted": aws.BoolValue(rule.Encrypted), - "cmk_arn": aws.StringValue(rule.CmkArn), + names.AttrEncrypted: aws.BoolValue(rule.Encrypted), + "cmk_arn": aws.StringValue(rule.CmkArn), } return []interface{}{m} @@ -935,7 +935,7 @@ func expandCrossRegionCopyRules(l []interface{}) []*dlm.CrossRegionCopyRule { if v, ok := m["deprecate_rule"].([]interface{}); ok && len(v) > 0 && v[0] != nil { rule.DeprecateRule = expandCrossRegionCopyRuleDeprecateRule(v) } - if v, ok := m["encrypted"].(bool); ok { + if v, ok := m[names.AttrEncrypted].(bool); ok { rule.Encrypted = aws.Bool(v) } if v, ok := m["retain_rule"].([]interface{}); ok && len(v) > 0 && v[0] != nil { @@ -964,12 +964,12 @@ func flattenCrossRegionCopyRules(rules []*dlm.CrossRegionCopyRule) []interface{} } m := map[string]interface{}{ - "cmk_arn": aws.StringValue(rule.CmkArn), - "copy_tags": aws.BoolValue(rule.CopyTags), - "deprecate_rule": flattenCrossRegionCopyRuleDeprecateRule(rule.DeprecateRule), - "encrypted": aws.BoolValue(rule.Encrypted), - "retain_rule": flattenCrossRegionCopyRuleRetainRule(rule.RetainRule), - "target": aws.StringValue(rule.Target), + "cmk_arn": aws.StringValue(rule.CmkArn), + "copy_tags": aws.BoolValue(rule.CopyTags), + "deprecate_rule": flattenCrossRegionCopyRuleDeprecateRule(rule.DeprecateRule), + names.AttrEncrypted: aws.BoolValue(rule.Encrypted), + "retain_rule": flattenCrossRegionCopyRuleRetainRule(rule.RetainRule), + "target": aws.StringValue(rule.Target), } result = append(result, m) From 295cdf9deb781fe9ab8afe3dcc6a2dc33de05e28 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:53:42 -0400 Subject: [PATCH 0877/1490] ec2: Use constant for encrypted strings --- internal/service/ec2/ebs_snapshot.go | 4 +-- internal/service/ec2/ebs_snapshot_copy.go | 4 +-- .../service/ec2/ebs_snapshot_data_source.go | 4 +-- .../ec2/ebs_snapshot_data_source_test.go | 2 +- internal/service/ec2/ebs_snapshot_import.go | 6 ++--- internal/service/ec2/ebs_volume.go | 6 ++--- .../service/ec2/ebs_volume_data_source.go | 4 +-- internal/service/ec2/ebs_volume_test.go | 26 +++++++++---------- internal/service/ec2/ec2_ami.go | 8 +++--- internal/service/ec2/ec2_ami_copy.go | 6 ++--- internal/service/ec2/ec2_ami_data_source.go | 4 +-- internal/service/ec2/ec2_ami_from_instance.go | 2 +- internal/service/ec2/ec2_ami_test.go | 8 +++--- internal/service/ec2/ec2_instance.go | 10 +++---- .../service/ec2/ec2_instance_data_source.go | 4 +-- internal/service/ec2/ec2_instance_migrate.go | 4 +-- internal/service/ec2/ec2_instance_test.go | 10 +++---- internal/service/ec2/ec2_launch_template.go | 6 ++--- .../ec2/ec2_launch_template_data_source.go | 2 +- .../service/ec2/ec2_spot_fleet_request.go | 12 ++++----- 20 files changed, 66 insertions(+), 66 deletions(-) diff --git a/internal/service/ec2/ebs_snapshot.go b/internal/service/ec2/ebs_snapshot.go index 902b9a1e634..ebb5b1a903f 100644 --- a/internal/service/ec2/ebs_snapshot.go +++ b/internal/service/ec2/ebs_snapshot.go @@ -60,7 +60,7 @@ func ResourceEBSSnapshot() *schema.Resource { Optional: true, ForceNew: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -197,7 +197,7 @@ func resourceEBSSnapshotRead(ctx context.Context, d *schema.ResourceData, meta i d.Set(names.AttrARN, arn) d.Set("data_encryption_key_id", snapshot.DataEncryptionKeyId) d.Set(names.AttrDescription, snapshot.Description) - d.Set("encrypted", snapshot.Encrypted) + d.Set(names.AttrEncrypted, snapshot.Encrypted) d.Set(names.AttrKMSKeyID, snapshot.KmsKeyId) d.Set("outpost_arn", snapshot.OutpostArn) d.Set("owner_alias", snapshot.OwnerAlias) diff --git a/internal/service/ec2/ebs_snapshot_copy.go b/internal/service/ec2/ebs_snapshot_copy.go index 1f93b51514f..1e97d74fa5e 100644 --- a/internal/service/ec2/ebs_snapshot_copy.go +++ b/internal/service/ec2/ebs_snapshot_copy.go @@ -52,7 +52,7 @@ func ResourceEBSSnapshotCopy() *schema.Resource { Optional: true, ForceNew: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, ForceNew: true, @@ -126,7 +126,7 @@ func resourceEBSSnapshotCopyCreate(ctx context.Context, d *schema.ResourceData, input.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("encrypted"); ok { + if v, ok := d.GetOk(names.AttrEncrypted); ok { input.Encrypted = aws.Bool(v.(bool)) } diff --git a/internal/service/ec2/ebs_snapshot_data_source.go b/internal/service/ec2/ebs_snapshot_data_source.go index c6126f7b42b..1b1d6028fce 100644 --- a/internal/service/ec2/ebs_snapshot_data_source.go +++ b/internal/service/ec2/ebs_snapshot_data_source.go @@ -43,7 +43,7 @@ func DataSourceEBSSnapshot() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -169,7 +169,7 @@ func dataSourceEBSSnapshotRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrARN, arn) d.Set("data_encryption_key_id", snapshot.DataEncryptionKeyId) d.Set(names.AttrDescription, snapshot.Description) - d.Set("encrypted", snapshot.Encrypted) + d.Set(names.AttrEncrypted, snapshot.Encrypted) d.Set(names.AttrKMSKeyID, snapshot.KmsKeyId) d.Set("outpost_arn", snapshot.OutpostArn) d.Set("owner_alias", snapshot.OwnerAlias) diff --git a/internal/service/ec2/ebs_snapshot_data_source_test.go b/internal/service/ec2/ebs_snapshot_data_source_test.go index 45d89148c35..9e938839082 100644 --- a/internal/service/ec2/ebs_snapshot_data_source_test.go +++ b/internal/service/ec2/ebs_snapshot_data_source_test.go @@ -29,7 +29,7 @@ func TestAccEC2EBSSnapshotDataSource_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(dataSourceName, "encrypted", resourceName, "encrypted"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEncrypted, resourceName, names.AttrEncrypted), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrKMSKeyID, resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttrPair(dataSourceName, "owner_alias", resourceName, "owner_alias"), diff --git a/internal/service/ec2/ebs_snapshot_import.go b/internal/service/ec2/ebs_snapshot_import.go index d29c2904987..bd6ab0943ea 100644 --- a/internal/service/ec2/ebs_snapshot_import.go +++ b/internal/service/ec2/ebs_snapshot_import.go @@ -137,7 +137,7 @@ func ResourceEBSSnapshotImport() *schema.Resource { }, }, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, ForceNew: true, @@ -214,7 +214,7 @@ func resourceEBSSnapshotImportCreate(ctx context.Context, d *schema.ResourceData input.DiskContainer = expandSnapshotDiskContainer(v.([]interface{})[0].(map[string]interface{})) } - if v, ok := d.GetOk("encrypted"); ok { + if v, ok := d.GetOk(names.AttrEncrypted); ok { input.Encrypted = aws.Bool(v.(bool)) } @@ -294,7 +294,7 @@ func resourceEBSSnapshotImportRead(ctx context.Context, d *schema.ResourceData, d.Set(names.AttrARN, arn) d.Set("data_encryption_key_id", snapshot.DataEncryptionKeyId) d.Set(names.AttrDescription, snapshot.Description) - d.Set("encrypted", snapshot.Encrypted) + d.Set(names.AttrEncrypted, snapshot.Encrypted) d.Set(names.AttrKMSKeyID, snapshot.KmsKeyId) d.Set("owner_alias", snapshot.OwnerAlias) d.Set(names.AttrOwnerID, snapshot.OwnerId) diff --git a/internal/service/ec2/ebs_volume.go b/internal/service/ec2/ebs_volume.go index 1ee7971bbcf..85da48214ad 100644 --- a/internal/service/ec2/ebs_volume.go +++ b/internal/service/ec2/ebs_volume.go @@ -61,7 +61,7 @@ func ResourceEBSVolume() *schema.Resource { Required: true, ForceNew: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -135,7 +135,7 @@ func resourceEBSVolumeCreate(ctx context.Context, d *schema.ResourceData, meta i TagSpecifications: getTagSpecificationsInV2(ctx, awstypes.ResourceTypeVolume), } - if value, ok := d.GetOk("encrypted"); ok { + if value, ok := d.GetOk(names.AttrEncrypted); ok { input.Encrypted = aws.Bool(value.(bool)) } @@ -211,7 +211,7 @@ func resourceEBSVolumeRead(ctx context.Context, d *schema.ResourceData, meta int } d.Set(names.AttrARN, arn.String()) d.Set(names.AttrAvailabilityZone, volume.AvailabilityZone) - d.Set("encrypted", volume.Encrypted) + d.Set(names.AttrEncrypted, volume.Encrypted) d.Set("iops", volume.Iops) d.Set(names.AttrKMSKeyID, volume.KmsKeyId) d.Set("multi_attach_enabled", volume.MultiAttachEnabled) diff --git a/internal/service/ec2/ebs_volume_data_source.go b/internal/service/ec2/ebs_volume_data_source.go index 1f7bc7839d7..fae8cb3a711 100644 --- a/internal/service/ec2/ebs_volume_data_source.go +++ b/internal/service/ec2/ebs_volume_data_source.go @@ -39,7 +39,7 @@ func DataSourceEBSVolume() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -142,7 +142,7 @@ func dataSourceEBSVolumeRead(ctx context.Context, d *schema.ResourceData, meta i } d.Set(names.AttrARN, arn.String()) d.Set(names.AttrAvailabilityZone, volume.AvailabilityZone) - d.Set("encrypted", volume.Encrypted) + d.Set(names.AttrEncrypted, volume.Encrypted) d.Set("iops", volume.Iops) d.Set(names.AttrKMSKeyID, volume.KmsKeyId) d.Set("multi_attach_enabled", volume.MultiAttachEnabled) diff --git a/internal/service/ec2/ebs_volume_test.go b/internal/service/ec2/ebs_volume_test.go index efdea5ce4ad..8af50224b51 100644 --- a/internal/service/ec2/ebs_volume_test.go +++ b/internal/service/ec2/ebs_volume_test.go @@ -38,7 +38,7 @@ func TestAccEC2EBSVolume_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "100"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -289,7 +289,7 @@ func TestAccEC2EBSVolume_kmsKey(t *testing.T) { Config: testAccEBSVolumeConfig_kmsKey(rName), Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "encrypted", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "true"), resource.TestCheckResourceAttrPair(resourceName, names.AttrKMSKeyID, kmsKeyResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "throughput", "0"), ), @@ -537,7 +537,7 @@ func TestAccEC2EBSVolume_GP3_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "3000"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -577,7 +577,7 @@ func TestAccEC2EBSVolume_GP3_iops(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "4000"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -601,7 +601,7 @@ func TestAccEC2EBSVolume_GP3_iops(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "5000"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -635,7 +635,7 @@ func TestAccEC2EBSVolume_GP3_throughput(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "3000"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -659,7 +659,7 @@ func TestAccEC2EBSVolume_GP3_throughput(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "3000"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -693,7 +693,7 @@ func TestAccEC2EBSVolume_gp3ToGP2(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "3000"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -717,7 +717,7 @@ func TestAccEC2EBSVolume_gp3ToGP2(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "100"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -751,7 +751,7 @@ func TestAccEC2EBSVolume_io1ToGP3(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "4000"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -775,7 +775,7 @@ func TestAccEC2EBSVolume_io1ToGP3(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "4000"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -810,7 +810,7 @@ func TestAccEC2EBSVolume_snapshotID(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "100"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), @@ -851,7 +851,7 @@ func TestAccEC2EBSVolume_snapshotIDAndSize(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVolumeExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`volume/vol-.+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "iops", "100"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, "multi_attach_enabled", "false"), diff --git a/internal/service/ec2/ec2_ami.go b/internal/service/ec2/ec2_ami.go index 4ea36a5a3a2..b781ea82f85 100644 --- a/internal/service/ec2/ec2_ami.go +++ b/internal/service/ec2/ec2_ami.go @@ -108,7 +108,7 @@ func ResourceAMI() *schema.Resource { Required: true, ForceNew: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, ForceNew: true, @@ -337,7 +337,7 @@ func resourceAMICreate(ctx context.Context, d *schema.ResourceData, meta interfa var encrypted bool - if v, ok := tfMap["encrypted"].(bool); ok { + if v, ok := tfMap[names.AttrEncrypted].(bool); ok { encrypted = v } @@ -625,7 +625,7 @@ func expandBlockDeviceMappingForAMIEBSBlockDevice(tfMap map[string]interface{}) // "Parameter encrypted is invalid. You cannot specify the encrypted flag if specifying a snapshot id in a block device mapping." if v, ok := tfMap["snapshot_id"].(string); ok && v != "" { apiObject.Ebs.SnapshotId = aws.String(v) - } else if v, ok := tfMap["encrypted"].(bool); ok { + } else if v, ok := tfMap[names.AttrEncrypted].(bool); ok { apiObject.Ebs.Encrypted = aws.Bool(v) } @@ -694,7 +694,7 @@ func flattenBlockDeviceMappingForAMIEBSBlockDevice(apiObject *ec2.BlockDeviceMap } if v := apiObject.Ebs.Encrypted; v != nil { - tfMap["encrypted"] = aws.BoolValue(v) + tfMap[names.AttrEncrypted] = aws.BoolValue(v) } if v := apiObject.Ebs.Iops; v != nil { diff --git a/internal/service/ec2/ec2_ami_copy.go b/internal/service/ec2/ec2_ami_copy.go index 7f308a448db..36d3bde4f9c 100644 --- a/internal/service/ec2/ec2_ami_copy.go +++ b/internal/service/ec2/ec2_ami_copy.go @@ -90,7 +90,7 @@ func ResourceAMICopy() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -132,7 +132,7 @@ func ResourceAMICopy() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Default: false, @@ -278,7 +278,7 @@ func resourceAMICopyCreate(ctx context.Context, d *schema.ResourceData, meta int input := &ec2.CopyImageInput{ ClientToken: aws.String(id.UniqueId()), Description: aws.String(d.Get(names.AttrDescription).(string)), - Encrypted: aws.Bool(d.Get("encrypted").(bool)), + Encrypted: aws.Bool(d.Get(names.AttrEncrypted).(bool)), Name: aws.String(name), SourceImageId: aws.String(sourceImageID), SourceRegion: aws.String(d.Get("source_ami_region").(string)), diff --git a/internal/service/ec2/ec2_ami_data_source.go b/internal/service/ec2/ec2_ami_data_source.go index cfa188b9f47..9fac910b0e0 100644 --- a/internal/service/ec2/ec2_ami_data_source.go +++ b/internal/service/ec2/ec2_ami_data_source.go @@ -362,7 +362,7 @@ func flattenAMIBlockDeviceMappings(m []*ec2.BlockDeviceMapping) *schema.Set { if v.Ebs != nil { ebs := map[string]interface{}{ names.AttrDeleteOnTermination: fmt.Sprintf("%t", aws.BoolValue(v.Ebs.DeleteOnTermination)), - "encrypted": fmt.Sprintf("%t", aws.BoolValue(v.Ebs.Encrypted)), + names.AttrEncrypted: fmt.Sprintf("%t", aws.BoolValue(v.Ebs.Encrypted)), "iops": fmt.Sprintf("%d", aws.Int64Value(v.Ebs.Iops)), "throughput": fmt.Sprintf("%d", aws.Int64Value(v.Ebs.Throughput)), "volume_size": fmt.Sprintf("%d", aws.Int64Value(v.Ebs.VolumeSize)), @@ -430,7 +430,7 @@ func amiBlockDeviceMappingHash(v interface{}) int { if len(d.(map[string]interface{})) > 0 { e := d.(map[string]interface{}) buf.WriteString(fmt.Sprintf("%s-", e[names.AttrDeleteOnTermination].(string))) - buf.WriteString(fmt.Sprintf("%s-", e["encrypted"].(string))) + buf.WriteString(fmt.Sprintf("%s-", e[names.AttrEncrypted].(string))) buf.WriteString(fmt.Sprintf("%s-", e["iops"].(string))) buf.WriteString(fmt.Sprintf("%s-", e["volume_size"].(string))) buf.WriteString(fmt.Sprintf("%s-", e["volume_type"].(string))) diff --git a/internal/service/ec2/ec2_ami_from_instance.go b/internal/service/ec2/ec2_ami_from_instance.go index 73169e49fc1..e81b1b7e32e 100644 --- a/internal/service/ec2/ec2_ami_from_instance.go +++ b/internal/service/ec2/ec2_ami_from_instance.go @@ -84,7 +84,7 @@ func ResourceAMIFromInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, diff --git a/internal/service/ec2/ec2_ami_test.go b/internal/service/ec2/ec2_ami_test.go index 13075fc1398..44dd0f46894 100644 --- a/internal/service/ec2/ec2_ami_test.go +++ b/internal/service/ec2/ec2_ami_test.go @@ -45,7 +45,7 @@ func TestAccEC2AMI_basic(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", names.AttrDeviceName: "/dev/sda1", - "encrypted": "false", + names.AttrEncrypted: "false", "iops": "0", "throughput": "0", "volume_size": "8", @@ -243,7 +243,7 @@ func TestAccEC2AMI_ephemeralBlockDevices(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", names.AttrDeviceName: "/dev/sda1", - "encrypted": "false", + names.AttrEncrypted: "false", "iops": "0", "throughput": "0", "volume_size": "8", @@ -307,7 +307,7 @@ func TestAccEC2AMI_gp3BlockDevice(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", names.AttrDeviceName: "/dev/sda1", - "encrypted": "false", + names.AttrEncrypted: "false", "iops": "0", "throughput": "0", "volume_size": "8", @@ -318,7 +318,7 @@ func TestAccEC2AMI_gp3BlockDevice(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "false", names.AttrDeviceName: "/dev/sdb", - "encrypted": "true", + names.AttrEncrypted: "true", "iops": "100", "throughput": "500", "volume_size": "10", diff --git a/internal/service/ec2/ec2_instance.go b/internal/service/ec2/ec2_instance.go index 84b609b4e48..1ededbaf2eb 100644 --- a/internal/service/ec2/ec2_instance.go +++ b/internal/service/ec2/ec2_instance.go @@ -241,7 +241,7 @@ func ResourceInstance() *schema.Resource { Required: true, ForceNew: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -702,7 +702,7 @@ func ResourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -2342,7 +2342,7 @@ func readBlockDevicesFromInstance(ctx context.Context, d *schema.ResourceData, m bd["iops"] = aws.Int64Value(vol.Iops) } if vol.Encrypted != nil { - bd["encrypted"] = aws.BoolValue(vol.Encrypted) + bd[names.AttrEncrypted] = aws.BoolValue(vol.Encrypted) } if vol.KmsKeyId != nil { bd[names.AttrKMSKeyID] = aws.StringValue(vol.KmsKeyId) @@ -2559,7 +2559,7 @@ func readBlockDeviceMappingsFromConfig(ctx context.Context, d *schema.ResourceDa ebs.SnapshotId = aws.String(v) } - if v, ok := bd["encrypted"].(bool); ok && v { + if v, ok := bd[names.AttrEncrypted].(bool); ok && v { ebs.Encrypted = aws.Bool(v) } @@ -2633,7 +2633,7 @@ func readBlockDeviceMappingsFromConfig(ctx context.Context, d *schema.ResourceDa DeleteOnTermination: aws.Bool(bd[names.AttrDeleteOnTermination].(bool)), } - if v, ok := bd["encrypted"].(bool); ok && v { + if v, ok := bd[names.AttrEncrypted].(bool); ok && v { ebs.Encrypted = aws.Bool(v) } diff --git a/internal/service/ec2/ec2_instance_data_source.go b/internal/service/ec2/ec2_instance_data_source.go index a2c8de2042a..c382443ba12 100644 --- a/internal/service/ec2/ec2_instance_data_source.go +++ b/internal/service/ec2/ec2_instance_data_source.go @@ -83,7 +83,7 @@ func DataSourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -321,7 +321,7 @@ func DataSourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, diff --git a/internal/service/ec2/ec2_instance_migrate.go b/internal/service/ec2/ec2_instance_migrate.go index 811972f06d6..bcae88dc524 100644 --- a/internal/service/ec2/ec2_instance_migrate.go +++ b/internal/service/ec2/ec2_instance_migrate.go @@ -92,11 +92,11 @@ func WriteV1BlockDevice( delete(oldBd, "virtual_name") case "root_block_device": delete(oldBd, "virtual_name") - delete(oldBd, "encrypted") + delete(oldBd, names.AttrEncrypted) delete(oldBd, "snapshot_id") case "ephemeral_block_device": delete(oldBd, names.AttrDeleteOnTermination) - delete(oldBd, "encrypted") + delete(oldBd, names.AttrEncrypted) delete(oldBd, "iops") delete(oldBd, "volume_size") delete(oldBd, "volume_type") diff --git a/internal/service/ec2/ec2_instance_test.go b/internal/service/ec2/ec2_instance_test.go index 4cbf2c201ef..cdac6cab503 100644 --- a/internal/service/ec2/ec2_instance_test.go +++ b/internal/service/ec2/ec2_instance_test.go @@ -416,7 +416,7 @@ func TestAccEC2Instance_EBSBlockDevice_kmsKeyARN(t *testing.T) { testAccCheckInstanceExists(ctx, resourceName, &instance), resource.TestCheckResourceAttr(resourceName, "ebs_block_device.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ - "encrypted": "true", + names.AttrEncrypted: "true", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "ebs_block_device.*.kms_key_id", kmsKeyResourceName, names.AttrARN), ), @@ -820,7 +820,7 @@ func TestAccEC2Instance_blockDevices(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeviceName: "/dev/sdd", - "encrypted": "true", + names.AttrEncrypted: "true", "volume_size": "12", }), resource.TestMatchTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]*regexp.Regexp{ @@ -2869,7 +2869,7 @@ func TestAccEC2Instance_EBSRootDevice_multipleDynamicEBSBlockDevices(t *testing. resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", names.AttrDeviceName: "/dev/sdd", - "encrypted": "false", + names.AttrEncrypted: "false", "iops": "100", "volume_size": "10", "volume_type": "gp2", @@ -2877,7 +2877,7 @@ func TestAccEC2Instance_EBSRootDevice_multipleDynamicEBSBlockDevices(t *testing. resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", names.AttrDeviceName: "/dev/sdc", - "encrypted": "false", + names.AttrEncrypted: "false", "iops": "100", "volume_size": "10", "volume_type": "gp2", @@ -2885,7 +2885,7 @@ func TestAccEC2Instance_EBSRootDevice_multipleDynamicEBSBlockDevices(t *testing. resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_block_device.*", map[string]string{ names.AttrDeleteOnTermination: "true", names.AttrDeviceName: "/dev/sdb", - "encrypted": "false", + names.AttrEncrypted: "false", "iops": "100", "volume_size": "10", "volume_type": "gp2", diff --git a/internal/service/ec2/ec2_launch_template.go b/internal/service/ec2/ec2_launch_template.go index 3edd67a970c..fabf3e49350 100644 --- a/internal/service/ec2/ec2_launch_template.go +++ b/internal/service/ec2/ec2_launch_template.go @@ -69,7 +69,7 @@ func ResourceLaunchTemplate() *schema.Resource { DiffSuppressFunc: nullable.DiffSuppressNullableBool, ValidateFunc: nullable.ValidateTypeStringNullableBool, }, - "encrypted": { + names.AttrEncrypted: { Type: nullable.TypeNullableBool, Optional: true, DiffSuppressFunc: nullable.DiffSuppressNullableBool, @@ -1377,7 +1377,7 @@ func expandLaunchTemplateEBSBlockDeviceRequest(tfMap map[string]interface{}) *ec apiObject.DeleteOnTermination = aws.Bool(v) } - if v, null, _ := nullable.Bool(tfMap["encrypted"].(string)).ValueBool(); !null { + if v, null, _ := nullable.Bool(tfMap[names.AttrEncrypted].(string)).ValueBool(); !null { apiObject.Encrypted = aws.Bool(v) } @@ -2399,7 +2399,7 @@ func flattenLaunchTemplateEBSBlockDevice(apiObject *ec2.LaunchTemplateEbsBlockDe } if v := apiObject.Encrypted; v != nil { - tfMap["encrypted"] = strconv.FormatBool(aws.BoolValue(v)) + tfMap[names.AttrEncrypted] = strconv.FormatBool(aws.BoolValue(v)) } if v := apiObject.Iops; 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 6bf73c3831e..9a5d4cacb6b 100644 --- a/internal/service/ec2/ec2_launch_template_data_source.go +++ b/internal/service/ec2/ec2_launch_template_data_source.go @@ -53,7 +53,7 @@ func DataSourceLaunchTemplate() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/ec2/ec2_spot_fleet_request.go b/internal/service/ec2/ec2_spot_fleet_request.go index 2bf4429e8e2..e2970d44d95 100644 --- a/internal/service/ec2/ec2_spot_fleet_request.go +++ b/internal/service/ec2/ec2_spot_fleet_request.go @@ -148,7 +148,7 @@ func ResourceSpotFleetRequest() *schema.Resource { Required: true, ForceNew: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -278,7 +278,7 @@ func ResourceSpotFleetRequest() *schema.Resource { Default: true, ForceNew: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -1348,7 +1348,7 @@ func readSpotFleetBlockDeviceMappingsFromConfig(ctx context.Context, d map[strin ebs.SnapshotId = aws.String(v) } - if v, ok := bd["encrypted"].(bool); ok && v { + if v, ok := bd[names.AttrEncrypted].(bool); ok && v { ebs.Encrypted = aws.Bool(v) } @@ -1401,7 +1401,7 @@ func readSpotFleetBlockDeviceMappingsFromConfig(ctx context.Context, d map[strin DeleteOnTermination: aws.Bool(bd[names.AttrDeleteOnTermination].(bool)), } - if v, ok := bd["encrypted"].(bool); ok && v { + if v, ok := bd[names.AttrEncrypted].(bool); ok && v { ebs.Encrypted = aws.Bool(v) } @@ -1984,7 +1984,7 @@ func ebsBlockDevicesToSet(bdm []*ec2.BlockDeviceMapping, rootDevName *string) *s } if ebs.Encrypted != nil { - m["encrypted"] = aws.BoolValue(ebs.Encrypted) + m[names.AttrEncrypted] = aws.BoolValue(ebs.Encrypted) } if ebs.KmsKeyId != nil { @@ -2045,7 +2045,7 @@ func rootBlockDeviceToSet(bdm []*ec2.BlockDeviceMapping, rootDevName *string) *s } if val.Ebs.Encrypted != nil { - m["encrypted"] = aws.BoolValue(val.Ebs.Encrypted) + m[names.AttrEncrypted] = aws.BoolValue(val.Ebs.Encrypted) } if val.Ebs.KmsKeyId != nil { From a1b0ec6f8d83520eb163234ca7501fdbb1ba84de Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:53:43 -0400 Subject: [PATCH 0878/1490] efs: Use constant for encrypted strings --- internal/service/efs/file_system.go | 6 +++--- internal/service/efs/file_system_data_source.go | 4 ++-- internal/service/efs/file_system_data_source_test.go | 6 +++--- internal/service/efs/file_system_test.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/efs/file_system.go b/internal/service/efs/file_system.go index 0210ce02cb4..f09853d9151 100644 --- a/internal/service/efs/file_system.go +++ b/internal/service/efs/file_system.go @@ -68,7 +68,7 @@ func ResourceFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -209,7 +209,7 @@ func resourceFileSystemCreate(ctx context.Context, d *schema.ResourceData, meta input.ProvisionedThroughputInMibps = aws.Float64(d.Get("provisioned_throughput_in_mibps").(float64)) } - encrypted, hasEncrypted := d.GetOk("encrypted") + encrypted, hasEncrypted := d.GetOk(names.AttrEncrypted) kmsKeyId, hasKmsKeyId := d.GetOk(names.AttrKMSKeyID) if hasEncrypted { @@ -284,7 +284,7 @@ func resourceFileSystemRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("availability_zone_name", fs.AvailabilityZoneName) d.Set("creation_token", fs.CreationToken) d.Set("dns_name", meta.(*conns.AWSClient).RegionalHostname(ctx, d.Id()+".efs")) - d.Set("encrypted", fs.Encrypted) + d.Set(names.AttrEncrypted, fs.Encrypted) d.Set(names.AttrKMSKeyID, fs.KmsKeyId) d.Set(names.AttrName, fs.Name) d.Set("number_of_mount_targets", fs.NumberOfMountTargets) diff --git a/internal/service/efs/file_system_data_source.go b/internal/service/efs/file_system_data_source.go index 488d28efe18..b1b1f0dee87 100644 --- a/internal/service/efs/file_system_data_source.go +++ b/internal/service/efs/file_system_data_source.go @@ -47,7 +47,7 @@ func DataSourceFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -154,7 +154,7 @@ func dataSourceFileSystemRead(ctx context.Context, d *schema.ResourceData, meta d.Set("creation_token", fs.CreationToken) d.Set("dns_name", meta.(*conns.AWSClient).RegionalHostname(ctx, d.Id()+".efs")) d.Set("file_system_id", fsID) - d.Set("encrypted", fs.Encrypted) + d.Set(names.AttrEncrypted, fs.Encrypted) d.Set(names.AttrKMSKeyID, fs.KmsKeyId) d.Set(names.AttrName, fs.Name) d.Set("performance_mode", fs.PerformanceMode) diff --git a/internal/service/efs/file_system_data_source_test.go b/internal/service/efs/file_system_data_source_test.go index fea66f90a9d..ff3561297e5 100644 --- a/internal/service/efs/file_system_data_source_test.go +++ b/internal/service/efs/file_system_data_source_test.go @@ -31,7 +31,7 @@ func TestAccEFSFileSystemDataSource_id(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, "performance_mode", resourceName, "performance_mode"), resource.TestCheckResourceAttrPair(dataSourceName, "creation_token", resourceName, "creation_token"), - resource.TestCheckResourceAttrPair(dataSourceName, "encrypted", resourceName, "encrypted"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEncrypted, resourceName, names.AttrEncrypted), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrKMSKeyID, resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrTags, resourceName, names.AttrTags), resource.TestCheckResourceAttrPair(dataSourceName, "dns_name", resourceName, "dns_name"), @@ -63,7 +63,7 @@ func TestAccEFSFileSystemDataSource_tags(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, "performance_mode", resourceName, "performance_mode"), resource.TestCheckResourceAttrPair(dataSourceName, "creation_token", resourceName, "creation_token"), - resource.TestCheckResourceAttrPair(dataSourceName, "encrypted", resourceName, "encrypted"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEncrypted, resourceName, names.AttrEncrypted), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrKMSKeyID, resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrTags, resourceName, names.AttrTags), resource.TestCheckResourceAttrPair(dataSourceName, "dns_name", resourceName, "dns_name"), @@ -95,7 +95,7 @@ func TestAccEFSFileSystemDataSource_name(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, "performance_mode", resourceName, "performance_mode"), resource.TestCheckResourceAttrPair(dataSourceName, "creation_token", resourceName, "creation_token"), - resource.TestCheckResourceAttrPair(dataSourceName, "encrypted", resourceName, "encrypted"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEncrypted, resourceName, names.AttrEncrypted), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrKMSKeyID, resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrTags, resourceName, names.AttrTags), resource.TestCheckResourceAttrPair(dataSourceName, "dns_name", resourceName, "dns_name"), diff --git a/internal/service/efs/file_system_test.go b/internal/service/efs/file_system_test.go index af6f4528903..0a2d00cf67e 100644 --- a/internal/service/efs/file_system_test.go +++ b/internal/service/efs/file_system_test.go @@ -38,7 +38,7 @@ func TestAccEFSFileSystem_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticfilesystem", regexache.MustCompile(`file-system/fs-.+`)), resource.TestCheckResourceAttrSet(resourceName, "creation_token"), acctest.MatchResourceAttrRegionalHostname(resourceName, "dns_name", "efs", regexache.MustCompile(`fs-[^.]+`)), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), resource.TestCheckResourceAttr(resourceName, "lifecycle_policy.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, ""), resource.TestCheckResourceAttr(resourceName, "number_of_mount_targets", "0"), @@ -257,7 +257,7 @@ func TestAccEFSFileSystem_kmsKey(t *testing.T) { Config: testAccFileSystemConfig_kmsKey(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckFileSystem(ctx, resourceName, &desc), - resource.TestCheckResourceAttr(resourceName, "encrypted", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "true"), resource.TestCheckResourceAttrPair(resourceName, names.AttrKMSKeyID, kmsKeyResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), From c7a635128a620d316ce1b00ec4d05def1763c1cd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:53:43 -0400 Subject: [PATCH 0879/1490] imagebuilder: Use constant for encrypted strings --- internal/service/imagebuilder/component.go | 4 ++-- internal/service/imagebuilder/component_data_source.go | 4 ++-- internal/service/imagebuilder/component_data_source_test.go | 2 +- internal/service/imagebuilder/component_test.go | 2 +- internal/service/imagebuilder/container_recipe.go | 6 +++--- .../service/imagebuilder/container_recipe_data_source.go | 6 +++--- .../imagebuilder/container_recipe_data_source_test.go | 2 +- internal/service/imagebuilder/container_recipe_test.go | 2 +- internal/service/imagebuilder/image_recipe.go | 6 +++--- internal/service/imagebuilder/image_recipe_data_source.go | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/imagebuilder/component.go b/internal/service/imagebuilder/component.go index c3f5c2acf57..598bd2feba8 100644 --- a/internal/service/imagebuilder/component.go +++ b/internal/service/imagebuilder/component.go @@ -63,7 +63,7 @@ func ResourceComponent() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 1024), }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -220,7 +220,7 @@ func resourceComponentRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("data", component.Data) d.Set("date_created", component.DateCreated) d.Set(names.AttrDescription, component.Description) - d.Set("encrypted", component.Encrypted) + d.Set(names.AttrEncrypted, component.Encrypted) d.Set(names.AttrKMSKeyID, component.KmsKeyId) d.Set(names.AttrName, component.Name) d.Set("owner", component.Owner) diff --git a/internal/service/imagebuilder/component_data_source.go b/internal/service/imagebuilder/component_data_source.go index c6f700b9e45..7f6ecd53467 100644 --- a/internal/service/imagebuilder/component_data_source.go +++ b/internal/service/imagebuilder/component_data_source.go @@ -44,7 +44,7 @@ func DataSourceComponent() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -112,7 +112,7 @@ func dataSourceComponentRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("data", component.Data) d.Set("date_created", component.DateCreated) d.Set(names.AttrDescription, component.Description) - d.Set("encrypted", component.Encrypted) + d.Set(names.AttrEncrypted, component.Encrypted) d.Set(names.AttrKMSKeyID, component.KmsKeyId) d.Set(names.AttrName, component.Name) d.Set("owner", component.Owner) diff --git a/internal/service/imagebuilder/component_data_source_test.go b/internal/service/imagebuilder/component_data_source_test.go index dd7d6585244..b9d47231293 100644 --- a/internal/service/imagebuilder/component_data_source_test.go +++ b/internal/service/imagebuilder/component_data_source_test.go @@ -33,7 +33,7 @@ func TestAccImageBuilderComponentDataSource_arn(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "data", resourceName, "data"), resource.TestCheckResourceAttrPair(dataSourceName, "date_created", resourceName, "date_created"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(dataSourceName, "encrypted", resourceName, "encrypted"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEncrypted, resourceName, names.AttrEncrypted), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrKMSKeyID, resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, "owner", resourceName, "owner"), diff --git a/internal/service/imagebuilder/component_test.go b/internal/service/imagebuilder/component_test.go index af6a7dbba3b..9611a086dca 100644 --- a/internal/service/imagebuilder/component_test.go +++ b/internal/service/imagebuilder/component_test.go @@ -41,7 +41,7 @@ func TestAccImageBuilderComponent_basic(t *testing.T) { resource.TestMatchResourceAttr(resourceName, "data", regexache.MustCompile(`schemaVersion`)), acctest.CheckResourceAttrRFC3339(resourceName, "date_created"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), - resource.TestCheckResourceAttr(resourceName, "encrypted", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "true"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), acctest.CheckResourceAttrAccountID(resourceName, "owner"), diff --git a/internal/service/imagebuilder/container_recipe.go b/internal/service/imagebuilder/container_recipe.go index a16712a7575..a28a940961d 100644 --- a/internal/service/imagebuilder/container_recipe.go +++ b/internal/service/imagebuilder/container_recipe.go @@ -104,7 +104,7 @@ func ResourceContainerRecipe() *schema.Resource { ExactlyOneOf: []string{"dockerfile_template_data", "dockerfile_template_uri"}, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^s3://`), "must begin with s3://"), }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -141,7 +141,7 @@ func ResourceContainerRecipe() *schema.Resource { DiffSuppressFunc: nullable.DiffSuppressNullableBool, ValidateFunc: nullable.ValidateTypeStringNullableBool, }, - "encrypted": { + names.AttrEncrypted: { Type: nullable.TypeNullableBool, Optional: true, ForceNew: true, @@ -391,7 +391,7 @@ func resourceContainerRecipeRead(ctx context.Context, d *schema.ResourceData, me d.Set("date_created", containerRecipe.DateCreated) d.Set(names.AttrDescription, containerRecipe.Description) d.Set("dockerfile_template_data", containerRecipe.DockerfileTemplateData) - d.Set("encrypted", containerRecipe.Encrypted) + d.Set(names.AttrEncrypted, containerRecipe.Encrypted) if containerRecipe.InstanceConfiguration != nil { d.Set("instance_configuration", []interface{}{flattenInstanceConfiguration(containerRecipe.InstanceConfiguration)}) diff --git a/internal/service/imagebuilder/container_recipe_data_source.go b/internal/service/imagebuilder/container_recipe_data_source.go index 3e3d37f1b38..a317e0a632b 100644 --- a/internal/service/imagebuilder/container_recipe_data_source.go +++ b/internal/service/imagebuilder/container_recipe_data_source.go @@ -71,7 +71,7 @@ func DataSourceContainerRecipe() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -98,7 +98,7 @@ func DataSourceContainerRecipe() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -226,7 +226,7 @@ func dataSourceContainerRecipeRead(ctx context.Context, d *schema.ResourceData, d.Set("date_created", containerRecipe.DateCreated) d.Set(names.AttrDescription, containerRecipe.Description) d.Set("dockerfile_template_data", containerRecipe.DockerfileTemplateData) - d.Set("encrypted", containerRecipe.Encrypted) + d.Set(names.AttrEncrypted, containerRecipe.Encrypted) if containerRecipe.InstanceConfiguration != nil { d.Set("instance_configuration", []interface{}{flattenInstanceConfiguration(containerRecipe.InstanceConfiguration)}) diff --git a/internal/service/imagebuilder/container_recipe_data_source_test.go b/internal/service/imagebuilder/container_recipe_data_source_test.go index f4c90974c22..2b30ad0b943 100644 --- a/internal/service/imagebuilder/container_recipe_data_source_test.go +++ b/internal/service/imagebuilder/container_recipe_data_source_test.go @@ -36,7 +36,7 @@ func TestAccImageBuilderContainerRecipeDataSource_arn(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "date_created", resourceName, "date_created"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), resource.TestCheckResourceAttrPair(dataSourceName, "dockerfile_template_data", resourceName, "dockerfile_template_data"), - resource.TestCheckResourceAttrPair(dataSourceName, "encrypted", resourceName, "encrypted"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEncrypted, resourceName, names.AttrEncrypted), resource.TestCheckResourceAttrPair(dataSourceName, "instance_configuration.#", resourceName, "instance_configuration.#"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrKMSKeyID, resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), diff --git a/internal/service/imagebuilder/container_recipe_test.go b/internal/service/imagebuilder/container_recipe_test.go index f07cba32c7d..1e133c9eea1 100644 --- a/internal/service/imagebuilder/container_recipe_test.go +++ b/internal/service/imagebuilder/container_recipe_test.go @@ -44,7 +44,7 @@ func TestAccImageBuilderContainerRecipe_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), acctest.CheckResourceAttrRFC3339(resourceName, "date_created"), resource.TestCheckResourceAttrSet(resourceName, "dockerfile_template_data"), - resource.TestCheckResourceAttr(resourceName, "encrypted", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "true"), resource.TestCheckResourceAttr(resourceName, "instance_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), diff --git a/internal/service/imagebuilder/image_recipe.go b/internal/service/imagebuilder/image_recipe.go index 9c3f821f1c7..60222643247 100644 --- a/internal/service/imagebuilder/image_recipe.go +++ b/internal/service/imagebuilder/image_recipe.go @@ -66,7 +66,7 @@ func ResourceImageRecipe() *schema.Resource { DiffSuppressFunc: nullable.DiffSuppressNullableBool, ValidateFunc: nullable.ValidateTypeStringNullableBool, }, - "encrypted": { + names.AttrEncrypted: { Type: nullable.TypeNullableBool, Optional: true, ForceNew: true, @@ -483,7 +483,7 @@ func expandEBSInstanceBlockDeviceSpecification(tfMap map[string]interface{}) *im apiObject.DeleteOnTermination = aws.Bool(v) } - if v, null, _ := nullable.Bool(tfMap["encrypted"].(string)).ValueBool(); !null { + if v, null, _ := nullable.Bool(tfMap[names.AttrEncrypted].(string)).ValueBool(); !null { apiObject.Encrypted = aws.Bool(v) } @@ -666,7 +666,7 @@ func flattenEBSInstanceBlockDeviceSpecification(apiObject *imagebuilder.EbsInsta } if v := apiObject.Encrypted; v != nil { - tfMap["encrypted"] = strconv.FormatBool(aws.BoolValue(v)) + tfMap[names.AttrEncrypted] = strconv.FormatBool(aws.BoolValue(v)) } if v := apiObject.Iops; v != nil { diff --git a/internal/service/imagebuilder/image_recipe_data_source.go b/internal/service/imagebuilder/image_recipe_data_source.go index a7a3e311578..61c27fbc9ec 100644 --- a/internal/service/imagebuilder/image_recipe_data_source.go +++ b/internal/service/imagebuilder/image_recipe_data_source.go @@ -46,7 +46,7 @@ func DataSourceImageRecipe() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, From 7b27129393abd8002891aa741b71358765ec88b2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:53:43 -0400 Subject: [PATCH 0880/1490] opsworks: Use constant for encrypted strings --- .../service/opsworks/custom_layer_test.go | 24 +++++++++---------- internal/service/opsworks/layers.go | 6 ++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/service/opsworks/custom_layer_test.go b/internal/service/opsworks/custom_layer_test.go index f7f18f1ff5f..7ec26366768 100644 --- a/internal/service/opsworks/custom_layer_test.go +++ b/internal/service/opsworks/custom_layer_test.go @@ -49,11 +49,11 @@ func TestAccOpsWorksCustomLayer_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "drain_elb_on_shutdown", "true"), resource.TestCheckResourceAttr(resourceName, "ebs_volume.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_volume.*", map[string]string{ - names.AttrType: "gp2", - "number_of_disks": "2", - "mount_point": "/home", - "size": "100", - "encrypted": "false", + names.AttrType: "gp2", + "number_of_disks": "2", + "mount_point": "/home", + "size": "100", + names.AttrEncrypted: "false", }), resource.TestCheckResourceAttr(resourceName, "elastic_load_balancer", ""), resource.TestCheckResourceAttr(resourceName, "instance_shutdown_timeout", "300"), @@ -128,13 +128,13 @@ func TestAccOpsWorksCustomLayer_update(t *testing.T) { "size": "100", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ebs_volume.*", map[string]string{ - names.AttrType: "io1", - "number_of_disks": "4", - "mount_point": "/var", - "size": "100", - "raid_level": "1", - "iops": "3000", - "encrypted": "true", + names.AttrType: "io1", + "number_of_disks": "4", + "mount_point": "/var", + "size": "100", + "raid_level": "1", + "iops": "3000", + names.AttrEncrypted: "true", }), resource.TestCheckResourceAttr(resourceName, "elastic_load_balancer", ""), resource.TestCheckResourceAttr(resourceName, "instance_shutdown_timeout", "120"), diff --git a/internal/service/opsworks/layers.go b/internal/service/opsworks/layers.go index ec55c30b88e..dd09cca4b98 100644 --- a/internal/service/opsworks/layers.go +++ b/internal/service/opsworks/layers.go @@ -227,7 +227,7 @@ func (lt *opsworksLayerType) resourceSchema() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Default: false, @@ -1217,7 +1217,7 @@ func expandVolumeConfiguration(tfMap map[string]interface{}) *opsworks.VolumeCon apiObject := &opsworks.VolumeConfiguration{} - if v, ok := tfMap["encrypted"].(bool); ok { + if v, ok := tfMap[names.AttrEncrypted].(bool); ok { apiObject.Encrypted = aws.Bool(v) } @@ -1284,7 +1284,7 @@ func flattenVolumeConfiguration(apiObject *opsworks.VolumeConfiguration) map[str tfMap := map[string]interface{}{} if v := apiObject.Encrypted; v != nil { - tfMap["encrypted"] = aws.BoolValue(v) + tfMap[names.AttrEncrypted] = aws.BoolValue(v) } if v := apiObject.Iops; v != nil { From 9915e04a0769c70120dd5f78e6f091fb6ff486ac Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:53:44 -0400 Subject: [PATCH 0881/1490] rds: Use constant for encrypted strings --- internal/service/rds/snapshot.go | 4 ++-- internal/service/rds/snapshot_copy.go | 4 ++-- internal/service/rds/snapshot_data_source.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/rds/snapshot.go b/internal/service/rds/snapshot.go index a530ed15862..586fd466049 100644 --- a/internal/service/rds/snapshot.go +++ b/internal/service/rds/snapshot.go @@ -64,7 +64,7 @@ func ResourceSnapshot() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -193,7 +193,7 @@ func resourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("db_instance_identifier", snapshot.DBInstanceIdentifier) d.Set("db_snapshot_arn", arn) d.Set("db_snapshot_identifier", snapshot.DBSnapshotIdentifier) - d.Set("encrypted", snapshot.Encrypted) + d.Set(names.AttrEncrypted, snapshot.Encrypted) d.Set("engine", snapshot.Engine) d.Set(names.AttrEngineVersion, snapshot.EngineVersion) d.Set("iops", snapshot.Iops) diff --git a/internal/service/rds/snapshot_copy.go b/internal/service/rds/snapshot_copy.go index ac6b9e76a42..8e41492ea2e 100644 --- a/internal/service/rds/snapshot_copy.go +++ b/internal/service/rds/snapshot_copy.go @@ -63,7 +63,7 @@ func ResourceSnapshotCopy() *schema.Resource { Optional: true, ForceNew: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -211,7 +211,7 @@ func resourceSnapshotCopyRead(ctx context.Context, d *schema.ResourceData, meta d.Set("allocated_storage", snapshot.AllocatedStorage) d.Set(names.AttrAvailabilityZone, snapshot.AvailabilityZone) d.Set("db_snapshot_arn", arn) - d.Set("encrypted", snapshot.Encrypted) + d.Set(names.AttrEncrypted, snapshot.Encrypted) d.Set("engine", snapshot.Engine) d.Set(names.AttrEngineVersion, snapshot.EngineVersion) d.Set("iops", snapshot.Iops) diff --git a/internal/service/rds/snapshot_data_source.go b/internal/service/rds/snapshot_data_source.go index acea6e83774..7cd5f64b7e8 100644 --- a/internal/service/rds/snapshot_data_source.go +++ b/internal/service/rds/snapshot_data_source.go @@ -46,7 +46,7 @@ func DataSourceSnapshot() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -185,7 +185,7 @@ func dataSourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("db_instance_identifier", snapshot.DBInstanceIdentifier) d.Set("db_snapshot_arn", snapshot.DBSnapshotArn) d.Set("db_snapshot_identifier", snapshot.DBSnapshotIdentifier) - d.Set("encrypted", snapshot.Encrypted) + d.Set(names.AttrEncrypted, snapshot.Encrypted) d.Set("engine", snapshot.Engine) d.Set(names.AttrEngineVersion, snapshot.EngineVersion) d.Set("iops", snapshot.Iops) From 2a36e927869ec9f997c633eb7390afe837ed00ae Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:53:44 -0400 Subject: [PATCH 0882/1490] redshift: Use constant for encrypted strings --- internal/service/redshift/cluster.go | 12 ++++++------ internal/service/redshift/cluster_data_source.go | 4 ++-- .../service/redshift/cluster_data_source_test.go | 2 +- internal/service/redshift/cluster_test.go | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/redshift/cluster.go b/internal/service/redshift/cluster.go index 00bd3789b37..2dc02dcd309 100644 --- a/internal/service/redshift/cluster.go +++ b/internal/service/redshift/cluster.go @@ -180,7 +180,7 @@ func resourceCluster() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Optional: true, Default: false, @@ -582,7 +582,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int return sdkdiag.AppendErrorf(diags, `provider.aws: aws_redshift_cluster: %s: "master_username": required field is not set`, d.Get(names.AttrClusterIdentifier).(string)) } - if v, ok := d.GetOk("encrypted"); ok { + if v, ok := d.GetOk(names.AttrEncrypted); ok { inputC.Encrypted = aws.Bool(v.(bool)) } @@ -689,7 +689,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("cluster_version", rsc.ClusterVersion) d.Set(names.AttrDatabaseName, rsc.DBName) d.Set("default_iam_role_arn", rsc.DefaultIamRoleArn) - d.Set("encrypted", rsc.Encrypted) + d.Set(names.AttrEncrypted, rsc.Encrypted) d.Set("enhanced_vpc_routing", rsc.EnhancedVpcRouting) d.Set("iam_roles", tfslices.ApplyToAll(rsc.IamRoles, func(v *redshift.ClusterIamRole) string { return aws.StringValue(v.IamRoleArn) @@ -789,15 +789,15 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int input.ClusterVersion = aws.String(d.Get("cluster_version").(string)) } - if d.HasChange("encrypted") { - input.Encrypted = aws.Bool(d.Get("encrypted").(bool)) + if d.HasChange(names.AttrEncrypted) { + input.Encrypted = aws.Bool(d.Get(names.AttrEncrypted).(bool)) } if d.HasChange("enhanced_vpc_routing") { input.EnhancedVpcRouting = aws.Bool(d.Get("enhanced_vpc_routing").(bool)) } - if d.Get("encrypted").(bool) && d.HasChange(names.AttrKMSKeyID) { + if d.Get(names.AttrEncrypted).(bool) && d.HasChange(names.AttrKMSKeyID) { input.KmsKeyId = aws.String(d.Get(names.AttrKMSKeyID).(string)) } diff --git a/internal/service/redshift/cluster_data_source.go b/internal/service/redshift/cluster_data_source.go index 921e5320037..3a8b0f4e1ad 100644 --- a/internal/service/redshift/cluster_data_source.go +++ b/internal/service/redshift/cluster_data_source.go @@ -122,7 +122,7 @@ func dataSourceCluster() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "encrypted": { + names.AttrEncrypted: { Type: schema.TypeBool, Computed: true, }, @@ -259,7 +259,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int if rsc.ElasticIpStatus != nil { d.Set("elastic_ip", rsc.ElasticIpStatus.ElasticIp) } - d.Set("encrypted", rsc.Encrypted) + d.Set(names.AttrEncrypted, rsc.Encrypted) if rsc.Endpoint != nil { d.Set(names.AttrEndpoint, rsc.Endpoint.Address) d.Set(names.AttrPort, rsc.Endpoint.Port) diff --git a/internal/service/redshift/cluster_data_source_test.go b/internal/service/redshift/cluster_data_source_test.go index 923eb2a56c7..50431041101 100644 --- a/internal/service/redshift/cluster_data_source_test.go +++ b/internal/service/redshift/cluster_data_source_test.go @@ -40,7 +40,7 @@ func TestAccRedshiftClusterDataSource_basic(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "cluster_type", "single-node"), resource.TestCheckResourceAttrSet(dataSourceName, "cluster_version"), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrDatabaseName), - resource.TestCheckResourceAttrSet(dataSourceName, "encrypted"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrEncrypted), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrEndpoint), resource.TestCheckResourceAttrSet(dataSourceName, "master_username"), resource.TestCheckResourceAttrSet(dataSourceName, "multi_az"), diff --git a/internal/service/redshift/cluster_test.go b/internal/service/redshift/cluster_test.go index 0bc299329e5..7232ccf1c1d 100644 --- a/internal/service/redshift/cluster_test.go +++ b/internal/service/redshift/cluster_test.go @@ -664,7 +664,7 @@ func TestAccRedshiftCluster_changeEncryption1(t *testing.T) { Config: testAccClusterConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &cluster1), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), ), }, { @@ -672,7 +672,7 @@ func TestAccRedshiftCluster_changeEncryption1(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &cluster2), testAccCheckClusterNotRecreated(&cluster1, &cluster2), - resource.TestCheckResourceAttr(resourceName, "encrypted", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "true"), ), }, }, @@ -695,7 +695,7 @@ func TestAccRedshiftCluster_changeEncryption2(t *testing.T) { Config: testAccClusterConfig_encrypted(rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &cluster1), - resource.TestCheckResourceAttr(resourceName, "encrypted", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "true"), ), }, { @@ -703,7 +703,7 @@ func TestAccRedshiftCluster_changeEncryption2(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &cluster2), testAccCheckClusterNotRecreated(&cluster1, &cluster2), - resource.TestCheckResourceAttr(resourceName, "encrypted", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrEncrypted, "false"), ), }, }, From f75d791cee810619098fbc3ea1e4de92a59f9f5f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:56:49 -0400 Subject: [PATCH 0883/1490] ci: Prefer constant for string literal "file_system_id" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index b2501de4de8..95534f87f3c 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1315,3 +1315,13 @@ rules: - pattern: '"encrypted"' severity: ERROR fix: "names.AttrEncrypted" + - id: literal-file_system_id-string-constant + languages: [go] + message: Use the constant `names.AttrFileSystemID` for the string literal "file_system_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"file_system_id"' + severity: ERROR + fix: "names.AttrFileSystemID" From 88a1310a54110a2ff37b12eda52dee1e36223327 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:56:49 -0400 Subject: [PATCH 0884/1490] names: Add constant for string literal "file_system_id" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 6bcd5566065..803b68c1bbc 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -27,6 +27,7 @@ const ( AttrEndpoint = "endpoint" AttrEndpoints = "endpoints" AttrEngineVersion = "engine_version" + AttrFileSystemID = "file_system_id" AttrHostedZoneID = "hosted_zone_id" AttrID = "id" // Should be explicitly declared only for Framework resources AttrInstanceID = "instance_id" From f16870f28fc5f92f95781bbae797a99d1c78ea39 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:56:50 -0400 Subject: [PATCH 0885/1490] ecs: Use constant for file_system_id strings --- internal/service/ecs/task_definition.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/ecs/task_definition.go b/internal/service/ecs/task_definition.go index da6c0ff6b99..6adb59bca7b 100644 --- a/internal/service/ecs/task_definition.go +++ b/internal/service/ecs/task_definition.go @@ -357,7 +357,7 @@ func ResourceTaskDefinition() *schema.Resource { }, }, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, ForceNew: true, Required: true, @@ -412,7 +412,7 @@ func ResourceTaskDefinition() *schema.Resource { }, }, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, ForceNew: true, Required: true, @@ -704,7 +704,7 @@ func resourceTaskDefinitionVolumeHash(v interface{}) int { if v, ok := m["efs_volume_configuration"]; ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { m := v.([]interface{})[0].(map[string]interface{}) - if v, ok := m["file_system_id"]; ok && v.(string) != "" { + if v, ok := m[names.AttrFileSystemID]; ok && v.(string) != "" { buf.WriteString(fmt.Sprintf("%s-", v.(string))) } @@ -732,7 +732,7 @@ func resourceTaskDefinitionVolumeHash(v interface{}) int { if v, ok := m["fsx_windows_file_server_volume_configuration"]; ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { m := v.([]interface{})[0].(map[string]interface{}) - if v, ok := m["file_system_id"]; ok && v.(string) != "" { + if v, ok := m[names.AttrFileSystemID]; ok && v.(string) != "" { buf.WriteString(fmt.Sprintf("%s-", v.(string))) } @@ -975,7 +975,7 @@ func expandVolumesEFSVolume(efsConfig []interface{}) *ecs.EFSVolumeConfiguration config := efsConfig[0].(map[string]interface{}) efsVol := &ecs.EFSVolumeConfiguration{} - if v, ok := config["file_system_id"].(string); ok && v != "" { + if v, ok := config[names.AttrFileSystemID].(string); ok && v != "" { efsVol.FileSystemId = aws.String(v) } @@ -1015,7 +1015,7 @@ func expandVolumesFSxWinVolume(fsxWinConfig []interface{}) *ecs.FSxWindowsFileSe config := fsxWinConfig[0].(map[string]interface{}) fsxVol := &ecs.FSxWindowsFileServerVolumeConfiguration{} - if v, ok := config["file_system_id"].(string); ok && v != "" { + if v, ok := config[names.AttrFileSystemID].(string); ok && v != "" { fsxVol.FileSystemId = aws.String(v) } @@ -1106,7 +1106,7 @@ func flattenEFSVolumeConfiguration(config *ecs.EFSVolumeConfiguration) []interfa m := make(map[string]interface{}) if config != nil { if v := config.FileSystemId; v != nil { - m["file_system_id"] = aws.StringValue(v) + m[names.AttrFileSystemID] = aws.StringValue(v) } if v := config.RootDirectory; v != nil { @@ -1150,7 +1150,7 @@ func flattenFSxWinVolumeConfiguration(config *ecs.FSxWindowsFileServerVolumeConf m := make(map[string]interface{}) if config != nil { if v := config.FileSystemId; v != nil { - m["file_system_id"] = aws.StringValue(v) + m[names.AttrFileSystemID] = aws.StringValue(v) } if v := config.RootDirectory; v != nil { From f743f1cd895d395ba43368c381979490b7abcbe5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:56:50 -0400 Subject: [PATCH 0886/1490] efs: Use constant for file_system_id strings --- internal/service/efs/access_point.go | 6 +++--- internal/service/efs/access_point_data_source.go | 4 ++-- internal/service/efs/access_point_test.go | 2 +- internal/service/efs/access_points_data_source.go | 5 +++-- internal/service/efs/backup_policy.go | 6 +++--- internal/service/efs/file_system_data_source.go | 6 +++--- internal/service/efs/file_system_policy.go | 6 +++--- internal/service/efs/mount_target.go | 6 +++--- internal/service/efs/mount_target_data_source.go | 6 +++--- internal/service/efs/mount_target_data_source_test.go | 6 +++--- internal/service/efs/replication_configuration.go | 6 +++--- 11 files changed, 30 insertions(+), 29 deletions(-) diff --git a/internal/service/efs/access_point.go b/internal/service/efs/access_point.go index 09617bee918..6904ff745d1 100644 --- a/internal/service/efs/access_point.go +++ b/internal/service/efs/access_point.go @@ -41,7 +41,7 @@ func ResourceAccessPoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -134,7 +134,7 @@ func resourceAccessPointCreate(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).EFSConn(ctx) - fsId := d.Get("file_system_id").(string) + fsId := d.Get(names.AttrFileSystemID).(string) input := efs.CreateAccessPointInput{ FileSystemId: aws.String(fsId), Tags: getTagsIn(ctx), @@ -204,7 +204,7 @@ func resourceAccessPointRead(ctx context.Context, d *schema.ResourceData, meta i Service: "elasticfilesystem", }.String() d.Set("file_system_arn", fsARN) - d.Set("file_system_id", fsID) + d.Set(names.AttrFileSystemID, fsID) d.Set(names.AttrOwnerID, ap.OwnerId) if err := d.Set("posix_user", flattenAccessPointPOSIXUser(ap.PosixUser)); err != nil { return sdkdiag.AppendErrorf(diags, "setting posix_user: %s", err) diff --git a/internal/service/efs/access_point_data_source.go b/internal/service/efs/access_point_data_source.go index 583c117e52f..56e6104d559 100644 --- a/internal/service/efs/access_point_data_source.go +++ b/internal/service/efs/access_point_data_source.go @@ -32,7 +32,7 @@ func DataSourceAccessPoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Computed: true, }, @@ -133,7 +133,7 @@ func dataSourceAccessPointRead(ctx context.Context, d *schema.ResourceData, meta Service: "elasticfilesystem", }.String() d.Set("file_system_arn", fsARN) - d.Set("file_system_id", fsID) + d.Set(names.AttrFileSystemID, fsID) d.Set(names.AttrOwnerID, ap.OwnerId) if err := d.Set("posix_user", flattenAccessPointPOSIXUser(ap.PosixUser)); err != nil { return sdkdiag.AppendErrorf(diags, "setting posix_user: %s", err) diff --git a/internal/service/efs/access_point_test.go b/internal/service/efs/access_point_test.go index bc602e2bd60..010c038af73 100644 --- a/internal/service/efs/access_point_test.go +++ b/internal/service/efs/access_point_test.go @@ -39,7 +39,7 @@ func TestAccEFSAccessPoint_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckAccessPointExists(ctx, resourceName, &ap), resource.TestCheckResourceAttrPair(resourceName, "file_system_arn", fsResourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "file_system_id", fsResourceName, names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrFileSystemID, fsResourceName, names.AttrID), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticfilesystem", regexache.MustCompile(`access-point/fsap-.+`)), resource.TestCheckResourceAttrSet(resourceName, names.AttrOwnerID), resource.TestCheckResourceAttr(resourceName, "tags.#", "0"), diff --git a/internal/service/efs/access_points_data_source.go b/internal/service/efs/access_points_data_source.go index e238d6acc4b..31c267753b7 100644 --- a/internal/service/efs/access_points_data_source.go +++ b/internal/service/efs/access_points_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_efs_access_points") @@ -26,7 +27,7 @@ func DataSourceAccessPoints() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringIsNotEmpty, @@ -44,7 +45,7 @@ func dataSourceAccessPointsRead(ctx context.Context, d *schema.ResourceData, met var diags diag.Diagnostics conn := meta.(*conns.AWSClient).EFSConn(ctx) - fileSystemID := d.Get("file_system_id").(string) + fileSystemID := d.Get(names.AttrFileSystemID).(string) input := &efs.DescribeAccessPointsInput{ FileSystemId: aws.String(fileSystemID), } diff --git a/internal/service/efs/backup_policy.go b/internal/service/efs/backup_policy.go index 9b1f75f3043..c3f862f1598 100644 --- a/internal/service/efs/backup_policy.go +++ b/internal/service/efs/backup_policy.go @@ -50,7 +50,7 @@ func ResourceBackupPolicy() *schema.Resource { }, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -63,7 +63,7 @@ func resourceBackupPolicyCreate(ctx context.Context, d *schema.ResourceData, met var diags diag.Diagnostics conn := meta.(*conns.AWSClient).EFSConn(ctx) - fsID := d.Get("file_system_id").(string) + fsID := d.Get(names.AttrFileSystemID).(string) if err := backupPolicyPut(ctx, conn, fsID, d.Get("backup_policy").([]interface{})[0].(map[string]interface{})); err != nil { return sdkdiag.AppendErrorf(diags, "creating EFS Backup Policy (%s): %s", fsID, err) @@ -94,7 +94,7 @@ func resourceBackupPolicyRead(ctx context.Context, d *schema.ResourceData, meta return sdkdiag.AppendErrorf(diags, "setting backup_policy: %s", err) } - d.Set("file_system_id", d.Id()) + d.Set(names.AttrFileSystemID, d.Id()) return diags } diff --git a/internal/service/efs/file_system_data_source.go b/internal/service/efs/file_system_data_source.go index b1b1f0dee87..2afa74a925f 100644 --- a/internal/service/efs/file_system_data_source.go +++ b/internal/service/efs/file_system_data_source.go @@ -51,7 +51,7 @@ func DataSourceFileSystem() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -128,7 +128,7 @@ func dataSourceFileSystemRead(ctx context.Context, d *schema.ResourceData, meta input.CreationToken = aws.String(v.(string)) } - if v, ok := d.GetOk("file_system_id"); ok { + if v, ok := d.GetOk(names.AttrFileSystemID); ok { input.FileSystemId = aws.String(v.(string)) } @@ -153,7 +153,7 @@ func dataSourceFileSystemRead(ctx context.Context, d *schema.ResourceData, meta d.Set("availability_zone_name", fs.AvailabilityZoneName) d.Set("creation_token", fs.CreationToken) d.Set("dns_name", meta.(*conns.AWSClient).RegionalHostname(ctx, d.Id()+".efs")) - d.Set("file_system_id", fsID) + d.Set(names.AttrFileSystemID, fsID) d.Set(names.AttrEncrypted, fs.Encrypted) d.Set(names.AttrKMSKeyID, fs.KmsKeyId) d.Set(names.AttrName, fs.Name) diff --git a/internal/service/efs/file_system_policy.go b/internal/service/efs/file_system_policy.go index 4276d82eab6..8f19ab94c41 100644 --- a/internal/service/efs/file_system_policy.go +++ b/internal/service/efs/file_system_policy.go @@ -39,7 +39,7 @@ func ResourceFileSystemPolicy() *schema.Resource { Optional: true, Default: false, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -68,7 +68,7 @@ func resourceFileSystemPolicyPut(ctx context.Context, d *schema.ResourceData, me return sdkdiag.AppendFromErr(diags, err) } - fsID := d.Get("file_system_id").(string) + fsID := d.Get(names.AttrFileSystemID).(string) input := &efs.PutFileSystemPolicyInput{ BypassPolicyLockoutSafetyCheck: aws.Bool(d.Get("bypass_policy_lockout_safety_check").(bool)), FileSystemId: aws.String(fsID), @@ -106,7 +106,7 @@ func resourceFileSystemPolicyRead(ctx context.Context, d *schema.ResourceData, m return sdkdiag.AppendErrorf(diags, "reading EFS File System Policy (%s): %s", d.Id(), err) } - d.Set("file_system_id", output.FileSystemId) + d.Set(names.AttrFileSystemID, output.FileSystemId) policyToSet, err := verify.SecondJSONUnlessEquivalent(d.Get(names.AttrPolicy).(string), aws.StringValue(output.Policy)) if err != nil { diff --git a/internal/service/efs/mount_target.go b/internal/service/efs/mount_target.go index 84006ceabbe..5d0a7eb1fd1 100644 --- a/internal/service/efs/mount_target.go +++ b/internal/service/efs/mount_target.go @@ -60,7 +60,7 @@ func ResourceMountTarget() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -114,7 +114,7 @@ func resourceMountTargetCreate(ctx context.Context, d *schema.ResourceData, meta return sdkdiag.AppendErrorf(diags, "reading EC2 Subnet (%s): %s", subnetID, err) } - fsID := d.Get("file_system_id").(string) + fsID := d.Get(names.AttrFileSystemID).(string) mtKey := "efs-mt-" + fsID + "-" + az conns.GlobalMutexKV.Lock(mtKey) defer conns.GlobalMutexKV.Unlock(mtKey) @@ -175,7 +175,7 @@ func resourceMountTargetRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("availability_zone_name", mt.AvailabilityZoneName) d.Set("dns_name", meta.(*conns.AWSClient).RegionalHostname(ctx, fsID+".efs")) d.Set("file_system_arn", fsARN) - d.Set("file_system_id", fsID) + d.Set(names.AttrFileSystemID, fsID) d.Set("ip_address", mt.IpAddress) d.Set("mount_target_dns_name", meta.(*conns.AWSClient).RegionalHostname(ctx, fmt.Sprintf("%s.%s.efs", aws.StringValue(mt.AvailabilityZoneName), aws.StringValue(mt.FileSystemId)))) d.Set(names.AttrNetworkInterfaceID, mt.NetworkInterfaceId) diff --git a/internal/service/efs/mount_target_data_source.go b/internal/service/efs/mount_target_data_source.go index 9bfee158a89..12d4c215255 100644 --- a/internal/service/efs/mount_target_data_source.go +++ b/internal/service/efs/mount_target_data_source.go @@ -43,7 +43,7 @@ func DataSourceMountTarget() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -92,7 +92,7 @@ func dataSourceMountTargetRead(ctx context.Context, d *schema.ResourceData, meta input.AccessPointId = aws.String(v.(string)) } - if v, ok := d.GetOk("file_system_id"); ok { + if v, ok := d.GetOk(names.AttrFileSystemID); ok { input.FileSystemId = aws.String(v.(string)) } @@ -119,7 +119,7 @@ func dataSourceMountTargetRead(ctx context.Context, d *schema.ResourceData, meta d.Set("availability_zone_name", mt.AvailabilityZoneName) d.Set("dns_name", meta.(*conns.AWSClient).RegionalHostname(ctx, fsID+".efs")) d.Set("file_system_arn", fsARN) - d.Set("file_system_id", fsID) + d.Set(names.AttrFileSystemID, fsID) d.Set("ip_address", mt.IpAddress) d.Set("mount_target_dns_name", meta.(*conns.AWSClient).RegionalHostname(ctx, fmt.Sprintf("%s.%s.efs", aws.StringValue(mt.AvailabilityZoneName), aws.StringValue(mt.FileSystemId)))) d.Set("mount_target_id", mt.MountTargetId) diff --git a/internal/service/efs/mount_target_data_source_test.go b/internal/service/efs/mount_target_data_source_test.go index 0aa4de72eba..0fecf6be98e 100644 --- a/internal/service/efs/mount_target_data_source_test.go +++ b/internal/service/efs/mount_target_data_source_test.go @@ -28,7 +28,7 @@ func TestAccEFSMountTargetDataSource_basic(t *testing.T) { Config: testAccMountTargetDataSourceConfig_byID(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "file_system_arn", resourceName, "file_system_arn"), - resource.TestCheckResourceAttrPair(dataSourceName, "file_system_id", resourceName, "file_system_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrFileSystemID, resourceName, names.AttrFileSystemID), resource.TestCheckResourceAttrPair(dataSourceName, "ip_address", resourceName, "ip_address"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrSubnetID, resourceName, names.AttrSubnetID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrNetworkInterfaceID, resourceName, names.AttrNetworkInterfaceID), @@ -59,7 +59,7 @@ func TestAccEFSMountTargetDataSource_byAccessPointID(t *testing.T) { Config: testAccMountTargetDataSourceConfig_byAccessPointID(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "file_system_arn", resourceName, "file_system_arn"), - resource.TestCheckResourceAttrPair(dataSourceName, "file_system_id", resourceName, "file_system_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrFileSystemID, resourceName, names.AttrFileSystemID), resource.TestCheckResourceAttrPair(dataSourceName, "ip_address", resourceName, "ip_address"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrSubnetID, resourceName, names.AttrSubnetID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrNetworkInterfaceID, resourceName, names.AttrNetworkInterfaceID), @@ -90,7 +90,7 @@ func TestAccEFSMountTargetDataSource_byFileSystemID(t *testing.T) { Config: testAccMountTargetDataSourceConfig_byFileSystemID(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "file_system_arn", resourceName, "file_system_arn"), - resource.TestCheckResourceAttrPair(dataSourceName, "file_system_id", resourceName, "file_system_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrFileSystemID, resourceName, names.AttrFileSystemID), resource.TestCheckResourceAttrPair(dataSourceName, "ip_address", resourceName, "ip_address"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrSubnetID, resourceName, names.AttrSubnetID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrNetworkInterfaceID, resourceName, names.AttrNetworkInterfaceID), diff --git a/internal/service/efs/replication_configuration.go b/internal/service/efs/replication_configuration.go index 1e9affbe84e..0211eec725c 100644 --- a/internal/service/efs/replication_configuration.go +++ b/internal/service/efs/replication_configuration.go @@ -56,7 +56,7 @@ func ResourceReplicationConfiguration() *schema.Resource { ForceNew: true, AtLeastOneOf: []string{"destination.0.availability_zone_name", "destination.0.region"}, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Optional: true, Computed: true, @@ -341,7 +341,7 @@ func expandDestinationToCreate(tfMap map[string]interface{}) *efs.DestinationToC apiObject.Region = aws.String(v) } - if v, ok := tfMap["file_system_id"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrFileSystemID].(string); ok && v != "" { apiObject.FileSystemId = aws.String(v) } @@ -382,7 +382,7 @@ func flattenDestination(apiObject *efs.Destination) map[string]interface{} { tfMap := map[string]interface{}{} if v := apiObject.FileSystemId; v != nil { - tfMap["file_system_id"] = aws.StringValue(v) + tfMap[names.AttrFileSystemID] = aws.StringValue(v) } if v := apiObject.Region; v != nil { From a63504488052d631045a17e30f8a362d9c8a96ef Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:56:50 -0400 Subject: [PATCH 0887/1490] fsx: Use constant for file_system_id strings --- internal/service/fsx/backup.go | 6 +++--- internal/service/fsx/data_repository_association.go | 6 +++--- internal/service/fsx/data_repository_association_test.go | 2 +- internal/service/fsx/file_cache.go | 2 +- internal/service/fsx/ontap_storage_virtual_machine.go | 6 +++--- .../fsx/ontap_storage_virtual_machine_data_source.go | 4 ++-- .../fsx/ontap_storage_virtual_machine_data_source_test.go | 4 ++-- .../service/fsx/ontap_storage_virtual_machine_migrate.go | 2 +- internal/service/fsx/ontap_storage_virtual_machine_test.go | 2 +- internal/service/fsx/ontap_volume.go | 4 ++-- internal/service/fsx/ontap_volume_test.go | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/internal/service/fsx/backup.go b/internal/service/fsx/backup.go index f2a3eb8a3f1..1d1cef89baa 100644 --- a/internal/service/fsx/backup.go +++ b/internal/service/fsx/backup.go @@ -48,7 +48,7 @@ func resourceBackup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -89,7 +89,7 @@ func resourceBackupCreate(ctx context.Context, d *schema.ResourceData, meta inte Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("file_system_id"); ok { + if v, ok := d.GetOk(names.AttrFileSystemID); ok { input.FileSystemId = aws.String(v.(string)) } @@ -138,7 +138,7 @@ func resourceBackupRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrARN, backup.ResourceARN) if backup.FileSystem != nil { - d.Set("file_system_id", backup.FileSystem.FileSystemId) + d.Set(names.AttrFileSystemID, backup.FileSystem.FileSystemId) } d.Set(names.AttrKMSKeyID, backup.KmsKeyId) d.Set(names.AttrOwnerID, backup.OwnerId) diff --git a/internal/service/fsx/data_repository_association.go b/internal/service/fsx/data_repository_association.go index 7b42e77fc52..8428acfc9fe 100644 --- a/internal/service/fsx/data_repository_association.go +++ b/internal/service/fsx/data_repository_association.go @@ -76,7 +76,7 @@ func resourceDataRepositoryAssociation() *schema.Resource { Optional: true, Default: false, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, ForceNew: true, Required: true, @@ -168,7 +168,7 @@ func resourceDataRepositoryAssociationCreate(ctx context.Context, d *schema.Reso input := &fsx.CreateDataRepositoryAssociationInput{ ClientRequestToken: aws.String(id.UniqueId()), DataRepositoryPath: aws.String(d.Get("data_repository_path").(string)), - FileSystemId: aws.String(d.Get("file_system_id").(string)), + FileSystemId: aws.String(d.Get(names.AttrFileSystemID).(string)), FileSystemPath: aws.String(d.Get("file_system_path").(string)), Tags: getTagsIn(ctx), } @@ -219,7 +219,7 @@ func resourceDataRepositoryAssociationRead(ctx context.Context, d *schema.Resour d.Set(names.AttrARN, association.ResourceARN) d.Set("batch_import_meta_data_on_create", association.BatchImportMetaDataOnCreate) d.Set("data_repository_path", association.DataRepositoryPath) - d.Set("file_system_id", association.FileSystemId) + d.Set(names.AttrFileSystemID, association.FileSystemId) d.Set("file_system_path", association.FileSystemPath) d.Set("imported_file_chunk_size", association.ImportedFileChunkSize) if err := d.Set("s3", flattenDataRepositoryAssociationS3(association.S3)); err != nil { diff --git a/internal/service/fsx/data_repository_association_test.go b/internal/service/fsx/data_repository_association_test.go index 190f4da9475..88522354123 100644 --- a/internal/service/fsx/data_repository_association_test.go +++ b/internal/service/fsx/data_repository_association_test.go @@ -49,7 +49,7 @@ func TestAccFSxDataRepositoryAssociation_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "fsx", regexache.MustCompile(`association/fs-.+/dra-.+`)), resource.TestCheckResourceAttr(resourceName, "batch_import_meta_data_on_create", "false"), resource.TestCheckResourceAttr(resourceName, "data_repository_path", bucketPath), - resource.TestMatchResourceAttr(resourceName, "file_system_id", regexache.MustCompile(`fs-.+`)), + resource.TestMatchResourceAttr(resourceName, names.AttrFileSystemID, regexache.MustCompile(`fs-.+`)), resource.TestCheckResourceAttr(resourceName, "file_system_path", fileSystemPath), resource.TestCheckResourceAttrSet(resourceName, "imported_file_chunk_size"), ), diff --git a/internal/service/fsx/file_cache.go b/internal/service/fsx/file_cache.go index 9637f604eff..c9cb2d38a4c 100644 --- a/internal/service/fsx/file_cache.go +++ b/internal/service/fsx/file_cache.go @@ -97,7 +97,7 @@ func resourceFileCache() *schema.Resource { validation.StringLenBetween(1, 4096), ), }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/fsx/ontap_storage_virtual_machine.go b/internal/service/fsx/ontap_storage_virtual_machine.go index 7a11f2fca1c..2452e101f9f 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine.go +++ b/internal/service/fsx/ontap_storage_virtual_machine.go @@ -197,7 +197,7 @@ func resourceONTAPStorageVirtualMachine() *schema.Resource { }, }, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -243,7 +243,7 @@ func resourceONTAPStorageVirtualMachineCreate(ctx context.Context, d *schema.Res name := d.Get(names.AttrName).(string) input := &fsx.CreateStorageVirtualMachineInput{ - FileSystemId: aws.String(d.Get("file_system_id").(string)), + FileSystemId: aws.String(d.Get(names.AttrFileSystemID).(string)), Name: aws.String(name), Tags: getTagsIn(ctx), } @@ -298,7 +298,7 @@ func resourceONTAPStorageVirtualMachineRead(ctx context.Context, d *schema.Resou if err := d.Set(names.AttrEndpoints, flattenSvmEndpoints(storageVirtualMachine.Endpoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoints: %s", err) } - d.Set("file_system_id", storageVirtualMachine.FileSystemId) + d.Set(names.AttrFileSystemID, storageVirtualMachine.FileSystemId) d.Set(names.AttrName, storageVirtualMachine.Name) // RootVolumeSecurityStyle and SVMAdminPassword are write only properties so they don't get returned from the describe API so we just store the original setting to state d.Set("root_volume_security_style", d.Get("root_volume_security_style").(string)) 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 574de360a2a..a895dc024b6 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go @@ -150,7 +150,7 @@ func dataSourceONTAPStorageVirtualMachine() *schema.Resource { }, }, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Computed: true, }, @@ -228,7 +228,7 @@ func dataSourceONTAPStorageVirtualMachineRead(ctx context.Context, d *schema.Res if err := d.Set(names.AttrEndpoints, flattenSvmEndpoints(svm.Endpoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoints: %s", err) } - d.Set("file_system_id", svm.FileSystemId) + d.Set(names.AttrFileSystemID, svm.FileSystemId) d.Set("lifecycle_status", svm.Lifecycle) if err := d.Set("lifecycle_transition_reason", flattenLifecycleTransitionReason(svm.LifecycleTransitionReason)); err != nil { return sdkdiag.AppendErrorf(diags, "setting lifecycle_transition_reason: %s", err) diff --git a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go index f7be92bcd25..137a8929c56 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source_test.go @@ -34,7 +34,7 @@ func TestAccFSxONTAPStorageVirtualMachineDataSource_Id(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, "active_directory_configuration.#", resourceName, "active_directory_configuration.#"), resource.TestCheckResourceAttrPair(dataSourceName, "endpoints.#", resourceName, "endpoints.#"), - resource.TestCheckResourceAttrPair(dataSourceName, "file_system_id", resourceName, "file_system_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrFileSystemID, resourceName, names.AttrFileSystemID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, "subtype", resourceName, "subtype"), @@ -68,7 +68,7 @@ func TestAccFSxONTAPStorageVirtualMachineDataSource_Filter(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, "active_directory_configuration.#", resourceName, "active_directory_configuration.#"), resource.TestCheckResourceAttrPair(dataSourceName, "endpoints.#", resourceName, "endpoints.#"), - resource.TestCheckResourceAttrPair(dataSourceName, "file_system_id", resourceName, "file_system_id"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrFileSystemID, resourceName, names.AttrFileSystemID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, "subtype", resourceName, "subtype"), diff --git a/internal/service/fsx/ontap_storage_virtual_machine_migrate.go b/internal/service/fsx/ontap_storage_virtual_machine_migrate.go index 52c685eebaf..3a3449b0963 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_migrate.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_migrate.go @@ -173,7 +173,7 @@ func resourceONTAPStorageVirtualMachineV0() *schema.Resource { }, }, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(11, 21), diff --git a/internal/service/fsx/ontap_storage_virtual_machine_test.go b/internal/service/fsx/ontap_storage_virtual_machine_test.go index a2a95738b74..620bb15dcae 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_test.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_test.go @@ -46,7 +46,7 @@ func TestAccFSxONTAPStorageVirtualMachine_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "endpoints.0.management.0.dns_name"), resource.TestCheckResourceAttr(resourceName, "endpoints.0.nfs.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "endpoints.0.nfs.0.dns_name"), - resource.TestCheckResourceAttrSet(resourceName, "file_system_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrFileSystemID), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, "subtype", fsx.StorageVirtualMachineSubtypeDefault), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), diff --git a/internal/service/fsx/ontap_volume.go b/internal/service/fsx/ontap_volume.go index 01dc79d42b2..a3fda697386 100644 --- a/internal/service/fsx/ontap_volume.go +++ b/internal/service/fsx/ontap_volume.go @@ -101,7 +101,7 @@ func resourceONTAPVolume() *schema.Resource { Optional: true, Default: false, }, - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Computed: true, }, @@ -448,7 +448,7 @@ func resourceONTAPVolumeRead(ctx context.Context, d *schema.ResourceData, meta i } d.Set(names.AttrARN, volume.ResourceARN) d.Set("copy_tags_to_backups", ontapConfig.CopyTagsToBackups) - d.Set("file_system_id", volume.FileSystemId) + d.Set(names.AttrFileSystemID, volume.FileSystemId) d.Set("junction_path", ontapConfig.JunctionPath) d.Set(names.AttrName, volume.Name) d.Set("ontap_volume_type", ontapConfig.OntapVolumeType) diff --git a/internal/service/fsx/ontap_volume_test.go b/internal/service/fsx/ontap_volume_test.go index 8dfb72adf1a..88cc9945a87 100644 --- a/internal/service/fsx/ontap_volume_test.go +++ b/internal/service/fsx/ontap_volume_test.go @@ -40,7 +40,7 @@ func TestAccFSxONTAPVolume_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "fsx", regexache.MustCompile(`volume/fs-.+/fsvol-.+`)), resource.TestCheckResourceAttr(resourceName, "bypass_snaplock_enterprise_retention", "false"), resource.TestCheckResourceAttr(resourceName, "copy_tags_to_backups", "false"), - resource.TestCheckResourceAttrSet(resourceName, "file_system_id"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrFileSystemID), resource.TestCheckResourceAttr(resourceName, "junction_path", fmt.Sprintf("/%[1]s", rName)), resource.TestCheckResourceAttr(resourceName, "ontap_volume_type", "RW"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), From 3b038e2fce3e613e63146cf02b3ec5076bd8d0a9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:56:50 -0400 Subject: [PATCH 0888/1490] m2: Use constant for file_system_id strings --- internal/service/m2/environment.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/m2/environment.go b/internal/service/m2/environment.go index 637d83b7a26..77f08462c51 100644 --- a/internal/service/m2/environment.go +++ b/internal/service/m2/environment.go @@ -216,7 +216,7 @@ func (r *environmentResource) Schema(ctx context.Context, request resource.Schem }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "file_system_id": schema.StringAttribute{ + names.AttrFileSystemID: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), @@ -241,7 +241,7 @@ func (r *environmentResource) Schema(ctx context.Context, request resource.Schem }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "file_system_id": schema.StringAttribute{ + names.AttrFileSystemID: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), From f00b4df43caf277d5c8f4df66f1bf417afb1c09d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:56:50 -0400 Subject: [PATCH 0889/1490] sagemaker: Use constant for file_system_id strings --- internal/service/sagemaker/domain.go | 6 +++--- internal/service/sagemaker/space.go | 6 +++--- internal/service/sagemaker/user_profile.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/sagemaker/domain.go b/internal/service/sagemaker/domain.go index 5cb96a3746b..4eb6a59c8e8 100644 --- a/internal/service/sagemaker/domain.go +++ b/internal/service/sagemaker/domain.go @@ -403,7 +403,7 @@ func ResourceDomain() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Required: true, }, @@ -2401,7 +2401,7 @@ func expandEFSFileSystemConfig(tfMap map[string]interface{}) *sagemaker.EFSFileS apiObject := &sagemaker.EFSFileSystemConfig{} - if v, ok := tfMap["file_system_id"].(string); ok { + if v, ok := tfMap[names.AttrFileSystemID].(string); ok { apiObject.FileSystemId = aws.String(v) } @@ -2452,7 +2452,7 @@ func flattenEFSFileSystemConfig(apiObject *sagemaker.EFSFileSystemConfig) []map[ tfMap := map[string]interface{}{} if apiObject.FileSystemId != nil { - tfMap["file_system_id"] = aws.StringValue(apiObject.FileSystemId) + tfMap[names.AttrFileSystemID] = aws.StringValue(apiObject.FileSystemId) } if apiObject.FileSystemPath != nil { diff --git a/internal/service/sagemaker/space.go b/internal/service/sagemaker/space.go index 78e994c49af..05906f12042 100644 --- a/internal/service/sagemaker/space.go +++ b/internal/service/sagemaker/space.go @@ -142,7 +142,7 @@ func ResourceSpace() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Required: true, }, @@ -816,7 +816,7 @@ func expandEFSFileSystem(tfMap map[string]interface{}) *sagemaker.EFSFileSystem apiObject := &sagemaker.EFSFileSystem{} - if v, ok := tfMap["file_system_id"].(string); ok { + if v, ok := tfMap[names.AttrFileSystemID].(string); ok { apiObject.FileSystemId = aws.String(v) } @@ -863,7 +863,7 @@ func flattenEFSFileSystem(apiObject *sagemaker.EFSFileSystem) []map[string]inter tfMap := map[string]interface{}{} if apiObject.FileSystemId != nil { - tfMap["file_system_id"] = aws.StringValue(apiObject.FileSystemId) + tfMap[names.AttrFileSystemID] = aws.StringValue(apiObject.FileSystemId) } return []map[string]interface{}{tfMap} diff --git a/internal/service/sagemaker/user_profile.go b/internal/service/sagemaker/user_profile.go index 0aa6744e8ed..5ff0ec8811a 100644 --- a/internal/service/sagemaker/user_profile.go +++ b/internal/service/sagemaker/user_profile.go @@ -252,7 +252,7 @@ func ResourceUserProfile() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Required: true, }, From df09037b0165d34bcfe199cd6cb3659b39704606 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 00:56:51 -0400 Subject: [PATCH 0890/1490] transfer: Use constant for file_system_id strings --- internal/service/transfer/workflow.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/transfer/workflow.go b/internal/service/transfer/workflow.go index 9a11ee8f1af..517ac06c804 100644 --- a/internal/service/transfer/workflow.go +++ b/internal/service/transfer/workflow.go @@ -78,7 +78,7 @@ func ResourceWorkflow() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -205,7 +205,7 @@ func ResourceWorkflow() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -391,7 +391,7 @@ func ResourceWorkflow() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -518,7 +518,7 @@ func ResourceWorkflow() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "file_system_id": { + names.AttrFileSystemID: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -1154,7 +1154,7 @@ func expandEFSFileLocation(tfMap []interface{}) *transfer.EfsFileLocation { apiObject := &transfer.EfsFileLocation{} - if v, ok := tfMapRaw["file_system_id"].(string); ok && v != "" { + if v, ok := tfMapRaw[names.AttrFileSystemID].(string); ok && v != "" { apiObject.FileSystemId = aws.String(v) } @@ -1173,7 +1173,7 @@ func flattenEFSFileLocation(apiObject *transfer.EfsFileLocation) []interface{} { tfMap := map[string]interface{}{} if v := apiObject.FileSystemId; v != nil { - tfMap["file_system_id"] = aws.StringValue(v) + tfMap[names.AttrFileSystemID] = aws.StringValue(v) } if v := apiObject.Path; v != nil { From 8b2e582442d5629fcf7b4027d6cf92a79c7b35e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 10:42:34 -0400 Subject: [PATCH 0891/1490] build(deps): bump bflad/action-milestone-comment from 1.0.2 to 2.0.0 (#37419) Bumps [bflad/action-milestone-comment](https://github.com/bflad/action-milestone-comment) from 1.0.2 to 2.0.0. - [Release notes](https://github.com/bflad/action-milestone-comment/releases) - [Changelog](https://github.com/bflad/action-milestone-comment/blob/main/CHANGELOG.md) - [Commits](https://github.com/bflad/action-milestone-comment/compare/ae6c9fdf5778064d4e09b4632604a16b7289096c...4618cbf8bf938d31af1c576beeaaa77f486f5af3) --- updated-dependencies: - dependency-name: bflad/action-milestone-comment dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/milestone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/milestone.yml b/.github/workflows/milestone.yml index ec7fd3e33a1..8e072675614 100644 --- a/.github/workflows/milestone.yml +++ b/.github/workflows/milestone.yml @@ -13,7 +13,7 @@ jobs: name: 'Post-Release Comment' runs-on: ubuntu-latest steps: - - uses: bflad/action-milestone-comment@ae6c9fdf5778064d4e09b4632604a16b7289096c # v1.0.2 + - uses: bflad/action-milestone-comment@4618cbf8bf938d31af1c576beeaaa77f486f5af3 # v2.0.0 with: body: | This functionality has been released in [${{ github.event.milestone.title }} of the Terraform AWS Provider](https://github.com/${{ github.repository }}/blob/${{ github.event.milestone.title }}/CHANGELOG.md). Please see the [Terraform documentation on provider versioning](https://www.terraform.io/docs/configuration/providers.html#provider-versions) or reach out if you need any assistance upgrading. From 0873c6feb902acba599665386b2bd620cff28b6a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 10:43:05 -0400 Subject: [PATCH 0892/1490] build(deps): bump github.com/aws/aws-sdk-go in /.ci/providerlint (#37418) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.52.5 to 1.52.6. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.52.5...v1.52.6) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .ci/providerlint/go.mod | 2 +- .ci/providerlint/go.sum | 4 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 78 +++++++++++++++++++ .ci/providerlint/vendor/modules.txt | 2 +- 4 files changed, 82 insertions(+), 4 deletions(-) diff --git a/.ci/providerlint/go.mod b/.ci/providerlint/go.mod index 0896788bb7d..737df075391 100644 --- a/.ci/providerlint/go.mod +++ b/.ci/providerlint/go.mod @@ -3,7 +3,7 @@ module github.com/hashicorp/terraform-provider-aws/ci/providerlint go 1.22 require ( - github.com/aws/aws-sdk-go v1.52.5 + github.com/aws/aws-sdk-go v1.52.6 github.com/bflad/tfproviderlint v0.29.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 golang.org/x/tools v0.13.0 diff --git a/.ci/providerlint/go.sum b/.ci/providerlint/go.sum index 5e9e1702e09..cf150e503d2 100644 --- a/.ci/providerlint/go.sum +++ b/.ci/providerlint/go.sum @@ -9,8 +9,8 @@ github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= -github.com/aws/aws-sdk-go v1.52.5 h1:m2lty5v9sHm1J3lhA43hJql+yKZudF09qzab0Ag9chM= -github.com/aws/aws-sdk-go v1.52.5/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.52.6 h1:nw1AMg0wIj5tTnI89KaDe9G5aISqXm4KJEe1DfNbFvA= +github.com/aws/aws-sdk-go v1.52.6/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/bflad/gopaniccheck v0.1.0 h1:tJftp+bv42ouERmUMWLoUn/5bi/iQZjHPznM00cP/bU= github.com/bflad/gopaniccheck v0.1.0/go.mod h1:ZCj2vSr7EqVeDaqVsWN4n2MwdROx1YL+LFo47TSWtsA= github.com/bflad/tfproviderlint v0.29.0 h1:zxKYAAM6IZ4ace1a3LX+uzMRIMP8L+iOtEc+FP2Yoow= diff --git a/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 420ea8c62ad..0b94fe7fe45 100644 --- a/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/.ci/providerlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -298,6 +298,12 @@ var awsPartition = partition{ endpointKey{ Region: "ca-west-1", }: endpoint{}, + endpointKey{ + Region: "ca-west-1", + Variant: fipsVariant, + }: endpoint{ + Hostname: "access-analyzer-fips.ca-west-1.amazonaws.com", + }, endpointKey{ Region: "eu-central-1", }: endpoint{}, @@ -331,6 +337,15 @@ var awsPartition = partition{ }, Deprecated: boxedTrue, }, + endpointKey{ + Region: "fips-ca-west-1", + }: endpoint{ + Hostname: "access-analyzer-fips.ca-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-west-1", + }, + Deprecated: boxedTrue, + }, endpointKey{ Region: "fips-us-east-1", }: endpoint{ @@ -1057,6 +1072,9 @@ var awsPartition = partition{ endpointKey{ Region: "eu-west-1", }: endpoint{}, + endpointKey{ + Region: "eu-west-3", + }: endpoint{}, endpointKey{ Region: "us-east-1", }: endpoint{}, @@ -40445,22 +40463,82 @@ var awsusgovPartition = partition{ }, "emr-containers": service{ Endpoints: serviceEndpoints{ + endpointKey{ + Region: "fips-us-gov-east-1", + }: endpoint{ + Hostname: "emr-containers.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + Deprecated: boxedTrue, + }, + endpointKey{ + Region: "fips-us-gov-west-1", + }: endpoint{ + Hostname: "emr-containers.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + Deprecated: boxedTrue, + }, endpointKey{ Region: "us-gov-east-1", }: endpoint{}, + endpointKey{ + Region: "us-gov-east-1", + Variant: fipsVariant, + }: endpoint{ + Hostname: "emr-containers.us-gov-east-1.amazonaws.com", + }, endpointKey{ Region: "us-gov-west-1", }: endpoint{}, + endpointKey{ + Region: "us-gov-west-1", + Variant: fipsVariant, + }: endpoint{ + Hostname: "emr-containers.us-gov-west-1.amazonaws.com", + }, }, }, "emr-serverless": service{ Endpoints: serviceEndpoints{ + endpointKey{ + Region: "fips-us-gov-east-1", + }: endpoint{ + Hostname: "emr-serverless.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + Deprecated: boxedTrue, + }, + endpointKey{ + Region: "fips-us-gov-west-1", + }: endpoint{ + Hostname: "emr-serverless.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + Deprecated: boxedTrue, + }, endpointKey{ Region: "us-gov-east-1", }: endpoint{}, + endpointKey{ + Region: "us-gov-east-1", + Variant: fipsVariant, + }: endpoint{ + Hostname: "emr-serverless.us-gov-east-1.amazonaws.com", + }, endpointKey{ Region: "us-gov-west-1", }: endpoint{}, + endpointKey{ + Region: "us-gov-west-1", + Variant: fipsVariant, + }: endpoint{ + Hostname: "emr-serverless.us-gov-west-1.amazonaws.com", + }, }, }, "es": service{ diff --git a/.ci/providerlint/vendor/modules.txt b/.ci/providerlint/vendor/modules.txt index 7e86f28321b..b23d4d6a4df 100644 --- a/.ci/providerlint/vendor/modules.txt +++ b/.ci/providerlint/vendor/modules.txt @@ -28,7 +28,7 @@ github.com/agext/levenshtein # github.com/apparentlymart/go-textseg/v15 v15.0.0 ## explicit; go 1.16 github.com/apparentlymart/go-textseg/v15/textseg -# github.com/aws/aws-sdk-go v1.52.5 +# github.com/aws/aws-sdk-go v1.52.6 ## explicit; go 1.19 github.com/aws/aws-sdk-go/aws/awserr github.com/aws/aws-sdk-go/aws/endpoints From 6c5e9a73303af1352c1b2eb8836ead4b8bd78f6c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 10:43:29 -0400 Subject: [PATCH 0893/1490] build(deps): bump the aws-sdk-go group with 6 updates (#37417) Bumps the aws-sdk-go group with 6 updates: | Package | From | To | | --- | --- | --- | | [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) | `1.52.5` | `1.52.6` | | [github.com/aws/aws-sdk-go-v2/service/accessanalyzer](https://github.com/aws/aws-sdk-go-v2) | `1.29.2` | `1.29.3` | | [github.com/aws/aws-sdk-go-v2/service/emrserverless](https://github.com/aws/aws-sdk-go-v2) | `1.19.1` | `1.19.2` | | [github.com/aws/aws-sdk-go-v2/service/opensearchserverless](https://github.com/aws/aws-sdk-go-v2) | `1.11.5` | `1.11.6` | | [github.com/aws/aws-sdk-go-v2/service/ssmsap](https://github.com/aws/aws-sdk-go-v2) | `1.12.5` | `1.13.0` | | [github.com/aws/aws-sdk-go-v2/service/verifiedpermissions](https://github.com/aws/aws-sdk-go-v2) | `1.13.2` | `1.14.0` | Updates `github.com/aws/aws-sdk-go` from 1.52.5 to 1.52.6 - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.52.5...v1.52.6) Updates `github.com/aws/aws-sdk-go-v2/service/accessanalyzer` from 1.29.2 to 1.29.3 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/s3/v1.29.2...service/s3/v1.29.3) Updates `github.com/aws/aws-sdk-go-v2/service/emrserverless` from 1.19.1 to 1.19.2 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.19.1...service/mq/v1.19.2) Updates `github.com/aws/aws-sdk-go-v2/service/opensearchserverless` from 1.11.5 to 1.11.6 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/waf/v1.11.5...service/waf/v1.11.6) Updates `github.com/aws/aws-sdk-go-v2/service/ssmsap` from 1.12.5 to 1.13.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/v1.13.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/dax/v1.12.5...v1.13.0) Updates `github.com/aws/aws-sdk-go-v2/service/verifiedpermissions` from 1.13.2 to 1.14.0 - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/v1.14.0/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/mq/v1.13.2...v1.14.0) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/accessanalyzer dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/emrserverless dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/opensearchserverless dependency-type: direct:production update-type: version-update:semver-patch dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/ssmsap dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go - dependency-name: github.com/aws/aws-sdk-go-v2/service/verifiedpermissions dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws-sdk-go ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index f7338de5649..048ef7fe195 100644 --- a/go.mod +++ b/go.mod @@ -6,13 +6,13 @@ require ( github.com/ProtonMail/go-crypto v1.1.0-alpha.2 github.com/YakDriver/go-version v0.1.0 github.com/YakDriver/regexache v0.23.0 - github.com/aws/aws-sdk-go v1.52.5 + github.com/aws/aws-sdk-go v1.52.6 github.com/aws/aws-sdk-go-v2 v1.26.1 github.com/aws/aws-sdk-go-v2/config v1.27.12 github.com/aws/aws-sdk-go-v2/credentials v1.17.12 github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.16 - github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.2 + github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.3 github.com/aws/aws-sdk-go-v2/service/account v1.16.5 github.com/aws/aws-sdk-go-v2/service/acm v1.25.5 github.com/aws/aws-sdk-go-v2/service/acmpca v1.29.5 @@ -84,7 +84,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.23.5 github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.6 github.com/aws/aws-sdk-go-v2/service/emr v1.39.6 - github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.1 + github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.2 github.com/aws/aws-sdk-go-v2/service/eventbridge v1.30.5 github.com/aws/aws-sdk-go-v2/service/evidently v1.19.5 github.com/aws/aws-sdk-go-v2/service/finspace v1.24.2 @@ -122,7 +122,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/mwaa v1.26.6 github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.8.2 github.com/aws/aws-sdk-go-v2/service/oam v1.11.1 - github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.5 + github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.6 github.com/aws/aws-sdk-go-v2/service/osis v1.8.5 github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.1 github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.5 @@ -159,7 +159,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/ssm v1.50.1 github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.5 github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.5 - github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.5 + github.com/aws/aws-sdk-go-v2/service/ssmsap v1.13.0 github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 github.com/aws/aws-sdk-go-v2/service/ssoadmin v1.25.6 github.com/aws/aws-sdk-go-v2/service/sts v1.28.7 @@ -168,7 +168,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.6 github.com/aws/aws-sdk-go-v2/service/transcribe v1.37.1 github.com/aws/aws-sdk-go-v2/service/transfer v1.47.3 - github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.2 + github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.14.0 github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.6 github.com/aws/aws-sdk-go-v2/service/wafv2 v1.48.4 github.com/aws/aws-sdk-go-v2/service/wellarchitected v1.30.1 diff --git a/go.sum b/go.sum index 7f379a2faab..91f4f1e7d7d 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.52.5 h1:m2lty5v9sHm1J3lhA43hJql+yKZudF09qzab0Ag9chM= -github.com/aws/aws-sdk-go v1.52.5/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.52.6 h1:nw1AMg0wIj5tTnI89KaDe9G5aISqXm4KJEe1DfNbFvA= +github.com/aws/aws-sdk-go v1.52.6/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to= @@ -44,8 +44,8 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7 github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5 h1:81KE7vaZzrl7yHBYHVEzYB8sypz11NMOZ40YlWvPxsU= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5/go.mod h1:LIt2rg7Mcgn09Ygbdh/RdIm0rQ+3BNkbP1gyVMFtRK0= -github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.2 h1:jZywIZbLnCUJ+ZmMQgEuP4pg43/0z6KxWA3VfB7WVxQ= -github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.2/go.mod h1:CDDc+pehLZpaGJNHUE6RJcp7MjQUhduISa1bQ/ixwR8= +github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.3 h1:BBUeY/+n606X9dEj6GKp2xG35HY4edSNo358QHBZ/Pw= +github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.3/go.mod h1:CDDc+pehLZpaGJNHUE6RJcp7MjQUhduISa1bQ/ixwR8= github.com/aws/aws-sdk-go-v2/service/account v1.16.5 h1:jhvXh67e1M5jqqKNulv1wTfM8KpnCnVe7OWUF3fW9r4= github.com/aws/aws-sdk-go-v2/service/account v1.16.5/go.mod h1:d6aNAmILOvNF389Sj6qTZuwRGVU1L/CQH3OlB5Xa9/k= github.com/aws/aws-sdk-go-v2/service/acm v1.25.5 h1:VUFUI8yF8Jgv6DtjS3eBcIsWrZzOsQ9qNzqEh8EhYEY= @@ -188,8 +188,8 @@ github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.6 h1:P5kMcIzrz github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.6/go.mod h1:e1McVqsud0JOERidvppLEHnuCdh/X6MRyL5L0LseAUk= github.com/aws/aws-sdk-go-v2/service/emr v1.39.6 h1:6FFt6seuRKdiIedxSHYMg2tC/zLD8yl56X8gJxQfFl8= github.com/aws/aws-sdk-go-v2/service/emr v1.39.6/go.mod h1:7WusX+O5pwTnx2yobUO/P1C5HlBibmrQb5gKEPFjTYM= -github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.1 h1:+aHhVyLzitWmStZzndkz1NI/SD12eM2FkQ77OxQIrbA= -github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.1/go.mod h1:TZrahLcSXIN/kO96kvxUzfLNLH8E6t3xodv8Zv5DHGs= +github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.2 h1:FUqD0sv/ZriloldGjCAc2jLwT4kOKKWw8y8qy6Ib1Rs= +github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.2/go.mod h1:TZrahLcSXIN/kO96kvxUzfLNLH8E6t3xodv8Zv5DHGs= github.com/aws/aws-sdk-go-v2/service/eventbridge v1.30.5 h1:8cIsFC9HskfTIrkJUk24+1HBRUetZ0wOW3rcTqN//vg= github.com/aws/aws-sdk-go-v2/service/eventbridge v1.30.5/go.mod h1:aIINXlt2xXhMeRsyCsLDUDohI8AdDm92gY9nIB6pv0M= github.com/aws/aws-sdk-go-v2/service/evidently v1.19.5 h1:gDSjoeOFMMpR+dxjkRnQX8j44pFdm2FFOP1rhs9G7vA= @@ -274,8 +274,8 @@ github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.8.2 h1:C08TU/uiP+9lFaH/wxH9 github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.8.2/go.mod h1:z/vZeXWTVU//C8fnX0JqhIykpNf9EqdmEIfNrU8nPyk= github.com/aws/aws-sdk-go-v2/service/oam v1.11.1 h1:JTj9z5gGzXhg4XoVdfd+RMUeg+DqvPKQa1yMpAnKJhs= github.com/aws/aws-sdk-go-v2/service/oam v1.11.1/go.mod h1:GNW8lL/rOjgXphUtGDvd9yikXGOfo51z2LBgct6XPTs= -github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.5 h1:gYmHliliNlF5EpVIsEiOVaHDAz9DWJBHVA9p1iBZ0F0= -github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.5/go.mod h1:T7lBopPcIVR1EJOibce+6Z3cJmY8uWTEM8+i63a4rD0= +github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.6 h1:N4jSI2xXE/KAOfU+lLgB8aoBgKb5wfCKrFZO+wdkRDM= +github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.6/go.mod h1:T7lBopPcIVR1EJOibce+6Z3cJmY8uWTEM8+i63a4rD0= github.com/aws/aws-sdk-go-v2/service/osis v1.8.5 h1:YbNekLy3cv7Kfq4scc9L3OrcwuaZfwXjSYBEGUMlPEc= github.com/aws/aws-sdk-go-v2/service/osis v1.8.5/go.mod h1:MHw9zAnU6CaZXqe/J1UNcxcEZLF5oXs21Efdxw0K5tY= github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.1 h1:1c5ZA0hDANl2Y4uooj+f/EuSU2DegLDHA7FQKXhpIGY= @@ -348,8 +348,8 @@ github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.5 h1:To1CPB7szsjzmscM7KUF github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.5/go.mod h1:LjUmrzAa81OMGqfygRS3JTkxhNinG4rswXYy4uUWvow= github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.5 h1:8TPcvvTtvyK56nUD50MC1wfL3WD7Tq2jQ5hyEYor2P8= github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.5/go.mod h1:xgj+QUtfv/DrfdZq1cGt0wlEX6om1oh/NHB+PClQbWs= -github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.5 h1:FPO6Zy+6UKz+1ejS+KvZRpCnTbb1V21KGzTDr/YUsog= -github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.5/go.mod h1:HYXzJ1bqOZnHNvjaArIrCPnSz5HnVQhKSb/317ZCTyc= +github.com/aws/aws-sdk-go-v2/service/ssmsap v1.13.0 h1:ZDjnSS+C6TFRM+VCn3LT7m6YuLvPi2Sk/MBSIOhgN0w= +github.com/aws/aws-sdk-go-v2/service/ssmsap v1.13.0/go.mod h1:HYXzJ1bqOZnHNvjaArIrCPnSz5HnVQhKSb/317ZCTyc= github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 h1:o5cTaeunSpfXiLTIBx5xo2enQmiChtu1IBbzXnfU9Hs= github.com/aws/aws-sdk-go-v2/service/sso v1.20.6/go.mod h1:qGzynb/msuZIE8I75DVRCUXw3o3ZyBmUvMwQ2t/BrGM= github.com/aws/aws-sdk-go-v2/service/ssoadmin v1.25.6 h1:Dzs+0j54D0WdqPDr6+zIp1UU+YcG88+d9CpIAInSoPo= @@ -368,8 +368,8 @@ github.com/aws/aws-sdk-go-v2/service/transcribe v1.37.1 h1:rGTny4YnKnvLcpJVrF3J+ github.com/aws/aws-sdk-go-v2/service/transcribe v1.37.1/go.mod h1:k8u3Uj5KgSM4eUoGXyvLNNf1Y/mLMM7jJM4o9kIazEc= github.com/aws/aws-sdk-go-v2/service/transfer v1.47.3 h1:EhqwUy9cWyivUol3OItsFxUT/m0jm5isdxUWGOWzOYQ= github.com/aws/aws-sdk-go-v2/service/transfer v1.47.3/go.mod h1:z3NpUj6ziVpg9XHEMdA0xpD/lgjPuZb9R/PBV6Mieb0= -github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.2 h1:H4Z5fqtcfa9grRYIIcJmfcAq0el2dpN9KmHCnOdFMk4= -github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.2/go.mod h1:DKtR1LdOqG21jCPD/b7zMxAFxpelWoGb65rNVTpBaXs= +github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.14.0 h1:xLuRLtl2r5Xb8854TV7cnhTtqZuThvFhoOz7K1rdBXg= +github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.14.0/go.mod h1:DKtR1LdOqG21jCPD/b7zMxAFxpelWoGb65rNVTpBaXs= github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.6 h1:ZJzyuwG/oxo8Usglni0OzP9hCCiFqg5EDAwAWFZIy4Y= github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.6/go.mod h1:lwuOe4SF+wdRnUrcPt1tukhJCj4gklxBV6xlD03Uo/8= github.com/aws/aws-sdk-go-v2/service/wafv2 v1.48.4 h1:2UwmqMxMqrh/PeC9rlz622TcUMa4mhIJ9YjoZHSPEvQ= From ddb77bc4c8bcaf7d3483bff546546139d4ab4942 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 10:57:04 -0400 Subject: [PATCH 0894/1490] Bump github.com/hashicorp/terraform-plugin-mux (#37398) Bumps the terraform-devex group with 1 update: [github.com/hashicorp/terraform-plugin-mux](https://github.com/hashicorp/terraform-plugin-mux). Updates `github.com/hashicorp/terraform-plugin-mux` from 0.15.0 to 0.16.0 - [Release notes](https://github.com/hashicorp/terraform-plugin-mux/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-mux/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/terraform-plugin-mux/compare/v0.15.0...v0.16.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-mux dependency-type: direct:production update-type: version-update:semver-minor dependency-group: terraform-devex ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 048ef7fe195..f0510e9e32c 100644 --- a/go.mod +++ b/go.mod @@ -198,9 +198,9 @@ require ( github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0 github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 - github.com/hashicorp/terraform-plugin-go v0.22.2 + github.com/hashicorp/terraform-plugin-go v0.23.0 github.com/hashicorp/terraform-plugin-log v0.9.0 - github.com/hashicorp/terraform-plugin-mux v0.15.0 + github.com/hashicorp/terraform-plugin-mux v0.16.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 github.com/hashicorp/terraform-plugin-testing v1.7.0 github.com/jmespath/go-jmespath v0.4.0 @@ -287,7 +287,7 @@ require ( google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/grpc v1.63.2 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/protobuf v1.34.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 91f4f1e7d7d..8fd4cc75ea4 100644 --- a/go.sum +++ b/go.sum @@ -496,10 +496,10 @@ github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0 h1:egR4InfakWkg github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0/go.mod h1:9vjvl36aY1p6KltaA5QCvGC5hdE/9t4YuhGftw6WOgE= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= -github.com/hashicorp/terraform-plugin-go v0.22.2 h1:5o8uveu6eZUf5J7xGPV0eY0TPXg3qpmwX9sce03Bxnc= -github.com/hashicorp/terraform-plugin-go v0.22.2/go.mod h1:drq8Snexp9HsbFZddvyLHN6LuWHHndSQg+gV+FPkcIM= -github.com/hashicorp/terraform-plugin-mux v0.15.0 h1:+/+lDx0WUsIOpkAmdwBIoFU8UP9o2eZASoOnLsWbKME= -github.com/hashicorp/terraform-plugin-mux v0.15.0/go.mod h1:9ezplb1Dyq394zQ+ldB0nvy/qbNAz3mMoHHseMTMaKo= +github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co= +github.com/hashicorp/terraform-plugin-go v0.23.0/go.mod h1:1E3Cr9h2vMlahWMbsSEcNrOCxovCZhOOIXjFHbjc/lQ= +github.com/hashicorp/terraform-plugin-mux v0.16.0 h1:RCzXHGDYwUwwqfYYWJKBFaS3fQsWn/ZECEiW7p2023I= +github.com/hashicorp/terraform-plugin-mux v0.16.0/go.mod h1:PF79mAsPc8CpusXPfEVa4X8PtkB+ngWoiUClMrNZlYo= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= github.com/hashicorp/terraform-plugin-testing v1.7.0 h1:I6aeCyZ30z4NiI3tzyDoO6fS7YxP5xSL1ceOon3gTe8= @@ -687,8 +687,8 @@ google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= +google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From e5e2d3caea63cd1b5927dcacae50a158abe8e4ac Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Fri, 10 May 2024 11:09:44 -0400 Subject: [PATCH 0895/1490] chore: make cleantidy --- tools/tfsdk2fw/go.mod | 32 +++++++++++----------- tools/tfsdk2fw/go.sum | 64 +++++++++++++++++++++---------------------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/tools/tfsdk2fw/go.mod b/tools/tfsdk2fw/go.mod index 304942e184d..690efd1fdd6 100644 --- a/tools/tfsdk2fw/go.mod +++ b/tools/tfsdk2fw/go.mod @@ -18,7 +18,7 @@ require ( github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect - github.com/aws/aws-sdk-go v1.52.5 // indirect + github.com/aws/aws-sdk-go v1.52.6 // indirect github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect github.com/aws/aws-sdk-go-v2/config v1.27.12 // indirect @@ -29,7 +29,7 @@ require ( github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5 // indirect - github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.2 // indirect + github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.3 // indirect github.com/aws/aws-sdk-go-v2/service/account v1.16.5 // indirect github.com/aws/aws-sdk-go-v2/service/acm v1.25.5 // indirect github.com/aws/aws-sdk-go-v2/service/acmpca v1.29.5 // indirect @@ -101,7 +101,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.23.5 // indirect github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.6 // indirect github.com/aws/aws-sdk-go-v2/service/emr v1.39.6 // indirect - github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.1 // indirect + github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.2 // indirect github.com/aws/aws-sdk-go-v2/service/eventbridge v1.30.5 // indirect github.com/aws/aws-sdk-go-v2/service/evidently v1.19.5 // indirect github.com/aws/aws-sdk-go-v2/service/finspace v1.24.2 // indirect @@ -144,7 +144,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/mwaa v1.26.6 // indirect github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.8.2 // indirect github.com/aws/aws-sdk-go-v2/service/oam v1.11.1 // indirect - github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.5 // indirect + github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.6 // indirect github.com/aws/aws-sdk-go-v2/service/osis v1.8.5 // indirect github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.1 // indirect github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.5 // indirect @@ -181,7 +181,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/ssm v1.50.1 // indirect github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.5 // indirect github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.5 // indirect - github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ssmsap v1.13.0 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 // indirect github.com/aws/aws-sdk-go-v2/service/ssoadmin v1.25.6 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.5 // indirect @@ -191,7 +191,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.6 // indirect github.com/aws/aws-sdk-go-v2/service/transcribe v1.37.1 // indirect github.com/aws/aws-sdk-go-v2/service/transfer v1.47.3 // indirect - github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.2 // indirect + github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.14.0 // indirect github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.6 // indirect github.com/aws/aws-sdk-go-v2/service/wafv2 v1.48.4 // indirect github.com/aws/aws-sdk-go-v2/service/wellarchitected v1.30.1 // indirect @@ -212,8 +212,8 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 // indirect - github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52 // indirect - github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53 // indirect + github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53 // indirect + github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.54 // indirect github.com/hashicorp/awspolicyequivalence v1.6.0 // indirect github.com/hashicorp/cli v1.1.6 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -235,9 +235,9 @@ require ( github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 // indirect github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0 // indirect github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.22.2 // indirect + github.com/hashicorp/terraform-plugin-go v0.23.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect - github.com/hashicorp/terraform-plugin-mux v0.15.0 // indirect + github.com/hashicorp/terraform-plugin-mux v0.16.0 // indirect github.com/hashicorp/terraform-plugin-testing v1.7.0 // indirect github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect @@ -266,20 +266,20 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/zclconf/go-cty v1.14.3 // indirect - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0 // indirect - go.opentelemetry.io/otel v1.25.0 // indirect - go.opentelemetry.io/otel/metric v1.25.0 // indirect - go.opentelemetry.io/otel/trace v1.25.0 // indirect + go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0 // indirect + go.opentelemetry.io/otel v1.26.0 // indirect + go.opentelemetry.io/otel/metric v1.26.0 // indirect + go.opentelemetry.io/otel/trace v1.26.0 // indirect golang.org/x/crypto v0.23.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.24.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.15.0 // indirect golang.org/x/tools v0.18.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/grpc v1.63.2 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/protobuf v1.34.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/tools/tfsdk2fw/go.sum b/tools/tfsdk2fw/go.sum index 67a7893e5bf..456a3665a77 100644 --- a/tools/tfsdk2fw/go.sum +++ b/tools/tfsdk2fw/go.sum @@ -22,8 +22,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.52.5 h1:m2lty5v9sHm1J3lhA43hJql+yKZudF09qzab0Ag9chM= -github.com/aws/aws-sdk-go v1.52.5/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.52.6 h1:nw1AMg0wIj5tTnI89KaDe9G5aISqXm4KJEe1DfNbFvA= +github.com/aws/aws-sdk-go v1.52.6/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to= @@ -44,8 +44,8 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7 github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5 h1:81KE7vaZzrl7yHBYHVEzYB8sypz11NMOZ40YlWvPxsU= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5/go.mod h1:LIt2rg7Mcgn09Ygbdh/RdIm0rQ+3BNkbP1gyVMFtRK0= -github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.2 h1:jZywIZbLnCUJ+ZmMQgEuP4pg43/0z6KxWA3VfB7WVxQ= -github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.2/go.mod h1:CDDc+pehLZpaGJNHUE6RJcp7MjQUhduISa1bQ/ixwR8= +github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.3 h1:BBUeY/+n606X9dEj6GKp2xG35HY4edSNo358QHBZ/Pw= +github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.3/go.mod h1:CDDc+pehLZpaGJNHUE6RJcp7MjQUhduISa1bQ/ixwR8= github.com/aws/aws-sdk-go-v2/service/account v1.16.5 h1:jhvXh67e1M5jqqKNulv1wTfM8KpnCnVe7OWUF3fW9r4= github.com/aws/aws-sdk-go-v2/service/account v1.16.5/go.mod h1:d6aNAmILOvNF389Sj6qTZuwRGVU1L/CQH3OlB5Xa9/k= github.com/aws/aws-sdk-go-v2/service/acm v1.25.5 h1:VUFUI8yF8Jgv6DtjS3eBcIsWrZzOsQ9qNzqEh8EhYEY= @@ -188,8 +188,8 @@ github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.6 h1:P5kMcIzrz github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.6/go.mod h1:e1McVqsud0JOERidvppLEHnuCdh/X6MRyL5L0LseAUk= github.com/aws/aws-sdk-go-v2/service/emr v1.39.6 h1:6FFt6seuRKdiIedxSHYMg2tC/zLD8yl56X8gJxQfFl8= github.com/aws/aws-sdk-go-v2/service/emr v1.39.6/go.mod h1:7WusX+O5pwTnx2yobUO/P1C5HlBibmrQb5gKEPFjTYM= -github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.1 h1:+aHhVyLzitWmStZzndkz1NI/SD12eM2FkQ77OxQIrbA= -github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.1/go.mod h1:TZrahLcSXIN/kO96kvxUzfLNLH8E6t3xodv8Zv5DHGs= +github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.2 h1:FUqD0sv/ZriloldGjCAc2jLwT4kOKKWw8y8qy6Ib1Rs= +github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.2/go.mod h1:TZrahLcSXIN/kO96kvxUzfLNLH8E6t3xodv8Zv5DHGs= github.com/aws/aws-sdk-go-v2/service/eventbridge v1.30.5 h1:8cIsFC9HskfTIrkJUk24+1HBRUetZ0wOW3rcTqN//vg= github.com/aws/aws-sdk-go-v2/service/eventbridge v1.30.5/go.mod h1:aIINXlt2xXhMeRsyCsLDUDohI8AdDm92gY9nIB6pv0M= github.com/aws/aws-sdk-go-v2/service/evidently v1.19.5 h1:gDSjoeOFMMpR+dxjkRnQX8j44pFdm2FFOP1rhs9G7vA= @@ -274,8 +274,8 @@ github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.8.2 h1:C08TU/uiP+9lFaH/wxH9 github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.8.2/go.mod h1:z/vZeXWTVU//C8fnX0JqhIykpNf9EqdmEIfNrU8nPyk= github.com/aws/aws-sdk-go-v2/service/oam v1.11.1 h1:JTj9z5gGzXhg4XoVdfd+RMUeg+DqvPKQa1yMpAnKJhs= github.com/aws/aws-sdk-go-v2/service/oam v1.11.1/go.mod h1:GNW8lL/rOjgXphUtGDvd9yikXGOfo51z2LBgct6XPTs= -github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.5 h1:gYmHliliNlF5EpVIsEiOVaHDAz9DWJBHVA9p1iBZ0F0= -github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.5/go.mod h1:T7lBopPcIVR1EJOibce+6Z3cJmY8uWTEM8+i63a4rD0= +github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.6 h1:N4jSI2xXE/KAOfU+lLgB8aoBgKb5wfCKrFZO+wdkRDM= +github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.6/go.mod h1:T7lBopPcIVR1EJOibce+6Z3cJmY8uWTEM8+i63a4rD0= github.com/aws/aws-sdk-go-v2/service/osis v1.8.5 h1:YbNekLy3cv7Kfq4scc9L3OrcwuaZfwXjSYBEGUMlPEc= github.com/aws/aws-sdk-go-v2/service/osis v1.8.5/go.mod h1:MHw9zAnU6CaZXqe/J1UNcxcEZLF5oXs21Efdxw0K5tY= github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.1 h1:1c5ZA0hDANl2Y4uooj+f/EuSU2DegLDHA7FQKXhpIGY= @@ -348,8 +348,8 @@ github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.5 h1:To1CPB7szsjzmscM7KUF github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.5/go.mod h1:LjUmrzAa81OMGqfygRS3JTkxhNinG4rswXYy4uUWvow= github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.5 h1:8TPcvvTtvyK56nUD50MC1wfL3WD7Tq2jQ5hyEYor2P8= github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.5/go.mod h1:xgj+QUtfv/DrfdZq1cGt0wlEX6om1oh/NHB+PClQbWs= -github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.5 h1:FPO6Zy+6UKz+1ejS+KvZRpCnTbb1V21KGzTDr/YUsog= -github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.5/go.mod h1:HYXzJ1bqOZnHNvjaArIrCPnSz5HnVQhKSb/317ZCTyc= +github.com/aws/aws-sdk-go-v2/service/ssmsap v1.13.0 h1:ZDjnSS+C6TFRM+VCn3LT7m6YuLvPi2Sk/MBSIOhgN0w= +github.com/aws/aws-sdk-go-v2/service/ssmsap v1.13.0/go.mod h1:HYXzJ1bqOZnHNvjaArIrCPnSz5HnVQhKSb/317ZCTyc= github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 h1:o5cTaeunSpfXiLTIBx5xo2enQmiChtu1IBbzXnfU9Hs= github.com/aws/aws-sdk-go-v2/service/sso v1.20.6/go.mod h1:qGzynb/msuZIE8I75DVRCUXw3o3ZyBmUvMwQ2t/BrGM= github.com/aws/aws-sdk-go-v2/service/ssoadmin v1.25.6 h1:Dzs+0j54D0WdqPDr6+zIp1UU+YcG88+d9CpIAInSoPo= @@ -368,8 +368,8 @@ github.com/aws/aws-sdk-go-v2/service/transcribe v1.37.1 h1:rGTny4YnKnvLcpJVrF3J+ github.com/aws/aws-sdk-go-v2/service/transcribe v1.37.1/go.mod h1:k8u3Uj5KgSM4eUoGXyvLNNf1Y/mLMM7jJM4o9kIazEc= github.com/aws/aws-sdk-go-v2/service/transfer v1.47.3 h1:EhqwUy9cWyivUol3OItsFxUT/m0jm5isdxUWGOWzOYQ= github.com/aws/aws-sdk-go-v2/service/transfer v1.47.3/go.mod h1:z3NpUj6ziVpg9XHEMdA0xpD/lgjPuZb9R/PBV6Mieb0= -github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.2 h1:H4Z5fqtcfa9grRYIIcJmfcAq0el2dpN9KmHCnOdFMk4= -github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.2/go.mod h1:DKtR1LdOqG21jCPD/b7zMxAFxpelWoGb65rNVTpBaXs= +github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.14.0 h1:xLuRLtl2r5Xb8854TV7cnhTtqZuThvFhoOz7K1rdBXg= +github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.14.0/go.mod h1:DKtR1LdOqG21jCPD/b7zMxAFxpelWoGb65rNVTpBaXs= github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.6 h1:ZJzyuwG/oxo8Usglni0OzP9hCCiFqg5EDAwAWFZIy4Y= github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.6/go.mod h1:lwuOe4SF+wdRnUrcPt1tukhJCj4gklxBV6xlD03Uo/8= github.com/aws/aws-sdk-go-v2/service/wafv2 v1.48.4 h1:2UwmqMxMqrh/PeC9rlz622TcUMa4mhIJ9YjoZHSPEvQ= @@ -443,10 +443,10 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 h1:N2V/ooY+BPQwwN3qPRIztByR8mWN6IqgULqVzGoUlog= github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0/go.mod h1:HAmscHyzSOfB1Dr16KLc177KNbn83wscnZC+N7WyaM8= -github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52 h1:bKvTdvF3jNgDt4rHDk55BxYnyofFVJhXHMj+RBRUmc0= -github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52/go.mod h1:YlwqmXqrK6MNTtW1cCjPFkoc3plCT939B+Yjmq+/DBc= -github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53 h1:hrcewXLBw48wZc6fe7blETM94eTwzTouQ4zWqQvjVwU= -github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53/go.mod h1:458CK33gIkH+FvTU2aZcJy2IANdsE3USy1NAUhK/uFg= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53 h1:jgOMbQlypMpUMaqYJotjT7ERSMvQP00Mppgjgh8lNt8= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53/go.mod h1:nvpXIeF0ANfZ7sMssXKSSR3pyXfksajxoC2tl4jjN08= +github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.54 h1:raRbM2Wynqv0Nyhe7AwVnFgb2roGSvpSUeQKxEg8Lts= +github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.54/go.mod h1:Q5SSO00VVkkbiPtT6ssI9twHV7yfh4gPLOtoLQJMbzw= github.com/hashicorp/awspolicyequivalence v1.6.0 h1:7aadmkalbc5ewStC6g3rljx1iNvP4QyAhg2KsHx8bU8= github.com/hashicorp/awspolicyequivalence v1.6.0/go.mod h1:9IOaIHx+a7C0NfUNk1A93M7kHd5rJ19aoUx37LZGC14= github.com/hashicorp/cli v1.1.6 h1:CMOV+/LJfL1tXCOKrgAX0uRKnzjj/mpmqNXloRSy2K8= @@ -493,10 +493,10 @@ github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0 h1:egR4InfakWkg github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0/go.mod h1:9vjvl36aY1p6KltaA5QCvGC5hdE/9t4YuhGftw6WOgE= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= -github.com/hashicorp/terraform-plugin-go v0.22.2 h1:5o8uveu6eZUf5J7xGPV0eY0TPXg3qpmwX9sce03Bxnc= -github.com/hashicorp/terraform-plugin-go v0.22.2/go.mod h1:drq8Snexp9HsbFZddvyLHN6LuWHHndSQg+gV+FPkcIM= -github.com/hashicorp/terraform-plugin-mux v0.15.0 h1:+/+lDx0WUsIOpkAmdwBIoFU8UP9o2eZASoOnLsWbKME= -github.com/hashicorp/terraform-plugin-mux v0.15.0/go.mod h1:9ezplb1Dyq394zQ+ldB0nvy/qbNAz3mMoHHseMTMaKo= +github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co= +github.com/hashicorp/terraform-plugin-go v0.23.0/go.mod h1:1E3Cr9h2vMlahWMbsSEcNrOCxovCZhOOIXjFHbjc/lQ= +github.com/hashicorp/terraform-plugin-mux v0.16.0 h1:RCzXHGDYwUwwqfYYWJKBFaS3fQsWn/ZECEiW7p2023I= +github.com/hashicorp/terraform-plugin-mux v0.16.0/go.mod h1:PF79mAsPc8CpusXPfEVa4X8PtkB+ngWoiUClMrNZlYo= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= github.com/hashicorp/terraform-plugin-testing v1.7.0 h1:I6aeCyZ30z4NiI3tzyDoO6fS7YxP5xSL1ceOon3gTe8= @@ -608,14 +608,14 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0 h1:0zXBsTKPsly2MlyLYyra1GuL23fsY5RMsi6E2ZOe988= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0/go.mod h1:Tztzncf+ezyOCjXz8zRjVL2agqyBxhymGnK6rqgoY5c= -go.opentelemetry.io/otel v1.25.0 h1:gldB5FfhRl7OJQbUHt/8s0a7cE8fbsPAtdpRaApKy4k= -go.opentelemetry.io/otel v1.25.0/go.mod h1:Wa2ds5NOXEMkCmUou1WA7ZBfLTHWIsp034OVD7AO+Vg= -go.opentelemetry.io/otel/metric v1.25.0 h1:LUKbS7ArpFL/I2jJHdJcqMGxkRdxpPHE0VU/D4NuEwA= -go.opentelemetry.io/otel/metric v1.25.0/go.mod h1:rkDLUSd2lC5lq2dFNrX9LGAbINP5B7WBkC78RXCpH5s= -go.opentelemetry.io/otel/trace v1.25.0 h1:tqukZGLwQYRIFtSQM2u2+yfMVTgGVeqRLPUYx1Dq6RM= -go.opentelemetry.io/otel/trace v1.25.0/go.mod h1:hCCs70XM/ljO+BeQkyFnbK28SBIJ/Emuha+ccrCRT7I= +go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0 h1:FGMfzzxfkNkw+gvKJOeT8dSmBjgrSFh+ClLl+OMKPno= +go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0/go.mod h1:hmHUXiKhyxbIhuNfG5ZTySq9HqqxJFNxaFOfXXvoMmQ= +go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= +go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= +go.opentelemetry.io/otel/metric v1.26.0 h1:7S39CLuY5Jgg9CrnA9HHiEjGMF/X2VHvoXGgSllRz30= +go.opentelemetry.io/otel/metric v1.26.0/go.mod h1:SY+rHOI4cEawI9a7N1A4nIg/nTQXe1ccCNWYOJUrpX4= +go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= +go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= @@ -631,8 +631,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -682,8 +682,8 @@ google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= +google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= From aef28e66adb7d68e7d56b0529e73da988607cd7b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 11:41:10 -0400 Subject: [PATCH 0896/1490] go mod tidy --- tools/tfsdk2fw/go.mod | 32 +++++++++++----------- tools/tfsdk2fw/go.sum | 64 +++++++++++++++++++++---------------------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/tools/tfsdk2fw/go.mod b/tools/tfsdk2fw/go.mod index 304942e184d..690efd1fdd6 100644 --- a/tools/tfsdk2fw/go.mod +++ b/tools/tfsdk2fw/go.mod @@ -18,7 +18,7 @@ require ( github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect - github.com/aws/aws-sdk-go v1.52.5 // indirect + github.com/aws/aws-sdk-go v1.52.6 // indirect github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect github.com/aws/aws-sdk-go-v2/config v1.27.12 // indirect @@ -29,7 +29,7 @@ require ( github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5 // indirect - github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.2 // indirect + github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.3 // indirect github.com/aws/aws-sdk-go-v2/service/account v1.16.5 // indirect github.com/aws/aws-sdk-go-v2/service/acm v1.25.5 // indirect github.com/aws/aws-sdk-go-v2/service/acmpca v1.29.5 // indirect @@ -101,7 +101,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.23.5 // indirect github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.6 // indirect github.com/aws/aws-sdk-go-v2/service/emr v1.39.6 // indirect - github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.1 // indirect + github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.2 // indirect github.com/aws/aws-sdk-go-v2/service/eventbridge v1.30.5 // indirect github.com/aws/aws-sdk-go-v2/service/evidently v1.19.5 // indirect github.com/aws/aws-sdk-go-v2/service/finspace v1.24.2 // indirect @@ -144,7 +144,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/mwaa v1.26.6 // indirect github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.8.2 // indirect github.com/aws/aws-sdk-go-v2/service/oam v1.11.1 // indirect - github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.5 // indirect + github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.6 // indirect github.com/aws/aws-sdk-go-v2/service/osis v1.8.5 // indirect github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.1 // indirect github.com/aws/aws-sdk-go-v2/service/pcaconnectorad v1.5.5 // indirect @@ -181,7 +181,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/ssm v1.50.1 // indirect github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.5 // indirect github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.5 // indirect - github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ssmsap v1.13.0 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 // indirect github.com/aws/aws-sdk-go-v2/service/ssoadmin v1.25.6 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.5 // indirect @@ -191,7 +191,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.25.6 // indirect github.com/aws/aws-sdk-go-v2/service/transcribe v1.37.1 // indirect github.com/aws/aws-sdk-go-v2/service/transfer v1.47.3 // indirect - github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.2 // indirect + github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.14.0 // indirect github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.6 // indirect github.com/aws/aws-sdk-go-v2/service/wafv2 v1.48.4 // indirect github.com/aws/aws-sdk-go-v2/service/wellarchitected v1.30.1 // indirect @@ -212,8 +212,8 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 // indirect - github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52 // indirect - github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53 // indirect + github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53 // indirect + github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.54 // indirect github.com/hashicorp/awspolicyequivalence v1.6.0 // indirect github.com/hashicorp/cli v1.1.6 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -235,9 +235,9 @@ require ( github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 // indirect github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0 // indirect github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.22.2 // indirect + github.com/hashicorp/terraform-plugin-go v0.23.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect - github.com/hashicorp/terraform-plugin-mux v0.15.0 // indirect + github.com/hashicorp/terraform-plugin-mux v0.16.0 // indirect github.com/hashicorp/terraform-plugin-testing v1.7.0 // indirect github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect @@ -266,20 +266,20 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/zclconf/go-cty v1.14.3 // indirect - go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0 // indirect - go.opentelemetry.io/otel v1.25.0 // indirect - go.opentelemetry.io/otel/metric v1.25.0 // indirect - go.opentelemetry.io/otel/trace v1.25.0 // indirect + go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0 // indirect + go.opentelemetry.io/otel v1.26.0 // indirect + go.opentelemetry.io/otel/metric v1.26.0 // indirect + go.opentelemetry.io/otel/trace v1.26.0 // indirect golang.org/x/crypto v0.23.0 // indirect golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.24.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.15.0 // indirect golang.org/x/tools v0.18.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/grpc v1.63.2 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/protobuf v1.34.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/tools/tfsdk2fw/go.sum b/tools/tfsdk2fw/go.sum index 67a7893e5bf..456a3665a77 100644 --- a/tools/tfsdk2fw/go.sum +++ b/tools/tfsdk2fw/go.sum @@ -22,8 +22,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.52.5 h1:m2lty5v9sHm1J3lhA43hJql+yKZudF09qzab0Ag9chM= -github.com/aws/aws-sdk-go v1.52.5/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.52.6 h1:nw1AMg0wIj5tTnI89KaDe9G5aISqXm4KJEe1DfNbFvA= +github.com/aws/aws-sdk-go v1.52.6/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to= @@ -44,8 +44,8 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7 github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5 h1:81KE7vaZzrl7yHBYHVEzYB8sypz11NMOZ40YlWvPxsU= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.5/go.mod h1:LIt2rg7Mcgn09Ygbdh/RdIm0rQ+3BNkbP1gyVMFtRK0= -github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.2 h1:jZywIZbLnCUJ+ZmMQgEuP4pg43/0z6KxWA3VfB7WVxQ= -github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.2/go.mod h1:CDDc+pehLZpaGJNHUE6RJcp7MjQUhduISa1bQ/ixwR8= +github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.3 h1:BBUeY/+n606X9dEj6GKp2xG35HY4edSNo358QHBZ/Pw= +github.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.29.3/go.mod h1:CDDc+pehLZpaGJNHUE6RJcp7MjQUhduISa1bQ/ixwR8= github.com/aws/aws-sdk-go-v2/service/account v1.16.5 h1:jhvXh67e1M5jqqKNulv1wTfM8KpnCnVe7OWUF3fW9r4= github.com/aws/aws-sdk-go-v2/service/account v1.16.5/go.mod h1:d6aNAmILOvNF389Sj6qTZuwRGVU1L/CQH3OlB5Xa9/k= github.com/aws/aws-sdk-go-v2/service/acm v1.25.5 h1:VUFUI8yF8Jgv6DtjS3eBcIsWrZzOsQ9qNzqEh8EhYEY= @@ -188,8 +188,8 @@ github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.6 h1:P5kMcIzrz github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.30.6/go.mod h1:e1McVqsud0JOERidvppLEHnuCdh/X6MRyL5L0LseAUk= github.com/aws/aws-sdk-go-v2/service/emr v1.39.6 h1:6FFt6seuRKdiIedxSHYMg2tC/zLD8yl56X8gJxQfFl8= github.com/aws/aws-sdk-go-v2/service/emr v1.39.6/go.mod h1:7WusX+O5pwTnx2yobUO/P1C5HlBibmrQb5gKEPFjTYM= -github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.1 h1:+aHhVyLzitWmStZzndkz1NI/SD12eM2FkQ77OxQIrbA= -github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.1/go.mod h1:TZrahLcSXIN/kO96kvxUzfLNLH8E6t3xodv8Zv5DHGs= +github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.2 h1:FUqD0sv/ZriloldGjCAc2jLwT4kOKKWw8y8qy6Ib1Rs= +github.com/aws/aws-sdk-go-v2/service/emrserverless v1.19.2/go.mod h1:TZrahLcSXIN/kO96kvxUzfLNLH8E6t3xodv8Zv5DHGs= github.com/aws/aws-sdk-go-v2/service/eventbridge v1.30.5 h1:8cIsFC9HskfTIrkJUk24+1HBRUetZ0wOW3rcTqN//vg= github.com/aws/aws-sdk-go-v2/service/eventbridge v1.30.5/go.mod h1:aIINXlt2xXhMeRsyCsLDUDohI8AdDm92gY9nIB6pv0M= github.com/aws/aws-sdk-go-v2/service/evidently v1.19.5 h1:gDSjoeOFMMpR+dxjkRnQX8j44pFdm2FFOP1rhs9G7vA= @@ -274,8 +274,8 @@ github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.8.2 h1:C08TU/uiP+9lFaH/wxH9 github.com/aws/aws-sdk-go-v2/service/neptunegraph v1.8.2/go.mod h1:z/vZeXWTVU//C8fnX0JqhIykpNf9EqdmEIfNrU8nPyk= github.com/aws/aws-sdk-go-v2/service/oam v1.11.1 h1:JTj9z5gGzXhg4XoVdfd+RMUeg+DqvPKQa1yMpAnKJhs= github.com/aws/aws-sdk-go-v2/service/oam v1.11.1/go.mod h1:GNW8lL/rOjgXphUtGDvd9yikXGOfo51z2LBgct6XPTs= -github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.5 h1:gYmHliliNlF5EpVIsEiOVaHDAz9DWJBHVA9p1iBZ0F0= -github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.5/go.mod h1:T7lBopPcIVR1EJOibce+6Z3cJmY8uWTEM8+i63a4rD0= +github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.6 h1:N4jSI2xXE/KAOfU+lLgB8aoBgKb5wfCKrFZO+wdkRDM= +github.com/aws/aws-sdk-go-v2/service/opensearchserverless v1.11.6/go.mod h1:T7lBopPcIVR1EJOibce+6Z3cJmY8uWTEM8+i63a4rD0= github.com/aws/aws-sdk-go-v2/service/osis v1.8.5 h1:YbNekLy3cv7Kfq4scc9L3OrcwuaZfwXjSYBEGUMlPEc= github.com/aws/aws-sdk-go-v2/service/osis v1.8.5/go.mod h1:MHw9zAnU6CaZXqe/J1UNcxcEZLF5oXs21Efdxw0K5tY= github.com/aws/aws-sdk-go-v2/service/paymentcryptography v1.10.1 h1:1c5ZA0hDANl2Y4uooj+f/EuSU2DegLDHA7FQKXhpIGY= @@ -348,8 +348,8 @@ github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.5 h1:To1CPB7szsjzmscM7KUF github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.22.5/go.mod h1:LjUmrzAa81OMGqfygRS3JTkxhNinG4rswXYy4uUWvow= github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.5 h1:8TPcvvTtvyK56nUD50MC1wfL3WD7Tq2jQ5hyEYor2P8= github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.30.5/go.mod h1:xgj+QUtfv/DrfdZq1cGt0wlEX6om1oh/NHB+PClQbWs= -github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.5 h1:FPO6Zy+6UKz+1ejS+KvZRpCnTbb1V21KGzTDr/YUsog= -github.com/aws/aws-sdk-go-v2/service/ssmsap v1.12.5/go.mod h1:HYXzJ1bqOZnHNvjaArIrCPnSz5HnVQhKSb/317ZCTyc= +github.com/aws/aws-sdk-go-v2/service/ssmsap v1.13.0 h1:ZDjnSS+C6TFRM+VCn3LT7m6YuLvPi2Sk/MBSIOhgN0w= +github.com/aws/aws-sdk-go-v2/service/ssmsap v1.13.0/go.mod h1:HYXzJ1bqOZnHNvjaArIrCPnSz5HnVQhKSb/317ZCTyc= github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 h1:o5cTaeunSpfXiLTIBx5xo2enQmiChtu1IBbzXnfU9Hs= github.com/aws/aws-sdk-go-v2/service/sso v1.20.6/go.mod h1:qGzynb/msuZIE8I75DVRCUXw3o3ZyBmUvMwQ2t/BrGM= github.com/aws/aws-sdk-go-v2/service/ssoadmin v1.25.6 h1:Dzs+0j54D0WdqPDr6+zIp1UU+YcG88+d9CpIAInSoPo= @@ -368,8 +368,8 @@ github.com/aws/aws-sdk-go-v2/service/transcribe v1.37.1 h1:rGTny4YnKnvLcpJVrF3J+ github.com/aws/aws-sdk-go-v2/service/transcribe v1.37.1/go.mod h1:k8u3Uj5KgSM4eUoGXyvLNNf1Y/mLMM7jJM4o9kIazEc= github.com/aws/aws-sdk-go-v2/service/transfer v1.47.3 h1:EhqwUy9cWyivUol3OItsFxUT/m0jm5isdxUWGOWzOYQ= github.com/aws/aws-sdk-go-v2/service/transfer v1.47.3/go.mod h1:z3NpUj6ziVpg9XHEMdA0xpD/lgjPuZb9R/PBV6Mieb0= -github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.2 h1:H4Z5fqtcfa9grRYIIcJmfcAq0el2dpN9KmHCnOdFMk4= -github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.13.2/go.mod h1:DKtR1LdOqG21jCPD/b7zMxAFxpelWoGb65rNVTpBaXs= +github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.14.0 h1:xLuRLtl2r5Xb8854TV7cnhTtqZuThvFhoOz7K1rdBXg= +github.com/aws/aws-sdk-go-v2/service/verifiedpermissions v1.14.0/go.mod h1:DKtR1LdOqG21jCPD/b7zMxAFxpelWoGb65rNVTpBaXs= github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.6 h1:ZJzyuwG/oxo8Usglni0OzP9hCCiFqg5EDAwAWFZIy4Y= github.com/aws/aws-sdk-go-v2/service/vpclattice v1.7.6/go.mod h1:lwuOe4SF+wdRnUrcPt1tukhJCj4gklxBV6xlD03Uo/8= github.com/aws/aws-sdk-go-v2/service/wafv2 v1.48.4 h1:2UwmqMxMqrh/PeC9rlz622TcUMa4mhIJ9YjoZHSPEvQ= @@ -443,10 +443,10 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0 h1:N2V/ooY+BPQwwN3qPRIztByR8mWN6IqgULqVzGoUlog= github.com/hashicorp/aws-cloudformation-resource-schema-sdk-go v0.22.0/go.mod h1:HAmscHyzSOfB1Dr16KLc177KNbn83wscnZC+N7WyaM8= -github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52 h1:bKvTdvF3jNgDt4rHDk55BxYnyofFVJhXHMj+RBRUmc0= -github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.52/go.mod h1:YlwqmXqrK6MNTtW1cCjPFkoc3plCT939B+Yjmq+/DBc= -github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53 h1:hrcewXLBw48wZc6fe7blETM94eTwzTouQ4zWqQvjVwU= -github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.53/go.mod h1:458CK33gIkH+FvTU2aZcJy2IANdsE3USy1NAUhK/uFg= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53 h1:jgOMbQlypMpUMaqYJotjT7ERSMvQP00Mppgjgh8lNt8= +github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.53/go.mod h1:nvpXIeF0ANfZ7sMssXKSSR3pyXfksajxoC2tl4jjN08= +github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.54 h1:raRbM2Wynqv0Nyhe7AwVnFgb2roGSvpSUeQKxEg8Lts= +github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.54/go.mod h1:Q5SSO00VVkkbiPtT6ssI9twHV7yfh4gPLOtoLQJMbzw= github.com/hashicorp/awspolicyequivalence v1.6.0 h1:7aadmkalbc5ewStC6g3rljx1iNvP4QyAhg2KsHx8bU8= github.com/hashicorp/awspolicyequivalence v1.6.0/go.mod h1:9IOaIHx+a7C0NfUNk1A93M7kHd5rJ19aoUx37LZGC14= github.com/hashicorp/cli v1.1.6 h1:CMOV+/LJfL1tXCOKrgAX0uRKnzjj/mpmqNXloRSy2K8= @@ -493,10 +493,10 @@ github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0 h1:egR4InfakWkg github.com/hashicorp/terraform-plugin-framework-timetypes v0.3.0/go.mod h1:9vjvl36aY1p6KltaA5QCvGC5hdE/9t4YuhGftw6WOgE= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= -github.com/hashicorp/terraform-plugin-go v0.22.2 h1:5o8uveu6eZUf5J7xGPV0eY0TPXg3qpmwX9sce03Bxnc= -github.com/hashicorp/terraform-plugin-go v0.22.2/go.mod h1:drq8Snexp9HsbFZddvyLHN6LuWHHndSQg+gV+FPkcIM= -github.com/hashicorp/terraform-plugin-mux v0.15.0 h1:+/+lDx0WUsIOpkAmdwBIoFU8UP9o2eZASoOnLsWbKME= -github.com/hashicorp/terraform-plugin-mux v0.15.0/go.mod h1:9ezplb1Dyq394zQ+ldB0nvy/qbNAz3mMoHHseMTMaKo= +github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co= +github.com/hashicorp/terraform-plugin-go v0.23.0/go.mod h1:1E3Cr9h2vMlahWMbsSEcNrOCxovCZhOOIXjFHbjc/lQ= +github.com/hashicorp/terraform-plugin-mux v0.16.0 h1:RCzXHGDYwUwwqfYYWJKBFaS3fQsWn/ZECEiW7p2023I= +github.com/hashicorp/terraform-plugin-mux v0.16.0/go.mod h1:PF79mAsPc8CpusXPfEVa4X8PtkB+ngWoiUClMrNZlYo= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= github.com/hashicorp/terraform-plugin-testing v1.7.0 h1:I6aeCyZ30z4NiI3tzyDoO6fS7YxP5xSL1ceOon3gTe8= @@ -608,14 +608,14 @@ github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0 h1:0zXBsTKPsly2MlyLYyra1GuL23fsY5RMsi6E2ZOe988= -go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.50.0/go.mod h1:Tztzncf+ezyOCjXz8zRjVL2agqyBxhymGnK6rqgoY5c= -go.opentelemetry.io/otel v1.25.0 h1:gldB5FfhRl7OJQbUHt/8s0a7cE8fbsPAtdpRaApKy4k= -go.opentelemetry.io/otel v1.25.0/go.mod h1:Wa2ds5NOXEMkCmUou1WA7ZBfLTHWIsp034OVD7AO+Vg= -go.opentelemetry.io/otel/metric v1.25.0 h1:LUKbS7ArpFL/I2jJHdJcqMGxkRdxpPHE0VU/D4NuEwA= -go.opentelemetry.io/otel/metric v1.25.0/go.mod h1:rkDLUSd2lC5lq2dFNrX9LGAbINP5B7WBkC78RXCpH5s= -go.opentelemetry.io/otel/trace v1.25.0 h1:tqukZGLwQYRIFtSQM2u2+yfMVTgGVeqRLPUYx1Dq6RM= -go.opentelemetry.io/otel/trace v1.25.0/go.mod h1:hCCs70XM/ljO+BeQkyFnbK28SBIJ/Emuha+ccrCRT7I= +go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0 h1:FGMfzzxfkNkw+gvKJOeT8dSmBjgrSFh+ClLl+OMKPno= +go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.51.0/go.mod h1:hmHUXiKhyxbIhuNfG5ZTySq9HqqxJFNxaFOfXXvoMmQ= +go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= +go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= +go.opentelemetry.io/otel/metric v1.26.0 h1:7S39CLuY5Jgg9CrnA9HHiEjGMF/X2VHvoXGgSllRz30= +go.opentelemetry.io/otel/metric v1.26.0/go.mod h1:SY+rHOI4cEawI9a7N1A4nIg/nTQXe1ccCNWYOJUrpX4= +go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= +go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= @@ -631,8 +631,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -682,8 +682,8 @@ google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= +google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= From 9842e174b63d483c76bbbf8d15e7fda974862eab Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:34 -0400 Subject: [PATCH 0897/1490] ci: Prefer constant for string literal "action" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 95534f87f3c..61f9c3ff33c 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1325,3 +1325,13 @@ rules: - pattern: '"file_system_id"' severity: ERROR fix: "names.AttrFileSystemID" + - id: literal-action-string-constant + languages: [go] + message: Use the constant `names.AttrAction` for the string literal "action" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"action"' + severity: ERROR + fix: "names.AttrAction" From ac214e5355120e02563c25f9353d9f64eb176006 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:35 -0400 Subject: [PATCH 0898/1490] names: Add constant for string literal "action" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 803b68c1bbc..03c9b71f500 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -7,6 +7,7 @@ const ( AttrARN = "arn" AttrAccessKey = "access_key" AttrAccountID = "account_id" + AttrAction = "action" AttrAutoMinorVersionUpgrade = "auto_minor_version_upgrade" AttrAvailabilityZone = "availability_zone" AttrAvailabilityZones = "availability_zones" From f32b857d4d900a28ab2892a11fad66cb641ecd7a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:35 -0400 Subject: [PATCH 0899/1490] apigatewayv2: Use constant for action strings --- internal/service/apigatewayv2/route_response_test.go | 2 +- internal/service/apigatewayv2/route_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/apigatewayv2/route_response_test.go b/internal/service/apigatewayv2/route_response_test.go index 4949e5211be..23b76be1659 100644 --- a/internal/service/apigatewayv2/route_response_test.go +++ b/internal/service/apigatewayv2/route_response_test.go @@ -99,7 +99,7 @@ func TestAccAPIGatewayV2RouteResponse_model(t *testing.T) { Config: testAccRouteResponseConfig_model(rName), Check: resource.ComposeTestCheckFunc( testAccCheckRouteResponseExists(ctx, resourceName, &apiId, &routeId, &v), - resource.TestCheckResourceAttr(resourceName, "model_selection_expression", "action"), + resource.TestCheckResourceAttr(resourceName, "model_selection_expression", names.AttrAction), resource.TestCheckResourceAttr(resourceName, "response_models.%", "1"), resource.TestCheckResourceAttrPair(resourceName, "response_models.test", modelResourceName, names.AttrName), resource.TestCheckResourceAttrPair(resourceName, "route_id", routeResourceName, names.AttrID), diff --git a/internal/service/apigatewayv2/route_test.go b/internal/service/apigatewayv2/route_test.go index 3bb79930da5..c9b1dd74023 100644 --- a/internal/service/apigatewayv2/route_test.go +++ b/internal/service/apigatewayv2/route_test.go @@ -222,7 +222,7 @@ func TestAccAPIGatewayV2Route_model(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "api_key_required", "false"), resource.TestCheckResourceAttr(resourceName, "authorization_type", string(awstypes.AuthorizationTypeNone)), resource.TestCheckResourceAttr(resourceName, "authorizer_id", ""), - resource.TestCheckResourceAttr(resourceName, "model_selection_expression", "action"), + resource.TestCheckResourceAttr(resourceName, "model_selection_expression", names.AttrAction), resource.TestCheckResourceAttr(resourceName, "operation_name", ""), resource.TestCheckResourceAttr(resourceName, "request_models.%", "1"), resource.TestCheckResourceAttrPair(resourceName, "request_models.test", modelResourceName, names.AttrName), From 9a589606ac19cfdb675d7031bb90583ba6de78d2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:35 -0400 Subject: [PATCH 0900/1490] appconfig: Use constant for action strings --- internal/service/appconfig/extension.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/appconfig/extension.go b/internal/service/appconfig/extension.go index 9837822870a..8c3994d1e0d 100644 --- a/internal/service/appconfig/extension.go +++ b/internal/service/appconfig/extension.go @@ -55,7 +55,7 @@ func ResourceExtension() *schema.Resource { Required: true, ValidateDiagFunc: enum.Validate[awstypes.ActionPoint](), }, - "action": { + names.AttrAction: { Type: schema.TypeSet, Required: true, MinItems: 1, @@ -276,7 +276,7 @@ func expandExtensionActionPoints(actionsPointListRaw []interface{}) map[string][ actionsMap := make(map[string][]awstypes.Action) for _, actionPointRaw := range actionsPointListRaw { actionPointMap := actionPointRaw.(map[string]interface{}) - actionsMap[actionPointMap["point"].(string)] = expandExtensionActions(actionPointMap["action"]) + actionsMap[actionPointMap["point"].(string)] = expandExtensionActions(actionPointMap[names.AttrAction]) } return actionsMap @@ -328,8 +328,8 @@ func flattenExtensionActionPoints(actionPointsMap map[string][]awstypes.Action) var rawActionPoints []interface{} for actionPoint, actions := range actionPointsMap { rawActionPoint := map[string]interface{}{ - "point": actionPoint, - "action": flattenExtensionActions(actions), + "point": actionPoint, + names.AttrAction: flattenExtensionActions(actions), } rawActionPoints = append(rawActionPoints, rawActionPoint) } From 7aa4da1518d73c99f4b054380c84524db1bbf378 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:35 -0400 Subject: [PATCH 0901/1490] appmesh: Use constant for action strings --- internal/service/appmesh/flex.go | 12 ++++++------ internal/service/appmesh/gateway_route.go | 12 ++++++------ internal/service/appmesh/route.go | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/service/appmesh/flex.go b/internal/service/appmesh/flex.go index c59f0e4c634..72ddd16a989 100644 --- a/internal/service/appmesh/flex.go +++ b/internal/service/appmesh/flex.go @@ -174,7 +174,7 @@ func expandGRPCRoute(vGrpcRoute []interface{}) *appmesh.GrpcRoute { grpcRoute := &appmesh.GrpcRoute{} - if vGrpcRouteAction, ok := mGrpcRoute["action"].([]interface{}); ok && len(vGrpcRouteAction) > 0 && vGrpcRouteAction[0] != nil { + if vGrpcRouteAction, ok := mGrpcRoute[names.AttrAction].([]interface{}); ok && len(vGrpcRouteAction) > 0 && vGrpcRouteAction[0] != nil { mGrpcRouteAction := vGrpcRouteAction[0].(map[string]interface{}) if vWeightedTargets, ok := mGrpcRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { @@ -346,7 +346,7 @@ func expandHTTPRoute(vHttpRoute []interface{}) *appmesh.HttpRoute { httpRoute := &appmesh.HttpRoute{} - if vHttpRouteAction, ok := mHttpRoute["action"].([]interface{}); ok && len(vHttpRouteAction) > 0 && vHttpRouteAction[0] != nil { + if vHttpRouteAction, ok := mHttpRoute[names.AttrAction].([]interface{}); ok && len(vHttpRouteAction) > 0 && vHttpRouteAction[0] != nil { mHttpRouteAction := vHttpRouteAction[0].(map[string]interface{}) if vWeightedTargets, ok := mHttpRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { @@ -618,7 +618,7 @@ func expandTCPRoute(vTcpRoute []interface{}) *appmesh.TcpRoute { tcpRoute := &appmesh.TcpRoute{} - if vTcpRouteAction, ok := mTcpRoute["action"].([]interface{}); ok && len(vTcpRouteAction) > 0 && vTcpRouteAction[0] != nil { + if vTcpRouteAction, ok := mTcpRoute[names.AttrAction].([]interface{}); ok && len(vTcpRouteAction) > 0 && vTcpRouteAction[0] != nil { mTcpRouteAction := vTcpRouteAction[0].(map[string]interface{}) if vWeightedTargets, ok := mTcpRouteAction["weighted_target"].(*schema.Set); ok && vWeightedTargets.Len() > 0 { @@ -1329,7 +1329,7 @@ func flattenGRPCRoute(grpcRoute *appmesh.GrpcRoute) []interface{} { vWeightedTargets = append(vWeightedTargets, mWeightedTarget) } - mGrpcRoute["action"] = []interface{}{ + mGrpcRoute[names.AttrAction] = []interface{}{ map[string]interface{}{ "weighted_target": vWeightedTargets, }, @@ -1430,7 +1430,7 @@ func flattenHTTPRoute(httpRoute *appmesh.HttpRoute) []interface{} { vWeightedTargets = append(vWeightedTargets, mWeightedTarget) } - mHttpRoute["action"] = []interface{}{ + mHttpRoute[names.AttrAction] = []interface{}{ map[string]interface{}{ "weighted_target": vWeightedTargets, }, @@ -1604,7 +1604,7 @@ func flattenTCPRoute(tcpRoute *appmesh.TcpRoute) []interface{} { vWeightedTargets = append(vWeightedTargets, mWeightedTarget) } - mTcpRoute["action"] = []interface{}{ + mTcpRoute[names.AttrAction] = []interface{}{ map[string]interface{}{ "weighted_target": vWeightedTargets, }, diff --git a/internal/service/appmesh/gateway_route.go b/internal/service/appmesh/gateway_route.go index ba645d42a21..788569e7a9e 100644 --- a/internal/service/appmesh/gateway_route.go +++ b/internal/service/appmesh/gateway_route.go @@ -102,7 +102,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Required: true, MinItems: 1, @@ -426,7 +426,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Required: true, MinItems: 1, @@ -760,7 +760,7 @@ func expandGRPCGatewayRoute(vGrpcRoute []interface{}) *appmesh.GrpcGatewayRoute mGrpcRoute := vGrpcRoute[0].(map[string]interface{}) - if vRouteAction, ok := mGrpcRoute["action"].([]interface{}); ok && len(vRouteAction) > 0 && vRouteAction[0] != nil { + if vRouteAction, ok := mGrpcRoute[names.AttrAction].([]interface{}); ok && len(vRouteAction) > 0 && vRouteAction[0] != nil { routeAction := &appmesh.GrpcGatewayRouteAction{} mRouteAction := vRouteAction[0].(map[string]interface{}) @@ -971,7 +971,7 @@ func expandHTTPGatewayRoute(vHttpRoute []interface{}) *appmesh.HttpGatewayRoute mHttpRoute := vHttpRoute[0].(map[string]interface{}) - if vRouteAction, ok := mHttpRoute["action"].([]interface{}); ok && len(vRouteAction) > 0 && vRouteAction[0] != nil { + if vRouteAction, ok := mHttpRoute[names.AttrAction].([]interface{}); ok && len(vRouteAction) > 0 && vRouteAction[0] != nil { routeAction := &appmesh.HttpGatewayRouteAction{} mRouteAction := vRouteAction[0].(map[string]interface{}) @@ -1041,7 +1041,7 @@ func flattenGRPCGatewayRoute(grpcRoute *appmesh.GrpcGatewayRoute) []interface{} "target": flattenGatewayRouteTarget(routeAction.Target), } - mGrpcRoute["action"] = []interface{}{mRouteAction} + mGrpcRoute[names.AttrAction] = []interface{}{mRouteAction} } if routeMatch := grpcRoute.Match; routeMatch != nil { @@ -1202,7 +1202,7 @@ func flattenHTTPGatewayRoute(httpRoute *appmesh.HttpGatewayRoute) []interface{} "rewrite": flattenHTTPGatewayRouteRewrite(routeAction.Rewrite), } - mHttpRoute["action"] = []interface{}{mRouteAction} + mHttpRoute[names.AttrAction] = []interface{}{mRouteAction} } if routeMatch := httpRoute.Match; routeMatch != nil { diff --git a/internal/service/appmesh/route.go b/internal/service/appmesh/route.go index 891c1531656..0b5f59f675c 100644 --- a/internal/service/appmesh/route.go +++ b/internal/service/appmesh/route.go @@ -102,7 +102,7 @@ func resourceRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Required: true, MinItems: 1, @@ -396,7 +396,7 @@ func resourceRouteSpecSchema() *schema.Schema { ConflictsWith: []string{"spec.0.http2_route", "spec.0.http_route", "spec.0.tcp_route"}, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Required: true, MinItems: 1, @@ -653,7 +653,7 @@ func resourceRouteSpecSchema() *schema.Schema { ConflictsWith: []string{"spec.0.grpc_route", "spec.0.http2_route", "spec.0.http_route"}, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Required: true, MinItems: 1, From 2a93c8190cd3cc7196ae14872fbb54395c94e299 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:35 -0400 Subject: [PATCH 0902/1490] appstream: Use constant for action strings --- internal/service/appstream/stack.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/appstream/stack.go b/internal/service/appstream/stack.go index ecb116f3fb2..9bc5ddbf543 100644 --- a/internal/service/appstream/stack.go +++ b/internal/service/appstream/stack.go @@ -188,7 +188,7 @@ func ResourceStack() *schema.Resource { DiffSuppressFunc: suppressAppsStreamStackUserSettings, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appstream.Action_Values(), false), @@ -698,7 +698,7 @@ func expandUserSetting(tfMap map[string]interface{}) *appstream.UserSetting { } apiObject := &appstream.UserSetting{ - Action: aws.String(tfMap["action"].(string)), + Action: aws.String(tfMap[names.AttrAction].(string)), Permission: aws.String(tfMap["permission"].(string)), } @@ -737,7 +737,7 @@ func flattenUserSetting(apiObject *appstream.UserSetting) map[string]interface{} } tfMap := map[string]interface{}{} - tfMap["action"] = aws.StringValue(apiObject.Action) + tfMap[names.AttrAction] = aws.StringValue(apiObject.Action) tfMap["permission"] = aws.StringValue(apiObject.Permission) return tfMap From 557bbef7e47a15a46cd66c48744f295423857e50 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:35 -0400 Subject: [PATCH 0903/1490] batch: Use constant for action strings --- internal/service/batch/job_definition.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/batch/job_definition.go b/internal/service/batch/job_definition.go index 99706cb551b..8baa1e71d7f 100644 --- a/internal/service/batch/job_definition.go +++ b/internal/service/batch/job_definition.go @@ -367,7 +367,7 @@ func ResourceJobDefinition() *schema.Resource { MaxItems: 5, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, StateFunc: func(v interface{}) string { @@ -1019,7 +1019,7 @@ func expandEvaluateOnExit(tfMap map[string]interface{}) *batch.EvaluateOnExit { apiObject := &batch.EvaluateOnExit{} - if v, ok := tfMap["action"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrAction].(string); ok && v != "" { apiObject.Action = aws.String(strings.ToLower(v)) } @@ -1090,7 +1090,7 @@ func flattenEvaluateOnExit(apiObject *batch.EvaluateOnExit) map[string]interface tfMap := map[string]interface{}{} if v := apiObject.Action; v != nil { - tfMap["action"] = aws.StringValue(v) + tfMap[names.AttrAction] = aws.StringValue(v) } if v := apiObject.OnExitCode; v != nil { From 16db2e59b733a4afbfc30cb6ffa6e0de9b8eac77 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:36 -0400 Subject: [PATCH 0904/1490] codepipeline: Use constant for action strings --- internal/service/codepipeline/codepipeline.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/codepipeline/codepipeline.go b/internal/service/codepipeline/codepipeline.go index c2e21963d2e..b6ac95e5939 100644 --- a/internal/service/codepipeline/codepipeline.go +++ b/internal/service/codepipeline/codepipeline.go @@ -126,7 +126,7 @@ func resourcePipeline() *schema.Resource { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Required: true, Elem: &schema.Resource{ @@ -785,7 +785,7 @@ func expandStageDeclaration(tfMap map[string]interface{}) *types.StageDeclaratio apiObject := &types.StageDeclaration{} - if v, ok := tfMap["action"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrAction].([]interface{}); ok && len(v) > 0 { apiObject.Actions = expandActionDeclarations(v) } @@ -1273,7 +1273,7 @@ func flattenStageDeclaration(d *schema.ResourceData, i int, apiObject types.Stag tfMap := map[string]interface{}{} if v := apiObject.Actions; v != nil { - tfMap["action"] = flattenActionDeclarations(d, i, v) + tfMap[names.AttrAction] = flattenActionDeclarations(d, i, v) } if v := apiObject.Name; v != nil { From 459504ad28e687e061f3214a381f0a20a9a87823 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:36 -0400 Subject: [PATCH 0905/1490] deploy: Use constant for action strings --- internal/service/deploy/deployment_group.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/deploy/deployment_group.go b/internal/service/deploy/deployment_group.go index b3aec06f855..9ad362de269 100644 --- a/internal/service/deploy/deployment_group.go +++ b/internal/service/deploy/deployment_group.go @@ -154,7 +154,7 @@ func resourceDeploymentGroup() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Optional: true, ValidateDiagFunc: enum.Validate[types.GreenFleetProvisioningAction](), @@ -168,7 +168,7 @@ func resourceDeploymentGroup() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Optional: true, ValidateDiagFunc: enum.Validate[types.InstanceAction](), @@ -1064,7 +1064,7 @@ func expandBlueGreenDeploymentConfiguration(list []interface{}) *types.BlueGreen m := a[0].(map[string]interface{}) greenFleetProvisioningOption := &types.GreenFleetProvisioningOption{} - if v, ok := m["action"]; ok { + if v, ok := m[names.AttrAction]; ok { greenFleetProvisioningOption.Action = types.GreenFleetProvisioningAction(v.(string)) } blueGreenDeploymentConfig.GreenFleetProvisioningOption = greenFleetProvisioningOption @@ -1078,7 +1078,7 @@ func expandBlueGreenDeploymentConfiguration(list []interface{}) *types.BlueGreen m := a[0].(map[string]interface{}) blueInstanceTerminationOption := &types.BlueInstanceTerminationOption{} - if v, ok := m["action"]; ok { + if v, ok := m[names.AttrAction]; ok { blueInstanceTerminationOption.Action = types.InstanceAction(v.(string)) } if v, ok := m["termination_wait_time_in_minutes"]; ok { @@ -1326,7 +1326,7 @@ func flattenBlueGreenDeploymentConfiguration(config *types.BlueGreenDeploymentCo greenFleetProvisioningOption := make(map[string]interface{}) if v := string(config.GreenFleetProvisioningOption.Action); v != "" { - greenFleetProvisioningOption["action"] = v + greenFleetProvisioningOption[names.AttrAction] = v } m["green_fleet_provisioning_option"] = append(b, greenFleetProvisioningOption) @@ -1337,7 +1337,7 @@ func flattenBlueGreenDeploymentConfiguration(config *types.BlueGreenDeploymentCo blueInstanceTerminationOption := make(map[string]interface{}) if v := string(config.TerminateBlueInstancesOnDeploymentSuccess.Action); v != "" { - blueInstanceTerminationOption["action"] = v + blueInstanceTerminationOption[names.AttrAction] = v } if v := config.TerminateBlueInstancesOnDeploymentSuccess.TerminationWaitTimeInMinutes; v != 0 { blueInstanceTerminationOption["termination_wait_time_in_minutes"] = v From 314b6cd86ec31317a1d277a05c9ff77aad6e49b5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:36 -0400 Subject: [PATCH 0906/1490] dlm: Use constant for action strings --- internal/service/dlm/lifecycle_policy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/dlm/lifecycle_policy.go b/internal/service/dlm/lifecycle_policy.go index f3994f2a93b..4a3b9ef519b 100644 --- a/internal/service/dlm/lifecycle_policy.go +++ b/internal/service/dlm/lifecycle_policy.go @@ -60,7 +60,7 @@ func ResourceLifecyclePolicy() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -627,7 +627,7 @@ func expandPolicyDetails(cfg []interface{}) *dlm.PolicyDetails { if v, ok := m["schedule"].([]interface{}); ok && len(v) > 0 { policyDetails.Schedules = expandSchedules(v) } - if v, ok := m["action"].([]interface{}); ok && len(v) > 0 { + if v, ok := m[names.AttrAction].([]interface{}); ok && len(v) > 0 { policyDetails.Actions = expandActions(v) } if v, ok := m["event_source"].([]interface{}); ok && len(v) > 0 { @@ -647,7 +647,7 @@ func flattenPolicyDetails(policyDetails *dlm.PolicyDetails) []map[string]interfa result := make(map[string]interface{}) result["resource_types"] = flex.FlattenStringList(policyDetails.ResourceTypes) result["resource_locations"] = flex.FlattenStringList(policyDetails.ResourceLocations) - result["action"] = flattenActions(policyDetails.Actions) + result[names.AttrAction] = flattenActions(policyDetails.Actions) result["event_source"] = flattenEventSource(policyDetails.EventSource) result["schedule"] = flattenSchedules(policyDetails.Schedules) result["target_tags"] = flattenTags(policyDetails.TargetTags) From 41d5d9d61f383cfaceb3cacd94e5bbd472b96838 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:36 -0400 Subject: [PATCH 0907/1490] ec2: Use constant for action strings --- internal/service/ec2/vpc_default_network_acl_test.go | 4 ++-- internal/service/ec2/vpc_network_acl.go | 8 ++++---- internal/service/ec2/vpc_network_acl_test.go | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/ec2/vpc_default_network_acl_test.go b/internal/service/ec2/vpc_default_network_acl_test.go index 01dec5f7c25..a42b7906657 100644 --- a/internal/service/ec2/vpc_default_network_acl_test.go +++ b/internal/service/ec2/vpc_default_network_acl_test.go @@ -152,7 +152,7 @@ func TestAccVPCDefaultNetworkACL_Deny_ingress(t *testing.T) { "rule_no": "100", "from_port": "0", "to_port": "0", - "action": "allow", + names.AttrAction: "allow", "cidr_block": "0.0.0.0/0", }), resource.TestCheckResourceAttr(resourceName, "ingress.#", "0"), @@ -185,7 +185,7 @@ func TestAccVPCDefaultNetworkACL_withIPv6Ingress(t *testing.T) { "rule_no": "101", "from_port": "0", "to_port": "0", - "action": "allow", + names.AttrAction: "allow", "ipv6_cidr_block": "::/0", }), ), diff --git a/internal/service/ec2/vpc_network_acl.go b/internal/service/ec2/vpc_network_acl.go index 93f648629ee..3b5ca4a9c2b 100644 --- a/internal/service/ec2/vpc_network_acl.go +++ b/internal/service/ec2/vpc_network_acl.go @@ -105,7 +105,7 @@ func resourceNetworkACL() *schema.Resource { func networkACLRuleNestedBlock() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { @@ -386,7 +386,7 @@ func networkACLRuleHash(v interface{}) int { buf.WriteString(fmt.Sprintf("%d-", tfMap["from_port"].(int))) buf.WriteString(fmt.Sprintf("%d-", tfMap["to_port"].(int))) buf.WriteString(fmt.Sprintf("%d-", tfMap["rule_no"].(int))) - buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(tfMap["action"].(string)))) + buf.WriteString(fmt.Sprintf("%s-", strings.ToLower(tfMap[names.AttrAction].(string)))) // The AWS network ACL API only speaks protocol numbers, and that's // all we store. Never hash a protocol name. @@ -511,7 +511,7 @@ func expandNetworkACLEntry(tfMap map[string]interface{}, egress bool) *ec2.Netwo apiObject.RuleNumber = aws.Int64(int64(v)) } - if v, ok := tfMap["action"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrAction].(string); ok && v != "" { apiObject.RuleAction = aws.String(v) } @@ -596,7 +596,7 @@ func flattenNetworkACLEntry(apiObject *ec2.NetworkAclEntry) map[string]interface } if v := apiObject.RuleAction; v != nil { - tfMap["action"] = aws.StringValue(v) + tfMap[names.AttrAction] = aws.StringValue(v) } if v := apiObject.CidrBlock; v != nil { diff --git a/internal/service/ec2/vpc_network_acl_test.go b/internal/service/ec2/vpc_network_acl_test.go index 1fd32838acc..5bf1e625d8a 100644 --- a/internal/service/ec2/vpc_network_acl_test.go +++ b/internal/service/ec2/vpc_network_acl_test.go @@ -220,7 +220,7 @@ func TestAccVPCNetworkACL_egressAndIngressRules(t *testing.T) { "rule_no": "1", "from_port": "80", "to_port": "80", - "action": "allow", + names.AttrAction: "allow", "cidr_block": "10.3.0.0/18", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "egress.*", map[string]string{ @@ -228,7 +228,7 @@ func TestAccVPCNetworkACL_egressAndIngressRules(t *testing.T) { "rule_no": "2", "from_port": "443", "to_port": "443", - "action": "allow", + names.AttrAction: "allow", "cidr_block": "10.3.0.0/18", }), ), @@ -258,7 +258,7 @@ func TestAccVPCNetworkACL_OnlyIngressRules_basic(t *testing.T) { "rule_no": "2", "from_port": "443", "to_port": "443", - "action": "deny", + names.AttrAction: "deny", "cidr_block": "10.2.0.0/18", }), ), @@ -289,7 +289,7 @@ func TestAccVPCNetworkACL_OnlyIngressRules_update(t *testing.T) { "rule_no": "1", "from_port": "0", "to_port": "22", - "action": "deny", + names.AttrAction: "deny", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "ingress.*", map[string]string{ "cidr_block": "10.2.0.0/18", @@ -308,7 +308,7 @@ func TestAccVPCNetworkACL_OnlyIngressRules_update(t *testing.T) { "rule_no": "1", "from_port": "0", "to_port": "22", - "action": "deny", + names.AttrAction: "deny", "cidr_block": "10.2.0.0/18", }), ), @@ -499,7 +499,7 @@ func TestAccVPCNetworkACL_ipv6Rules(t *testing.T) { "rule_no": "1", "from_port": "0", "to_port": "22", - "action": "allow", + names.AttrAction: "allow", "ipv6_cidr_block": "::/0", }), ), From 59c1c244832c9fa0d1f5b730c81a6a0394c4ce53 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:37 -0400 Subject: [PATCH 0908/1490] ecr: Use constant for action strings --- internal/service/ecr/lifecycle_policy_document_data_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ecr/lifecycle_policy_document_data_source.go b/internal/service/ecr/lifecycle_policy_document_data_source.go index 95cd50684ac..02e336ba621 100644 --- a/internal/service/ecr/lifecycle_policy_document_data_source.go +++ b/internal/service/ecr/lifecycle_policy_document_data_source.go @@ -60,7 +60,7 @@ func (d *lifecyclePolicyDocumentDataSource) Schema(ctx context.Context, request }, }, Blocks: map[string]schema.Block{ - "action": schema.ListNestedBlock{ + names.AttrAction: schema.ListNestedBlock{ CustomType: fwtypes.NewListNestedObjectTypeOf[lifecyclePolicyDocumentRuleAction](ctx), Validators: []validator.List{ listvalidator.SizeAtMost(1), From 5cc49e66b226cff9e187a2f3036edac9195ea965 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:37 -0400 Subject: [PATCH 0909/1490] eks: Use constant for action strings --- internal/service/eks/token.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/eks/token.go b/internal/service/eks/token.go index 1424e4f8594..a846356903d 100644 --- a/internal/service/eks/token.go +++ b/internal/service/eks/token.go @@ -134,7 +134,7 @@ func NewSTSError(m string) STSError { } var parameterWhitelist = map[string]bool{ - "action": true, + names.AttrAction: true, names.AttrVersion: true, "x-amz-algorithm": true, "x-amz-credential": true, @@ -329,7 +329,7 @@ func (v tokenVerifier) Verify(token string) (*Identity, error) { queryParamsLower.Set(strings.ToLower(key), values[0]) } - if queryParamsLower.Get("action") != "GetCallerIdentity" { + if queryParamsLower.Get(names.AttrAction) != "GetCallerIdentity" { return nil, FormatError{"unexpected action parameter in pre-signed URL"} } From 058cc2a721da6e9542f7c7b549ccfe8b014d8927 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:37 -0400 Subject: [PATCH 0910/1490] elbv2: Use constant for action strings --- internal/service/elbv2/listener_rule.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/elbv2/listener_rule.go b/internal/service/elbv2/listener_rule.go index 239c0c940d4..075ed753674 100644 --- a/internal/service/elbv2/listener_rule.go +++ b/internal/service/elbv2/listener_rule.go @@ -76,7 +76,7 @@ func ResourceListenerRule() *schema.Resource { ForceNew: false, ValidateFunc: validListenerRulePriority, }, - "action": { + names.AttrAction: { Type: schema.TypeList, Required: true, Elem: &schema.Resource{ @@ -104,7 +104,7 @@ func ResourceListenerRule() *schema.Resource { Type: schema.TypeList, Optional: true, DiffSuppressOnRefresh: true, - DiffSuppressFunc: diffSuppressMissingForward("action"), + DiffSuppressFunc: diffSuppressMissingForward(names.AttrAction), MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -483,7 +483,7 @@ func ResourceListenerRule() *schema.Resource { CustomizeDiff: customdiff.All( verify.SetTagsDiff, - validateListenerActionsCustomDiff("action"), + validateListenerActionsCustomDiff(names.AttrAction), ), } } @@ -513,7 +513,7 @@ func resourceListenerRuleCreate(ctx context.Context, d *schema.ResourceData, met Tags: getTagsInV2(ctx), } - input.Actions = expandLbListenerActions(cty.GetAttrPath("action"), d.Get("action").([]any), &diags) + input.Actions = expandLbListenerActions(cty.GetAttrPath(names.AttrAction), d.Get(names.AttrAction).([]any), &diags) if diags.HasError() { return diags } @@ -615,7 +615,7 @@ func resourceListenerRuleRead(ctx context.Context, d *schema.ResourceData, meta sort.Slice(rule.Actions, func(i, j int) bool { return aws.ToInt32(rule.Actions[i].Order) < aws.ToInt32(rule.Actions[j].Order) }) - if err := d.Set("action", flattenLbListenerActions(d, "action", rule.Actions)); err != nil { + if err := d.Set(names.AttrAction, flattenLbListenerActions(d, names.AttrAction, rule.Actions)); err != nil { return sdkdiag.AppendErrorf(diags, "setting action: %s", err) } @@ -706,8 +706,8 @@ func resourceListenerRuleUpdate(ctx context.Context, d *schema.ResourceData, met RuleArn: aws.String(d.Id()), } - if d.HasChange("action") { - input.Actions = expandLbListenerActions(cty.GetAttrPath("action"), d.Get("action").([]any), &diags) + if d.HasChange(names.AttrAction) { + input.Actions = expandLbListenerActions(cty.GetAttrPath(names.AttrAction), d.Get(names.AttrAction).([]any), &diags) if diags.HasError() { return diags } From 3511b178365bbd34d0539c76fb94eb383c294bc7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:37 -0400 Subject: [PATCH 0911/1490] events: Use constant for action strings --- internal/service/events/permission.go | 8 ++++---- internal/service/events/permission_test.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/events/permission.go b/internal/service/events/permission.go index 9aad8cb2c30..a1ef536a223 100644 --- a/internal/service/events/permission.go +++ b/internal/service/events/permission.go @@ -39,7 +39,7 @@ func resourcePermission() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Optional: true, Default: "events:PutEvents", @@ -99,7 +99,7 @@ func resourcePermissionCreate(ctx context.Context, d *schema.ResourceData, meta statementID := d.Get("statement_id").(string) id := permissionCreateResourceID(eventBusName, statementID) input := &eventbridge.PutPermissionInput{ - Action: aws.String(d.Get("action").(string)), + Action: aws.String(d.Get(names.AttrAction).(string)), Condition: expandCondition(d.Get("condition").([]interface{})), EventBusName: aws.String(eventBusName), Principal: aws.String(d.Get("principal").(string)), @@ -143,7 +143,7 @@ func resourcePermissionRead(ctx context.Context, d *schema.ResourceData, meta in policyStatement := outputRaw.(*permissionPolicyStatement) - d.Set("action", policyStatement.Action) + d.Set(names.AttrAction, policyStatement.Action) if err := d.Set("condition", flattenPermissionPolicyStatementCondition(policyStatement.Condition)); err != nil { return sdkdiag.AppendErrorf(diags, "setting condition: %s", err) } @@ -180,7 +180,7 @@ func resourcePermissionUpdate(ctx context.Context, d *schema.ResourceData, meta } input := &eventbridge.PutPermissionInput{ - Action: aws.String(d.Get("action").(string)), + Action: aws.String(d.Get(names.AttrAction).(string)), Condition: expandCondition(d.Get("condition").([]interface{})), EventBusName: aws.String(eventBusName), Principal: aws.String(d.Get("principal").(string)), diff --git a/internal/service/events/permission_test.go b/internal/service/events/permission_test.go index 340391ea304..6804b46604f 100644 --- a/internal/service/events/permission_test.go +++ b/internal/service/events/permission_test.go @@ -64,7 +64,7 @@ func TestAccEventsPermission_basic(t *testing.T) { Config: testAccPermissionConfig_basic(principal1, statementID), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "action", "events:PutEvents"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "events:PutEvents"), resource.TestCheckResourceAttr(resourceName, "condition.#", "0"), resource.TestCheckResourceAttr(resourceName, "principal", principal1), resource.TestCheckResourceAttr(resourceName, "statement_id", statementID), @@ -109,7 +109,7 @@ func TestAccEventsPermission_eventBusName(t *testing.T) { Config: testAccPermissionConfig_eventBusName(principal1, busName, statementID), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "action", "events:PutEvents"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "events:PutEvents"), resource.TestCheckResourceAttr(resourceName, "condition.#", "0"), resource.TestCheckResourceAttr(resourceName, "principal", principal1), resource.TestCheckResourceAttr(resourceName, "statement_id", statementID), @@ -157,7 +157,7 @@ func TestAccEventsPermission_action(t *testing.T) { Config: testAccPermissionConfig_action("events:PutEvents", principal, statementID), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "action", "events:PutEvents"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "events:PutEvents"), ), }, { From 9d10f5d87ade1c34c70755753e2c3762c2a7371b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:37 -0400 Subject: [PATCH 0912/1490] fis: Use constant for action strings --- internal/service/fis/experiment_template.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/fis/experiment_template.go b/internal/service/fis/experiment_template.go index dff41011eb9..74152b872ab 100644 --- a/internal/service/fis/experiment_template.go +++ b/internal/service/fis/experiment_template.go @@ -52,7 +52,7 @@ func ResourceExperimentTemplate() *schema.Resource { CustomizeDiff: verify.SetTagsDiff, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeSet, Required: true, Elem: &schema.Resource{ @@ -289,7 +289,7 @@ func resourceExperimentTemplateCreate(ctx context.Context, d *schema.ResourceDat conn := meta.(*conns.AWSClient).FISClient(ctx) input := &fis.CreateExperimentTemplateInput{ - Actions: expandExperimentTemplateActions(d.Get("action").(*schema.Set)), + Actions: expandExperimentTemplateActions(d.Get(names.AttrAction).(*schema.Set)), ClientToken: aws.String(id.UniqueId()), Description: aws.String(d.Get(names.AttrDescription).(string)), LogConfiguration: expandExperimentTemplateLogConfiguration(d.Get("log_configuration").([]interface{})), @@ -348,8 +348,8 @@ func resourceExperimentTemplateRead(ctx context.Context, d *schema.ResourceData, d.Set(names.AttrRoleARN, experimentTemplate.RoleArn) d.Set(names.AttrDescription, experimentTemplate.Description) - if err := d.Set("action", flattenExperimentTemplateActions(experimentTemplate.Actions)); err != nil { - return create.AppendDiagSettingError(diags, names.FIS, ResNameExperimentTemplate, d.Id(), "action", err) + if err := d.Set(names.AttrAction, flattenExperimentTemplateActions(experimentTemplate.Actions)); err != nil { + return create.AppendDiagSettingError(diags, names.FIS, ResNameExperimentTemplate, d.Id(), names.AttrAction, err) } if err := d.Set("log_configuration", flattenExperimentTemplateLogConfiguration(experimentTemplate.LogConfiguration)); err != nil { @@ -379,8 +379,8 @@ func resourceExperimentTemplateUpdate(ctx context.Context, d *schema.ResourceDat Id: aws.String(d.Id()), } - if d.HasChange("action") { - input.Actions = expandExperimentTemplateActionsForUpdate(d.Get("action").(*schema.Set)) + if d.HasChange(names.AttrAction) { + input.Actions = expandExperimentTemplateActionsForUpdate(d.Get(names.AttrAction).(*schema.Set)) } if d.HasChange(names.AttrDescription) { From ba7726d865cd03bdb9c28830cc7b18f973e53f39 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:38 -0400 Subject: [PATCH 0913/1490] guardduty: Use constant for action strings --- internal/service/guardduty/filter.go | 10 +++++----- internal/service/guardduty/filter_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/guardduty/filter.go b/internal/service/guardduty/filter.go index e2120580a8e..fb6a4eacc71 100644 --- a/internal/service/guardduty/filter.go +++ b/internal/service/guardduty/filter.go @@ -40,7 +40,7 @@ func ResourceFilter() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(guardduty.FilterAction_Values(), false), @@ -140,7 +140,7 @@ func resourceFilterCreate(ctx context.Context, d *schema.ResourceData, meta inte conn := meta.(*conns.AWSClient).GuardDutyConn(ctx) input := guardduty.CreateFilterInput{ - Action: aws.String(d.Get("action").(string)), + Action: aws.String(d.Get(names.AttrAction).(string)), Description: aws.String(d.Get(names.AttrDescription).(string)), DetectorId: aws.String(d.Get("detector_id").(string)), Name: aws.String(d.Get(names.AttrName).(string)), @@ -214,7 +214,7 @@ func resourceFilterRead(ctx context.Context, d *schema.ResourceData, meta interf return sdkdiag.AppendErrorf(diags, "Setting GuardDuty Filter FindingCriteria failed: %s", err) } - d.Set("action", filter.Action) + d.Set(names.AttrAction, filter.Action) d.Set(names.AttrDescription, filter.Description) d.Set(names.AttrName, filter.Name) d.Set("detector_id", detectorID) @@ -231,9 +231,9 @@ func resourceFilterUpdate(ctx context.Context, d *schema.ResourceData, meta inte var diags diag.Diagnostics conn := meta.(*conns.AWSClient).GuardDutyConn(ctx) - if d.HasChanges("action", names.AttrDescription, "finding_criteria", "rank") { + if d.HasChanges(names.AttrAction, names.AttrDescription, "finding_criteria", "rank") { input := guardduty.UpdateFilterInput{ - Action: aws.String(d.Get("action").(string)), + Action: aws.String(d.Get(names.AttrAction).(string)), Description: aws.String(d.Get(names.AttrDescription).(string)), DetectorId: aws.String(d.Get("detector_id").(string)), FilterName: aws.String(d.Get(names.AttrName).(string)), diff --git a/internal/service/guardduty/filter_test.go b/internal/service/guardduty/filter_test.go index cdad0832927..0c7d3a421eb 100644 --- a/internal/service/guardduty/filter_test.go +++ b/internal/service/guardduty/filter_test.go @@ -47,7 +47,7 @@ func testAccFilter_basic(t *testing.T) { testAccCheckFilterExists(ctx, resourceName, &v1), resource.TestCheckResourceAttrPair(resourceName, "detector_id", detectorResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, names.AttrName, "test-filter"), - resource.TestCheckResourceAttr(resourceName, "action", "ARCHIVE"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "ARCHIVE"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "rank", "1"), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "guardduty", regexache.MustCompile("detector/[0-9a-z]{32}/filter/test-filter$")), @@ -83,7 +83,7 @@ func testAccFilter_basic(t *testing.T) { testAccCheckFilterExists(ctx, resourceName, &v2), resource.TestCheckResourceAttrPair(resourceName, "detector_id", detectorResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, names.AttrName, "test-filter"), - resource.TestCheckResourceAttr(resourceName, "action", "NOOP"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "NOOP"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "This is a NOOP"), resource.TestCheckResourceAttr(resourceName, "rank", "1"), resource.TestCheckResourceAttr(resourceName, "finding_criteria.#", "1"), From 4618ddeb4de23fa31d080e043ae01cad4ffb5539 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:38 -0400 Subject: [PATCH 0914/1490] lambda: Use constant for action strings --- internal/service/lambda/invocation.go | 5 ++-- .../lambda/layer_version_permission.go | 6 ++-- .../lambda/layer_version_permission_test.go | 8 ++--- internal/service/lambda/permission.go | 7 +++-- internal/service/lambda/permission_test.go | 30 +++++++++---------- internal/service/lambda/validate_test.go | 4 +-- 6 files changed, 31 insertions(+), 29 deletions(-) diff --git a/internal/service/lambda/invocation.go b/internal/service/lambda/invocation.go index 3f8e4e2759e..d5d750a9859 100644 --- a/internal/service/lambda/invocation.go +++ b/internal/service/lambda/invocation.go @@ -22,6 +22,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/enum" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_lambda_invocation", name="Invocation") @@ -125,8 +126,8 @@ func buildInput(d *schema.ResourceData, action invocationAction) ([]byte, error) } newInputMap[d.Get("terraform_key").(string)] = map[string]interface{}{ - "action": action, - "prev_input": oldInputMap, + names.AttrAction: action, + "prev_input": oldInputMap, } return json.Marshal(&newInputMap) } diff --git a/internal/service/lambda/layer_version_permission.go b/internal/service/lambda/layer_version_permission.go index 7cb7387774e..798a14297ba 100644 --- a/internal/service/lambda/layer_version_permission.go +++ b/internal/service/lambda/layer_version_permission.go @@ -44,7 +44,7 @@ func resourceLayerVersionPermission() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -104,7 +104,7 @@ func resourceLayerVersionPermissionCreate(ctx context.Context, d *schema.Resourc versionNumber := d.Get("version_number").(int) id := errs.Must(flex.FlattenResourceId([]string{layerName, strconv.FormatInt(int64(versionNumber), 10)}, layerVersionPermissionResourceIDPartCount, true)) input := &lambda.AddLayerVersionPermissionInput{ - Action: aws.String(d.Get("action").(string)), + Action: aws.String(d.Get(names.AttrAction).(string)), LayerName: aws.String(layerName), Principal: aws.String(d.Get("principal").(string)), StatementId: aws.String(d.Get("statement_id").(string)), @@ -169,7 +169,7 @@ func resourceLayerVersionPermissionRead(ctx context.Context, d *schema.ResourceD action = actions.(string) } - d.Set("action", action) + d.Set(names.AttrAction, action) } if len(policyDoc.Statements[0].Conditions) > 0 { diff --git a/internal/service/lambda/layer_version_permission_test.go b/internal/service/lambda/layer_version_permission_test.go index c9b09a792ce..07012b203f7 100644 --- a/internal/service/lambda/layer_version_permission_test.go +++ b/internal/service/lambda/layer_version_permission_test.go @@ -33,7 +33,7 @@ func TestAccLambdaLayerVersionPermission_basic_byARN(t *testing.T) { Config: testAccLayerVersionPermissionConfig_basicARN(rName), Check: resource.ComposeTestCheckFunc( testAccCheckLayerVersionPermissionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:GetLayerVersion"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:GetLayerVersion"), resource.TestCheckResourceAttr(resourceName, "principal", "*"), resource.TestCheckResourceAttr(resourceName, "statement_id", "xaccount"), resource.TestCheckResourceAttrPair(resourceName, "layer_name", "aws_lambda_layer_version.test", "layer_arn"), @@ -64,7 +64,7 @@ func TestAccLambdaLayerVersionPermission_basic_byName(t *testing.T) { Config: testAccLayerVersionPermissionConfig_basicName(rName), Check: resource.ComposeTestCheckFunc( testAccCheckLayerVersionPermissionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:GetLayerVersion"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:GetLayerVersion"), resource.TestCheckResourceAttr(resourceName, "principal", "*"), resource.TestCheckResourceAttr(resourceName, "statement_id", "xaccount"), resource.TestCheckResourceAttrPair(resourceName, "layer_name", "aws_lambda_layer_version.test", "layer_name"), @@ -95,7 +95,7 @@ func TestAccLambdaLayerVersionPermission_org(t *testing.T) { Config: testAccLayerVersionPermissionConfig_org(rName), Check: resource.ComposeTestCheckFunc( testAccCheckLayerVersionPermissionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:GetLayerVersion"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:GetLayerVersion"), resource.TestCheckResourceAttr(resourceName, "principal", "*"), resource.TestCheckResourceAttr(resourceName, "statement_id", "xaccount"), resource.TestCheckResourceAttr(resourceName, "organization_id", "o-0123456789"), @@ -127,7 +127,7 @@ func TestAccLambdaLayerVersionPermission_account(t *testing.T) { Config: testAccLayerVersionPermissionConfig_account(rName), Check: resource.ComposeTestCheckFunc( testAccCheckLayerVersionPermissionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:GetLayerVersion"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:GetLayerVersion"), resource.TestCheckResourceAttrPair(resourceName, "principal", "data.aws_caller_identity.current", names.AttrAccountID), resource.TestCheckResourceAttr(resourceName, "statement_id", "xaccount"), resource.TestCheckResourceAttrPair(resourceName, "layer_name", "aws_lambda_layer_version.test", "layer_arn"), diff --git a/internal/service/lambda/permission.go b/internal/service/lambda/permission.go index 4df61599f0a..6d08eb84bed 100644 --- a/internal/service/lambda/permission.go +++ b/internal/service/lambda/permission.go @@ -24,6 +24,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) var functionRegexp = `^(arn:[\w-]+:lambda:)?([a-z]{2}-(?:[a-z]+-){1,2}\d{1}:)?(\d{12}:)?(function:)?([0-9A-Za-z_-]+)(:(\$LATEST|[0-9A-Za-z_-]+))?$` @@ -40,7 +41,7 @@ func resourcePermission() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -126,7 +127,7 @@ func resourcePermissionCreate(ctx context.Context, d *schema.ResourceData, meta defer conns.GlobalMutexKV.Unlock(functionName) input := &lambda.AddPermissionInput{ - Action: aws.String(d.Get("action").(string)), + Action: aws.String(d.Get(names.AttrAction).(string)), FunctionName: aws.String(functionName), Principal: aws.String(d.Get("principal").(string)), StatementId: aws.String(statementID), @@ -209,7 +210,7 @@ func resourcePermissionRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("function_name", functionName) } - d.Set("action", statement.Action) + d.Set(names.AttrAction, statement.Action) // Check if the principal is a cross-account IAM role if v, ok := statement.Principal.(map[string]interface{}); ok { if _, ok := v["AWS"]; ok { diff --git a/internal/service/lambda/permission_test.go b/internal/service/lambda/permission_test.go index 7326639bc56..0d604621117 100644 --- a/internal/service/lambda/permission_test.go +++ b/internal/service/lambda/permission_test.go @@ -240,7 +240,7 @@ func TestAccLambdaPermission_basic(t *testing.T) { Config: testAccPermissionConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName, &statement), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:InvokeFunction"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:InvokeFunction"), resource.TestCheckResourceAttr(resourceName, "event_source_token", "test-event-source-token"), resource.TestCheckResourceAttrPair(resourceName, "function_name", functionResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "principal", "events.amazonaws.com"), @@ -277,7 +277,7 @@ func TestAccLambdaPermission_principalOrgID(t *testing.T) { Config: testAccPermissionConfig_orgID(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName, &statement), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:InvokeFunction"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:InvokeFunction"), resource.TestCheckResourceAttr(resourceName, "principal", "*"), resource.TestCheckResourceAttrPair(resourceName, "principal_org_id", "data.aws_organizations_organization.test", names.AttrID), resource.TestCheckResourceAttr(resourceName, "statement_id", "AllowExecutionFromCloudWatch"), @@ -337,7 +337,7 @@ func TestAccLambdaPermission_rawFunctionName(t *testing.T) { Config: testAccPermissionConfig_rawFunctionName(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName, &statement), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:InvokeFunction"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:InvokeFunction"), resource.TestCheckResourceAttr(resourceName, "principal", "events.amazonaws.com"), resource.TestCheckResourceAttr(resourceName, "statement_id", "AllowExecutionWithRawFuncName"), resource.TestCheckResourceAttrPair(resourceName, "function_name", functionResourceName, names.AttrARN), @@ -370,7 +370,7 @@ func TestAccLambdaPermission_statementIDPrefix(t *testing.T) { Config: testAccPermissionConfig_statementIDPrefix(rName, "AllowExecutionWithStatementIdPrefix-"), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName, &statement), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:InvokeFunction"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:InvokeFunction"), resource.TestCheckResourceAttrPair(resourceName, "function_name", functionResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "principal", "events.amazonaws.com"), acctest.CheckResourceAttrNameFromPrefix(resourceName, "statement_id", "AllowExecutionWithStatementIdPrefix-"), @@ -406,7 +406,7 @@ func TestAccLambdaPermission_qualifier(t *testing.T) { Config: testAccPermissionConfig_qualifier(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName, &statement), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:InvokeFunction"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:InvokeFunction"), resource.TestCheckResourceAttr(resourceName, "principal", "events.amazonaws.com"), resource.TestCheckResourceAttr(resourceName, "statement_id", "AllowExecutionWithQualifier"), resource.TestCheckResourceAttrPair(resourceName, "function_name", functionResourceName, names.AttrARN), @@ -476,13 +476,13 @@ func TestAccLambdaPermission_multiplePerms(t *testing.T) { Check: resource.ComposeTestCheckFunc( // 1st testAccCheckPermissionExists(ctx, resourceNameFirst, &firstStatement), - resource.TestCheckResourceAttr(resourceNameFirst, "action", "lambda:InvokeFunction"), + resource.TestCheckResourceAttr(resourceNameFirst, names.AttrAction, "lambda:InvokeFunction"), resource.TestCheckResourceAttr(resourceNameFirst, "principal", "events.amazonaws.com"), resource.TestCheckResourceAttr(resourceNameFirst, "statement_id", "AllowExecutionFirst"), resource.TestCheckResourceAttrPair(resourceNameFirst, "function_name", functionResourceName, names.AttrARN), // 2nd testAccCheckPermissionExists(ctx, resourceNameSecond, &firstStatementModified), - resource.TestCheckResourceAttr(resourceNameSecond, "action", "lambda:*"), + resource.TestCheckResourceAttr(resourceNameSecond, names.AttrAction, "lambda:*"), resource.TestCheckResourceAttr(resourceNameSecond, "principal", "events.amazonaws.com"), resource.TestCheckResourceAttr(resourceNameSecond, "statement_id", "AllowExecutionSecond"), resource.TestCheckResourceAttrPair(resourceNameSecond, "function_name", functionResourceName, names.AttrARN), @@ -493,19 +493,19 @@ func TestAccLambdaPermission_multiplePerms(t *testing.T) { Check: resource.ComposeTestCheckFunc( // 1st testAccCheckPermissionExists(ctx, resourceNameFirst, &secondStatement), - resource.TestCheckResourceAttr(resourceNameFirst, "action", "lambda:InvokeFunction"), + resource.TestCheckResourceAttr(resourceNameFirst, names.AttrAction, "lambda:InvokeFunction"), resource.TestCheckResourceAttr(resourceNameFirst, "principal", "events.amazonaws.com"), resource.TestCheckResourceAttr(resourceNameFirst, "statement_id", "AllowExecutionFirst"), resource.TestCheckResourceAttrPair(resourceNameFirst, "function_name", functionResourceName, names.AttrARN), // 2nd testAccCheckPermissionExists(ctx, resourceNameSecondModified, &secondStatementModified), - resource.TestCheckResourceAttr(resourceNameSecondModified, "action", "lambda:*"), + resource.TestCheckResourceAttr(resourceNameSecondModified, names.AttrAction, "lambda:*"), resource.TestCheckResourceAttr(resourceNameSecondModified, "principal", "events.amazonaws.com"), resource.TestCheckResourceAttr(resourceNameSecondModified, "statement_id", "AllowExecutionSec0nd"), resource.TestCheckResourceAttrPair(resourceNameSecondModified, "function_name", functionResourceName, names.AttrARN), // 3rd testAccCheckPermissionExists(ctx, resourceNameThird, &thirdStatement), - resource.TestCheckResourceAttr(resourceNameThird, "action", "lambda:*"), + resource.TestCheckResourceAttr(resourceNameThird, names.AttrAction, "lambda:*"), resource.TestCheckResourceAttr(resourceNameThird, "principal", "events.amazonaws.com"), resource.TestCheckResourceAttr(resourceNameThird, "statement_id", "AllowExecutionThird"), resource.TestCheckResourceAttrPair(resourceNameThird, "function_name", functionResourceName, names.AttrARN), @@ -547,7 +547,7 @@ func TestAccLambdaPermission_s3(t *testing.T) { Config: testAccPermissionConfig_s3(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName, &statement), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:InvokeFunction"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:InvokeFunction"), resource.TestCheckResourceAttr(resourceName, "principal", "s3.amazonaws.com"), resource.TestCheckResourceAttr(resourceName, "statement_id", "AllowExecutionFromS3"), resource.TestCheckResourceAttrPair(resourceName, "function_name", functionResourceName, names.AttrARN), @@ -584,7 +584,7 @@ func TestAccLambdaPermission_sns(t *testing.T) { Config: testAccPermissionConfig_sns(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName, &statement), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:InvokeFunction"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:InvokeFunction"), resource.TestCheckResourceAttr(resourceName, "principal", "sns.amazonaws.com"), resource.TestCheckResourceAttr(resourceName, "statement_id", "AllowExecutionFromSNS"), resource.TestCheckResourceAttrPair(resourceName, "function_name", functionResourceName, names.AttrARN), @@ -621,7 +621,7 @@ func TestAccLambdaPermission_iamRole(t *testing.T) { Config: testAccPermissionConfig_iamRole(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName, &statement), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:InvokeFunction"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:InvokeFunction"), resource.TestCheckResourceAttrPair(resourceName, "principal", iamRoleResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "statement_id", "AllowExecutionFromIAMRole"), resource.TestCheckResourceAttrPair(resourceName, "function_name", functionResourceName, names.AttrARN), @@ -655,7 +655,7 @@ func TestAccLambdaPermission_FunctionURLs_iam(t *testing.T) { Config: testAccPermissionConfig_functionURLsIAM(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName, &statement), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:InvokeFunctionUrl"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:InvokeFunctionUrl"), resource.TestCheckResourceAttr(resourceName, "principal", "*"), resource.TestCheckResourceAttr(resourceName, "statement_id", "AllowExecutionWithIAM"), resource.TestCheckResourceAttr(resourceName, "qualifier", ""), @@ -691,7 +691,7 @@ func TestAccLambdaPermission_FunctionURLs_none(t *testing.T) { Config: testAccPermissionConfig_functionURLsNone(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPermissionExists(ctx, resourceName, &statement), - resource.TestCheckResourceAttr(resourceName, "action", "lambda:InvokeFunctionUrl"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "lambda:InvokeFunctionUrl"), resource.TestCheckResourceAttr(resourceName, "principal", "*"), resource.TestCheckResourceAttr(resourceName, "statement_id", "AllowExecutionFromWithoutAuth"), resource.TestCheckResourceAttr(resourceName, "qualifier", ""), diff --git a/internal/service/lambda/validate_test.go b/internal/service/lambda/validate_test.go index a60b41fbd94..c5b2ec18bf4 100644 --- a/internal/service/lambda/validate_test.go +++ b/internal/service/lambda/validate_test.go @@ -52,7 +52,7 @@ func TestValidPermissionAction(t *testing.T) { "*", } for _, v := range validNames { - _, errors := validPermissionAction()(v, "action") + _, errors := validPermissionAction()(v, names.AttrAction) if len(errors) != 0 { t.Fatalf("%q should be a valid Lambda permission action: %q", v, errors) } @@ -65,7 +65,7 @@ func TestValidPermissionAction(t *testing.T) { "lambda:Invoke*", } for _, v := range invalidNames { - _, errors := validPermissionAction()(v, "action") + _, errors := validPermissionAction()(v, names.AttrAction) if len(errors) == 0 { t.Fatalf("%q should be an invalid Lambda permission action", v) } From dadec60d0e91f2d82bc0cfce50389f6a803bf36c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:38 -0400 Subject: [PATCH 0915/1490] macie2: Use constant for action strings --- internal/service/macie2/findings_filter.go | 10 +++++----- .../service/macie2/findings_filter_test.go | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/macie2/findings_filter.go b/internal/service/macie2/findings_filter.go index bf1ccc0d58b..3c6db28de8d 100644 --- a/internal/service/macie2/findings_filter.go +++ b/internal/service/macie2/findings_filter.go @@ -115,7 +115,7 @@ func ResourceFindingsFilter() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(0, 512), }, - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(macie2.FindingsFilterAction_Values(), false), @@ -143,7 +143,7 @@ func resourceFindingsFilterCreate(ctx context.Context, d *schema.ResourceData, m input := &macie2.CreateFindingsFilterInput{ ClientToken: aws.String(id.UniqueId()), Name: aws.String(create.Name(d.Get(names.AttrName).(string), d.Get(names.AttrNamePrefix).(string))), - Action: aws.String(d.Get("action").(string)), + Action: aws.String(d.Get(names.AttrAction).(string)), Tags: getTagsIn(ctx), } @@ -216,7 +216,7 @@ func resourceFindingsFilterRead(ctx context.Context, d *schema.ResourceData, met d.Set(names.AttrName, resp.Name) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.StringValue(resp.Name))) d.Set(names.AttrDescription, resp.Description) - d.Set("action", resp.Action) + d.Set(names.AttrAction, resp.Action) d.Set("position", resp.Position) setTagsOut(ctx, resp.Tags) @@ -251,8 +251,8 @@ func resourceFindingsFilterUpdate(ctx context.Context, d *schema.ResourceData, m if d.HasChange(names.AttrDescription) { input.Description = aws.String(d.Get(names.AttrDescription).(string)) } - if d.HasChange("action") { - input.Action = aws.String(d.Get("action").(string)) + if d.HasChange(names.AttrAction) { + input.Action = aws.String(d.Get(names.AttrAction).(string)) } if d.HasChange("position") { input.Position = aws.Int64(int64(d.Get("position").(int))) diff --git a/internal/service/macie2/findings_filter_test.go b/internal/service/macie2/findings_filter_test.go index 079db839d46..bbce5182db9 100644 --- a/internal/service/macie2/findings_filter_test.go +++ b/internal/service/macie2/findings_filter_test.go @@ -38,7 +38,7 @@ func testAccFindingsFilter_basic(t *testing.T) { testAccCheckFindingsFilterExists(ctx, resourceName, &macie2Output), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, "terraform-"), - resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionArchive), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, macie2.FindingsFilterActionArchive), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "macie2", regexache.MustCompile(`findings-filter/.+`)), ), }, @@ -153,7 +153,7 @@ func testAccFindingsFilter_complete(t *testing.T) { testAccCheckFindingsFilterExists(ctx, resourceName, &macie2Output), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, "terraform-"), - resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionArchive), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, macie2.FindingsFilterActionArchive), resource.TestCheckResourceAttr(resourceName, "finding_criteria.0.criterion.0.field", names.AttrRegion), resource.TestCheckResourceAttrPair(resourceName, "finding_criteria.0.criterion.0.eq.0", dataSourceRegion, names.AttrName), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ @@ -172,7 +172,7 @@ func testAccFindingsFilter_complete(t *testing.T) { testAccCheckFindingsFilterExists(ctx, resourceName, &macie2Output), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, "terraform-"), - resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionNoop), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, macie2.FindingsFilterActionNoop), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "macie2", regexache.MustCompile(`findings-filter/.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, descriptionUpdated), resource.TestCheckResourceAttr(resourceName, "position", "1"), @@ -191,7 +191,7 @@ func testAccFindingsFilter_complete(t *testing.T) { testAccCheckFindingsFilterExists(ctx, resourceName, &macie2Output), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, "terraform-"), - resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionNoop), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, macie2.FindingsFilterActionNoop), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "macie2", regexache.MustCompile(`findings-filter/.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, descriptionUpdated), resource.TestCheckResourceAttr(resourceName, "position", "1"), @@ -235,7 +235,7 @@ func testAccFindingsFilter_WithDate(t *testing.T) { testAccCheckFindingsFilterExists(ctx, resourceName, &macie2Output), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, "terraform-"), - resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionArchive), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, macie2.FindingsFilterActionArchive), resource.TestCheckTypeSetElemAttrPair(resourceName, "finding_criteria.0.criterion.*.eq.*", dataSourceRegion, names.AttrName), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "finding_criteria.0.criterion.*", map[string]string{ "field": names.AttrRegion, @@ -253,7 +253,7 @@ func testAccFindingsFilter_WithDate(t *testing.T) { testAccCheckFindingsFilterExists(ctx, resourceName, &macie2Output), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, "terraform-"), - resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionNoop), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, macie2.FindingsFilterActionNoop), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "macie2", regexache.MustCompile(`findings-filter/.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, descriptionUpdated), resource.TestCheckResourceAttr(resourceName, "position", "1"), @@ -312,7 +312,7 @@ func testAccFindingsFilter_WithNumber(t *testing.T) { testAccCheckFindingsFilterExists(ctx, resourceName, &macie2Output), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, "terraform-"), - resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionArchive), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, macie2.FindingsFilterActionArchive), resource.TestCheckTypeSetElemAttrPair(resourceName, "finding_criteria.0.criterion.*.eq.*", dataSourceRegion, names.AttrName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "macie2", regexache.MustCompile(`findings-filter/.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), @@ -330,7 +330,7 @@ func testAccFindingsFilter_WithNumber(t *testing.T) { testAccCheckFindingsFilterExists(ctx, resourceName, &macie2Output), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, "terraform-"), - resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionNoop), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, macie2.FindingsFilterActionNoop), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "macie2", regexache.MustCompile(`findings-filter/.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, descriptionUpdated), resource.TestCheckResourceAttr(resourceName, "position", "1"), @@ -380,7 +380,7 @@ func testAccFindingsFilter_withTags(t *testing.T) { testAccCheckFindingsFilterExists(ctx, resourceName, &macie2Output), acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, "terraform-"), - resource.TestCheckResourceAttr(resourceName, "action", macie2.FindingsFilterActionArchive), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, macie2.FindingsFilterActionArchive), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.Key", names.AttrValue), resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), From fa016d47cca85601d5aa71fa14d9d28b60061ee1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:38 -0400 Subject: [PATCH 0916/1490] networkfirewall: Use constant for action strings --- internal/service/networkfirewall/firewall_policy.go | 6 +++--- .../networkfirewall/firewall_policy_data_source.go | 2 +- internal/service/networkfirewall/rule_group.go | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/networkfirewall/firewall_policy.go b/internal/service/networkfirewall/firewall_policy.go index 631735b43dd..69104f72fbb 100644 --- a/internal/service/networkfirewall/firewall_policy.go +++ b/internal/service/networkfirewall/firewall_policy.go @@ -130,7 +130,7 @@ func ResourceFirewallPolicy() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice(networkfirewall.OverrideAction_Values(), false), @@ -430,7 +430,7 @@ func expandStatefulRuleGroupOverride(l []interface{}) *networkfirewall.StatefulR lRaw := l[0].(map[string]interface{}) override := &networkfirewall.StatefulRuleGroupOverride{} - if v, ok := lRaw["action"].(string); ok && v != "" { + if v, ok := lRaw[names.AttrAction].(string); ok && v != "" { override.SetAction(v) } @@ -599,7 +599,7 @@ func flattenStatefulRuleGroupOverride(override *networkfirewall.StatefulRuleGrou } m := map[string]interface{}{ - "action": aws.StringValue(override.Action), + names.AttrAction: aws.StringValue(override.Action), } return []interface{}{m} diff --git a/internal/service/networkfirewall/firewall_policy_data_source.go b/internal/service/networkfirewall/firewall_policy_data_source.go index 987b7723ee9..b5f8b30cfc7 100644 --- a/internal/service/networkfirewall/firewall_policy_data_source.go +++ b/internal/service/networkfirewall/firewall_policy_data_source.go @@ -70,7 +70,7 @@ func DataSourceFirewallPolicy() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Optional: true, }, diff --git a/internal/service/networkfirewall/rule_group.go b/internal/service/networkfirewall/rule_group.go index 7d11ee80612..b357c70dfdd 100644 --- a/internal/service/networkfirewall/rule_group.go +++ b/internal/service/networkfirewall/rule_group.go @@ -148,7 +148,7 @@ func ResourceRuleGroup() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(networkfirewall.StatefulAction_Values(), false), @@ -766,7 +766,7 @@ func expandStatefulRules(l []interface{}) []*networkfirewall.StatefulRule { continue } rule := &networkfirewall.StatefulRule{} - if v, ok := tfMap["action"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrAction].(string); ok && v != "" { rule.Action = aws.String(v) } if v, ok := tfMap["header"].([]interface{}); ok && len(v) > 0 && v[0] != nil { @@ -1243,9 +1243,9 @@ func flattenStatefulRules(sr []*networkfirewall.StatefulRule) []interface{} { rules := make([]interface{}, 0, len(sr)) for _, s := range sr { m := map[string]interface{}{ - "action": aws.StringValue(s.Action), - "header": flattenHeader(s.Header), - "rule_option": flattenRuleOptions(s.RuleOptions), + names.AttrAction: aws.StringValue(s.Action), + "header": flattenHeader(s.Header), + "rule_option": flattenRuleOptions(s.RuleOptions), } rules = append(rules, m) } From 9c54ca23ff633e5bc0cca88f46578bb5e173896f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:39 -0400 Subject: [PATCH 0917/1490] networkmanager: Use constant for action strings --- .../core_network_policy_document_data_source.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/networkmanager/core_network_policy_document_data_source.go b/internal/service/networkmanager/core_network_policy_document_data_source.go index c7cb4b5af5e..99ba3825ba6 100644 --- a/internal/service/networkmanager/core_network_policy_document_data_source.go +++ b/internal/service/networkmanager/core_network_policy_document_data_source.go @@ -95,7 +95,7 @@ func DataSourceCoreNetworkPolicyDocument() *schema.Resource { }, }, }, - "action": { + names.AttrAction: { Type: schema.TypeList, Required: true, MaxItems: 1, @@ -250,7 +250,7 @@ func DataSourceCoreNetworkPolicyDocument() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ @@ -366,7 +366,7 @@ func expandDataCoreNetworkPolicySegmentActions(cfgSegmentActionsIntf []interface for i, sgmtActionI := range cfgSegmentActionsIntf { cfgSA := sgmtActionI.(map[string]interface{}) sgmtAction := &CoreNetworkPolicySegmentAction{} - action := cfgSA["action"].(string) + action := cfgSA[names.AttrAction].(string) sgmtAction.Action = action var shareWith, shareWithExcept interface{} @@ -440,7 +440,7 @@ func expandDataCoreNetworkPolicyAttachmentPolicies(cfgAttachmentPolicyIntf []int policy.ConditionLogic = cL.(string) } - action, err := expandDataCoreNetworkPolicyAttachmentPoliciesAction(cfgPol["action"].([]interface{})) + action, err := expandDataCoreNetworkPolicyAttachmentPoliciesAction(cfgPol[names.AttrAction].([]interface{})) if err != nil { return nil, fmt.Errorf("Problem with attachment policy rule number (%s). See attachment_policy[%s].action: %q", ruleStr, strconv.Itoa(i), err) } From 50a19518899a56f0d9dc89cdab9fe02a4559f450 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:39 -0400 Subject: [PATCH 0918/1490] route53resolver: Use constant for action strings --- internal/service/route53resolver/firewall_rule.go | 8 ++++---- internal/service/route53resolver/firewall_rule_test.go | 6 +++--- .../service/route53resolver/firewall_rules_data_source.go | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/route53resolver/firewall_rule.go b/internal/service/route53resolver/firewall_rule.go index 9bd141431b2..91c381df44f 100644 --- a/internal/service/route53resolver/firewall_rule.go +++ b/internal/service/route53resolver/firewall_rule.go @@ -35,7 +35,7 @@ func ResourceFirewallRule() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(route53resolver.Action_Values(), false), @@ -93,7 +93,7 @@ func resourceFirewallRuleCreate(ctx context.Context, d *schema.ResourceData, met ruleID := FirewallRuleCreateResourceID(firewallRuleGroupID, firewallDomainListID) name := d.Get(names.AttrName).(string) input := &route53resolver.CreateFirewallRuleInput{ - Action: aws.String(d.Get("action").(string)), + Action: aws.String(d.Get(names.AttrAction).(string)), CreatorRequestId: aws.String(id.PrefixedUniqueId("tf-r53-resolver-firewall-rule-")), FirewallRuleGroupId: aws.String(firewallRuleGroupID), FirewallDomainListId: aws.String(firewallDomainListID), @@ -149,7 +149,7 @@ func resourceFirewallRuleRead(ctx context.Context, d *schema.ResourceData, meta return diag.Errorf("reading Route53 Resolver Firewall Rule (%s): %s", d.Id(), err) } - d.Set("action", firewallRule.Action) + d.Set(names.AttrAction, firewallRule.Action) d.Set("block_override_dns_type", firewallRule.BlockOverrideDnsType) d.Set("block_override_domain", firewallRule.BlockOverrideDomain) d.Set("block_override_ttl", firewallRule.BlockOverrideTtl) @@ -172,7 +172,7 @@ func resourceFirewallRuleUpdate(ctx context.Context, d *schema.ResourceData, met } input := &route53resolver.UpdateFirewallRuleInput{ - Action: aws.String(d.Get("action").(string)), + Action: aws.String(d.Get(names.AttrAction).(string)), FirewallDomainListId: aws.String(firewallDomainListID), FirewallRuleGroupId: aws.String(firewallRuleGroupID), Name: aws.String(d.Get(names.AttrName).(string)), diff --git a/internal/service/route53resolver/firewall_rule_test.go b/internal/service/route53resolver/firewall_rule_test.go index 9058e4c8aeb..eb2c86e9b9b 100644 --- a/internal/service/route53resolver/firewall_rule_test.go +++ b/internal/service/route53resolver/firewall_rule_test.go @@ -36,7 +36,7 @@ func TestAccRoute53ResolverFirewallRule_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckFirewallRuleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "action", "ALLOW"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "ALLOW"), resource.TestCheckResourceAttrPair(resourceName, "firewall_rule_group_id", "aws_route53_resolver_firewall_rule_group.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "firewall_domain_list_id", "aws_route53_resolver_firewall_domain_list.test", names.AttrID), resource.TestCheckResourceAttr(resourceName, "priority", "100"), @@ -68,7 +68,7 @@ func TestAccRoute53ResolverFirewallRule_block(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckFirewallRuleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "action", "BLOCK"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "BLOCK"), resource.TestCheckResourceAttr(resourceName, "block_response", "NODATA"), ), }, @@ -98,7 +98,7 @@ func TestAccRoute53ResolverFirewallRule_blockOverride(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckFirewallRuleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "action", "BLOCK"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "BLOCK"), resource.TestCheckResourceAttr(resourceName, "block_override_dns_type", "CNAME"), resource.TestCheckResourceAttr(resourceName, "block_override_domain", "example.com."), resource.TestCheckResourceAttr(resourceName, "block_override_ttl", "60"), diff --git a/internal/service/route53resolver/firewall_rules_data_source.go b/internal/service/route53resolver/firewall_rules_data_source.go index 9cbd528cfa3..fed718d5911 100644 --- a/internal/service/route53resolver/firewall_rules_data_source.go +++ b/internal/service/route53resolver/firewall_rules_data_source.go @@ -20,7 +20,7 @@ func DataSourceResolverFirewallRules() *schema.Resource { ReadWithoutTimeout: dataSourceResolverFirewallFirewallRulesRead, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Optional: true, }, @@ -33,7 +33,7 @@ func DataSourceResolverFirewallRules() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Computed: true, }, @@ -97,7 +97,7 @@ func dataSourceResolverFirewallFirewallRulesRead(ctx context.Context, d *schema. firewallRuleGroupID := d.Get("firewall_rule_group_id").(string) rules, err := findFirewallRules(ctx, conn, firewallRuleGroupID, func(rule *route53resolver.FirewallRule) bool { - if v, ok := d.GetOk("action"); ok && aws.StringValue(rule.Action) != v.(string) { + if v, ok := d.GetOk(names.AttrAction); ok && aws.StringValue(rule.Action) != v.(string) { return false } @@ -152,7 +152,7 @@ func flattenFirewallRule(apiObject *route53resolver.FirewallRule) map[string]int tfMap := map[string]interface{}{} if apiObject.Action != nil { - tfMap["action"] = aws.StringValue(apiObject.Action) + tfMap[names.AttrAction] = aws.StringValue(apiObject.Action) } if apiObject.BlockOverrideDnsType != nil { tfMap["block_override_dns_type"] = aws.StringValue(apiObject.BlockOverrideDnsType) From 39b4338584f75e31af436dc6560fa7c683aa9832 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:39 -0400 Subject: [PATCH 0919/1490] shield: Use constant for action strings --- .../service/shield/application_layer_automatic_response.go | 2 +- .../shield/application_layer_automatic_response_test.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/shield/application_layer_automatic_response.go b/internal/service/shield/application_layer_automatic_response.go index 349a876616e..c75c2e88e92 100644 --- a/internal/service/shield/application_layer_automatic_response.go +++ b/internal/service/shield/application_layer_automatic_response.go @@ -66,7 +66,7 @@ func (r *applicationLayerAutomaticResponseResource) Metadata(_ context.Context, func (r *applicationLayerAutomaticResponseResource) Schema(ctx context.Context, request resource.SchemaRequest, response *resource.SchemaResponse) { response.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "action": schema.StringAttribute{ + names.AttrAction: schema.StringAttribute{ CustomType: fwtypes.StringEnumType[applicationLayerAutomaticResponseAction](), Required: true, }, diff --git a/internal/service/shield/application_layer_automatic_response_test.go b/internal/service/shield/application_layer_automatic_response_test.go index 76198e4456a..85f26c2a6c5 100644 --- a/internal/service/shield/application_layer_automatic_response_test.go +++ b/internal/service/shield/application_layer_automatic_response_test.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" tfshield "github.com/hashicorp/terraform-provider-aws/internal/service/shield" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) func TestAccShieldApplicationLayerAutomaticResponse_basic(t *testing.T) { @@ -37,7 +38,7 @@ func TestAccShieldApplicationLayerAutomaticResponse_basic(t *testing.T) { Config: testAccApplicationLayerAutomaticResponseConfig_basic(rName, "COUNT"), Check: resource.ComposeTestCheckFunc( testAccCheckApplicationLayerAutomaticResponseExists(ctx, resourceName, &applicationlayerautomaticresponse), - resource.TestCheckResourceAttr(resourceName, "action", "COUNT"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "COUNT"), ), }, { @@ -49,7 +50,7 @@ func TestAccShieldApplicationLayerAutomaticResponse_basic(t *testing.T) { Config: testAccApplicationLayerAutomaticResponseConfig_basic(rName, "BLOCK"), Check: resource.ComposeTestCheckFunc( testAccCheckApplicationLayerAutomaticResponseExists(ctx, resourceName, &applicationlayerautomaticresponse), - resource.TestCheckResourceAttr(resourceName, "action", "BLOCK"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "BLOCK"), ), }, }, From b7f048fc381af6b42fd16752e51b43e82ddf0060 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:39 -0400 Subject: [PATCH 0920/1490] signer: Use constant for action strings --- internal/service/signer/signing_profile_permission.go | 7 ++++--- internal/service/signer/signing_profile_permission_test.go | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/service/signer/signing_profile_permission.go b/internal/service/signer/signing_profile_permission.go index 2f5dde56dcf..92436e37fe6 100644 --- a/internal/service/signer/signing_profile_permission.go +++ b/internal/service/signer/signing_profile_permission.go @@ -23,6 +23,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_signer_signing_profile_permission") @@ -37,7 +38,7 @@ func ResourceSigningProfilePermission() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -108,7 +109,7 @@ func resourceSigningProfilePermissionCreate(ctx context.Context, d *schema.Resou statementID := create.Name(d.Get("statement_id").(string), d.Get("statement_id_prefix").(string)) input := &signer.AddProfilePermissionInput{ - Action: aws.String(d.Get("action").(string)), + Action: aws.String(d.Get(names.AttrAction).(string)), Principal: aws.String(d.Get("principal").(string)), ProfileName: aws.String(profileName), RevisionId: aws.String(revisionID), @@ -168,7 +169,7 @@ func resourceSigningProfilePermissionRead(ctx context.Context, d *schema.Resourc return sdkdiag.AppendErrorf(diags, "reading Signer Signing Profile Permission (%s): %s", d.Id(), err) } - d.Set("action", permission.Action) + d.Set(names.AttrAction, permission.Action) d.Set("principal", permission.Principal) d.Set("profile_version", permission.ProfileVersion) d.Set("statement_id", permission.StatementId) diff --git a/internal/service/signer/signing_profile_permission_test.go b/internal/service/signer/signing_profile_permission_test.go index 488538ff3e9..1e61971186c 100644 --- a/internal/service/signer/signing_profile_permission_test.go +++ b/internal/service/signer/signing_profile_permission_test.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" tfsigner "github.com/hashicorp/terraform-provider-aws/internal/service/signer" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) func TestAccSignerSigningProfilePermission_basic(t *testing.T) { @@ -38,7 +39,7 @@ func TestAccSignerSigningProfilePermission_basic(t *testing.T) { Destroy: false, Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSigningProfilePermissionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "action", "signer:StartSigningJob"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "signer:StartSigningJob"), resource.TestCheckResourceAttr(resourceName, "profile_version", ""), resource.TestCheckResourceAttr(resourceName, "statement_id", rName), resource.TestCheckResourceAttr(resourceName, "statement_id_prefix", ""), @@ -163,14 +164,14 @@ func TestAccSignerSigningProfilePermission_getSigningProfile(t *testing.T) { Config: testAccSigningProfilePermissionConfig_getSP(rName), Check: resource.ComposeTestCheckFunc( testAccCheckSigningProfilePermissionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "action", "signer:GetSigningProfile"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "signer:GetSigningProfile"), ), }, { Config: testAccSigningProfilePermissionConfig_revokeSignature(rName), Check: resource.ComposeTestCheckFunc( testAccCheckSigningProfilePermissionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "action", "signer:RevokeSignature"), + resource.TestCheckResourceAttr(resourceName, names.AttrAction, "signer:RevokeSignature"), ), }, }, From b5f7bf4d851f12013e1ecf5cd4d6ea25666b1920 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:39 -0400 Subject: [PATCH 0921/1490] ssmincidents: Use constant for action strings --- internal/service/ssmincidents/helper.go | 2 +- internal/service/ssmincidents/response_plan.go | 8 ++++---- .../service/ssmincidents/response_plan_data_source.go | 2 +- internal/service/ssmincidents/ssmincidents_test.go | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/service/ssmincidents/helper.go b/internal/service/ssmincidents/helper.go index c3fdcd5cd58..1093eb0902a 100644 --- a/internal/service/ssmincidents/helper.go +++ b/internal/service/ssmincidents/helper.go @@ -32,7 +32,7 @@ func setResponsePlanResourceData( d *schema.ResourceData, getResponsePlanOutput *ssmincidents.GetResponsePlanOutput, ) (*schema.ResourceData, error) { - if err := d.Set("action", flattenAction(getResponsePlanOutput.Actions)); err != nil { + if err := d.Set(names.AttrAction, flattenAction(getResponsePlanOutput.Actions)); err != nil { return d, err } if err := d.Set(names.AttrARN, getResponsePlanOutput.Arn); err != nil { diff --git a/internal/service/ssmincidents/response_plan.go b/internal/service/ssmincidents/response_plan.go index ed8340d3498..abd70719c0a 100644 --- a/internal/service/ssmincidents/response_plan.go +++ b/internal/service/ssmincidents/response_plan.go @@ -36,7 +36,7 @@ func ResourceResponsePlan() *schema.Resource { DeleteWithoutTimeout: resourceResponsePlanDelete, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -197,7 +197,7 @@ func resourceResponsePlanCreate(ctx context.Context, d *schema.ResourceData, met client := meta.(*conns.AWSClient).SSMIncidentsClient(ctx) input := &ssmincidents.CreateResponsePlanInput{ - Actions: expandAction(d.Get("action").([]interface{})), + Actions: expandAction(d.Get(names.AttrAction).([]interface{})), ChatChannel: expandChatChannel(d.Get("chat_channel").(*schema.Set)), DisplayName: aws.String(d.Get("display_name").(string)), Engagements: flex.ExpandStringValueSet(d.Get("engagements").(*schema.Set)), @@ -252,8 +252,8 @@ func resourceResponsePlanUpdate(ctx context.Context, d *schema.ResourceData, met Arn: aws.String(d.Id()), } - if d.HasChanges("action") { - input.Actions = expandAction(d.Get("action").([]interface{})) + if d.HasChanges(names.AttrAction) { + input.Actions = expandAction(d.Get(names.AttrAction).([]interface{})) } if d.HasChanges("chat_channel") { diff --git a/internal/service/ssmincidents/response_plan_data_source.go b/internal/service/ssmincidents/response_plan_data_source.go index 18ae3196044..a5c3553b5f2 100644 --- a/internal/service/ssmincidents/response_plan_data_source.go +++ b/internal/service/ssmincidents/response_plan_data_source.go @@ -20,7 +20,7 @@ func DataSourceResponsePlan() *schema.Resource { ReadWithoutTimeout: dataSourceResponsePlanRead, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ diff --git a/internal/service/ssmincidents/ssmincidents_test.go b/internal/service/ssmincidents/ssmincidents_test.go index 848715775f5..da3fffdc268 100644 --- a/internal/service/ssmincidents/ssmincidents_test.go +++ b/internal/service/ssmincidents/ssmincidents_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/hashicorp/terraform-provider-aws/internal/acctest" + "github.com/hashicorp/terraform-provider-aws/names" ) // only one replication set resource can be active at once, so we must have serialised tests @@ -35,7 +36,7 @@ func TestAccSSMIncidents_serial(t *testing.T) { "displayName": testResponsePlan_displayName, "chatChannel": testResponsePlan_chatChannel, "engagement": testResponsePlan_engagement, - "action": testResponsePlan_action, + names.AttrAction: testResponsePlan_action, }, "Response Plan Data Source Tests": { "basic": testResponsePlanDataSource_basic, From 95c70a4e95a7ce2213b3379aeaa7e99bb3c9362c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:40 -0400 Subject: [PATCH 0922/1490] vpclattice: Use constant for action strings --- internal/service/vpclattice/listener_rule.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/vpclattice/listener_rule.go b/internal/service/vpclattice/listener_rule.go index d71dce4799c..bf45f5e7d30 100644 --- a/internal/service/vpclattice/listener_rule.go +++ b/internal/service/vpclattice/listener_rule.go @@ -61,7 +61,7 @@ func ResourceListenerRule() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, MaxItems: 1, Required: true, @@ -254,7 +254,7 @@ func resourceListenerRuleCreate(ctx context.Context, d *schema.ResourceData, met name := d.Get(names.AttrName).(string) in := &vpclattice.CreateRuleInput{ - Action: expandRuleAction(d.Get("action").([]interface{})[0].(map[string]interface{})), + Action: expandRuleAction(d.Get(names.AttrAction).([]interface{})[0].(map[string]interface{})), ClientToken: aws.String(id.UniqueId()), ListenerIdentifier: aws.String(d.Get("listener_identifier").(string)), Match: expandRuleMatch(d.Get("match").([]interface{})[0].(map[string]interface{})), @@ -317,7 +317,7 @@ func resourceListenerRuleRead(ctx context.Context, d *schema.ResourceData, meta d.Set("service_identifier", serviceId) d.Set("rule_id", out.Id) - if err := d.Set("action", []interface{}{flattenRuleAction(out.Action)}); err != nil { + if err := d.Set(names.AttrAction, []interface{}{flattenRuleAction(out.Action)}); err != nil { return create.DiagError(names.VPCLattice, create.ErrActionSetting, ResNameListenerRule, d.Id(), err) } @@ -342,8 +342,8 @@ func resourceListenerRuleUpdate(ctx context.Context, d *schema.ResourceData, met ServiceIdentifier: aws.String(serviceId), } - if d.HasChange("action") { - if v, ok := d.GetOk("action"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if d.HasChange(names.AttrAction) { + if v, ok := d.GetOk(names.AttrAction); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { in.Action = expandRuleAction(v.([]interface{})[0].(map[string]interface{})) } } From d96552e75f69c0f4dfd9494f3d8af6120469a286 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:40 -0400 Subject: [PATCH 0923/1490] waf: Use constant for action strings --- internal/service/waf/flex.go | 4 ++-- internal/service/waf/helpers.go | 4 ++-- internal/service/waf/rule_group.go | 2 +- internal/service/waf/rule_group_test.go | 2 +- internal/service/waf/web_acl.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/waf/flex.go b/internal/service/waf/flex.go index 7a3b26bd0b1..a08a6dcf5a2 100644 --- a/internal/service/waf/flex.go +++ b/internal/service/waf/flex.go @@ -46,7 +46,7 @@ func ExpandWebACLUpdate(updateAction string, aclRule map[string]interface{}) *wa } default: rule = &waf.ActivatedRule{ - Action: ExpandAction(aclRule["action"].([]interface{})), + Action: ExpandAction(aclRule[names.AttrAction].([]interface{})), Priority: aws.Int64(int64(aclRule["priority"].(int))), RuleId: aws.String(aclRule["rule_id"].(string)), Type: aws.String(aclRule[names.AttrType].(string)), @@ -88,7 +88,7 @@ func FlattenWebACLRules(ts []*waf.ActivatedRule) []map[string]interface{} { actionMap := map[string]interface{}{ names.AttrType: aws.StringValue(r.Action.Type), } - m["action"] = []map[string]interface{}{actionMap} + m[names.AttrAction] = []map[string]interface{}{actionMap} } m["priority"] = int(aws.Int64Value(r.Priority)) diff --git a/internal/service/waf/helpers.go b/internal/service/waf/helpers.go index 2f875908654..aeacbe63775 100644 --- a/internal/service/waf/helpers.go +++ b/internal/service/waf/helpers.go @@ -262,7 +262,7 @@ func FlattenActivatedRules(activatedRules []*waf.ActivatedRule) []interface{} { names.AttrType: aws.StringValue(ar.Type), } if ar.Action != nil { - rule["action"] = []interface{}{ + rule[names.AttrAction] = []interface{}{ map[string]interface{}{ names.AttrType: aws.StringValue(ar.Action.Type), }, @@ -280,7 +280,7 @@ func ExpandActivatedRule(rule map[string]interface{}) *waf.ActivatedRule { Type: aws.String(rule[names.AttrType].(string)), } - if a, ok := rule["action"].([]interface{}); ok && len(a) > 0 { + if a, ok := rule[names.AttrAction].([]interface{}); ok && len(a) > 0 { m := a[0].(map[string]interface{}) r.Action = &waf.WafAction{ Type: aws.String(m[names.AttrType].(string)), diff --git a/internal/service/waf/rule_group.go b/internal/service/waf/rule_group.go index cd3ad6f6831..bb533dbdaa3 100644 --- a/internal/service/waf/rule_group.go +++ b/internal/service/waf/rule_group.go @@ -50,7 +50,7 @@ func ResourceRuleGroup() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, MaxItems: 1, Required: true, diff --git a/internal/service/waf/rule_group_test.go b/internal/service/waf/rule_group_test.go index f73cbe3641b..854bc01d63e 100644 --- a/internal/service/waf/rule_group_test.go +++ b/internal/service/waf/rule_group_test.go @@ -212,7 +212,7 @@ func computeActivatedRuleWithRuleId(rule *waf.Rule, actionType string, priority ruleResource := tfwaf.ResourceRuleGroup().SchemaMap()["activated_rule"].Elem.(*schema.Resource) m := map[string]interface{}{ - "action": []interface{}{ + names.AttrAction: []interface{}{ map[string]interface{}{ names.AttrType: actionType, }, diff --git a/internal/service/waf/web_acl.go b/internal/service/waf/web_acl.go index 0eb1229ce0b..451bee5f479 100644 --- a/internal/service/waf/web_acl.go +++ b/internal/service/waf/web_acl.go @@ -107,7 +107,7 @@ func ResourceWebACL() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Optional: true, MaxItems: 1, From 254efc9b443eea6269e7f221d4519ba75af290e2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:40 -0400 Subject: [PATCH 0924/1490] wafregional: Use constant for action strings --- internal/service/wafregional/rule_group.go | 2 +- internal/service/wafregional/rule_group_test.go | 2 +- internal/service/wafregional/web_acl.go | 2 +- internal/service/wafregional/web_acl_test.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/wafregional/rule_group.go b/internal/service/wafregional/rule_group.go index 6614ae5e040..c6ace4277e6 100644 --- a/internal/service/wafregional/rule_group.go +++ b/internal/service/wafregional/rule_group.go @@ -53,7 +53,7 @@ func resourceRuleGroup() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, MaxItems: 1, Required: true, diff --git a/internal/service/wafregional/rule_group_test.go b/internal/service/wafregional/rule_group_test.go index 852eab17b4e..2a8a2ad07c8 100644 --- a/internal/service/wafregional/rule_group_test.go +++ b/internal/service/wafregional/rule_group_test.go @@ -485,7 +485,7 @@ func computeActivatedRuleWithRuleId(rule *waf.Rule, actionType string, priority ruleResource := tfwafregional.ResourceRuleGroup().SchemaMap()["activated_rule"].Elem.(*schema.Resource) m := map[string]interface{}{ - "action": []interface{}{ + names.AttrAction: []interface{}{ map[string]interface{}{ names.AttrType: actionType, }, diff --git a/internal/service/wafregional/web_acl.go b/internal/service/wafregional/web_acl.go index 13da60662cf..226016556fd 100644 --- a/internal/service/wafregional/web_acl.go +++ b/internal/service/wafregional/web_acl.go @@ -115,7 +115,7 @@ func resourceWebACL() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Optional: true, MaxItems: 1, diff --git a/internal/service/wafregional/web_acl_test.go b/internal/service/wafregional/web_acl_test.go index ed2cdc64542..9fe28f57c68 100644 --- a/internal/service/wafregional/web_acl_test.go +++ b/internal/service/wafregional/web_acl_test.go @@ -416,7 +416,7 @@ func computeWebACLRuleIndex(ruleId **string, priority int, ruleType string, acti "rule_id": **ruleId, names.AttrType: ruleType, "priority": priority, - "action": []interface{}{actionMap}, + names.AttrAction: []interface{}{actionMap}, "override_action": []interface{}{}, } From aad05675b124053c6d7319c6ada2bf9671100f0d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:14:41 -0400 Subject: [PATCH 0925/1490] wafv2: Use constant for action strings --- internal/service/wafv2/flex.go | 8 ++++---- internal/service/wafv2/rule_group.go | 2 +- internal/service/wafv2/web_acl.go | 2 +- internal/service/wafv2/web_acl_logging_configuration.go | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/wafv2/flex.go b/internal/service/wafv2/flex.go index 78487e149fd..5f59ae2846f 100644 --- a/internal/service/wafv2/flex.go +++ b/internal/service/wafv2/flex.go @@ -31,7 +31,7 @@ func expandRules(l []interface{}) []awstypes.Rule { func expandRule(m map[string]interface{}) awstypes.Rule { rule := awstypes.Rule{ - Action: expandRuleAction(m["action"].([]interface{})), + Action: expandRuleAction(m[names.AttrAction].([]interface{})), CaptchaConfig: expandCaptchaConfig(m["captcha_config"].([]interface{})), Name: aws.String(m[names.AttrName].(string)), Priority: int32(m["priority"].(int)), @@ -993,7 +993,7 @@ func expandWebACLRules(l []interface{}) []awstypes.Rule { func expandWebACLRule(m map[string]interface{}) awstypes.Rule { rule := awstypes.Rule{ - Action: expandRuleAction(m["action"].([]interface{})), + Action: expandRuleAction(m[names.AttrAction].([]interface{})), CaptchaConfig: expandCaptchaConfig(m["captcha_config"].([]interface{})), Name: aws.String(m[names.AttrName].(string)), OverrideAction: expandOverrideAction(m["override_action"].([]interface{})), @@ -1638,7 +1638,7 @@ func flattenRules(r []awstypes.Rule) interface{} { out := make([]map[string]interface{}, len(r)) for i, rule := range r { m := make(map[string]interface{}) - m["action"] = flattenRuleAction(rule.Action) + m[names.AttrAction] = flattenRuleAction(rule.Action) m["captcha_config"] = flattenCaptchaConfig(rule.CaptchaConfig) m[names.AttrName] = aws.ToString(rule.Name) m["priority"] = rule.Priority @@ -2485,7 +2485,7 @@ func flattenWebACLRules(r []awstypes.Rule) interface{} { out := make([]map[string]interface{}, len(r)) for i, rule := range r { m := make(map[string]interface{}) - m["action"] = flattenRuleAction(rule.Action) + m[names.AttrAction] = flattenRuleAction(rule.Action) m["captcha_config"] = flattenCaptchaConfig(rule.CaptchaConfig) m["override_action"] = flattenOverrideAction(rule.OverrideAction) m[names.AttrName] = aws.ToString(rule.Name) diff --git a/internal/service/wafv2/rule_group.go b/internal/service/wafv2/rule_group.go index f89dd0e2d1b..ad2757ae724 100644 --- a/internal/service/wafv2/rule_group.go +++ b/internal/service/wafv2/rule_group.go @@ -109,7 +109,7 @@ func resourceRuleGroup() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Required: true, MaxItems: 1, diff --git a/internal/service/wafv2/web_acl.go b/internal/service/wafv2/web_acl.go index 5496894f502..0d70895cd23 100644 --- a/internal/service/wafv2/web_acl.go +++ b/internal/service/wafv2/web_acl.go @@ -111,7 +111,7 @@ func resourceWebACL() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeList, Optional: true, MaxItems: 1, diff --git a/internal/service/wafv2/web_acl_logging_configuration.go b/internal/service/wafv2/web_acl_logging_configuration.go index 512916caf6a..9ac22a231d8 100644 --- a/internal/service/wafv2/web_acl_logging_configuration.go +++ b/internal/service/wafv2/web_acl_logging_configuration.go @@ -87,7 +87,7 @@ func resourceWebACLLoggingConfiguration() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "action": { + names.AttrAction: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[awstypes.ActionValue](), @@ -385,7 +385,7 @@ func expandActionCondition(l []interface{}) *awstypes.ActionCondition { condition := &awstypes.ActionCondition{} - if v, ok := tfMap["action"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrAction].(string); ok && v != "" { condition.Action = awstypes.ActionValue(v) } @@ -505,7 +505,7 @@ func flattenActionCondition(a *awstypes.ActionCondition) []interface{} { } m := map[string]interface{}{ - "action": string(a.Action), + names.AttrAction: string(a.Action), } return []interface{}{m} From fc1ec6b4f8cd82d120c7f4f716044463cbd82a42 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:48 -0400 Subject: [PATCH 0926/1490] ci: Prefer constant for string literal "source" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 61f9c3ff33c..bcf144874d4 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1335,3 +1335,13 @@ rules: - pattern: '"action"' severity: ERROR fix: "names.AttrAction" + - id: literal-source-string-constant + languages: [go] + message: Use the constant `names.AttrSource` for the string literal "source" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"source"' + severity: ERROR + fix: "names.AttrSource" From 1eed67704d32a05e2ad1766dc07666164a096d9f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:48 -0400 Subject: [PATCH 0927/1490] names: Add constant for string literal "source" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 03c9b71f500..63098ee4d4c 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -59,6 +59,7 @@ const ( AttrSharedConfigFiles = "shared_config_files" AttrSkipCredentialsValidation = "skip_credentials_validation" AttrSkipRequestingAccountID = "skip_requesting_account_id" + AttrSource = "source" AttrState = "state" AttrStatus = "status" AttrSubnetID = "subnet_id" From 60c98df8a8272560b170ccf3a901567503be16bb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:48 -0400 Subject: [PATCH 0928/1490] amp: Use constant for source strings --- internal/service/amp/scraper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/amp/scraper.go b/internal/service/amp/scraper.go index 29f90c64ddd..ad68dfe711f 100644 --- a/internal/service/amp/scraper.go +++ b/internal/service/amp/scraper.go @@ -121,7 +121,7 @@ func (r *scraperResource) Schema(ctx context.Context, req resource.SchemaRequest }, }, }, - "source": schema.ListNestedBlock{ + names.AttrSource: schema.ListNestedBlock{ CustomType: fwtypes.NewListNestedObjectTypeOf[scraperSourceModel](ctx), Validators: []validator.List{ listvalidator.SizeAtLeast(1), From 68466a767b6313604dcf647ebade4fe8af617ebb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:48 -0400 Subject: [PATCH 0929/1490] amplify: Use constant for source strings --- internal/service/amplify/app.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/amplify/app.go b/internal/service/amplify/app.go index b48a307e4fc..bb94657b57a 100644 --- a/internal/service/amplify/app.go +++ b/internal/service/amplify/app.go @@ -186,7 +186,7 @@ func resourceApp() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(1, 2048), }, - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 2048), @@ -700,7 +700,7 @@ func expandCustomRule(tfMap map[string]interface{}) *types.CustomRule { apiObject.Condition = aws.String(v) } - if v, ok := tfMap["source"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrSource].(string); ok && v != "" { apiObject.Source = aws.String(v) } @@ -749,7 +749,7 @@ func flattenCustomRule(apiObject types.CustomRule) map[string]interface{} { } if v := apiObject.Source; v != nil { - tfMap["source"] = aws.ToString(v) + tfMap[names.AttrSource] = aws.ToString(v) } if v := apiObject.Status; v != nil { From 74105f86d9ad4ea5a92d2a2a81ed257a8831015f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:49 -0400 Subject: [PATCH 0930/1490] appintegrations: Use constant for source strings --- internal/service/appintegrations/event_integration.go | 6 +++--- .../appintegrations/event_integration_data_source.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/appintegrations/event_integration.go b/internal/service/appintegrations/event_integration.go index c07c5a53a84..a9f748aceb9 100644 --- a/internal/service/appintegrations/event_integration.go +++ b/internal/service/appintegrations/event_integration.go @@ -57,7 +57,7 @@ func ResourceEventIntegration() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -207,7 +207,7 @@ func expandEventFilter(eventFilter []interface{}) *awstypes.EventFilter { } result := &awstypes.EventFilter{ - Source: aws.String(tfMap["source"].(string)), + Source: aws.String(tfMap[names.AttrSource].(string)), } return result @@ -219,7 +219,7 @@ func flattenEventFilter(eventFilter *awstypes.EventFilter) []interface{} { } values := map[string]interface{}{ - "source": aws.ToString(eventFilter.Source), + names.AttrSource: aws.ToString(eventFilter.Source), } return []interface{}{values} diff --git a/internal/service/appintegrations/event_integration_data_source.go b/internal/service/appintegrations/event_integration_data_source.go index 24e765a4d24..e5b0dd6cf6f 100644 --- a/internal/service/appintegrations/event_integration_data_source.go +++ b/internal/service/appintegrations/event_integration_data_source.go @@ -35,7 +35,7 @@ func DataSourceEventIntegration() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "source": { + names.AttrSource: { Type: schema.TypeString, Computed: true, }, From c2bf7134885311a0dbd5612480771c87ef3aa3b6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:49 -0400 Subject: [PATCH 0931/1490] ce: Use constant for source strings --- internal/service/ce/cost_category.go | 6 +++--- internal/service/ce/cost_category_data_source.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/ce/cost_category.go b/internal/service/ce/cost_category.go index bc439739a44..5b361a7628e 100644 --- a/internal/service/ce/cost_category.go +++ b/internal/service/ce/cost_category.go @@ -153,7 +153,7 @@ func resourceCostCategory() *schema.Resource { }, }, }, - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(0, 1024), @@ -637,7 +637,7 @@ func expandTagValues(tfMap map[string]interface{}) *awstypes.TagValues { func expandCostCategorySplitChargeRule(tfMap map[string]interface{}) *awstypes.CostCategorySplitChargeRule { apiObject := &awstypes.CostCategorySplitChargeRule{ Method: awstypes.CostCategorySplitChargeMethod(tfMap["method"].(string)), - Source: aws.String(tfMap["source"].(string)), + Source: aws.String(tfMap[names.AttrSource].(string)), Targets: flex.ExpandStringValueSet(tfMap["targets"].(*schema.Set)), } if v, ok := tfMap["parameter"]; ok { @@ -848,7 +848,7 @@ func flattenCostCategorySplitChargeRule(apiObject *awstypes.CostCategorySplitCha tfMap := map[string]interface{}{} tfMap["method"] = string(apiObject.Method) tfMap["parameter"] = flattenCostCategorySplitChargeRuleParameters(apiObject.Parameters) - tfMap["source"] = aws.ToString(apiObject.Source) + tfMap[names.AttrSource] = aws.ToString(apiObject.Source) tfMap["targets"] = apiObject.Targets return tfMap diff --git a/internal/service/ce/cost_category_data_source.go b/internal/service/ce/cost_category_data_source.go index ff885315d1a..3d32843d43f 100644 --- a/internal/service/ce/cost_category_data_source.go +++ b/internal/service/ce/cost_category_data_source.go @@ -114,7 +114,7 @@ func dataSourceCostCategory() *schema.Resource { }, }, }, - "source": { + names.AttrSource: { Type: schema.TypeString, Computed: true, }, From b95b231fd523de6e0bcf0805523f287efb7e33b8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:49 -0400 Subject: [PATCH 0932/1490] codebuild: Use constant for source strings --- internal/service/codebuild/project.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/codebuild/project.go b/internal/service/codebuild/project.go index 38db52bb52b..3916686e2e1 100644 --- a/internal/service/codebuild/project.go +++ b/internal/service/codebuild/project.go @@ -593,7 +593,7 @@ func resourceProject() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "source": { + names.AttrSource: { Type: schema.TypeList, MaxItems: 1, Required: true, @@ -717,7 +717,7 @@ func resourceProjectCreate(ctx context.Context, d *schema.ResourceData, meta int conn := meta.(*conns.AWSClient).CodeBuildClient(ctx) var projectSource *types.ProjectSource - if v, ok := d.GetOk("source"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrSource); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { projectSource = expandProjectSource(v.([]interface{})[0].(map[string]interface{})) } @@ -907,11 +907,11 @@ func resourceProjectRead(ctx context.Context, d *schema.ResourceData, meta inter } d.Set("service_role", project.ServiceRole) if project.Source != nil { - if err := d.Set("source", []interface{}{flattenProjectSource(project.Source)}); err != nil { + if err := d.Set(names.AttrSource, []interface{}{flattenProjectSource(project.Source)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting source: %s", err) } } else { - d.Set("source", nil) + d.Set(names.AttrSource, nil) } d.Set("source_version", project.SourceVersion) if err := d.Set("vpc_config", flattenVPCConfig(project.VpcConfig)); err != nil { @@ -1037,8 +1037,8 @@ func resourceProjectUpdate(ctx context.Context, d *schema.ResourceData, meta int input.ServiceRole = aws.String(d.Get("service_role").(string)) } - if d.HasChange("source") { - if v, ok := d.GetOk("source"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if d.HasChange(names.AttrSource) { + if v, ok := d.GetOk(names.AttrSource); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.Source = expandProjectSource(v.([]interface{})[0].(map[string]interface{})) } } From be3acb7635a55a162101c57572a7b0a1ed8901b1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:49 -0400 Subject: [PATCH 0933/1490] configservice: Use constant for source strings --- internal/service/configservice/config_rule.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/configservice/config_rule.go b/internal/service/configservice/config_rule.go index d0b130bab13..9ce761f3714 100644 --- a/internal/service/configservice/config_rule.go +++ b/internal/service/configservice/config_rule.go @@ -120,7 +120,7 @@ func resourceConfigRule() *schema.Resource { }, }, }, - "source": { + names.AttrSource: { Type: schema.TypeList, MaxItems: 1, Required: true, @@ -230,7 +230,7 @@ func resourceConfigRulePut(ctx context.Context, d *schema.ResourceData, meta int configRule.Scope = expandScope(v.([]interface{})[0].(map[string]interface{})) } - if v, ok := d.GetOk("source"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrSource); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { configRule.Source = expandSource(v.([]interface{})[0].(map[string]interface{})) } @@ -291,7 +291,7 @@ func resourceConfigRuleRead(ctx context.Context, d *schema.ResourceData, meta in rule.Source.CustomPolicyDetails.PolicyText = aws.String(v.(string)) } } - if err := d.Set("source", flattenSource(rule.Source)); err != nil { + if err := d.Set(names.AttrSource, flattenSource(rule.Source)); err != nil { return sdkdiag.AppendErrorf(diags, "setting source: %s", err) } From 0ffee8a3732b0ac74855e95d98fb6d2d14aa8e83 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:49 -0400 Subject: [PATCH 0934/1490] dms: Use constant for source strings --- internal/service/dms/s3_endpoint_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/dms/s3_endpoint_test.go b/internal/service/dms/s3_endpoint_test.go index a466877e5cc..e26f2fd30f5 100644 --- a/internal/service/dms/s3_endpoint_test.go +++ b/internal/service/dms/s3_endpoint_test.go @@ -284,7 +284,7 @@ func TestAccDMSS3Endpoint_sourceSimple(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_statistics", "true"), resource.TestCheckResourceAttr(resourceName, "encoding_type", ""), resource.TestCheckResourceAttr(resourceName, "endpoint_id", rName), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "source"), + resource.TestCheckResourceAttr(resourceName, "endpoint_type", names.AttrSource), resource.TestCheckResourceAttr(resourceName, "expected_bucket_owner", ""), 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", "0"), @@ -333,7 +333,7 @@ func TestAccDMSS3Endpoint_source(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "csv_delimiter", ";"), resource.TestCheckResourceAttr(resourceName, "csv_row_delimiter", "\\r\\n"), resource.TestCheckResourceAttr(resourceName, "endpoint_id", rName), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "source"), + resource.TestCheckResourceAttr(resourceName, "endpoint_type", names.AttrSource), resource.TestCheckResourceAttr(resourceName, "ignore_header_rows", "1"), resource.TestCheckResourceAttr(resourceName, "rfc_4180", "false"), resource.TestCheckResourceAttrPair(resourceName, "service_access_role_arn", "aws_iam_role.test", names.AttrARN), @@ -369,7 +369,7 @@ func TestAccDMSS3Endpoint_source(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "csv_delimiter", ","), resource.TestCheckResourceAttr(resourceName, "csv_row_delimiter", "\\n"), resource.TestCheckResourceAttr(resourceName, "endpoint_id", rName), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "source"), + resource.TestCheckResourceAttr(resourceName, "endpoint_type", names.AttrSource), resource.TestCheckResourceAttr(resourceName, "ignore_header_rows", "1"), resource.TestCheckResourceAttr(resourceName, "rfc_4180", "true"), resource.TestCheckResourceAttrPair(resourceName, "service_access_role_arn", "aws_iam_role.test", names.AttrARN), From 9e5a6d4c97f733cb9da14737fcfcb90fd7fc6bfd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:49 -0400 Subject: [PATCH 0935/1490] ec2: Use constant for source strings --- internal/service/ec2/vpc_network_insights_path.go | 6 +++--- .../service/ec2/vpc_network_insights_path_data_source.go | 4 ++-- .../ec2/vpc_network_insights_path_data_source_test.go | 2 +- internal/service/ec2/vpc_network_insights_path_test.go | 4 ++-- .../ec2/vpc_network_performance_metric_subscription.go | 7 ++++--- .../vpc_network_performance_metric_subscription_test.go | 2 +- internal/service/ec2/vpnsite_connection.go | 4 ++-- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/internal/service/ec2/vpc_network_insights_path.go b/internal/service/ec2/vpc_network_insights_path.go index 3e023c80d87..4c6a1ecb7d8 100644 --- a/internal/service/ec2/vpc_network_insights_path.go +++ b/internal/service/ec2/vpc_network_insights_path.go @@ -67,7 +67,7 @@ func ResourceNetworkInsightsPath() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringInSlice(ec2.Protocol_Values(), false), }, - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -99,7 +99,7 @@ func resourceNetworkInsightsPathCreate(ctx context.Context, d *schema.ResourceDa ClientToken: aws.String(id.UniqueId()), Destination: aws.String(d.Get("destination").(string)), Protocol: aws.String(d.Get(names.AttrProtocol).(string)), - Source: aws.String(d.Get("source").(string)), + Source: aws.String(d.Get(names.AttrSource).(string)), TagSpecifications: getTagSpecificationsIn(ctx, ec2.ResourceTypeNetworkInsightsPath), } @@ -149,7 +149,7 @@ func resourceNetworkInsightsPathRead(ctx context.Context, d *schema.ResourceData d.Set("destination_ip", nip.DestinationIp) d.Set("destination_port", nip.DestinationPort) d.Set(names.AttrProtocol, nip.Protocol) - d.Set("source", nip.Source) + d.Set(names.AttrSource, nip.Source) d.Set("source_arn", nip.SourceArn) d.Set("source_ip", nip.SourceIp) diff --git a/internal/service/ec2/vpc_network_insights_path_data_source.go b/internal/service/ec2/vpc_network_insights_path_data_source.go index 7cb33124aa7..975460683d5 100644 --- a/internal/service/ec2/vpc_network_insights_path_data_source.go +++ b/internal/service/ec2/vpc_network_insights_path_data_source.go @@ -53,7 +53,7 @@ func DataSourceNetworkInsightsPath() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "source": { + names.AttrSource: { Type: schema.TypeString, Computed: true, }, @@ -106,7 +106,7 @@ func dataSourceNetworkInsightsPathRead(ctx context.Context, d *schema.ResourceDa d.Set("destination_port", nip.DestinationPort) d.Set("network_insights_path_id", networkInsightsPathID) d.Set(names.AttrProtocol, nip.Protocol) - d.Set("source", nip.Source) + d.Set(names.AttrSource, nip.Source) d.Set("source_arn", nip.SourceArn) d.Set("source_ip", nip.SourceIp) diff --git a/internal/service/ec2/vpc_network_insights_path_data_source_test.go b/internal/service/ec2/vpc_network_insights_path_data_source_test.go index 25a3aeb0497..702da9cb6e5 100644 --- a/internal/service/ec2/vpc_network_insights_path_data_source_test.go +++ b/internal/service/ec2/vpc_network_insights_path_data_source_test.go @@ -34,7 +34,7 @@ func TestAccVPCNetworkInsightsPathDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "destination_port", resourceName, "destination_port"), resource.TestCheckResourceAttrPair(datasourceName, "network_insights_path_id", resourceName, names.AttrID), resource.TestCheckResourceAttrPair(datasourceName, names.AttrProtocol, resourceName, names.AttrProtocol), - resource.TestCheckResourceAttrPair(datasourceName, "source", resourceName, "source"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrSource, resourceName, names.AttrSource), resource.TestCheckResourceAttrPair(datasourceName, "source_arn", resourceName, "source_arn"), resource.TestCheckResourceAttrPair(datasourceName, "source_ip", resourceName, "source_ip"), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), diff --git a/internal/service/ec2/vpc_network_insights_path_test.go b/internal/service/ec2/vpc_network_insights_path_test.go index df94e09e516..fb0e780babc 100644 --- a/internal/service/ec2/vpc_network_insights_path_test.go +++ b/internal/service/ec2/vpc_network_insights_path_test.go @@ -40,7 +40,7 @@ func TestAccVPCNetworkInsightsPath_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "destination_ip", ""), resource.TestCheckResourceAttr(resourceName, "destination_port", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrProtocol, "tcp"), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_network_interface.test.0", names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_network_interface.test.0", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "source_arn", "aws_network_interface.test.0", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_ip", ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -140,7 +140,7 @@ func TestAccVPCNetworkInsightsPath_sourceAndDestinationARN(t *testing.T) { testAccCheckNetworkInsightsPathExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, "destination", "aws_network_interface.test.1", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "destination_arn", "aws_network_interface.test.1", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_network_interface.test.0", names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_network_interface.test.0", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "source_arn", "aws_network_interface.test.0", names.AttrARN), ), }, diff --git a/internal/service/ec2/vpc_network_performance_metric_subscription.go b/internal/service/ec2/vpc_network_performance_metric_subscription.go index 51c202345d4..0c8fefdb2c2 100644 --- a/internal/service/ec2/vpc_network_performance_metric_subscription.go +++ b/internal/service/ec2/vpc_network_performance_metric_subscription.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/enum" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_vpc_network_performance_metric_subscription") @@ -44,7 +45,7 @@ func ResourceNetworkPerformanceMetricSubscription() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -65,7 +66,7 @@ func resourceNetworkPerformanceMetricSubscriptionCreate(ctx context.Context, d * conn := meta.(*conns.AWSClient).EC2Client(ctx) - source := d.Get("source").(string) + source := d.Get(names.AttrSource).(string) destination := d.Get("destination").(string) metric := d.Get("metric").(string) statistic := d.Get("statistic").(string) @@ -114,7 +115,7 @@ func resourceNetworkPerformanceMetricSubscriptionRead(ctx context.Context, d *sc d.Set("destination", subscription.Destination) d.Set("metric", subscription.Metric) d.Set("period", subscription.Period) - d.Set("source", subscription.Source) + d.Set(names.AttrSource, subscription.Source) d.Set("statistic", subscription.Statistic) return diags diff --git a/internal/service/ec2/vpc_network_performance_metric_subscription_test.go b/internal/service/ec2/vpc_network_performance_metric_subscription_test.go index 35ed1c1ffcb..90b44322cf4 100644 --- a/internal/service/ec2/vpc_network_performance_metric_subscription_test.go +++ b/internal/service/ec2/vpc_network_performance_metric_subscription_test.go @@ -47,7 +47,7 @@ func testAccNetworkPerformanceMetricSubscription_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "destination", dst), resource.TestCheckResourceAttr(resourceName, "metric", "aggregate-latency"), resource.TestCheckResourceAttr(resourceName, "period", "five-minutes"), - resource.TestCheckResourceAttr(resourceName, "source", src), + resource.TestCheckResourceAttr(resourceName, names.AttrSource, src), resource.TestCheckResourceAttr(resourceName, "statistic", "p50"), ), }, diff --git a/internal/service/ec2/vpnsite_connection.go b/internal/service/ec2/vpnsite_connection.go index 078aa23b2e9..c24e8c14f15 100644 --- a/internal/service/ec2/vpnsite_connection.go +++ b/internal/service/ec2/vpnsite_connection.go @@ -111,7 +111,7 @@ func resourceVPNConnection() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "source": { + names.AttrSource: { Type: schema.TypeString, Computed: true, }, @@ -1441,7 +1441,7 @@ func flattenVPNStaticRoute(apiObject *ec2.VpnStaticRoute) map[string]interface{} } if v := apiObject.Source; v != nil { - tfMap["source"] = aws.StringValue(v) + tfMap[names.AttrSource] = aws.StringValue(v) } if v := apiObject.State; v != nil { From 31fa340f4d4d368e418748eaf1321b10275dacbf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:50 -0400 Subject: [PATCH 0936/1490] fis: Use constant for source strings --- internal/service/fis/experiment_template.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/fis/experiment_template.go b/internal/service/fis/experiment_template.go index 74152b872ab..135d536bdb0 100644 --- a/internal/service/fis/experiment_template.go +++ b/internal/service/fis/experiment_template.go @@ -182,7 +182,7 @@ func ResourceExperimentTemplate() *schema.Resource { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ValidateFunc: validExperimentTemplateStopConditionSource(), @@ -530,7 +530,7 @@ func expandExperimentTemplateStopConditions(l *schema.Set) []types.CreateExperim raw := m.(map[string]interface{}) config := types.CreateExperimentTemplateStopConditionInput{} - if v, ok := raw["source"].(string); ok && v != "" { + if v, ok := raw[names.AttrSource].(string); ok && v != "" { config.Source = aws.String(v) } @@ -607,7 +607,7 @@ func expandExperimentTemplateStopConditionsForUpdate(l *schema.Set) []types.Upda raw := m.(map[string]interface{}) config := types.UpdateExperimentTemplateStopConditionInput{} - if v, ok := raw["source"].(string); ok && v != "" { + if v, ok := raw[names.AttrSource].(string); ok && v != "" { config.Source = aws.String(v) } @@ -842,7 +842,7 @@ func flattenExperimentTemplateStopConditions(configured []types.ExperimentTempla for _, v := range configured { item := make(map[string]interface{}) - item["source"] = aws.ToString(v.Source) + item[names.AttrSource] = aws.ToString(v.Source) if aws.ToString(v.Value) != "" { item[names.AttrValue] = aws.ToString(v.Value) From 2be1fcfc838f45433e98d79f3996ec6042cbc626 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:50 -0400 Subject: [PATCH 0937/1490] glue: Use constant for source strings --- internal/service/glue/script_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/glue/script_data_source.go b/internal/service/glue/script_data_source.go index bb9c4f80c86..b45e46f9251 100644 --- a/internal/service/glue/script_data_source.go +++ b/internal/service/glue/script_data_source.go @@ -27,7 +27,7 @@ func DataSourceScript() *schema.Resource { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, }, @@ -159,7 +159,7 @@ func expandCodeGenEdges(l []interface{}) []*glue.CodeGenEdge { for _, mRaw := range l { m := mRaw.(map[string]interface{}) edge := &glue.CodeGenEdge{ - Source: aws.String(m["source"].(string)), + Source: aws.String(m[names.AttrSource].(string)), Target: aws.String(m["target"].(string)), } if v, ok := m["target_parameter"]; ok && v.(string) != "" { From ec66e8ed93899fc0f06e20cfac374c119579a3df Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:50 -0400 Subject: [PATCH 0938/1490] lexv2models: Use constant for source strings --- internal/service/lexv2models/slot_type.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/lexv2models/slot_type.go b/internal/service/lexv2models/slot_type.go index a1819fdb9ed..846be35395a 100644 --- a/internal/service/lexv2models/slot_type.go +++ b/internal/service/lexv2models/slot_type.go @@ -138,7 +138,7 @@ func (r *resourceSlotType) Schema(ctx context.Context, req resource.SchemaReques CustomType: fwtypes.NewListNestedObjectTypeOf[GrammarSlotTypeSetting](ctx), NestedObject: schema.NestedBlockObject{ Blocks: map[string]schema.Block{ - "source": schema.ListNestedBlock{ + names.AttrSource: schema.ListNestedBlock{ Validators: []validator.List{ listvalidator.SizeAtMost(1), }, From 45f7b8ca911a9857ccf72b89b447bc924fb523c5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:51 -0400 Subject: [PATCH 0939/1490] medialive: Use constant for source strings --- .../service/medialive/channel_encoder_settings_schema.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index 7627414704b..11ca58852e2 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -1298,7 +1298,7 @@ func channelEncoderSettingsSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[types.TimecodeConfigSource](), @@ -4876,7 +4876,7 @@ func expandChannelEncoderSettingsTimecodeConfig(tfList []interface{}) *types.Tim m := tfList[0].(map[string]interface{}) var config types.TimecodeConfig - if v, ok := m["source"].(string); ok && v != "" { + if v, ok := m[names.AttrSource].(string); ok && v != "" { config.Source = types.TimecodeConfigSource(v) } if v, ok := m["sync_threshold"].(int); ok && v != 0 { @@ -6639,7 +6639,7 @@ func flattenTimecodeConfig(in *types.TimecodeConfig) []interface{} { } m := map[string]interface{}{ - "source": string(in.Source), + names.AttrSource: string(in.Source), "sync_threshold": int(aws.ToInt32(in.SyncThreshold)), } From f36f4bfe085791d855c86088cc7b872cab45217f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:51 -0400 Subject: [PATCH 0940/1490] memorydb: Use constant for source strings --- internal/service/memorydb/snapshot.go | 4 ++-- internal/service/memorydb/snapshot_data_source.go | 4 ++-- internal/service/memorydb/snapshot_data_source_test.go | 2 +- internal/service/memorydb/snapshot_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/memorydb/snapshot.go b/internal/service/memorydb/snapshot.go index 8ec3214b213..4b5277eb04e 100644 --- a/internal/service/memorydb/snapshot.go +++ b/internal/service/memorydb/snapshot.go @@ -138,7 +138,7 @@ func ResourceSnapshot() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validateResourceNamePrefix(snapshotNameMaxLength - id.UniqueIDSuffixLength), }, - "source": { + names.AttrSource: { Type: schema.TypeString, Computed: true, }, @@ -210,7 +210,7 @@ func resourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrKMSKeyARN, snapshot.KmsKeyId) d.Set(names.AttrName, snapshot.Name) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.StringValue(snapshot.Name))) - d.Set("source", snapshot.Source) + d.Set(names.AttrSource, snapshot.Source) return diags } diff --git a/internal/service/memorydb/snapshot_data_source.go b/internal/service/memorydb/snapshot_data_source.go index fdfd3fd94f0..8e933c0df0b 100644 --- a/internal/service/memorydb/snapshot_data_source.go +++ b/internal/service/memorydb/snapshot_data_source.go @@ -98,7 +98,7 @@ func DataSourceSnapshot() *schema.Resource { Type: schema.TypeString, Required: true, }, - "source": { + names.AttrSource: { Type: schema.TypeString, Computed: true, }, @@ -130,7 +130,7 @@ func dataSourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("cluster_name", snapshot.ClusterConfiguration.Name) d.Set(names.AttrKMSKeyARN, snapshot.KmsKeyId) d.Set(names.AttrName, snapshot.Name) - d.Set("source", snapshot.Source) + d.Set(names.AttrSource, snapshot.Source) tags, err := listTags(ctx, conn, d.Get(names.AttrARN).(string)) diff --git a/internal/service/memorydb/snapshot_data_source_test.go b/internal/service/memorydb/snapshot_data_source_test.go index 55143d210d8..531810f3ebe 100644 --- a/internal/service/memorydb/snapshot_data_source_test.go +++ b/internal/service/memorydb/snapshot_data_source_test.go @@ -44,7 +44,7 @@ func TestAccMemoryDBSnapshotDataSource_basic(t *testing.T) { resource.TestCheckTypeSetElemAttrPair(dataSourceName, names.AttrKMSKeyARN, resourceName, names.AttrKMSKeyARN), resource.TestCheckTypeSetElemAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckTypeSetElemAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), - resource.TestCheckTypeSetElemAttrPair(dataSourceName, "source", resourceName, "source"), + resource.TestCheckTypeSetElemAttrPair(dataSourceName, names.AttrSource, resourceName, names.AttrSource), resource.TestCheckResourceAttr(dataSourceName, "tags.%", "1"), resource.TestCheckResourceAttr(dataSourceName, "tags.Test", "test"), ), diff --git a/internal/service/memorydb/snapshot_test.go b/internal/service/memorydb/snapshot_test.go index 0ac82a74f81..3662dff7f15 100644 --- a/internal/service/memorydb/snapshot_test.go +++ b/internal/service/memorydb/snapshot_test.go @@ -49,7 +49,7 @@ func TestAccMemoryDBSnapshot_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "cluster_name", rName), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyARN, ""), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "source", "manual"), + resource.TestCheckResourceAttr(resourceName, names.AttrSource, "manual"), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.Test", "test"), ), From 143edffb98e71a053a61701ea42824b571436b64 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:51 -0400 Subject: [PATCH 0941/1490] networkfirewall: Use constant for source strings --- internal/service/networkfirewall/rule_group.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/networkfirewall/rule_group.go b/internal/service/networkfirewall/rule_group.go index b357c70dfdd..4701d379e83 100644 --- a/internal/service/networkfirewall/rule_group.go +++ b/internal/service/networkfirewall/rule_group.go @@ -177,7 +177,7 @@ func ResourceRuleGroup() *schema.Resource { Required: true, ValidateFunc: validation.StringInSlice(networkfirewall.StatefulRuleProtocol_Values(), false), }, - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, }, @@ -275,7 +275,7 @@ func ResourceRuleGroup() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeInt}, }, - "source": { + names.AttrSource: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -697,7 +697,7 @@ func expandStatefulRuleHeader(l []interface{}) *networkfirewall.Header { if v, ok := tfMap[names.AttrProtocol].(string); ok && v != "" { header.Protocol = aws.String(v) } - if v, ok := tfMap["source"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrSource].(string); ok && v != "" { header.Source = aws.String(v) } if v, ok := tfMap["source_port"].(string); ok && v != "" { @@ -1014,7 +1014,7 @@ func expandMatchAttributes(l []interface{}) *networkfirewall.MatchAttributes { if v, ok := tfMap["protocols"].(*schema.Set); ok && v.Len() > 0 { matchAttributes.Protocols = flex.ExpandInt64Set(v) } - if v, ok := tfMap["source"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := tfMap[names.AttrSource].(*schema.Set); ok && v.Len() > 0 { matchAttributes.Sources = expandAddresses(v.List()) } if v, ok := tfMap["source_port"].(*schema.Set); ok && v.Len() > 0 { @@ -1262,7 +1262,7 @@ func flattenHeader(h *networkfirewall.Header) []interface{} { "destination_port": aws.StringValue(h.DestinationPort), "direction": aws.StringValue(h.Direction), names.AttrProtocol: aws.StringValue(h.Protocol), - "source": aws.StringValue(h.Source), + names.AttrSource: aws.StringValue(h.Source), "source_port": aws.StringValue(h.SourcePort), } @@ -1338,7 +1338,7 @@ func flattenMatchAttributes(ma *networkfirewall.MatchAttributes) []interface{} { "destination": flattenAddresses(ma.Destinations), "destination_port": flattenPortRanges(ma.DestinationPorts), "protocols": flex.FlattenInt64Set(ma.Protocols), - "source": flattenAddresses(ma.Sources), + names.AttrSource: flattenAddresses(ma.Sources), "source_port": flattenPortRanges(ma.SourcePorts), "tcp_flag": flattenTCPFlags(ma.TCPFlags), } From 7fd2af686061372b2af14fbe943c6a5c29851ce1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:51 -0400 Subject: [PATCH 0942/1490] pipes: Use constant for source strings --- internal/service/pipes/pipe.go | 6 +++--- internal/service/pipes/pipe_test.go | 24 ++++++++++----------- internal/service/pipes/target_parameters.go | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/pipes/pipe.go b/internal/service/pipes/pipe.go index 77c9b1b6ecf..14417570287 100644 --- a/internal/service/pipes/pipe.go +++ b/internal/service/pipes/pipe.go @@ -99,7 +99,7 @@ func resourcePipe() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -133,7 +133,7 @@ func resourcePipeCreate(ctx context.Context, d *schema.ResourceData, meta interf DesiredState: awstypes.RequestedPipeState(d.Get("desired_state").(string)), Name: aws.String(name), RoleArn: aws.String(d.Get(names.AttrRoleARN).(string)), - Source: aws.String(d.Get("source").(string)), + Source: aws.String(d.Get(names.AttrSource).(string)), Tags: getTagsIn(ctx), Target: aws.String(d.Get("target").(string)), } @@ -202,7 +202,7 @@ func resourcePipeRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set(names.AttrName, output.Name) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.ToString(output.Name))) d.Set(names.AttrRoleARN, output.RoleArn) - d.Set("source", output.Source) + d.Set(names.AttrSource, output.Source) if v := output.SourceParameters; !types.IsZero(v) { if err := d.Set("source_parameters", []interface{}{flattenPipeSourceParameters(v)}); err != nil { return diag.Errorf("setting source_parameters: %s", err) diff --git a/internal/service/pipes/pipe_test.go b/internal/service/pipes/pipe_test.go index f3723396b5a..f6c20f58961 100644 --- a/internal/service/pipes/pipe_test.go +++ b/internal/service/pipes/pipe_test.go @@ -51,7 +51,7 @@ func TestAccPipesPipe_basicSQS(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_sqs_queue.source", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_sqs_queue.source", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "0"), @@ -666,7 +666,7 @@ func TestAccPipesPipe_kinesisSourceAndTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_kinesis_stream.source", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_kinesis_stream.source", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "0"), @@ -719,7 +719,7 @@ func TestAccPipesPipe_kinesisSourceAndTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_kinesis_stream.source", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_kinesis_stream.source", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "0"), @@ -787,7 +787,7 @@ func TestAccPipesPipe_dynamoDBSourceCloudWatchLogsTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_dynamodb_table.source", "stream_arn"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_dynamodb_table.source", "stream_arn"), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "1"), @@ -859,7 +859,7 @@ func TestAccPipesPipe_activeMQSourceStepFunctionTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_mq_broker.source", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_mq_broker.source", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.0.batch_size", "100"), @@ -927,7 +927,7 @@ func TestAccPipesPipe_rabbitMQSourceEventBusTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_mq_broker.source", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_mq_broker.source", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "0"), @@ -985,7 +985,7 @@ func TestAccPipesPipe_mskSourceHTTPTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_msk_cluster.source", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_msk_cluster.source", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "0"), @@ -1061,7 +1061,7 @@ func TestAccPipesPipe_selfManagedKafkaSourceLambdaFunctionTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "source", "smk://test1:9092,test2:9092"), + resource.TestCheckResourceAttr(resourceName, names.AttrSource, "smk://test1:9092,test2:9092"), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "0"), @@ -1136,7 +1136,7 @@ func TestAccPipesPipe_sqsSourceRedshiftTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_sqs_queue.source", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_sqs_queue.source", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "0"), @@ -1208,7 +1208,7 @@ func TestAccPipesPipe_SourceSageMakerTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_sqs_queue.source", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_sqs_queue.source", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "0"), @@ -1275,7 +1275,7 @@ func TestAccPipesPipe_sqsSourceBatchJobTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_sqs_queue.source", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_sqs_queue.source", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "0"), @@ -1359,7 +1359,7 @@ func TestAccPipesPipe_sqsSourceECSTaskTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enrichment_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "source", "aws_sqs_queue.source", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_sqs_queue.source", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.activemq_broker_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.dynamodb_stream_parameters.#", "0"), diff --git a/internal/service/pipes/target_parameters.go b/internal/service/pipes/target_parameters.go index 034984bdd13..70552dc8be8 100644 --- a/internal/service/pipes/target_parameters.go +++ b/internal/service/pipes/target_parameters.go @@ -542,7 +542,7 @@ func targetParametersSchema() *schema.Schema { ValidateFunc: verify.ValidARN, }, }, - "source": { + names.AttrSource: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.All( @@ -1673,7 +1673,7 @@ func expandPipeTargetEventBridgeEventBusParameters(tfMap map[string]interface{}) apiObject.Resources = flex.ExpandStringValueSet(v) } - if v, ok := tfMap["source"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrSource].(string); ok && v != "" { apiObject.Source = aws.String(v) } @@ -2534,7 +2534,7 @@ func flattenPipeTargetEventBridgeEventBusParameters(apiObject *types.PipeTargetE } if v := apiObject.Source; v != nil { - tfMap["source"] = aws.ToString(v) + tfMap[names.AttrSource] = aws.ToString(v) } if v := apiObject.Time; v != nil { From 411c3add5e770c84f063266a05d9b020640c4670 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:51 -0400 Subject: [PATCH 0943/1490] quicksight: Use constant for source strings --- internal/service/quicksight/data_set.go | 6 +++--- internal/service/quicksight/data_set_data_source.go | 2 +- .../quicksight/schema/visual_sankey_diagram.go | 11 ++++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/internal/service/quicksight/data_set.go b/internal/service/quicksight/data_set.go index b747fd225da..6ab41f20059 100644 --- a/internal/service/quicksight/data_set.go +++ b/internal/service/quicksight/data_set.go @@ -577,7 +577,7 @@ func logicalTableMapSchema() *schema.Resource { Type: schema.TypeString, Required: true, }, - "source": { + names.AttrSource: { Type: schema.TypeList, Required: true, MaxItems: 1, @@ -1294,7 +1294,7 @@ func expandDataSetLogicalTableMap(tfSet *schema.Set) map[string]*quicksight.Logi if v, ok := vMap["alias"].(string); ok { logicalTable.Alias = aws.String(v) } - if v, ok := vMap["source"].([]interface{}); ok { + if v, ok := vMap[names.AttrSource].([]interface{}); ok { logicalTable.Source = expandDataSetLogicalTableSource(v[0].(map[string]interface{})) } if v, ok := vMap["data_transforms"].([]interface{}); ok { @@ -2148,7 +2148,7 @@ func flattenLogicalTableMap(apiObject map[string]*quicksight.LogicalTable, resou tfMap["data_transforms"] = flattenDataTransforms(table.DataTransforms) } if table.Source != nil { - tfMap["source"] = flattenLogicalTableSource(table.Source) + tfMap[names.AttrSource] = flattenLogicalTableSource(table.Source) } tfList = append(tfList, tfMap) } diff --git a/internal/service/quicksight/data_set_data_source.go b/internal/service/quicksight/data_set_data_source.go index 1645539af2d..926c4863a66 100644 --- a/internal/service/quicksight/data_set_data_source.go +++ b/internal/service/quicksight/data_set_data_source.go @@ -399,7 +399,7 @@ func logicalTableMapDataSourceSchema() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "source": { + names.AttrSource: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ diff --git a/internal/service/quicksight/schema/visual_sankey_diagram.go b/internal/service/quicksight/schema/visual_sankey_diagram.go index 9b9bfd55c3c..36cf97b1d27 100644 --- a/internal/service/quicksight/schema/visual_sankey_diagram.go +++ b/internal/service/quicksight/schema/visual_sankey_diagram.go @@ -8,6 +8,7 @@ import ( "github.com/aws/aws-sdk-go/service/quicksight" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) func sankeyDiagramVisualSchema() *schema.Schema { @@ -42,9 +43,9 @@ func sankeyDiagramVisualSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": dimensionFieldSchema(dimensionsFieldMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DimensionField.html - "source": dimensionFieldSchema(dimensionsFieldMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DimensionField.html - "weight": measureFieldSchema(measureFieldsMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_MeasureField.html + "destination": dimensionFieldSchema(dimensionsFieldMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DimensionField.html + names.AttrSource: dimensionFieldSchema(dimensionsFieldMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DimensionField.html + "weight": measureFieldSchema(measureFieldsMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_MeasureField.html }, }, }, @@ -165,7 +166,7 @@ func expandSankeyDiagramAggregatedFieldWells(tfList []interface{}) *quicksight.S if v, ok := tfMap["destination"].([]interface{}); ok && len(v) > 0 { config.Destination = expandDimensionFields(v) } - if v, ok := tfMap["source"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrSource].([]interface{}); ok && len(v) > 0 { config.Source = expandDimensionFields(v) } if v, ok := tfMap["weight"].([]interface{}); ok && len(v) > 0 { @@ -266,7 +267,7 @@ func flattenSankeyDiagramAggregatedFieldWells(apiObject *quicksight.SankeyDiagra tfMap["destination"] = flattenDimensionFields(apiObject.Destination) } if apiObject.Source != nil { - tfMap["source"] = flattenDimensionFields(apiObject.Source) + tfMap[names.AttrSource] = flattenDimensionFields(apiObject.Source) } if apiObject.Weight != nil { tfMap["weight"] = flattenMeasureFields(apiObject.Weight) From 8a1cf63e97bdd97284139e5f7754fed38a0115e6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:52 -0400 Subject: [PATCH 0944/1490] rolesanywhere: Use constant for source strings --- internal/service/rolesanywhere/trust_anchor.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/rolesanywhere/trust_anchor.go b/internal/service/rolesanywhere/trust_anchor.go index 13affdaa1fb..1f910b6a575 100644 --- a/internal/service/rolesanywhere/trust_anchor.go +++ b/internal/service/rolesanywhere/trust_anchor.go @@ -48,7 +48,7 @@ func ResourceTrustAnchor() *schema.Resource { Type: schema.TypeString, Required: true, }, - "source": { + names.AttrSource: { Type: schema.TypeList, Required: true, MinItems: 1, @@ -97,7 +97,7 @@ func resourceTrustAnchorCreate(ctx context.Context, d *schema.ResourceData, meta input := &rolesanywhere.CreateTrustAnchorInput{ Enabled: aws.Bool(d.Get(names.AttrEnabled).(bool)), Name: aws.String(name), - Source: expandSource(d.Get("source").([]interface{})), + Source: expandSource(d.Get(names.AttrSource).([]interface{})), Tags: getTagsIn(ctx), } @@ -132,7 +132,7 @@ func resourceTrustAnchorRead(ctx context.Context, d *schema.ResourceData, meta i d.Set(names.AttrEnabled, trustAnchor.Enabled) d.Set(names.AttrName, trustAnchor.Name) - if err := d.Set("source", flattenSource(trustAnchor.Source)); err != nil { + if err := d.Set(names.AttrSource, flattenSource(trustAnchor.Source)); err != nil { return diag.Errorf("setting source: %s", err) } @@ -146,7 +146,7 @@ func resourceTrustAnchorUpdate(ctx context.Context, d *schema.ResourceData, meta input := &rolesanywhere.UpdateTrustAnchorInput{ TrustAnchorId: aws.String(d.Id()), Name: aws.String(d.Get(names.AttrName).(string)), - Source: expandSource(d.Get("source").([]interface{})), + Source: expandSource(d.Get(names.AttrSource).([]interface{})), } log.Printf("[DEBUG] Updating RolesAnywhere Trust Anchor (%s): %#v", d.Id(), input) From db01916f2e8ccf7263880de97c28d42030697b71 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:52 -0400 Subject: [PATCH 0945/1490] s3: Use constant for source strings --- internal/service/s3/bucket_object.go | 10 +-- internal/service/s3/bucket_object_test.go | 18 ++--- internal/service/s3/object.go | 10 +-- internal/service/s3/object_copy.go | 6 +- internal/service/s3/object_copy_test.go | 90 +++++++++++------------ internal/service/s3/object_test.go | 20 ++--- 6 files changed, 77 insertions(+), 77 deletions(-) diff --git a/internal/service/s3/bucket_object.go b/internal/service/s3/bucket_object.go index 36c4378a5a2..aa777d08a7d 100644 --- a/internal/service/s3/bucket_object.go +++ b/internal/service/s3/bucket_object.go @@ -86,12 +86,12 @@ func resourceBucketObject() *schema.Resource { "content": { Type: schema.TypeString, Optional: true, - ConflictsWith: []string{"source", "content_base64"}, + ConflictsWith: []string{names.AttrSource, "content_base64"}, }, "content_base64": { Type: schema.TypeString, Optional: true, - ConflictsWith: []string{"source", "content"}, + ConflictsWith: []string{names.AttrSource, "content"}, }, "content_disposition": { Type: schema.TypeString, @@ -171,7 +171,7 @@ func resourceBucketObject() *schema.Resource { ValidateDiagFunc: enum.Validate[types.ServerSideEncryption](), Computed: true, }, - "source": { + names.AttrSource: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"content", "content_base64"}, @@ -378,7 +378,7 @@ func resourceBucketObjectUpload(ctx context.Context, d *schema.ResourceData, met var body io.ReadSeeker - if v, ok := d.GetOk("source"); ok { + if v, ok := d.GetOk(names.AttrSource); ok { source := v.(string) path, err := homedir.Expand(source) if err != nil { @@ -550,7 +550,7 @@ func hasBucketObjectContentChanges(d sdkv2.ResourceDiffer) bool { names.AttrKMSKeyID, "metadata", "server_side_encryption", - "source", + names.AttrSource, "source_hash", "storage_class", "website_redirect", diff --git a/internal/service/s3/bucket_object_test.go b/internal/service/s3/bucket_object_test.go index 442b4b5b072..b65ec119c9b 100644 --- a/internal/service/s3/bucket_object_test.go +++ b/internal/service/s3/bucket_object_test.go @@ -92,7 +92,7 @@ func TestAccS3BucketObject_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", ""), resource.TestCheckResourceAttr(resourceName, "server_side_encryption", "AES256"), - resource.TestCheckNoResourceAttr(resourceName, "source"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrSource), resource.TestCheckNoResourceAttr(resourceName, "source_hash"), resource.TestCheckResourceAttr(resourceName, "storage_class", "STANDARD"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -137,7 +137,7 @@ func TestAccS3BucketObject_source(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "source", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -202,7 +202,7 @@ func TestAccS3BucketObject_etagEncryption(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "source", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -283,7 +283,7 @@ func TestAccS3BucketObject_sourceHashTrigger(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "content", "content_base64", "force_destroy", "source", "source_hash"}, + ImportStateVerifyIgnore: []string{"acl", "content", "content_base64", "force_destroy", names.AttrSource, "source_hash"}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -344,7 +344,7 @@ func TestAccS3BucketObject_nonVersioned(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "source", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -394,7 +394,7 @@ func TestAccS3BucketObject_updates(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "source", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -487,7 +487,7 @@ func TestAccS3BucketObject_updatesWithVersioning(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "source", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -562,7 +562,7 @@ func TestAccS3BucketObject_kms(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "source", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -597,7 +597,7 @@ func TestAccS3BucketObject_sse(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "source", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, diff --git a/internal/service/s3/object.go b/internal/service/s3/object.go index 43144a85a3e..038d5b676d9 100644 --- a/internal/service/s3/object.go +++ b/internal/service/s3/object.go @@ -113,12 +113,12 @@ func resourceObject() *schema.Resource { "content": { Type: schema.TypeString, Optional: true, - ConflictsWith: []string{"source", "content_base64"}, + ConflictsWith: []string{names.AttrSource, "content_base64"}, }, "content_base64": { Type: schema.TypeString, Optional: true, - ConflictsWith: []string{"source", "content"}, + ConflictsWith: []string{names.AttrSource, "content"}, }, "content_disposition": { Type: schema.TypeString, @@ -221,7 +221,7 @@ func resourceObject() *schema.Resource { Computed: true, ValidateDiagFunc: enum.Validate[types.ServerSideEncryption](), }, - "source": { + names.AttrSource: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"content", "content_base64"}, @@ -463,7 +463,7 @@ func resourceObjectUpload(ctx context.Context, d *schema.ResourceData, meta inte var body io.ReadSeeker - if v, ok := d.GetOk("source"); ok { + if v, ok := d.GetOk(names.AttrSource); ok { source := v.(string) path, err := homedir.Expand(source) if err != nil { @@ -657,7 +657,7 @@ func hasObjectContentChanges(d sdkv2.ResourceDiffer) bool { names.AttrKMSKeyID, "metadata", "server_side_encryption", - "source", + names.AttrSource, "source_hash", "storage_class", "website_redirect", diff --git a/internal/service/s3/object_copy.go b/internal/service/s3/object_copy.go index 4b7cc294379..296deff89d4 100644 --- a/internal/service/s3/object_copy.go +++ b/internal/service/s3/object_copy.go @@ -276,7 +276,7 @@ func resourceObjectCopy() *schema.Resource { Computed: true, ValidateDiagFunc: enum.Validate[types.ServerSideEncryption](), }, - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -444,7 +444,7 @@ func resourceObjectCopyUpdate(ctx context.Context, d *schema.ResourceData, meta "object_lock_retain_until_date", "request_payer", "server_side_encryption", - "source", + names.AttrSource, "source_customer_algorithm", "source_customer_key", "source_customer_key_md5", @@ -503,7 +503,7 @@ func resourceObjectCopyDoCopy(ctx context.Context, d *schema.ResourceData, meta input := &s3.CopyObjectInput{ Bucket: aws.String(bucket), - CopySource: aws.String(url.QueryEscape(d.Get("source").(string))), + CopySource: aws.String(url.QueryEscape(d.Get(names.AttrSource).(string))), Key: aws.String(sdkv1CompatibleCleanKey(d.Get(names.AttrKey).(string))), } diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index 2e8ff4cf838..cc936316fd7 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -27,7 +27,7 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { rNameTarget := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" sourceName := "aws_s3_object.source" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -37,7 +37,7 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_basic(rNameSource, sourceKey, rNameTarget, targetKey), + Config: testAccObjectCopyConfig_basic(rNameSource, names.AttrSource, rNameTarget, targetKey), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckNoResourceAttr(resourceName, "acl"), @@ -80,7 +80,7 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_charged", "false"), resource.TestCheckNoResourceAttr(resourceName, "request_payer"), resource.TestCheckResourceAttr(resourceName, "server_side_encryption", "AES256"), - resource.TestCheckResourceAttr(resourceName, "source", fmt.Sprintf("%s/%s", rNameSource, sourceKey)), + resource.TestCheckResourceAttr(resourceName, names.AttrSource, fmt.Sprintf("%s/%s", rNameSource, names.AttrSource)), resource.TestCheckNoResourceAttr(resourceName, "source_customer_algorithm"), resource.TestCheckNoResourceAttr(resourceName, "source_customer_key"), resource.TestCheckNoResourceAttr(resourceName, "source_customer_key_md5"), @@ -101,7 +101,7 @@ func TestAccS3ObjectCopy_disappears(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -111,7 +111,7 @@ func TestAccS3ObjectCopy_disappears(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_basic(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_basic(rName1, names.AttrSource, rName2, targetKey), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), acctest.CheckResourceDisappears(ctx, acctest.Provider, tfs3.ResourceObjectCopy(), resourceName), @@ -127,7 +127,7 @@ func TestAccS3ObjectCopy_tags(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -137,7 +137,7 @@ func TestAccS3ObjectCopy_tags(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_tags1(rName1, sourceKey, rName2, targetKey, "key1", "value1"), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key1", "value1"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tagging_directive", "REPLACE"), @@ -146,7 +146,7 @@ func TestAccS3ObjectCopy_tags(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_tags2(rName1, sourceKey, rName2, targetKey, "key1", "value1updated", "key2", "value2"), + Config: testAccObjectCopyConfig_tags2(rName1, names.AttrSource, rName2, targetKey, "key1", "value1updated", "key2", "value2"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tagging_directive", "REPLACE"), @@ -156,7 +156,7 @@ func TestAccS3ObjectCopy_tags(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_tags1(rName1, sourceKey, rName2, targetKey, "key2", "value2"), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key2", "value2"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tagging_directive", "REPLACE"), @@ -173,7 +173,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnCreate(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -183,7 +183,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnCreate(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_tags1(rName1, sourceKey, rName2, targetKey, "key1", ""), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key1", ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -199,7 +199,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Add(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -209,7 +209,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Add(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_tags1(rName1, sourceKey, rName2, targetKey, "key1", "value1"), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key1", "value1"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -217,7 +217,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Add(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_tags2(rName1, sourceKey, rName2, targetKey, "key1", "value1", "key2", ""), + Config: testAccObjectCopyConfig_tags2(rName1, names.AttrSource, rName2, targetKey, "key1", "value1", "key2", ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), @@ -234,7 +234,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -244,7 +244,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_tags1(rName1, sourceKey, rName2, targetKey, "key1", "value1"), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key1", "value1"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -252,7 +252,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_tags1(rName1, sourceKey, rName2, targetKey, "key1", ""), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key1", ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -268,7 +268,7 @@ func TestAccS3ObjectCopy_metadata(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -278,7 +278,7 @@ func TestAccS3ObjectCopy_metadata(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_metadata(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_metadata(rName1, names.AttrSource, rName2, targetKey), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "metadata_directive", "REPLACE"), @@ -295,7 +295,7 @@ func TestAccS3ObjectCopy_grant(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -305,7 +305,7 @@ func TestAccS3ObjectCopy_grant(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_grant(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_grant(rName1, names.AttrSource, rName2, targetKey), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "grant.#", "1"), @@ -325,7 +325,7 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_bucket(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -335,7 +335,7 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_bucket(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_bucketKeyEnabledBucket(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_bucketKeyEnabledBucket(rName1, names.AttrSource, rName2, targetKey), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "bucket_key_enabled", "true"), @@ -350,7 +350,7 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_object(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -360,7 +360,7 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_object(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_bucketKeyEnabledObject(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_bucketKeyEnabledObject(rName1, names.AttrSource, rName2, targetKey), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "bucket_key_enabled", "true"), @@ -394,7 +394,7 @@ func TestAccS3ObjectCopy_sourceWithSlashes(t *testing.T) { Config: testAccObjectCopyConfig_externalSourceObject(rName1, sourceKey, rName2, targetKey), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "source", fmt.Sprintf("%s/%s", rName1, sourceKey)), + resource.TestCheckResourceAttr(resourceName, names.AttrSource, fmt.Sprintf("%s/%s", rName1, sourceKey)), ), }, }, @@ -406,7 +406,7 @@ func TestAccS3ObjectCopy_checksumAlgorithm(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -416,7 +416,7 @@ func TestAccS3ObjectCopy_checksumAlgorithm(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_checksumAlgorithm(rName1, sourceKey, rName2, targetKey, "CRC32C"), + Config: testAccObjectCopyConfig_checksumAlgorithm(rName1, names.AttrSource, rName2, targetKey, "CRC32C"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "checksum_algorithm", "CRC32C"), @@ -427,7 +427,7 @@ func TestAccS3ObjectCopy_checksumAlgorithm(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_checksumAlgorithm(rName1, sourceKey, rName2, targetKey, "SHA1"), + Config: testAccObjectCopyConfig_checksumAlgorithm(rName1, names.AttrSource, rName2, targetKey, "SHA1"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "checksum_algorithm", "SHA1"), @@ -446,7 +446,7 @@ func TestAccS3ObjectCopy_objectLockLegalHold(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -456,14 +456,14 @@ func TestAccS3ObjectCopy_objectLockLegalHold(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_lockLegalHold(rName1, sourceKey, rName2, targetKey, "ON"), + Config: testAccObjectCopyConfig_lockLegalHold(rName1, names.AttrSource, rName2, targetKey, "ON"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", "ON"), ), }, { - Config: testAccObjectCopyConfig_lockLegalHold(rName1, sourceKey, rName2, targetKey, "OFF"), + Config: testAccObjectCopyConfig_lockLegalHold(rName1, names.AttrSource, rName2, targetKey, "OFF"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", "OFF"), @@ -478,7 +478,7 @@ func TestAccS3ObjectCopy_targetWithMultipleSlashes(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "/dir//target/" resource.ParallelTest(t, resource.TestCase{ @@ -488,10 +488,10 @@ func TestAccS3ObjectCopy_targetWithMultipleSlashes(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_basic(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_basic(rName1, names.AttrSource, rName2, targetKey), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, names.AttrKey, targetKey), - resource.TestCheckResourceAttr(resourceName, "source", fmt.Sprintf("%s/%s", rName1, sourceKey)), + resource.TestCheckResourceAttr(resourceName, names.AttrSource, fmt.Sprintf("%s/%s", rName1, names.AttrSource)), ), }, }, @@ -503,7 +503,7 @@ func TestAccS3ObjectCopy_targetWithMultipleSlashesMigrated(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "/dir//target/" resource.ParallelTest(t, resource.TestCase{ @@ -519,15 +519,15 @@ func TestAccS3ObjectCopy_targetWithMultipleSlashesMigrated(t *testing.T) { VersionConstraint: "5.15.0", }, }, - Config: testAccObjectCopyConfig_basic(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_basic(rName1, names.AttrSource, rName2, targetKey), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, names.AttrKey, targetKey), - resource.TestCheckResourceAttr(resourceName, "source", fmt.Sprintf("%s/%s", rName1, sourceKey)), + resource.TestCheckResourceAttr(resourceName, names.AttrSource, fmt.Sprintf("%s/%s", rName1, names.AttrSource)), ), }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - Config: testAccObjectCopyConfig_basic(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_basic(rName1, names.AttrSource, rName2, targetKey), PlanOnly: true, }, }, @@ -539,7 +539,7 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -549,7 +549,7 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_directoryBucket(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_directoryBucket(rName1, names.AttrSource, rName2, targetKey), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckNoResourceAttr(resourceName, "acl"), @@ -591,7 +591,7 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_charged", "false"), resource.TestCheckNoResourceAttr(resourceName, "request_payer"), resource.TestCheckResourceAttr(resourceName, "server_side_encryption", "AES256"), - resource.TestCheckResourceAttrSet(resourceName, "source"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrSource), resource.TestCheckNoResourceAttr(resourceName, "source_customer_algorithm"), resource.TestCheckNoResourceAttr(resourceName, "source_customer_key"), resource.TestCheckNoResourceAttr(resourceName, "source_customer_key_md5"), @@ -613,7 +613,7 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" sourceName := "aws_s3_object.source" - sourceKey := "source" + sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -623,7 +623,7 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_basicViaAccessPoint(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_basicViaAccessPoint(rName1, names.AttrSource, rName2, targetKey), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckNoResourceAttr(resourceName, "acl"), @@ -665,7 +665,7 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_charged", "false"), resource.TestCheckNoResourceAttr(resourceName, "request_payer"), resource.TestCheckResourceAttr(resourceName, "server_side_encryption", "AES256"), - resource.TestCheckResourceAttrSet(resourceName, "source"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrSource), resource.TestCheckNoResourceAttr(resourceName, "source_customer_algorithm"), resource.TestCheckNoResourceAttr(resourceName, "source_customer_key"), resource.TestCheckNoResourceAttr(resourceName, "source_customer_key_md5"), diff --git a/internal/service/s3/object_test.go b/internal/service/s3/object_test.go index 961076ee986..c64def8b094 100644 --- a/internal/service/s3/object_test.go +++ b/internal/service/s3/object_test.go @@ -149,7 +149,7 @@ func TestAccS3Object_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", ""), resource.TestCheckResourceAttr(resourceName, "server_side_encryption", "AES256"), - resource.TestCheckNoResourceAttr(resourceName, "source"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrSource), resource.TestCheckNoResourceAttr(resourceName, "source_hash"), resource.TestCheckResourceAttr(resourceName, "storage_class", "STANDARD"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -274,7 +274,7 @@ func TestAccS3Object_source(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "source"}, + ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -337,7 +337,7 @@ func TestAccS3Object_etagEncryption(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "source"}, + ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -415,7 +415,7 @@ func TestAccS3Object_sourceHashTrigger(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"content", "content_base64", "force_destroy", "source", "source_hash"}, + ImportStateVerifyIgnore: []string{"content", "content_base64", "force_destroy", names.AttrSource, "source_hash"}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -476,7 +476,7 @@ func TestAccS3Object_nonVersioned(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "source"}, + ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -526,7 +526,7 @@ func TestAccS3Object_updates(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "source"}, + ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -619,7 +619,7 @@ func TestAccS3Object_updatesWithVersioning(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "source"}, + ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -694,7 +694,7 @@ func TestAccS3Object_kms(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "source"}, + ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -728,7 +728,7 @@ func TestAccS3Object_sse(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "source"}, + ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -2025,7 +2025,7 @@ func TestAccS3Object_directoryBucket(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "override_provider.0.default_tags.#", "1"), resource.TestCheckResourceAttr(resourceName, "override_provider.0.default_tags.0.tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "server_side_encryption", "AES256"), - resource.TestCheckNoResourceAttr(resourceName, "source"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrSource), resource.TestCheckNoResourceAttr(resourceName, "source_hash"), resource.TestCheckResourceAttr(resourceName, "storage_class", "EXPRESS_ONEZONE"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), From 1d37aa85cd418e400dd86db24457be12c467aa3b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:52 -0400 Subject: [PATCH 0946/1490] scheduler: Use constant for source strings --- internal/service/scheduler/flex.go | 4 ++-- internal/service/scheduler/schedule.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/scheduler/flex.go b/internal/service/scheduler/flex.go index 59aa931972d..179dbaab194 100644 --- a/internal/service/scheduler/flex.go +++ b/internal/service/scheduler/flex.go @@ -266,7 +266,7 @@ func expandEventBridgeParameters(tfMap map[string]interface{}) *types.EventBridg a.DetailType = aws.String(v) } - if v, ok := tfMap["source"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrSource].(string); ok && v != "" { a.Source = aws.String(v) } @@ -285,7 +285,7 @@ func flattenEventBridgeParameters(apiObject *types.EventBridgeParameters) map[st } if v := apiObject.Source; v != nil { - m["source"] = aws.ToString(v) + m[names.AttrSource] = aws.ToString(v) } return m diff --git a/internal/service/scheduler/schedule.go b/internal/service/scheduler/schedule.go index 9d52a7f8178..f871fa754ad 100644 --- a/internal/service/scheduler/schedule.go +++ b/internal/service/scheduler/schedule.go @@ -315,7 +315,7 @@ func resourceSchedule() *schema.Resource { Required: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 128)), }, - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 256)), From 1cc12ed9625ff5ee2cb02eda53b652e5c311d701 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:53 -0400 Subject: [PATCH 0947/1490] securitylake: Use constant for source strings --- internal/service/securitylake/aws_log_source.go | 2 +- internal/service/securitylake/subscriber.go | 2 +- internal/service/securitylake/subscriber_test.go | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/securitylake/aws_log_source.go b/internal/service/securitylake/aws_log_source.go index fbc0227e6d4..8ff8103e89b 100644 --- a/internal/service/securitylake/aws_log_source.go +++ b/internal/service/securitylake/aws_log_source.go @@ -53,7 +53,7 @@ func (r *awsLogSourceResource) Schema(ctx context.Context, request resource.Sche names.AttrID: framework.IDAttribute(), }, Blocks: map[string]schema.Block{ - "source": schema.ListNestedBlock{ + names.AttrSource: schema.ListNestedBlock{ CustomType: fwtypes.NewListNestedObjectTypeOf[awsLogSourceSourceModel](ctx), PlanModifiers: []planmodifier.List{ listplanmodifier.RequiresReplace(), diff --git a/internal/service/securitylake/subscriber.go b/internal/service/securitylake/subscriber.go index 7e0abbcd26c..cd32a0aeeb2 100644 --- a/internal/service/securitylake/subscriber.go +++ b/internal/service/securitylake/subscriber.go @@ -102,7 +102,7 @@ func (r *subscriberResource) Schema(ctx context.Context, request resource.Schema names.AttrTagsAll: tftags.TagsAttributeComputedOnly(), }, Blocks: map[string]schema.Block{ - "source": schema.SetNestedBlock{ + names.AttrSource: schema.SetNestedBlock{ Validators: []validator.Set{ setvalidator.IsRequired(), setvalidator.SizeAtLeast(1), diff --git a/internal/service/securitylake/subscriber_test.go b/internal/service/securitylake/subscriber_test.go index 2bae702709f..30a5380375a 100644 --- a/internal/service/securitylake/subscriber_test.go +++ b/internal/service/securitylake/subscriber_test.go @@ -311,7 +311,7 @@ func testAccSubscriber_multipleSources(t *testing.T) { ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, - tfjsonpath.New("source"), + tfjsonpath.New(names.AttrSource), knownvalue.SetExact([]knownvalue.Check{ knownvalue.ObjectExact(map[string]knownvalue.Check{ "aws_log_source_resource": knownvalue.ListExact([]knownvalue.Check{ @@ -355,7 +355,7 @@ func testAccSubscriber_multipleSources(t *testing.T) { ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, - tfjsonpath.New("source"), + tfjsonpath.New(names.AttrSource), knownvalue.SetExact([]knownvalue.Check{ knownvalue.ObjectExact(map[string]knownvalue.Check{ "aws_log_source_resource": knownvalue.ListExact([]knownvalue.Check{ @@ -382,7 +382,7 @@ func testAccSubscriber_multipleSources(t *testing.T) { ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, - tfjsonpath.New("source"), + tfjsonpath.New(names.AttrSource), knownvalue.SetExact([]knownvalue.Check{ knownvalue.ObjectExact(map[string]knownvalue.Check{ "aws_log_source_resource": knownvalue.ListExact([]knownvalue.Check{ @@ -445,7 +445,7 @@ func testAccSubscriber_migrate_source(t *testing.T) { ), ConfigStateChecks: []statecheck.StateCheck{ statecheck.ExpectKnownValue(resourceName, - tfjsonpath.New("source"), + tfjsonpath.New(names.AttrSource), knownvalue.ListExact([]knownvalue.Check{ knownvalue.ObjectExact(map[string]knownvalue.Check{ "aws_log_source_resource": knownvalue.ListExact([]knownvalue.Check{ From 28ef6cad1eab834df07e5837bb69e6d2f80db733 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:53 -0400 Subject: [PATCH 0948/1490] signer: Use constant for source strings --- internal/service/signer/signing_job.go | 6 +++--- internal/service/signer/signing_job_data_source.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/signer/signing_job.go b/internal/service/signer/signing_job.go index aafc2aa8b9c..617c09c27e5 100644 --- a/internal/service/signer/signing_job.go +++ b/internal/service/signer/signing_job.go @@ -37,7 +37,7 @@ func ResourceSigningJob() *schema.Resource { Required: true, ForceNew: true, }, - "source": { + names.AttrSource: { Type: schema.TypeList, Required: true, ForceNew: true, @@ -208,7 +208,7 @@ func resourceSigningJobCreate(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).SignerClient(ctx) profileName := d.Get("profile_name") - source := d.Get("source").([]interface{}) + source := d.Get(names.AttrSource).([]interface{}) destination := d.Get("destination").([]interface{}) startSigningJobInput := &signer.StartSigningJobInput{ @@ -320,7 +320,7 @@ func resourceSigningJobRead(ctx context.Context, d *schema.ResourceData, meta in return sdkdiag.AppendErrorf(diags, "setting signer signing job signed object: %s", err) } - if err := d.Set("source", flattenSigningJobSource(describeSigningJobOutput.Source)); err != nil { + if err := d.Set(names.AttrSource, flattenSigningJobSource(describeSigningJobOutput.Source)); err != nil { return sdkdiag.AppendErrorf(diags, "setting signer signing job source: %s", err) } diff --git a/internal/service/signer/signing_job_data_source.go b/internal/service/signer/signing_job_data_source.go index e8dbdfb8810..d841d5ad9ac 100644 --- a/internal/service/signer/signing_job_data_source.go +++ b/internal/service/signer/signing_job_data_source.go @@ -110,7 +110,7 @@ func DataSourceSigningJob() *schema.Resource { }, }, }, - "source": { + names.AttrSource: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -215,7 +215,7 @@ func dataSourceSigningJobRead(ctx context.Context, d *schema.ResourceData, meta return sdkdiag.AppendErrorf(diags, "setting signer signing job signed object: %s", err) } - if err := d.Set("source", flattenSigningJobSource(describeSigningJobOutput.Source)); err != nil { + if err := d.Set(names.AttrSource, flattenSigningJobSource(describeSigningJobOutput.Source)); err != nil { return sdkdiag.AppendErrorf(diags, "setting signer signing job source: %s", err) } From 4e7651edf3bb8b9c70e90998990d30af91c443cd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:53 -0400 Subject: [PATCH 0949/1490] ssm: Use constant for source strings --- internal/service/ssm/patch_baseline.go | 12 ++++++------ internal/service/ssm/patch_baseline_data_source.go | 4 ++-- .../service/ssm/patch_baseline_data_source_test.go | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/ssm/patch_baseline.go b/internal/service/ssm/patch_baseline.go index f94722c0165..c74006e7cb4 100644 --- a/internal/service/ssm/patch_baseline.go +++ b/internal/service/ssm/patch_baseline.go @@ -184,7 +184,7 @@ func resourcePatchBaseline() *schema.Resource { Computed: true, ValidateFunc: validation.StringInSlice(ssm.PatchAction_Values(), false), }, - "source": { + names.AttrSource: { Type: schema.TypeList, Optional: true, MaxItems: 20, @@ -266,7 +266,7 @@ func resourcePatchBaselineCreate(ctx context.Context, d *schema.ResourceData, me input.RejectedPatchesAction = aws.String(v.(string)) } - if _, ok := d.GetOk("source"); ok { + if _, ok := d.GetOk(names.AttrSource); ok { input.Sources = expandPatchSource(d) } @@ -327,7 +327,7 @@ func resourcePatchBaselineRead(ctx context.Context, d *schema.ResourceData, meta d.Set("operating_system", output.OperatingSystem) d.Set("rejected_patches", aws.StringValueSlice(output.RejectedPatches)) d.Set("rejected_patches_action", output.RejectedPatchesAction) - if err := d.Set("source", flattenPatchSource(output.Sources)); err != nil { + if err := d.Set(names.AttrSource, flattenPatchSource(output.Sources)); err != nil { return sdkdiag.AppendErrorf(diags, "setting source: %s", err) } @@ -379,7 +379,7 @@ func resourcePatchBaselineUpdate(ctx context.Context, d *schema.ResourceData, me input.RejectedPatchesAction = aws.String(d.Get("rejected_patches_action").(string)) } - if d.HasChange("source") { + if d.HasChange(names.AttrSource) { input.Sources = expandPatchSource(d) } @@ -560,7 +560,7 @@ func flattenPatchRuleGroup(group *ssm.PatchRuleGroup) []map[string]interface{} { func expandPatchSource(d *schema.ResourceData) []*ssm.PatchSource { var sources []*ssm.PatchSource - sourceConfigs := d.Get("source").([]interface{}) + sourceConfigs := d.Get(names.AttrSource).([]interface{}) for _, sConfig := range sourceConfigs { config := sConfig.(map[string]interface{}) @@ -614,7 +614,7 @@ func hasObjectContentChanges(d sdkv2.ResourceDiffer) bool { "approved_patches_compliance_level", "rejected_patches_action", "approved_patches_enable_non_security", - "source", + names.AttrSource, } { if d.HasChange(key) { return true diff --git a/internal/service/ssm/patch_baseline_data_source.go b/internal/service/ssm/patch_baseline_data_source.go index 0d341b35902..b0953e13106 100644 --- a/internal/service/ssm/patch_baseline_data_source.go +++ b/internal/service/ssm/patch_baseline_data_source.go @@ -134,7 +134,7 @@ func DataSourcePatchBaseline() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "source": { + names.AttrSource: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -251,7 +251,7 @@ func dataPatchBaselineRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("operating_system", baseline.OperatingSystem) d.Set("rejected_patches", aws.StringValueSlice(output.RejectedPatches)) d.Set("rejected_patches_action", output.RejectedPatchesAction) - d.Set("source", flattenPatchSource(output.Sources)) + d.Set(names.AttrSource, flattenPatchSource(output.Sources)) return diags } diff --git a/internal/service/ssm/patch_baseline_data_source_test.go b/internal/service/ssm/patch_baseline_data_source_test.go index 2232237a4bb..283ee0a35f1 100644 --- a/internal/service/ssm/patch_baseline_data_source_test.go +++ b/internal/service/ssm/patch_baseline_data_source_test.go @@ -72,7 +72,7 @@ func TestAccSSMPatchBaselineDataSource_newBaseline(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "operating_system", resourceName, "operating_system"), resource.TestCheckResourceAttrPair(dataSourceName, "rejected_patches", resourceName, "rejected_patches"), resource.TestCheckResourceAttrPair(dataSourceName, "rejected_patches_action", resourceName, "rejected_patches_action"), - resource.TestCheckResourceAttrPair(dataSourceName, "source", resourceName, "source"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrSource, resourceName, names.AttrSource), ), }, }, From 82cf90f00b3620b1308edc6488a9571e5852f3bd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:53 -0400 Subject: [PATCH 0950/1490] ssoadmin: Use constant for source strings --- .../service/ssoadmin/instance_access_control_attributes.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/ssoadmin/instance_access_control_attributes.go b/internal/service/ssoadmin/instance_access_control_attributes.go index 5f15952e378..3ef49c2e48e 100644 --- a/internal/service/ssoadmin/instance_access_control_attributes.go +++ b/internal/service/ssoadmin/instance_access_control_attributes.go @@ -50,7 +50,7 @@ func ResourceAccessControlAttributes() *schema.Resource { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "source": { + names.AttrSource: { Type: schema.TypeSet, Required: true, MinItems: 1, @@ -200,7 +200,7 @@ func expandAccessControlAttributes(d *schema.ResourceData) []awstypes.AccessCont attribute.Key = aws.String(key) } val := attr[names.AttrValue].(*schema.Set).List()[0].(map[string]interface{}) - if v, ok := val["source"].(*schema.Set); ok && len(v.List()) > 0 { + if v, ok := val[names.AttrSource].(*schema.Set); ok && len(v.List()) > 0 { attribute.Value = &awstypes.AccessControlAttributeValue{ Source: flex.ExpandStringValueSet(v), } @@ -220,7 +220,7 @@ func flattenAccessControlAttributes(attributes []awstypes.AccessControlAttribute for _, attr := range attributes { var val []interface{} val = append(val, map[string]interface{}{ - "source": flex.FlattenStringValueSet(attr.Value.Source), + names.AttrSource: flex.FlattenStringValueSet(attr.Value.Source), }) results = append(results, map[string]interface{}{ names.AttrKey: aws.ToString(attr.Key), From 899a1b0ec6b8bb6b34eab0f2c418adc1566eb8f0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:17:53 -0400 Subject: [PATCH 0951/1490] workspaces: Use constant for source strings --- internal/service/workspaces/ip_group.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/workspaces/ip_group.go b/internal/service/workspaces/ip_group.go index cf77f8da3f5..5a8d0ca28f1 100644 --- a/internal/service/workspaces/ip_group.go +++ b/internal/service/workspaces/ip_group.go @@ -48,7 +48,7 @@ func ResourceIPGroup() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "source": { + names.AttrSource: { Type: schema.TypeString, Required: true, ValidateFunc: validation.IsCIDR, @@ -202,7 +202,7 @@ func expandIPGroupRules(rules []interface{}) []types.IpRuleItem { r := rule.(map[string]interface{}) result = append(result, types.IpRuleItem{ - IpRule: aws.String(r["source"].(string)), + IpRule: aws.String(r[names.AttrSource].(string)), RuleDesc: aws.String(r[names.AttrDescription].(string)), }) } @@ -215,7 +215,7 @@ func flattenIPGroupRules(rules []types.IpRuleItem) []map[string]interface{} { r := map[string]interface{}{} if v := rule.IpRule; v != nil { - r["source"] = aws.ToString(v) + r[names.AttrSource] = aws.ToString(v) } if v := rule.RuleDesc; v != nil { From 36c0660000f580878094e2682dccbe3ddd283170 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:04 -0400 Subject: [PATCH 0952/1490] ci: Prefer constant for string literal "password" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index bcf144874d4..a485e8c68aa 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1345,3 +1345,13 @@ rules: - pattern: '"source"' severity: ERROR fix: "names.AttrSource" + - id: literal-password-string-constant + languages: [go] + message: Use the constant `names.AttrPassword` for the string literal "password" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"password"' + severity: ERROR + fix: "names.AttrPassword" From 05b077d7df2e2e8bdf44acecd320264c6f8633e6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:04 -0400 Subject: [PATCH 0953/1490] names: Add constant for string literal "password" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 63098ee4d4c..80685b2831e 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -44,6 +44,7 @@ const ( AttrNetworkInterfaceID = "network_interface_id" AttrOwnerID = "owner_id" AttrParameters = "parameters" + AttrPassword = "password" AttrPolicy = "policy" AttrPort = "port" AttrPreferredMaintenanceWindow = "preferred_maintenance_window" From f077ec6d728b3c532bc3f972963b2dd4c07d026a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:05 -0400 Subject: [PATCH 0954/1490] appflow: Use constant for password strings --- internal/service/appflow/connector_profile.go | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/appflow/connector_profile.go b/internal/service/appflow/connector_profile.go index bf6831d23ee..6efa8458daf 100644 --- a/internal/service/appflow/connector_profile.go +++ b/internal/service/appflow/connector_profile.go @@ -136,7 +136,7 @@ func resourceConnectorProfile() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -520,7 +520,7 @@ func resourceConnectorProfile() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -615,7 +615,7 @@ func resourceConnectorProfile() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -708,7 +708,7 @@ func resourceConnectorProfile() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -808,7 +808,7 @@ func resourceConnectorProfile() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -849,7 +849,7 @@ func resourceConnectorProfile() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -1757,7 +1757,7 @@ func expandMarketoConnectorProfileCredentials(m map[string]interface{}) *types.M func expandRedshiftConnectorProfileCredentials(m map[string]interface{}) *types.RedshiftConnectorProfileCredentials { credentials := &types.RedshiftConnectorProfileCredentials{ - Password: aws.String(m["password"].(string)), + Password: aws.String(m[names.AttrPassword].(string)), Username: aws.String(m["username"].(string)), } @@ -1804,7 +1804,7 @@ func expandSAPODataConnectorProfileCredentials(m map[string]interface{}) *types. func expandServiceNowConnectorProfileCredentials(m map[string]interface{}) *types.ServiceNowConnectorProfileCredentials { credentials := &types.ServiceNowConnectorProfileCredentials{ - Password: aws.String(m["password"].(string)), + Password: aws.String(m[names.AttrPassword].(string)), Username: aws.String(m["username"].(string)), } @@ -1835,7 +1835,7 @@ func expandSlackConnectorProfileCredentials(m map[string]interface{}) *types.Sla func expandSnowflakeConnectorProfileCredentials(m map[string]interface{}) *types.SnowflakeConnectorProfileCredentials { credentials := &types.SnowflakeConnectorProfileCredentials{ - Password: aws.String(m["password"].(string)), + Password: aws.String(m[names.AttrPassword].(string)), Username: aws.String(m["username"].(string)), } @@ -1852,7 +1852,7 @@ func expandTrendmicroConnectorProfileCredentials(m map[string]interface{}) *type func expandVeevaConnectorProfileCredentials(m map[string]interface{}) *types.VeevaConnectorProfileCredentials { credentials := &types.VeevaConnectorProfileCredentials{ - Password: aws.String(m["password"].(string)), + Password: aws.String(m[names.AttrPassword].(string)), Username: aws.String(m["username"].(string)), } @@ -1904,7 +1904,7 @@ func expandAPIKeyCredentials(m map[string]interface{}) *types.ApiKeyCredentials func expandBasicAuthCredentials(m map[string]interface{}) *types.BasicAuthCredentials { credentials := &types.BasicAuthCredentials{} - if v, ok := m["password"].(string); ok && v != "" { + if v, ok := m[names.AttrPassword].(string); ok && v != "" { credentials.Password = aws.String(v) } From 4d2c2c4926c6d08bd72550d158a74f8827a07f66 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:05 -0400 Subject: [PATCH 0955/1490] chime: Use constant for password strings --- .../service/chime/voice_connector_termination_credentials.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/chime/voice_connector_termination_credentials.go b/internal/service/chime/voice_connector_termination_credentials.go index d019b276f40..b7e5955dbf1 100644 --- a/internal/service/chime/voice_connector_termination_credentials.go +++ b/internal/service/chime/voice_connector_termination_credentials.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_chime_voice_connector_termination_credentials") @@ -45,7 +46,7 @@ func ResourceVoiceConnectorTerminationCredentials() *schema.Resource { Required: true, ValidateFunc: validation.StringIsNotEmpty, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -174,7 +175,7 @@ func expandCredentials(data []interface{}) []awstypes.Credential { item := rItem.(map[string]interface{}) credentials = append(credentials, awstypes.Credential{ Username: aws.String(item["username"].(string)), - Password: aws.String(item["password"].(string)), + Password: aws.String(item[names.AttrPassword].(string)), }) } From ad39dbbfce2bc241f368ba4928887c4a04a60ccd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:05 -0400 Subject: [PATCH 0956/1490] cognitoidp: Use constant for password strings --- internal/service/cognitoidp/user.go | 12 ++++++------ internal/service/cognitoidp/user_test.go | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/cognitoidp/user.go b/internal/service/cognitoidp/user.go index f76b9e88019..d4336024af0 100644 --- a/internal/service/cognitoidp/user.go +++ b/internal/service/cognitoidp/user.go @@ -118,7 +118,7 @@ func resourceUser() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Sensitive: true, Optional: true, @@ -130,7 +130,7 @@ func resourceUser() *schema.Resource { Sensitive: true, Optional: true, ValidateFunc: validation.StringLenBetween(6, 256), - ConflictsWith: []string{"password"}, + ConflictsWith: []string{names.AttrPassword}, }, "validation_data": { Type: schema.TypeMap, @@ -210,7 +210,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf } } - if v, ok := d.GetOk("password"); ok { + if v, ok := d.GetOk(names.AttrPassword); ok { setPasswordParams := &cognitoidentityprovider.AdminSetUserPasswordInput{ Username: aws.String(d.Get("username").(string)), UserPoolId: aws.String(d.Get("user_pool_id").(string)), @@ -346,8 +346,8 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf } } - if d.HasChange("password") { - password := d.Get("password").(string) + if d.HasChange(names.AttrPassword) { + password := d.Get(names.AttrPassword).(string) if password != "" { setPasswordParams := &cognitoidentityprovider.AdminSetUserPasswordInput{ @@ -362,7 +362,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf return sdkdiag.AppendErrorf(diags, "changing Cognito User's password (%s): %s", d.Id(), err) } } else { - d.Set("password", nil) + d.Set(names.AttrPassword, nil) } } diff --git a/internal/service/cognitoidp/user_test.go b/internal/service/cognitoidp/user_test.go index cafcad3a81c..cf6cfdf0553 100644 --- a/internal/service/cognitoidp/user_test.go +++ b/internal/service/cognitoidp/user_test.go @@ -52,7 +52,7 @@ func TestAccCognitoIDPUser_basic(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "temporary_password", - "password", + names.AttrPassword, "client_metadata", "validation_data", "desired_delivery_mediums", @@ -117,7 +117,7 @@ func TestAccCognitoIDPUser_temporaryPassword(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "temporary_password", - "password", + names.AttrPassword, "client_metadata", "validation_data", "desired_delivery_mediums", @@ -174,7 +174,7 @@ func TestAccCognitoIDPUser_password(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "temporary_password", - "password", + names.AttrPassword, "client_metadata", "validation_data", "desired_delivery_mediums", @@ -193,7 +193,7 @@ func TestAccCognitoIDPUser_password(t *testing.T) { Config: testAccUserConfig_noPassword(rUserPoolName, rClientName, rUserName), Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, userResourceName), - resource.TestCheckResourceAttr(userResourceName, "password", ""), + resource.TestCheckResourceAttr(userResourceName, names.AttrPassword, ""), resource.TestCheckResourceAttr(userResourceName, names.AttrStatus, cognitoidentityprovider.UserStatusTypeConfirmed), ), }, @@ -229,7 +229,7 @@ func TestAccCognitoIDPUser_attributes(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "temporary_password", - "password", + names.AttrPassword, "client_metadata", "validation_data", "desired_delivery_mediums", @@ -275,7 +275,7 @@ func TestAccCognitoIDPUser_enabled(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "temporary_password", - "password", + names.AttrPassword, "client_metadata", "validation_data", "desired_delivery_mediums", @@ -391,7 +391,7 @@ func testAccUserPassword(ctx context.Context, userResName string, clientResName } userName := userRs.Primary.Attributes["username"] - userPassword := userRs.Primary.Attributes["password"] + userPassword := userRs.Primary.Attributes[names.AttrPassword] clientId := clientRs.Primary.Attributes[names.AttrID] conn := acctest.Provider.Meta().(*conns.AWSClient).CognitoIDPConn(ctx) From 87acd716ddc83d6420e564cd432c26758a198639 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:05 -0400 Subject: [PATCH 0957/1490] connect: Use constant for password strings --- internal/service/connect/user.go | 4 ++-- internal/service/connect/user_test.go | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/connect/user.go b/internal/service/connect/user.go index 00d1a3bf8a9..6e4f519aee1 100644 --- a/internal/service/connect/user.go +++ b/internal/service/connect/user.go @@ -84,7 +84,7 @@ func ResourceUser() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 100), }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -175,7 +175,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf input.IdentityInfo = expandIdentityInfo(v.([]interface{})) } - if v, ok := d.GetOk("password"); ok { + if v, ok := d.GetOk(names.AttrPassword); ok { input.Password = aws.String(v.(string)) } diff --git a/internal/service/connect/user_test.go b/internal/service/connect/user_test.go index dd3d815b900..b9b08c08148 100644 --- a/internal/service/connect/user_test.go +++ b/internal/service/connect/user_test.go @@ -49,7 +49,7 @@ func testAccUser_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "identity_info.0.last_name", "example2"), resource.TestCheckResourceAttrPair(resourceName, names.AttrInstanceID, "aws_connect_instance.test", names.AttrID), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName5), - resource.TestCheckResourceAttr(resourceName, "password", "Password123"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "Password123"), resource.TestCheckResourceAttr(resourceName, "phone_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "phone_config.0.after_contact_work_time_limit", "0"), resource.TestCheckResourceAttr(resourceName, "phone_config.0.phone_type", connect.PhoneTypeSoftPhone), @@ -93,7 +93,7 @@ func testAccUser_updateHierarchyGroupId(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccUserConfig_hierarchyGroupID(rName, rName2, rName3, rName4, rName5, "second"), @@ -144,7 +144,7 @@ func testAccUser_updateIdentityInfo(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccUserConfig_identityInfo(rName, rName2, rName3, rName4, rName5, emailUpdated, firstNameUpdated, lastNameUpdated), @@ -196,7 +196,7 @@ func testAccUser_updatePhoneConfig(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccUserConfig_phoneDeskPhone(rName, rName2, rName3, rName4, rName5, after_contact_work_time_limit_original, auto_accept_original, desk_phone_number_original), @@ -213,7 +213,7 @@ func testAccUser_updatePhoneConfig(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccUserConfig_phoneDeskPhone(rName, rName2, rName3, rName4, rName5, after_contact_work_time_limit_updated, auto_accept_updated, desk_phone_number_updated), @@ -259,7 +259,7 @@ func testAccUser_updateSecurityProfileIds(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccUserConfig_securityProfileIDs(rName, rName2, rName3, rName4, rName5, "second"), @@ -274,7 +274,7 @@ func testAccUser_updateSecurityProfileIds(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccUserConfig_securityProfileIDs(rName, rName2, rName3, rName4, rName5, "third"), @@ -318,7 +318,7 @@ func testAccUser_updateRoutingProfileId(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccUserConfig_routingProfileID(rName, rName2, rName3, rName4, rName5, "second"), @@ -360,7 +360,7 @@ func testAccUser_updateTags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccUserConfig_tags(rName, rName2, rName3, rName4, rName5), From cc311c3539837654c34fe3ef8b7a3f0a4fd3cc2c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:05 -0400 Subject: [PATCH 0958/1490] datasync: Use constant for password strings --- internal/service/datasync/common_fsx_protocol_functions.go | 5 +++-- internal/service/datasync/location_fsx_ontap_file_system.go | 2 +- .../service/datasync/location_fsx_windows_file_system.go | 4 ++-- .../datasync/location_fsx_windows_file_system_test.go | 6 +++--- internal/service/datasync/location_smb.go | 6 +++--- internal/service/datasync/location_smb_test.go | 4 ++-- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/internal/service/datasync/common_fsx_protocol_functions.go b/internal/service/datasync/common_fsx_protocol_functions.go index 429d2e27d23..f67a68f7758 100644 --- a/internal/service/datasync/common_fsx_protocol_functions.go +++ b/internal/service/datasync/common_fsx_protocol_functions.go @@ -6,6 +6,7 @@ package datasync import ( "github.com/aws/aws-sdk-go-v2/aws" awstypes "github.com/aws/aws-sdk-go-v2/service/datasync/types" + "github.com/hashicorp/terraform-provider-aws/names" ) func expandProtocol(l []interface{}) *awstypes.FsxProtocol { @@ -70,7 +71,7 @@ func expandSMB(l []interface{}) *awstypes.FsxProtocolSmb { if v, ok := m["domain"].(string); ok && v != "" { protocol.Domain = aws.String(v) } - if v, ok := m["password"].(string); ok && v != "" { + if v, ok := m[names.AttrPassword].(string); ok && v != "" { protocol.Password = aws.String(v) } if v, ok := m["user"].(string); ok && v != "" { @@ -105,7 +106,7 @@ func flattenSMB(smb *awstypes.FsxProtocolSmb) []interface{} { m["domain"] = aws.ToString(v) } if v := smb.Password; v != nil { - m["password"] = aws.ToString(v) + m[names.AttrPassword] = aws.ToString(v) } if v := smb.User; v != nil { m["user"] = aws.ToString(v) diff --git a/internal/service/datasync/location_fsx_ontap_file_system.go b/internal/service/datasync/location_fsx_ontap_file_system.go index a79f4a081b5..e5371e426d1 100644 --- a/internal/service/datasync/location_fsx_ontap_file_system.go +++ b/internal/service/datasync/location_fsx_ontap_file_system.go @@ -138,7 +138,7 @@ func resourceLocationFSxONTAPFileSystem() *schema.Resource { }, }, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, ForceNew: true, diff --git a/internal/service/datasync/location_fsx_windows_file_system.go b/internal/service/datasync/location_fsx_windows_file_system.go index e819b88f171..219c8882494 100644 --- a/internal/service/datasync/location_fsx_windows_file_system.go +++ b/internal/service/datasync/location_fsx_windows_file_system.go @@ -74,7 +74,7 @@ func resourceLocationFSxWindowsFileSystem() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -123,7 +123,7 @@ func resourceLocationFSxWindowsFileSystemCreate(ctx context.Context, d *schema.R input := &datasync.CreateLocationFsxWindowsInput{ FsxFilesystemArn: aws.String(d.Get("fsx_filesystem_arn").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), SecurityGroupArns: flex.ExpandStringValueSet(d.Get("security_group_arns").(*schema.Set)), Tags: getTagsIn(ctx), User: aws.String(d.Get("user").(string)), diff --git a/internal/service/datasync/location_fsx_windows_file_system_test.go b/internal/service/datasync/location_fsx_windows_file_system_test.go index 2ff1e00dab3..525978f0033 100644 --- a/internal/service/datasync/location_fsx_windows_file_system_test.go +++ b/internal/service/datasync/location_fsx_windows_file_system_test.go @@ -56,7 +56,7 @@ func TestAccDataSyncLocationFSxWindowsFileSystem_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateIdFunc: testAccLocationFSxWindowsImportStateID(resourceName), - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -120,7 +120,7 @@ func TestAccDataSyncLocationFSxWindowsFileSystem_subdirectory(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateIdFunc: testAccLocationFSxWindowsImportStateID(resourceName), - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -156,7 +156,7 @@ func TestAccDataSyncLocationFSxWindowsFileSystem_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateIdFunc: testAccLocationFSxWindowsImportStateID(resourceName), - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccLocationFSxWindowsFileSystemConfig_tags2(rName, domainName, "key1", "value1updated", "key2", "value2"), diff --git a/internal/service/datasync/location_smb.go b/internal/service/datasync/location_smb.go index 2d39bceeccb..c15e4c95ac1 100644 --- a/internal/service/datasync/location_smb.go +++ b/internal/service/datasync/location_smb.go @@ -73,7 +73,7 @@ func resourceLocationSMB() *schema.Resource { }, }, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -125,7 +125,7 @@ func resourceLocationSMBCreate(ctx context.Context, d *schema.ResourceData, meta input := &datasync.CreateLocationSmbInput{ AgentArns: flex.ExpandStringValueSet(d.Get("agent_arns").(*schema.Set)), MountOptions: expandSMBMountOptions(d.Get("mount_options").([]interface{})), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerHostname: aws.String(d.Get("server_hostname").(string)), Subdirectory: aws.String(d.Get("subdirectory").(string)), Tags: getTagsIn(ctx), @@ -196,7 +196,7 @@ func resourceLocationSMBUpdate(ctx context.Context, d *schema.ResourceData, meta LocationArn: aws.String(d.Id()), AgentArns: flex.ExpandStringValueSet(d.Get("agent_arns").(*schema.Set)), MountOptions: expandSMBMountOptions(d.Get("mount_options").([]interface{})), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), Subdirectory: aws.String(d.Get("subdirectory").(string)), User: aws.String(d.Get("user").(string)), } diff --git a/internal/service/datasync/location_smb_test.go b/internal/service/datasync/location_smb_test.go index de613508cee..ffb0657bc0a 100644 --- a/internal/service/datasync/location_smb_test.go +++ b/internal/service/datasync/location_smb_test.go @@ -49,7 +49,7 @@ func TestAccDataSyncLocationSMB_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccLocationSMBConfig_basic(rName, "/test2/"), @@ -116,7 +116,7 @@ func TestAccDataSyncLocationSMB_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccLocationSMBConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), From 854e4d1ae240010f01e349a4cc3d5c0603f53a9a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:06 -0400 Subject: [PATCH 0959/1490] dms: Use constant for password strings --- internal/service/dms/endpoint.go | 62 +++++----- internal/service/dms/endpoint_data_source.go | 2 +- internal/service/dms/endpoint_test.go | 120 +++++++++---------- 3 files changed, 92 insertions(+), 92 deletions(-) diff --git a/internal/service/dms/endpoint.go b/internal/service/dms/endpoint.go index 195f1f0b6b0..7ac00683db1 100644 --- a/internal/service/dms/endpoint.go +++ b/internal/service/dms/endpoint.go @@ -331,7 +331,7 @@ func ResourceEndpoint() *schema.Resource { }, }, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -731,14 +731,14 @@ func ResourceEndpoint() *schema.Resource { Optional: true, ValidateFunc: verify.ValidARN, RequiredWith: []string{"secrets_manager_arn"}, - ConflictsWith: []string{"username", "password", "server_name", names.AttrPort}, + ConflictsWith: []string{"username", names.AttrPassword, "server_name", names.AttrPort}, }, "secrets_manager_arn": { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, RequiredWith: []string{"secrets_manager_access_role_arn"}, - ConflictsWith: []string{"username", "password", "server_name", names.AttrPort}, + ConflictsWith: []string{"username", names.AttrPassword, "server_name", names.AttrPort}, }, "server_name": { Type: schema.TypeString, @@ -814,7 +814,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in } else { input.MySQLSettings = &dms.MySQLSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -835,7 +835,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in settings.DatabaseName = aws.String(d.Get(names.AttrDatabaseName).(string)) } else { settings.Username = aws.String(d.Get("username").(string)) - settings.Password = aws.String(d.Get("password").(string)) + settings.Password = aws.String(d.Get(names.AttrPassword).(string)) settings.ServerName = aws.String(d.Get("server_name").(string)) settings.Port = aws.Int64(int64(d.Get(names.AttrPort).(int))) settings.DatabaseName = aws.String(d.Get(names.AttrDatabaseName).(string)) @@ -869,7 +869,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in settings.SecretsManagerSecretId = aws.String(d.Get("secrets_manager_arn").(string)) } else { settings.Username = aws.String(d.Get("username").(string)) - settings.Password = aws.String(d.Get("password").(string)) + settings.Password = aws.String(d.Get(names.AttrPassword).(string)) settings.ServerName = aws.String(d.Get("server_name").(string)) settings.Port = aws.Int64(int64(d.Get(names.AttrPort).(int))) @@ -897,7 +897,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in } else { input.OracleSettings = &dms.OracleSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -918,7 +918,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in settings.SecretsManagerSecretId = aws.String(d.Get("secrets_manager_arn").(string)) } else { settings.Username = aws.String(d.Get("username").(string)) - settings.Password = aws.String(d.Get("password").(string)) + settings.Password = aws.String(d.Get(names.AttrPassword).(string)) settings.ServerName = aws.String(d.Get("server_name").(string)) settings.Port = aws.Int64(int64(d.Get(names.AttrPort).(int))) @@ -961,7 +961,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in } else { input.MicrosoftSQLServerSettings = &dms.MicrosoftSQLServerSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -980,7 +980,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in } else { input.SybaseSettings = &dms.SybaseSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -999,7 +999,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in } else { input.IBMDb2Settings = &dms.IBMDb2Settings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -1104,7 +1104,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in switch engineName := d.Get("engine_name").(string); engineName { case engineNameAurora, engineNameMariadb, engineNameMySQL: if d.HasChanges( - "username", "password", "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.MySQLSettings = &dms.MySQLSettings{ @@ -1114,7 +1114,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } else { input.MySQLSettings = &dms.MySQLSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -1127,7 +1127,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameAuroraPostgresql, engineNamePostgres: if d.HasChanges( - "username", "password", "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.PostgreSQLSettings = &dms.PostgreSQLSettings{ @@ -1138,7 +1138,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } else { input.PostgreSQLSettings = &dms.PostgreSQLSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -1183,7 +1183,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameMongodb: if d.HasChanges( - "username", "password", "server_name", names.AttrPort, names.AttrDatabaseName, "mongodb_settings.0.auth_type", + "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "mongodb_settings.0.auth_type", "mongodb_settings.0.auth_mechanism", "mongodb_settings.0.nesting_level", "mongodb_settings.0.extract_doc_id", "mongodb_settings.0.docs_to_investigate", "mongodb_settings.0.auth_source", "secrets_manager_access_role_arn", "secrets_manager_arn") { @@ -1204,7 +1204,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } else { input.MongoDbSettings = &dms.MongoDbSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -1225,7 +1225,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameOracle: if d.HasChanges( - "username", "password", "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.OracleSettings = &dms.OracleSettings{ @@ -1236,7 +1236,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } else { input.OracleSettings = &dms.OracleSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -1254,7 +1254,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameRedshift: if d.HasChanges( - "username", "password", "server_name", names.AttrPort, names.AttrDatabaseName, + "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "redshift_settings", "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { @@ -1266,7 +1266,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } else { input.RedshiftSettings = &dms.RedshiftSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -1303,7 +1303,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameSQLServer, engineNameBabelfish: if d.HasChanges( - "username", "password", "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.MicrosoftSQLServerSettings = &dms.MicrosoftSQLServerSettings{ @@ -1314,7 +1314,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } else { input.MicrosoftSQLServerSettings = &dms.MicrosoftSQLServerSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -1327,7 +1327,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameSybase: if d.HasChanges( - "username", "password", "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.SybaseSettings = &dms.SybaseSettings{ @@ -1338,7 +1338,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } else { input.SybaseSettings = &dms.SybaseSettings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -1351,7 +1351,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameDB2, engineNameDB2zOS: if d.HasChanges( - "username", "password", "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.IBMDb2Settings = &dms.IBMDb2Settings{ @@ -1362,7 +1362,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } else { input.IBMDb2Settings = &dms.IBMDb2Settings{ Username: aws.String(d.Get("username").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), DatabaseName: aws.String(d.Get(names.AttrDatabaseName).(string)), @@ -1383,8 +1383,8 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in input.DatabaseName = aws.String(d.Get(names.AttrDatabaseName).(string)) } - if d.HasChange("password") { - input.Password = aws.String(d.Get("password").(string)) + if d.HasChange(names.AttrPassword) { + input.Password = aws.String(d.Get(names.AttrPassword).(string)) } if d.HasChange(names.AttrPort) { @@ -2618,7 +2618,7 @@ func engineSettingsToSet(l []interface{}) *schema.Set { func expandTopLevelConnectionInfo(d *schema.ResourceData, input *dms.CreateEndpointInput) { input.Username = aws.String(d.Get("username").(string)) - input.Password = aws.String(d.Get("password").(string)) + input.Password = aws.String(d.Get(names.AttrPassword).(string)) input.ServerName = aws.String(d.Get("server_name").(string)) input.Port = aws.Int64(int64(d.Get(names.AttrPort).(int))) @@ -2629,7 +2629,7 @@ func expandTopLevelConnectionInfo(d *schema.ResourceData, input *dms.CreateEndpo func expandTopLevelConnectionInfoModify(d *schema.ResourceData, input *dms.ModifyEndpointInput) { input.Username = aws.String(d.Get("username").(string)) - input.Password = aws.String(d.Get("password").(string)) + input.Password = aws.String(d.Get(names.AttrPassword).(string)) input.ServerName = aws.String(d.Get("server_name").(string)) input.Port = aws.Int64(int64(d.Get(names.AttrPort).(int))) diff --git a/internal/service/dms/endpoint_data_source.go b/internal/service/dms/endpoint_data_source.go index 5a21faa6ca1..7223cbab59b 100644 --- a/internal/service/dms/endpoint_data_source.go +++ b/internal/service/dms/endpoint_data_source.go @@ -233,7 +233,7 @@ func DataSourceEndpoint() *schema.Resource { }, }, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/dms/endpoint_test.go b/internal/service/dms/endpoint_test.go index 22d6a8ea6b2..75c53b97422 100644 --- a/internal/service/dms/endpoint_test.go +++ b/internal/service/dms/endpoint_test.go @@ -43,7 +43,7 @@ func TestAccDMSEndpoint_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccEndpointConfig_basicUpdate(rName), @@ -51,7 +51,7 @@ func TestAccDMSEndpoint_basic(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tf-test-dms-db-updated"), resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", "extra"), - resource.TestCheckResourceAttr(resourceName, "password", "tftestupdate"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftestupdate"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3303"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"), @@ -84,7 +84,7 @@ func TestAccDMSEndpoint_Aurora_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -142,7 +142,7 @@ func TestAccDMSEndpoint_Aurora_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3307"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestMatchResourceAttr(resourceName, "extra_connection_attributes", regexache.MustCompile(`EventsPollInterval=40;`)), @@ -152,7 +152,7 @@ func TestAccDMSEndpoint_Aurora_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -180,7 +180,7 @@ func TestAccDMSEndpoint_AuroraPostgreSQL_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -238,7 +238,7 @@ func TestAccDMSEndpoint_AuroraPostgreSQL_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "require"), resource.TestMatchResourceAttr(resourceName, "extra_connection_attributes", regexache.MustCompile(`ExecuteTimeout=1000;`)), @@ -248,7 +248,7 @@ func TestAccDMSEndpoint_AuroraPostgreSQL_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -300,7 +300,7 @@ func TestAccDMSEndpoint_S3_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccEndpointConfig_s3Update(rName), @@ -457,7 +457,7 @@ func TestAccDMSEndpoint_S3_extraConnectionAttributes(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -543,7 +543,7 @@ func TestAccDMSEndpoint_dynamoDB(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccEndpointConfig_dynamoDBUpdate(rName), @@ -581,7 +581,7 @@ func TestAccDMSEndpoint_OpenSearch_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -613,7 +613,7 @@ func TestAccDMSEndpoint_OpenSearch_extraConnectionAttributes(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -642,7 +642,7 @@ func TestAccDMSEndpoint_OpenSearch_errorRetryDuration(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, // Resource needs additional creation retry handling for the following: // Error creating DMS endpoint: ResourceAlreadyExistsFault: ReplicationEndpoint "xxx" already in use @@ -681,7 +681,7 @@ func TestAccDMSEndpoint_OpenSearch_UseNewMappingType(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -710,7 +710,7 @@ func TestAccDMSEndpoint_OpenSearch_fullLoadErrorPercentage(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, // Resource needs additional creation retry handling for the following: // Error creating DMS endpoint: ResourceAlreadyExistsFault: ReplicationEndpoint "xxx" already in use @@ -766,7 +766,7 @@ func TestAccDMSEndpoint_kafka(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccEndpointConfig_kafkaUpdate(rName, domainName), @@ -830,7 +830,7 @@ func TestAccDMSEndpoint_kinesis(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccEndpointConfig_kinesisUpdate(rName), @@ -875,7 +875,7 @@ func TestAccDMSEndpoint_MongoDB_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -903,7 +903,7 @@ func TestAccDMSEndpoint_MongoDB_secretID(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -932,7 +932,7 @@ func TestAccDMSEndpoint_MongoDB_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27017"), resource.TestCheckResourceAttr(resourceName, "username", "tftest"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), ), @@ -944,7 +944,7 @@ func TestAccDMSEndpoint_MongoDB_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "require"), resource.TestCheckResourceAttr(resourceName, "mongodb_settings.#", "1"), @@ -958,7 +958,7 @@ func TestAccDMSEndpoint_MongoDB_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -986,7 +986,7 @@ func TestAccDMSEndpoint_MariaDB_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1044,7 +1044,7 @@ func TestAccDMSEndpoint_MariaDB_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3307"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestMatchResourceAttr(resourceName, "extra_connection_attributes", regexache.MustCompile(`EventsPollInterval=30;`)), @@ -1054,7 +1054,7 @@ func TestAccDMSEndpoint_MariaDB_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1082,7 +1082,7 @@ func TestAccDMSEndpoint_MySQL_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1140,7 +1140,7 @@ func TestAccDMSEndpoint_MySQL_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3307"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestMatchResourceAttr(resourceName, "extra_connection_attributes", regexache.MustCompile(`CleanSrcMetadataOnMismatch=false;`)), @@ -1150,7 +1150,7 @@ func TestAccDMSEndpoint_MySQL_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1179,7 +1179,7 @@ func TestAccDMSEndpoint_Oracle_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1231,7 +1231,7 @@ func TestAccDMSEndpoint_Oracle_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27017"), resource.TestCheckResourceAttr(resourceName, "username", "tftest"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", ""), @@ -1244,7 +1244,7 @@ func TestAccDMSEndpoint_Oracle_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestMatchResourceAttr(resourceName, "extra_connection_attributes", regexache.MustCompile(`charLengthSemantics=CHAR;`)), @@ -1254,7 +1254,7 @@ func TestAccDMSEndpoint_Oracle_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1282,7 +1282,7 @@ func TestAccDMSEndpoint_PostgreSQL_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1340,7 +1340,7 @@ func TestAccDMSEndpoint_PostgreSQL_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "require"), resource.TestMatchResourceAttr(resourceName, "extra_connection_attributes", regexache.MustCompile(`HeartbeatFrequency=180;`)), @@ -1350,7 +1350,7 @@ func TestAccDMSEndpoint_PostgreSQL_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1465,7 +1465,7 @@ func TestAccDMSEndpoint_SQLServer_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1523,7 +1523,7 @@ func TestAccDMSEndpoint_SQLServer_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "require"), resource.TestMatchResourceAttr(resourceName, "extra_connection_attributes", regexache.MustCompile(`TlogAccessMode=PreferTlog;`)), @@ -1533,7 +1533,7 @@ func TestAccDMSEndpoint_SQLServer_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1564,7 +1564,7 @@ func TestAccDMSEndpoint_babelfish(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "require"), ), @@ -1573,7 +1573,7 @@ func TestAccDMSEndpoint_babelfish(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1625,7 +1625,7 @@ func TestAccDMSEndpoint_Sybase_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1677,7 +1677,7 @@ func TestAccDMSEndpoint_Sybase_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27017"), resource.TestCheckResourceAttr(resourceName, "username", "tftest"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", ""), @@ -1690,7 +1690,7 @@ func TestAccDMSEndpoint_Sybase_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", ""), @@ -1700,7 +1700,7 @@ func TestAccDMSEndpoint_Sybase_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -1752,7 +1752,7 @@ func TestAccDMSEndpoint_docDB(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccEndpointConfig_docDBUpdate(rName), @@ -1760,7 +1760,7 @@ func TestAccDMSEndpoint_docDB(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tf-test-dms-db-updated"), resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", "extra"), - resource.TestCheckResourceAttr(resourceName, "password", "tftestupdate"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftestupdate"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27019"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"), @@ -1793,7 +1793,7 @@ func TestAccDMSEndpoint_db2_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccEndpointConfig_db2Update(rName), @@ -1801,7 +1801,7 @@ func TestAccDMSEndpoint_db2_basic(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tf-test-dms-db-updated"), resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", "extra"), - resource.TestCheckResourceAttr(resourceName, "password", "tftestupdate"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftestupdate"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27019"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"), @@ -1834,7 +1834,7 @@ func TestAccDMSEndpoint_db2zOS_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccEndpointConfig_db2zOSUpdate(rName), @@ -1842,7 +1842,7 @@ func TestAccDMSEndpoint_db2zOS_basic(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tf-test-dms-db-updated"), resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", "extra"), - resource.TestCheckResourceAttr(resourceName, "password", "tftestupdate"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftestupdate"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27019"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"), @@ -1875,7 +1875,7 @@ func TestAccDMSEndpoint_azureSQLManagedInstance(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, { Config: testAccEndpointConfig_azureSQLManagedInstanceUpdate(rName), @@ -1883,7 +1883,7 @@ func TestAccDMSEndpoint_azureSQLManagedInstance(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tf-test-dms-db-updated"), resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", "extra"), - resource.TestCheckResourceAttr(resourceName, "password", "tftestupdate"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftestupdate"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3342"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"), @@ -2026,7 +2026,7 @@ func TestAccDMSEndpoint_Redshift_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -2081,7 +2081,7 @@ func TestAccDMSEndpoint_Redshift_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", ""), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27017"), resource.TestCheckResourceAttr(resourceName, "username", "tftest"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest"), resource.TestCheckResourceAttr(resourceName, "redshift_settings.#", "1"), resource.TestCheckResourceAttr(resourceName, "redshift_settings.0.bucket_name", ""), resource.TestCheckResourceAttr(resourceName, "redshift_settings.0.bucket_folder", ""), @@ -2098,7 +2098,7 @@ func TestAccDMSEndpoint_Redshift_update(t *testing.T) { resource.TestMatchResourceAttr(resourceName, "extra_connection_attributes", regexache.MustCompile(`acceptanydate=true`)), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), - resource.TestCheckResourceAttr(resourceName, "password", "tftest-new-password"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, "redshift_settings.#", "1"), resource.TestCheckResourceAttr(resourceName, "redshift_settings.0.bucket_name", names.AttrBucketName), resource.TestCheckResourceAttr(resourceName, "redshift_settings.0.bucket_folder", "bucket_folder"), @@ -2111,7 +2111,7 @@ func TestAccDMSEndpoint_Redshift_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -2140,7 +2140,7 @@ func TestAccDMSEndpoint_Redshift_kmsKey(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -2170,7 +2170,7 @@ func TestAccDMSEndpoint_Redshift_SSEKMSKeyARN(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) @@ -2200,7 +2200,7 @@ func TestAccDMSEndpoint_Redshift_SSEKMSKeyId(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"password"}, + ImportStateVerifyIgnore: []string{names.AttrPassword}, }, }, }) From a73b34f74bd265f093cce101dc07e069c4789130 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:06 -0400 Subject: [PATCH 0960/1490] ds: Use constant for password strings --- internal/service/ds/directory.go | 8 ++++---- internal/service/ds/directory_test.go | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/ds/directory.go b/internal/service/ds/directory.go index af5fbf492d4..26f8ebbc252 100644 --- a/internal/service/ds/directory.go +++ b/internal/service/ds/directory.go @@ -141,7 +141,7 @@ func ResourceDirectory() *schema.Resource { ForceNew: true, ValidateFunc: domainValidator, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -399,7 +399,7 @@ func (c adConnectorCreator) TypeName() string { func (c adConnectorCreator) Create(ctx context.Context, conn *directoryservice.DirectoryService, name string, d *schema.ResourceData) error { input := &directoryservice.ConnectDirectoryInput{ Name: aws.String(name), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), Tags: getTagsIn(ctx), } @@ -442,7 +442,7 @@ func (c microsoftADCreator) TypeName() string { func (c microsoftADCreator) Create(ctx context.Context, conn *directoryservice.DirectoryService, name string, d *schema.ResourceData) error { input := &directoryservice.CreateMicrosoftADInput{ Name: aws.String(name), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), Tags: getTagsIn(ctx), } @@ -482,7 +482,7 @@ func (c simpleADCreator) TypeName() string { func (c simpleADCreator) Create(ctx context.Context, conn *directoryservice.DirectoryService, name string, d *schema.ResourceData) error { input := &directoryservice.CreateDirectoryInput{ Name: aws.String(name), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), Tags: getTagsIn(ctx), } diff --git a/internal/service/ds/directory_test.go b/internal/service/ds/directory_test.go index bca55cebd9b..86e8ad5354e 100644 --- a/internal/service/ds/directory_test.go +++ b/internal/service/ds/directory_test.go @@ -64,7 +64,7 @@ func TestAccDSDirectory_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "password", + names.AttrPassword, }, }, }, @@ -130,7 +130,7 @@ func TestAccDSDirectory_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "password", + names.AttrPassword, }, }, { @@ -195,7 +195,7 @@ func TestAccDSDirectory_microsoft(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "password", + names.AttrPassword, }, }, }, @@ -243,7 +243,7 @@ func TestAccDSDirectory_microsoftStandard(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "password", + names.AttrPassword, }, }, }, @@ -297,7 +297,7 @@ func TestAccDSDirectory_connector(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "password", + names.AttrPassword, }, }, }, @@ -350,7 +350,7 @@ func TestAccDSDirectory_withAliasAndSSO(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "password", + names.AttrPassword, }, }, { @@ -412,7 +412,7 @@ func TestAccDSDirectory_desiredNumberOfDomainControllers(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "password", + names.AttrPassword, }, }, { From 6f90997bebadab1ca142af206d4b1adc75c3c066 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:06 -0400 Subject: [PATCH 0961/1490] ecr: Use constant for password strings --- internal/service/ecr/authorization_token_data_source.go | 5 +++-- internal/service/ecr/authorization_token_data_source_test.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/ecr/authorization_token_data_source.go b/internal/service/ecr/authorization_token_data_source.go index 7c9ddfce96e..03551570abc 100644 --- a/internal/service/ecr/authorization_token_data_source.go +++ b/internal/service/ecr/authorization_token_data_source.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" itypes "github.com/hashicorp/terraform-provider-aws/internal/types" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_ecr_authorization_token", name="Authorization Token") @@ -32,7 +33,7 @@ func dataSourceAuthorizationToken() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Computed: true, Sensitive: true, @@ -83,7 +84,7 @@ func dataSourceAuthorizationTokenRead(ctx context.Context, d *schema.ResourceDat d.Set("proxy_endpoint", proxyEndpoint) d.Set("expires_at", expiresAt) d.Set("user_name", userName) - d.Set("password", password) + d.Set(names.AttrPassword, password) return diags } diff --git a/internal/service/ecr/authorization_token_data_source_test.go b/internal/service/ecr/authorization_token_data_source_test.go index 7a653845608..e0661dd69bd 100644 --- a/internal/service/ecr/authorization_token_data_source_test.go +++ b/internal/service/ecr/authorization_token_data_source_test.go @@ -32,7 +32,7 @@ func TestAccECRAuthorizationTokenDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet(dataSourceName, "expires_at"), resource.TestCheckResourceAttrSet(dataSourceName, "user_name"), resource.TestMatchResourceAttr(dataSourceName, "user_name", regexache.MustCompile(`AWS`)), - resource.TestCheckResourceAttrSet(dataSourceName, "password"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrPassword), ), }, { @@ -44,7 +44,7 @@ func TestAccECRAuthorizationTokenDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet(dataSourceName, "expires_at"), resource.TestCheckResourceAttrSet(dataSourceName, "user_name"), resource.TestMatchResourceAttr(dataSourceName, "user_name", regexache.MustCompile(`AWS`)), - resource.TestCheckResourceAttrSet(dataSourceName, "password"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrPassword), ), }, }, From 296ade7b180795bbbeaca527a0a8e147cba89e3a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:07 -0400 Subject: [PATCH 0962/1490] ecrpublic: Use constant for password strings --- .../service/ecrpublic/authorization_token_data_source.go | 5 +++-- .../ecrpublic/authorization_token_data_source_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/ecrpublic/authorization_token_data_source.go b/internal/service/ecrpublic/authorization_token_data_source.go index f998261061a..c6e15d77ef4 100644 --- a/internal/service/ecrpublic/authorization_token_data_source.go +++ b/internal/service/ecrpublic/authorization_token_data_source.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" itypes "github.com/hashicorp/terraform-provider-aws/internal/types" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_ecrpublic_authorization_token") @@ -32,7 +33,7 @@ func DataSourceAuthorizationToken() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Computed: true, Sensitive: true, @@ -76,7 +77,7 @@ func dataSourceAuthorizationTokenRead(ctx context.Context, d *schema.ResourceDat d.Set("authorization_token", authorizationToken) d.Set("expires_at", expiresAt) d.Set("user_name", userName) - d.Set("password", password) + d.Set(names.AttrPassword, password) return diags } diff --git a/internal/service/ecrpublic/authorization_token_data_source_test.go b/internal/service/ecrpublic/authorization_token_data_source_test.go index ef977be2a85..f016d5918af 100644 --- a/internal/service/ecrpublic/authorization_token_data_source_test.go +++ b/internal/service/ecrpublic/authorization_token_data_source_test.go @@ -28,7 +28,7 @@ func TestAccECRPublicAuthorizationTokenDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet(dataSourceName, "expires_at"), resource.TestCheckResourceAttrSet(dataSourceName, "user_name"), resource.TestMatchResourceAttr(dataSourceName, "user_name", regexache.MustCompile(`AWS`)), - resource.TestCheckResourceAttrSet(dataSourceName, "password"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrPassword), ), }, }, From f8eb20b347be17ab7d2baceabbe052251465dbf5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:07 -0400 Subject: [PATCH 0963/1490] elasticache: Use constant for password strings --- internal/service/elasticache/user_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/elasticache/user_test.go b/internal/service/elasticache/user_test.go index 1fdc8a1658d..a5f6342b9ab 100644 --- a/internal/service/elasticache/user_test.go +++ b/internal/service/elasticache/user_test.go @@ -77,7 +77,7 @@ func TestAccElastiCacheUser_password_auth_mode(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.password_count", "1"), resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.passwords.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "authentication_mode.0.passwords.*", "aaaaaaaaaaaaaaaa"), - resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.type", "password"), + resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.type", names.AttrPassword), ), }, { From 630e3c4bfef2c44bd668076f7f80821d32e21107 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:07 -0400 Subject: [PATCH 0964/1490] events: Use constant for password strings --- internal/service/events/connection.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/events/connection.go b/internal/service/events/connection.go index aa66d33b1d2..bc7d9fd2251 100644 --- a/internal/service/events/connection.go +++ b/internal/service/events/connection.go @@ -141,7 +141,7 @@ func resourceConnection() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -524,7 +524,7 @@ func expandCreateConnectionBasicAuthRequestParameters(config []interface{}) *typ if val, ok := param["username"].(string); ok && val != "" { basicAuthParameters.Username = aws.String(val) } - if val, ok := param["password"].(string); ok && val != "" { + if val, ok := param[names.AttrPassword].(string); ok && val != "" { basicAuthParameters.Password = aws.String(val) } } @@ -709,7 +709,7 @@ func flattenConnectionBasicAuthParameters(basicAuthParameters *types.ConnectionB } if v, ok := d.GetOk("auth_parameters.0.basic.0.password"); ok { - config["password"] = v.(string) + config[names.AttrPassword] = v.(string) } result := []map[string]interface{}{config} @@ -855,7 +855,7 @@ func expandUpdateConnectionBasicAuthRequestParameters(config []interface{}) *typ if val, ok := param["username"].(string); ok && val != "" { basicAuthParameters.Username = aws.String(val) } - if val, ok := param["password"].(string); ok && val != "" { + if val, ok := param[names.AttrPassword].(string); ok && val != "" { basicAuthParameters.Password = aws.String(val) } } From 41c61f8e92beed87d97e958290d570906f87aa75 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:07 -0400 Subject: [PATCH 0965/1490] firehose: Use constant for password strings --- internal/service/firehose/delivery_stream.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index 8d9c71d9e8b..0138c5441ea 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -1197,7 +1197,7 @@ func resourceDeliveryStream() *schema.Resource { Type: schema.TypeString, Required: true, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -2372,7 +2372,7 @@ func expandRedshiftDestinationConfiguration(redshift map[string]interface{}) *ty configuration := &types.RedshiftDestinationConfiguration{ ClusterJDBCURL: aws.String(redshift["cluster_jdbcurl"].(string)), RetryOptions: expandRedshiftRetryOptions(redshift), - Password: aws.String(redshift["password"].(string)), + Password: aws.String(redshift[names.AttrPassword].(string)), Username: aws.String(redshift["username"].(string)), RoleARN: aws.String(roleARN), CopyCommand: expandCopyCommand(redshift), @@ -2398,7 +2398,7 @@ func expandRedshiftDestinationUpdate(redshift map[string]interface{}) *types.Red configuration := &types.RedshiftDestinationUpdate{ ClusterJDBCURL: aws.String(redshift["cluster_jdbcurl"].(string)), RetryOptions: expandRedshiftRetryOptions(redshift), - Password: aws.String(redshift["password"].(string)), + Password: aws.String(redshift[names.AttrPassword].(string)), Username: aws.String(redshift["username"].(string)), RoleARN: aws.String(roleARN), CopyCommand: expandCopyCommand(redshift), @@ -3381,7 +3381,7 @@ func flattenRedshiftDestinationDescription(description *types.RedshiftDestinatio m := map[string]interface{}{ "cloudwatch_logging_options": flattenCloudWatchLoggingOptions(description.CloudWatchLoggingOptions), "cluster_jdbcurl": aws.ToString(description.ClusterJDBCURL), - "password": configuredPassword, + names.AttrPassword: configuredPassword, "processing_configuration": flattenProcessingConfiguration(description.ProcessingConfiguration, destinationTypeRedshift, aws.ToString(description.RoleARN)), names.AttrRoleARN: aws.ToString(description.RoleARN), "s3_backup_configuration": flattenS3DestinationDescription(description.S3BackupDescription), From be1b061d62440d2d3acceae6ba96a4b63275e774 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:08 -0400 Subject: [PATCH 0966/1490] fsx: Use constant for password strings --- internal/service/fsx/ontap_storage_virtual_machine.go | 8 ++++---- .../service/fsx/ontap_storage_virtual_machine_migrate.go | 2 +- internal/service/fsx/windows_file_system.go | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/fsx/ontap_storage_virtual_machine.go b/internal/service/fsx/ontap_storage_virtual_machine.go index 2452e101f9f..a28ef8eda0f 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine.go +++ b/internal/service/fsx/ontap_storage_virtual_machine.go @@ -100,7 +100,7 @@ func resourceONTAPStorageVirtualMachine() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(1, 2000), }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Sensitive: true, Required: true, @@ -413,7 +413,7 @@ func expandSelfManagedActiveDirectoryConfiguration(cfg []interface{}) *fsx.SelfM out.OrganizationalUnitDistinguishedName = aws.String(v) } - if v, ok := conf["password"].(string); ok && len(v) > 0 { + if v, ok := conf[names.AttrPassword].(string); ok && len(v) > 0 { out.Password = aws.String(v) } @@ -469,7 +469,7 @@ func expandSelfManagedActiveDirectoryConfigurationUpdates(cfg []interface{}) *fs out.OrganizationalUnitDistinguishedName = aws.String(v) } - if v, ok := conf["password"].(string); ok && len(v) > 0 { + if v, ok := conf[names.AttrPassword].(string); ok && len(v) > 0 { out.Password = aws.String(v) } @@ -530,7 +530,7 @@ func flattenSelfManagedActiveDirectoryAttributes(d *schema.ResourceData, rs *fsx m["file_system_administrators_group"] = v.(string) } if v, ok := d.GetOk("active_directory_configuration.0.self_managed_active_directory_configuration.0.password"); ok { - m["password"] = v.(string) + m[names.AttrPassword] = v.(string) } return []interface{}{m} diff --git a/internal/service/fsx/ontap_storage_virtual_machine_migrate.go b/internal/service/fsx/ontap_storage_virtual_machine_migrate.go index 3a3449b0963..22a187b5ce3 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_migrate.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_migrate.go @@ -80,7 +80,7 @@ func resourceONTAPStorageVirtualMachineV0() *schema.Resource { ValidateFunc: validation.StringLenBetween(1, 2000), ConflictsWith: []string{"active_directory_configuration.0.self_managed_active_directory_configuration.0.organizational_unit_distinguidshed_name"}, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Sensitive: true, Required: true, diff --git a/internal/service/fsx/windows_file_system.go b/internal/service/fsx/windows_file_system.go index b19e3fda4a2..b370c47571e 100644 --- a/internal/service/fsx/windows_file_system.go +++ b/internal/service/fsx/windows_file_system.go @@ -234,7 +234,7 @@ func resourceWindowsFileSystem() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(1, 2000), }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -649,7 +649,7 @@ func expandSelfManagedActiveDirectoryConfigurationCreate(l []interface{}) *fsx.S req := &fsx.SelfManagedActiveDirectoryConfiguration{ DomainName: aws.String(data[names.AttrDomainName].(string)), DnsIps: flex.ExpandStringSet(data["dns_ips"].(*schema.Set)), - Password: aws.String(data["password"].(string)), + Password: aws.String(data[names.AttrPassword].(string)), UserName: aws.String(data["username"].(string)), } @@ -676,7 +676,7 @@ func expandSelfManagedActiveDirectoryConfigurationUpdate(l []interface{}) *fsx.S req.DnsIps = flex.ExpandStringSet(v) } - if v, ok := data["password"].(string); ok && v != "" { + if v, ok := data[names.AttrPassword].(string); ok && v != "" { req.Password = aws.String(v) } @@ -703,7 +703,7 @@ func flattenSelfManagedActiveDirectoryConfiguration(d *schema.ResourceData, adop names.AttrDomainName: aws.StringValue(adopts.DomainName), "file_system_administrators_group": aws.StringValue(adopts.FileSystemAdministratorsGroup), "organizational_unit_distinguished_name": aws.StringValue(adopts.OrganizationalUnitDistinguishedName), - "password": d.Get("self_managed_active_directory.0.password").(string), + names.AttrPassword: d.Get("self_managed_active_directory.0.password").(string), "username": aws.StringValue(adopts.UserName), } From 4d74c11fe07ed8b3b6868b641c7ef664c2b9822a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:08 -0400 Subject: [PATCH 0967/1490] iam: Use constant for password strings --- internal/service/iam/user_login_profile.go | 5 +++-- internal/service/iam/user_login_profile_test.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/iam/user_login_profile.go b/internal/service/iam/user_login_profile.go index 49f8d6c1fc1..9d295098ffc 100644 --- a/internal/service/iam/user_login_profile.go +++ b/internal/service/iam/user_login_profile.go @@ -23,6 +23,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_iam_user_login_profile", name="User Login Profile") @@ -73,7 +74,7 @@ func resourceUserLoginProfile() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Computed: true, }, @@ -173,7 +174,7 @@ func resourceUserLoginProfileCreate(ctx context.Context, d *schema.ResourceData, d.Set("key_fingerprint", fingerprint) d.Set("encrypted_password", encrypted) } else { - d.Set("password", initialPassword) + d.Set(names.AttrPassword, initialPassword) } return append(diags, resourceUserLoginProfileRead(ctx, d, meta)...) diff --git a/internal/service/iam/user_login_profile_test.go b/internal/service/iam/user_login_profile_test.go index 836592e4ec6..a51563337a1 100644 --- a/internal/service/iam/user_login_profile_test.go +++ b/internal/service/iam/user_login_profile_test.go @@ -249,7 +249,7 @@ func TestAccIAMUserLoginProfile_nogpg(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckUserLoginProfileExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "password_length", "20"), - resource.TestCheckResourceAttrSet(resourceName, "password"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrPassword), ), }, { @@ -260,7 +260,7 @@ func TestAccIAMUserLoginProfile_nogpg(t *testing.T) { "encrypted_password", "key_fingerprint", "password_length", - "password", + names.AttrPassword, }, }, }, From bee7d81293d5d0ff108680bd688a46c29aa9e6bd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:08 -0400 Subject: [PATCH 0968/1490] iot: Use constant for password strings --- internal/service/iot/topic_rule_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/iot/topic_rule_test.go b/internal/service/iot/topic_rule_test.go index 1d7d0dfb80e..c9308f6e98a 100644 --- a/internal/service/iot/topic_rule_test.go +++ b/internal/service/iot/topic_rule_test.go @@ -1373,7 +1373,7 @@ func TestAccIoTTopicRule_kafka(t *testing.T) { "client_properties.compression.type": "none", "client_properties.key.serializer": "org.apache.kafka.common.serialization.StringSerializer", "client_properties.security.protocol": "SSL", - "client_properties.ssl.keystore.password": "password", + "client_properties.ssl.keystore.password": names.AttrPassword, "client_properties.value.serializer": "org.apache.kafka.common.serialization.ByteBufferSerializer", "topic": "fake_topic", "header.#": "2", @@ -1415,7 +1415,7 @@ func TestAccIoTTopicRule_kafka(t *testing.T) { "client_properties.compression.type": "none", "client_properties.key.serializer": "org.apache.kafka.common.serialization.StringSerializer", "client_properties.security.protocol": "SSL", - "client_properties.ssl.keystore.password": "password", + "client_properties.ssl.keystore.password": names.AttrPassword, "client_properties.value.serializer": "org.apache.kafka.common.serialization.ByteBufferSerializer", "topic": "different_topic", "header.#": "2", @@ -1458,7 +1458,7 @@ func TestAccIoTTopicRule_kafka(t *testing.T) { "client_properties.compression.type": "none", "client_properties.key.serializer": "org.apache.kafka.common.serialization.StringSerializer", "client_properties.security.protocol": "SSL", - "client_properties.ssl.keystore.password": "password", + "client_properties.ssl.keystore.password": names.AttrPassword, "client_properties.value.serializer": "org.apache.kafka.common.serialization.ByteBufferSerializer", "topic": "different_topic", "header.#": "2", From d36d75812586ac7291d297f69e7f357dcd95789e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:08 -0400 Subject: [PATCH 0969/1490] mediapackage: Use constant for password strings --- internal/service/mediapackage/channel.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/mediapackage/channel.go b/internal/service/mediapackage/channel.go index cec42b0ab5b..49d5f6f637b 100644 --- a/internal/service/mediapackage/channel.go +++ b/internal/service/mediapackage/channel.go @@ -63,7 +63,7 @@ func ResourceChannel() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "password": { + names.AttrPassword: { Type: schema.TypeString, Computed: true, Sensitive: true, @@ -206,9 +206,9 @@ func flattenHLSIngest(h *types.HlsIngest) []map[string]interface{} { var ingestEndpoints []map[string]interface{} for _, e := range h.IngestEndpoints { endpoint := map[string]interface{}{ - "password": aws.ToString(e.Password), - "url": aws.ToString(e.Url), - "username": aws.ToString(e.Username), + names.AttrPassword: aws.ToString(e.Password), + "url": aws.ToString(e.Url), + "username": aws.ToString(e.Username), } ingestEndpoints = append(ingestEndpoints, endpoint) From e0cd7000ade434807e13c5e2373e6dc8cd743cb9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:09 -0400 Subject: [PATCH 0970/1490] memorydb: Use constant for password strings --- internal/service/memorydb/user_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/memorydb/user_test.go b/internal/service/memorydb/user_test.go index 41a357ddf22..f0f11ac015c 100644 --- a/internal/service/memorydb/user_test.go +++ b/internal/service/memorydb/user_test.go @@ -38,7 +38,7 @@ func TestAccMemoryDBUser_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.password_count", "1"), resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.passwords.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "authentication_mode.0.passwords.*", "aaaaaaaaaaaaaaaa"), - resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.type", "password"), + resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.type", names.AttrPassword), resource.TestCheckResourceAttrSet(resourceName, "minimum_engine_version"), resource.TestCheckResourceAttr(resourceName, "user_name", rName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), From d76f57a8c01e7c9f6f35325f0c7cf94f6cec6ba8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:09 -0400 Subject: [PATCH 0971/1490] mq: Use constant for password strings --- internal/service/mq/broker.go | 14 ++-- internal/service/mq/broker_test.go | 104 ++++++++++++++--------------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/internal/service/mq/broker.go b/internal/service/mq/broker.go index dc7a70f7af6..20aea32d985 100644 --- a/internal/service/mq/broker.go +++ b/internal/service/mq/broker.go @@ -352,7 +352,7 @@ func resourceBroker() *schema.Resource { ValidateFunc: validation.StringLenBetween(2, 100), }, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -797,7 +797,7 @@ func resourceUserHash(v interface{}) int { if g, ok := m["groups"]; ok { buf.WriteString(fmt.Sprintf("%v-", g.(*schema.Set).List())) } - if p, ok := m["password"]; ok { + if p, ok := m[names.AttrPassword]; ok { buf.WriteString(fmt.Sprintf("%s-", p.(string))) } buf.WriteString(fmt.Sprintf("%s-", m["username"].(string))) @@ -884,7 +884,7 @@ func DiffBrokerUsers(bId string, oldUsers, newUsers []interface{}) (cr []*mq.Cre ConsoleAccess: aws.Bool(newUserMap["console_access"].(bool)), Groups: flex.ExpandStringValueList(ng), ReplicationUser: aws.Bool(newUserMap["replication_user"].(bool)), - Password: aws.String(newUserMap["password"].(string)), + Password: aws.String(newUserMap[names.AttrPassword].(string)), Username: aws.String(username), }) } @@ -895,7 +895,7 @@ func DiffBrokerUsers(bId string, oldUsers, newUsers []interface{}) (cr []*mq.Cre cur := &mq.CreateUserInput{ BrokerId: aws.String(bId), ConsoleAccess: aws.Bool(newUserMap["console_access"].(bool)), - Password: aws.String(newUserMap["password"].(string)), + Password: aws.String(newUserMap[names.AttrPassword].(string)), ReplicationUser: aws.Bool(newUserMap["replication_user"].(bool)), Username: aws.String(username), } @@ -978,7 +978,7 @@ func expandUsers(cfg []interface{}) []types.User { u := m.(map[string]interface{}) user := types.User{ Username: aws.String(u["username"].(string)), - Password: aws.String(u["password"].(string)), + Password: aws.String(u[names.AttrPassword].(string)), } if v, ok := u["console_access"]; ok { user.ConsoleAccess = aws.Bool(v.(bool)) @@ -1026,7 +1026,7 @@ func flattenUsers(users []*types.User, cfgUsers []interface{}) *schema.Set { for _, u := range cfgUsers { user := u.(map[string]interface{}) username := user["username"].(string) - existingPairs[username] = user["password"].(string) + existingPairs[username] = user[names.AttrPassword].(string) } out := make([]interface{}, 0) @@ -1039,7 +1039,7 @@ func flattenUsers(users []*types.User, cfgUsers []interface{}) *schema.Set { password = p } if password != "" { - m["password"] = password + m[names.AttrPassword] = password } if u.ConsoleAccess != nil { m["console_access"] = aws.ToBool(u.ConsoleAccess) diff --git a/internal/service/mq/broker_test.go b/internal/service/mq/broker_test.go index f92bdd5b8c2..e978628b076 100644 --- a/internal/service/mq/broker_test.go +++ b/internal/service/mq/broker_test.go @@ -127,7 +127,7 @@ func TestDiffUsers(t *testing.T) { map[string]interface{}{ "console_access": false, "username": "second", - "password": "TestTest2222", + names.AttrPassword: "TestTest2222", "groups": schema.NewSet(schema.HashString, []interface{}{"admin"}), "replication_user": false, }, @@ -150,7 +150,7 @@ func TestDiffUsers(t *testing.T) { map[string]interface{}{ "console_access": true, "username": "first", - "password": "TestTest1111", + names.AttrPassword: "TestTest1111", "replication_user": false, }, }, @@ -158,7 +158,7 @@ func TestDiffUsers(t *testing.T) { map[string]interface{}{ "console_access": false, "username": "second", - "password": "TestTest2222", + names.AttrPassword: "TestTest2222", "replication_user": false, }, }, @@ -181,13 +181,13 @@ func TestDiffUsers(t *testing.T) { map[string]interface{}{ "console_access": true, "username": "first", - "password": "TestTest1111updated", + names.AttrPassword: "TestTest1111updated", "replication_user": false, }, map[string]interface{}{ "console_access": false, "username": "second", - "password": "TestTest2222", + names.AttrPassword: "TestTest2222", "replication_user": false, }, }, @@ -195,7 +195,7 @@ func TestDiffUsers(t *testing.T) { map[string]interface{}{ "console_access": false, "username": "second", - "password": "TestTest2222", + names.AttrPassword: "TestTest2222", "groups": schema.NewSet(schema.HashString, []interface{}{"admin"}), "replication_user": false, }, @@ -308,10 +308,10 @@ func TestAccMQBroker_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "user.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "false", - "groups.#": "0", - "username": "Test", - "password": "TestTest1234", + "console_access": "false", + "groups.#": "0", + "username": "Test", + names.AttrPassword: "TestTest1234", }), ), }, @@ -460,10 +460,10 @@ func TestAccMQBroker_throughputOptimized(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "subnet_ids.#", "1"), resource.TestCheckResourceAttr(resourceName, "user.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "false", - "groups.#": "0", - "username": "Test", - "password": "TestTest1234", + "console_access": "false", + "groups.#": "0", + "username": "Test", + names.AttrPassword: "TestTest1234", }), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "mq", regexache.MustCompile(`broker:+.`)), resource.TestCheckResourceAttr(resourceName, "instances.#", "1"), @@ -542,19 +542,19 @@ func TestAccMQBroker_AllFields_defaultVPC(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "subnet_ids.#", "2"), resource.TestCheckResourceAttr(resourceName, "user.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "true", - "groups.#": "3", - "username": "SecondTest", - "password": "SecondTestTest1234", + "console_access": "true", + "groups.#": "3", + "username": "SecondTest", + names.AttrPassword: "SecondTestTest1234", }), resource.TestCheckTypeSetElemAttr(resourceName, "user.*.groups.*", "first"), resource.TestCheckTypeSetElemAttr(resourceName, "user.*.groups.*", "second"), resource.TestCheckTypeSetElemAttr(resourceName, "user.*.groups.*", "third"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "false", - "groups.#": "0", - "username": "Test", - "password": "TestTest1234", + "console_access": "false", + "groups.#": "0", + "username": "Test", + names.AttrPassword: "TestTest1234", }), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "mq", regexache.MustCompile(`broker:+.`)), resource.TestCheckResourceAttr(resourceName, "instances.#", "2"), @@ -671,19 +671,19 @@ func TestAccMQBroker_AllFields_customVPC(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "subnet_ids.#", "2"), resource.TestCheckResourceAttr(resourceName, "user.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "true", - "groups.#": "3", - "username": "SecondTest", - "password": "SecondTestTest1234", + "console_access": "true", + "groups.#": "3", + "username": "SecondTest", + names.AttrPassword: "SecondTestTest1234", }), resource.TestCheckTypeSetElemAttr(resourceName, "user.*.groups.*", "first"), resource.TestCheckTypeSetElemAttr(resourceName, "user.*.groups.*", "second"), resource.TestCheckTypeSetElemAttr(resourceName, "user.*.groups.*", "third"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "false", - "groups.#": "0", - "username": "Test", - "password": "TestTest1234", + "console_access": "false", + "groups.#": "0", + "username": "Test", + names.AttrPassword: "TestTest1234", }), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "mq", regexache.MustCompile(`broker:+.`)), resource.TestCheckResourceAttr(resourceName, "instances.#", "2"), @@ -887,10 +887,10 @@ func TestAccMQBroker_Update_users(t *testing.T) { testAccCheckBrokerExists(ctx, resourceName, &broker), resource.TestCheckResourceAttr(resourceName, "user.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "false", - "groups.#": "0", - "username": "first", - "password": "TestTest1111", + "console_access": "false", + "groups.#": "0", + "username": "first", + names.AttrPassword: "TestTest1111", }), ), }, @@ -907,16 +907,16 @@ func TestAccMQBroker_Update_users(t *testing.T) { testAccCheckBrokerExists(ctx, resourceName, &broker), resource.TestCheckResourceAttr(resourceName, "user.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "false", - "groups.#": "0", - "username": "second", - "password": "TestTest2222", + "console_access": "false", + "groups.#": "0", + "username": "second", + names.AttrPassword: "TestTest2222", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "true", - "groups.#": "0", - "username": "first", - "password": "TestTest1111updated", + "console_access": "true", + "groups.#": "0", + "username": "first", + names.AttrPassword: "TestTest1111updated", }), ), }, @@ -927,10 +927,10 @@ func TestAccMQBroker_Update_users(t *testing.T) { testAccCheckBrokerExists(ctx, resourceName, &broker), resource.TestCheckResourceAttr(resourceName, "user.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "false", - "groups.#": "1", - "username": "second", - "password": "TestTest2222", + "console_access": "false", + "groups.#": "1", + "username": "second", + names.AttrPassword: "TestTest2222", }), resource.TestCheckTypeSetElemAttr(resourceName, "user.*.groups.*", "admin"), ), @@ -988,8 +988,8 @@ func TestAccMQBroker_Update_securityGroup(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "security_groups.#", "1"), resource.TestCheckResourceAttr(resourceName, "user.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "username": "Test", - "password": "TestTest9999", + "username": "Test", + names.AttrPassword: "TestTest9999", }), ), }, @@ -1303,10 +1303,10 @@ func TestAccMQBroker_RabbitMQ_cluster(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "subnet_ids.#", "data.aws_subnets.default", "ids.#"), resource.TestCheckResourceAttr(resourceName, "user.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "console_access": "false", - "groups.#": "0", - "username": "Test", - "password": "TestTest1234", + "console_access": "false", + "groups.#": "0", + "username": "Test", + names.AttrPassword: "TestTest1234", }), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "mq", regexache.MustCompile(`broker:+.`)), resource.TestCheckResourceAttr(resourceName, "instances.#", "1"), From cfa97d284e4eb2e135d379e45267cb8e8d1512cb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:09 -0400 Subject: [PATCH 0972/1490] opsworks: Use constant for password strings --- internal/service/opsworks/application.go | 4 ++-- internal/service/opsworks/ganglia_layer.go | 3 ++- internal/service/opsworks/ganglia_layer_test.go | 2 +- internal/service/opsworks/stack.go | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/service/opsworks/application.go b/internal/service/opsworks/application.go index 821260d8c8e..e78928b559f 100644 --- a/internal/service/opsworks/application.go +++ b/internal/service/opsworks/application.go @@ -96,7 +96,7 @@ func ResourceApplication() *schema.Resource { Optional: true, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -486,7 +486,7 @@ func resourceSetApplicationSource(d *schema.ResourceData, v *opsworks.Source) er // v.Password and v.SshKey will, on read, contain the placeholder string // "*****FILTERED*****", so we ignore it on read and let persist // the value already in the state. - m["password"] = d.Get("app_source.0.password").(string) + m[names.AttrPassword] = d.Get("app_source.0.password").(string) m["ssh_key"] = d.Get("app_source.0.ssh_key").(string) nv = append(nv, m) diff --git a/internal/service/opsworks/ganglia_layer.go b/internal/service/opsworks/ganglia_layer.go index 79c1eda1b85..67f882f827f 100644 --- a/internal/service/opsworks/ganglia_layer.go +++ b/internal/service/opsworks/ganglia_layer.go @@ -6,6 +6,7 @@ package opsworks import ( "github.com/aws/aws-sdk-go/service/opsworks" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_opsworks_ganglia_layer", name="Ganglia Layer") @@ -16,7 +17,7 @@ func ResourceGangliaLayer() *schema.Resource { DefaultLayerName: "Ganglia", Attributes: map[string]*opsworksLayerTypeAttribute{ - "password": { + names.AttrPassword: { AttrName: opsworks.LayerAttributesKeysGangliaPassword, Type: schema.TypeString, Required: true, diff --git a/internal/service/opsworks/ganglia_layer_test.go b/internal/service/opsworks/ganglia_layer_test.go index 4c060c4e857..e7f7b700730 100644 --- a/internal/service/opsworks/ganglia_layer_test.go +++ b/internal/service/opsworks/ganglia_layer_test.go @@ -32,7 +32,7 @@ func TestAccOpsWorksGangliaLayer_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckLayerExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrName, "Ganglia"), - resource.TestCheckResourceAttrSet(resourceName, "password"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrPassword), resource.TestCheckResourceAttr(resourceName, "url", "/ganglia"), resource.TestCheckResourceAttr(resourceName, "username", "opsworks"), ), diff --git a/internal/service/opsworks/stack.go b/internal/service/opsworks/stack.go index 928518c3d3c..7fd499d14df 100644 --- a/internal/service/opsworks/stack.go +++ b/internal/service/opsworks/stack.go @@ -83,7 +83,7 @@ func ResourceStack() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "password": { + names.AttrPassword: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -379,7 +379,7 @@ func resourceStackRead(ctx context.Context, d *schema.ResourceData, meta interfa if v, ok := d.GetOk("custom_cookbooks_source"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { v := v.([]interface{})[0].(map[string]interface{}) - tfMap["password"] = v["password"] + tfMap[names.AttrPassword] = v[names.AttrPassword] tfMap["ssh_key"] = v["ssh_key"] } @@ -605,7 +605,7 @@ func expandSource(tfMap map[string]interface{}) *opsworks.Source { apiObject := &opsworks.Source{} - if v, ok := tfMap["password"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPassword].(string); ok && v != "" { apiObject.Password = aws.String(v) } @@ -640,7 +640,7 @@ func flattenSource(apiObject *opsworks.Source) map[string]interface{} { tfMap := map[string]interface{}{} if v := apiObject.Password; v != nil { - tfMap["password"] = aws.StringValue(v) + tfMap[names.AttrPassword] = aws.StringValue(v) } if v := apiObject.Revision; v != nil { From 81f8a829e460bf17ac53f15a806042bd68c0b7a5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:09 -0400 Subject: [PATCH 0973/1490] quicksight: Use constant for password strings --- internal/service/quicksight/data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/quicksight/data_source.go b/internal/service/quicksight/data_source.go index 6c094954c51..078d34fec47 100644 --- a/internal/service/quicksight/data_source.go +++ b/internal/service/quicksight/data_source.go @@ -67,7 +67,7 @@ func ResourceDataSource() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -868,7 +868,7 @@ func expandDataSourceCredentialPair(tfList []interface{}) *quicksight.Credential credentialPair.Username = aws.String(v) } - if v, ok := tfMap["password"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPassword].(string); ok && v != "" { credentialPair.Password = aws.String(v) } From da516846c61641bd7b94f2f314bcd58f4ff2027b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:10 -0400 Subject: [PATCH 0974/1490] rds: Use constant for password strings --- internal/service/rds/instance.go | 20 +-- internal/service/rds/instance_migrate.go | 6 +- internal/service/rds/instance_migrate_test.go | 8 +- internal/service/rds/instance_test.go | 130 +++++++++--------- 4 files changed, 82 insertions(+), 82 deletions(-) diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go index 4351fa00eb2..e4d124e48e6 100644 --- a/internal/service/rds/instance.go +++ b/internal/service/rds/instance.go @@ -408,7 +408,7 @@ func ResourceInstance() *schema.Resource { "manage_master_user_password": { Type: schema.TypeBool, Optional: true, - ConflictsWith: []string{"password"}, + ConflictsWith: []string{names.AttrPassword}, }, "master_user_secret": { Type: schema.TypeList, @@ -485,7 +485,7 @@ func ResourceInstance() *schema.Resource { Optional: true, Computed: true, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -937,7 +937,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in } } - if v, ok := d.GetOk("password"); ok { + if v, ok := d.GetOk(names.AttrPassword); ok { modifyDbInstanceInput.MasterUserPassword = aws.String(v.(string)) requiresModifyDbInstance = true } @@ -1046,7 +1046,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in input.DBParameterGroupName = aws.String(v.(string)) } - if v, ok := d.GetOk("password"); ok { + if v, ok := d.GetOk(names.AttrPassword); ok { input.MasterUserPassword = aws.String(v.(string)) } @@ -1284,7 +1284,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in input.DBParameterGroupName = aws.String(v.(string)) } - if v, ok := d.GetOk("password"); ok { + if v, ok := d.GetOk(names.AttrPassword); ok { modifyDbInstanceInput.MasterUserPassword = aws.String(v.(string)) requiresModifyDbInstance = true } @@ -1502,7 +1502,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in input.DBParameterGroupName = aws.String(v.(string)) } - if v, ok := d.GetOk("password"); ok { + if v, ok := d.GetOk(names.AttrPassword); ok { modifyDbInstanceInput.MasterUserPassword = aws.String(v.(string)) requiresModifyDbInstance = true } @@ -1694,7 +1694,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in input.OptionGroupName = aws.String(v.(string)) } - if v, ok := d.GetOk("password"); ok { + if v, ok := d.GetOk(names.AttrPassword); ok { input.MasterUserPassword = aws.String(v.(string)) } @@ -2008,7 +2008,7 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in "skip_final_snapshot", names.AttrTags, names.AttrTagsAll, "deletion_protection", - "password", + names.AttrPassword, ) { orchestrator := newBlueGreenOrchestrator(conn) defer orchestrator.CleanUp(ctx) @@ -2354,10 +2354,10 @@ func dbInstancePopulateModify(input *rds_sdkv2.ModifyDBInstanceInput, d *schema. input.OptionGroupName = aws.String(d.Get("option_group_name").(string)) } - if d.HasChange("password") { + if d.HasChange(names.AttrPassword) { needsModify = true // With ManageMasterUserPassword set to true, the password is no longer needed, so we omit it from the API call. - if v, ok := d.GetOk("password"); ok { + if v, ok := d.GetOk(names.AttrPassword); ok { input.MasterUserPassword = aws.String(v.(string)) } } diff --git a/internal/service/rds/instance_migrate.go b/internal/service/rds/instance_migrate.go index 449d28e72ec..66de32a526a 100644 --- a/internal/service/rds/instance_migrate.go +++ b/internal/service/rds/instance_migrate.go @@ -40,7 +40,7 @@ func resourceInstanceResourceV0() *schema.Resource { ForceNew: true, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -667,7 +667,7 @@ func resourceInstanceResourceV1() *schema.Resource { "manage_master_user_password": { Type: schema.TypeBool, Optional: true, - ConflictsWith: []string{"password"}, + ConflictsWith: []string{names.AttrPassword}, }, "master_user_secret": { Type: schema.TypeList, @@ -744,7 +744,7 @@ func resourceInstanceResourceV1() *schema.Resource { Optional: true, Computed: true, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Optional: true, Sensitive: true, diff --git a/internal/service/rds/instance_migrate_test.go b/internal/service/rds/instance_migrate_test.go index 987e1c8d899..cb5ad1e0cf9 100644 --- a/internal/service/rds/instance_migrate_test.go +++ b/internal/service/rds/instance_migrate_test.go @@ -33,7 +33,7 @@ func TestInstanceStateUpgradeV0(t *testing.T) { "engine": "mariadb", "identifier": "my-test-instance", "instance_class": "db.t2.micro", - "password": "avoid-plaintext-passwords", + names.AttrPassword: "avoid-plaintext-passwords", "username": "tfacctest", names.AttrTags: map[string]interface{}{"key1": "value1"}, }, @@ -43,7 +43,7 @@ func TestInstanceStateUpgradeV0(t *testing.T) { "engine": "mariadb", "identifier": "my-test-instance", "instance_class": "db.t2.micro", - "password": "avoid-plaintext-passwords", + names.AttrPassword: "avoid-plaintext-passwords", "username": "tfacctest", names.AttrTags: map[string]interface{}{"key1": "value1"}, }, @@ -89,7 +89,7 @@ func TestInstanceStateUpgradeV1(t *testing.T) { names.AttrID: "my-test-instance", "identifier": "my-test-instance", "instance_class": "db.t2.micro", - "password": "avoid-plaintext-passwords", + names.AttrPassword: "avoid-plaintext-passwords", "resource_id": "db-cnuap2ilnbmok4eunzklfvwjca", names.AttrTags: map[string]interface{}{"key1": "value1"}, "username": "tfacctest", @@ -100,7 +100,7 @@ func TestInstanceStateUpgradeV1(t *testing.T) { names.AttrID: "db-cnuap2ilnbmok4eunzklfvwjca", "identifier": "my-test-instance", "instance_class": "db.t2.micro", - "password": "avoid-plaintext-passwords", + names.AttrPassword: "avoid-plaintext-passwords", "resource_id": "db-cnuap2ilnbmok4eunzklfvwjca", names.AttrTags: map[string]interface{}{"key1": "value1"}, "username": "tfacctest", diff --git a/internal/service/rds/instance_test.go b/internal/service/rds/instance_test.go index 9835f535dd7..66a4bac8498 100644 --- a/internal/service/rds/instance_test.go +++ b/internal/service/rds/instance_test.go @@ -103,7 +103,7 @@ func TestAccRDSInstance_basic(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "manage_master_user_password", "skip_final_snapshot", "delete_automated_backups", @@ -142,7 +142,7 @@ func TestAccRDSInstance_identifierPrefix(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, }, @@ -178,7 +178,7 @@ func TestAccRDSInstance_identifierGenerated(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, }, @@ -244,7 +244,7 @@ func TestAccRDSInstance_tags(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", }, @@ -301,7 +301,7 @@ func TestAccRDSInstance_Versions_onlyMajor(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", names.AttrEngineVersion, - "password", + names.AttrPassword, }, }, }, @@ -341,7 +341,7 @@ func TestAccRDSInstance_kmsKey(t *testing.T) { "apply_immediately", "delete_automated_backups", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -538,7 +538,7 @@ func TestAccRDSInstance_Versions_allowMajor(t *testing.T) { "allow_major_version_upgrade", "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -671,7 +671,7 @@ func TestAccRDSInstance_deletionProtection(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", }, @@ -867,7 +867,7 @@ func TestAccRDSInstance_password(t *testing.T) { Config: testAccInstanceConfig_password(rName, "valid-password-1"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v1), - resource.TestCheckResourceAttr(resourceName, "password", "valid-password-1"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "valid-password-1"), ), }, { @@ -877,7 +877,7 @@ func TestAccRDSInstance_password(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -886,7 +886,7 @@ func TestAccRDSInstance_password(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v2), testAccCheckDBInstanceNotRecreated(&v1, &v2), - resource.TestCheckResourceAttr(resourceName, "password", "valid-password-2"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "valid-password-2"), ), }, }, @@ -1000,7 +1000,7 @@ func TestAccRDSInstance_ManageMasterPassword_convertToManaged(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -1063,7 +1063,7 @@ func TestAccRDSInstance_ReplicateSourceDB_basic(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, { @@ -1083,7 +1083,7 @@ func TestAccRDSInstance_ReplicateSourceDB_basic(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, }, @@ -1122,7 +1122,7 @@ func TestAccRDSInstance_ReplicateSourceDB_namePrefix(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, }, @@ -1160,7 +1160,7 @@ func TestAccRDSInstance_ReplicateSourceDB_nameGenerated(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, }, @@ -2081,7 +2081,7 @@ func TestAccRDSInstance_ReplicateSourceDB_characterSet_Source(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "manage_master_user_password", "skip_final_snapshot", "delete_automated_backups", @@ -2157,7 +2157,7 @@ func TestAccRDSInstance_ReplicateSourceDB_replicaMode(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "manage_master_user_password", "skip_final_snapshot", "delete_automated_backups", @@ -2263,7 +2263,7 @@ func TestAccRDSInstance_ReplicateSourceDB_CrossRegion_parameterGroupNameEquivale ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, }, @@ -2306,7 +2306,7 @@ func TestAccRDSInstance_ReplicateSourceDB_CrossRegion_characterSet(t *testing.T) ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, }, @@ -2342,7 +2342,7 @@ func TestAccRDSInstance_s3Import(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, }, @@ -2476,7 +2476,7 @@ func TestAccRDSInstance_SnapshotIdentifier_namePrefix(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, "snapshot_identifier", }, }, @@ -2515,7 +2515,7 @@ func TestAccRDSInstance_SnapshotIdentifier_nameGenerated(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, "snapshot_identifier", }, }, @@ -3455,7 +3455,7 @@ func TestAccRDSInstance_monitoringInterval(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -3515,7 +3515,7 @@ func TestAccRDSInstance_MonitoringRoleARN_enabledToDisabled(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -3561,7 +3561,7 @@ func TestAccRDSInstance_MonitoringRoleARN_enabledToRemoved(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -3605,7 +3605,7 @@ func TestAccRDSInstance_MonitoringRoleARN_removedToEnabled(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -4009,7 +4009,7 @@ func TestAccRDSInstance_CloudWatchLogsExport_basic(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", }, @@ -4052,7 +4052,7 @@ func TestAccRDSInstance_CloudWatchLogsExport_db2(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -4146,7 +4146,7 @@ func TestAccRDSInstance_CloudWatchLogsExport_msSQL(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -4184,7 +4184,7 @@ func TestAccRDSInstance_CloudWatchLogsExport_oracle(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", }, @@ -4223,7 +4223,7 @@ func TestAccRDSInstance_CloudWatchLogsExport_postgresql(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", }, @@ -4261,7 +4261,7 @@ func TestAccRDSInstance_dedicatedLogVolume_enableOnCreate(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, }, @@ -4304,7 +4304,7 @@ func TestAccRDSInstance_dedicatedLogVolume_enableOnUpdate(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, { @@ -4320,7 +4320,7 @@ func TestAccRDSInstance_dedicatedLogVolume_enableOnUpdate(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, }, }, }, @@ -4387,7 +4387,7 @@ func TestAccRDSInstance_PerformanceInsights_disabledToEnabled(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", }, @@ -4435,7 +4435,7 @@ func TestAccRDSInstance_PerformanceInsights_enabledToDisabled(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", }, @@ -4485,7 +4485,7 @@ func TestAccRDSInstance_PerformanceInsights_kmsKeyID(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", }, @@ -4543,7 +4543,7 @@ func TestAccRDSInstance_PerformanceInsights_retentionPeriod(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", }, @@ -4705,7 +4705,7 @@ func TestAccRDSInstance_RestoreToPointInTime_sourceIdentifier(t *testing.T) { "delete_automated_backups", "final_snapshot_identifier", "latest_restorable_time", // dynamic value of a DBInstance - "password", + names.AttrPassword, "restore_to_point_in_time", "skip_final_snapshot", }, @@ -4747,7 +4747,7 @@ func TestAccRDSInstance_RestoreToPointInTime_sourceResourceID(t *testing.T) { "delete_automated_backups", "final_snapshot_identifier", "latest_restorable_time", // dynamic value of a DBInstance - "password", + names.AttrPassword, "restore_to_point_in_time", "skip_final_snapshot", }, @@ -4824,7 +4824,7 @@ func TestAccRDSInstance_RestoreToPointInTime_manageMasterPassword(t *testing.T) "final_snapshot_identifier", "latest_restorable_time", // dynamic value of a DBInstance "manage_master_user_password", - "password", + names.AttrPassword, "restore_to_point_in_time", "skip_final_snapshot", }, @@ -4864,7 +4864,7 @@ func TestAccRDSInstance_Oracle_nationalCharacterSet(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", }, @@ -4904,7 +4904,7 @@ func TestAccRDSInstance_Oracle_noNationalCharacterSet(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", }, @@ -4963,7 +4963,7 @@ func TestAccRDSInstance_Outposts_coIPDisabledToEnabled(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", }, @@ -5004,7 +5004,7 @@ func TestAccRDSInstance_Outposts_coIPEnabledToDisabled(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "apply_immediately", - "password", + names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", }, @@ -5050,7 +5050,7 @@ func TestAccRDSInstance_Outposts_coIPRestoreToPointInTime(t *testing.T) { "delete_automated_backups", "final_snapshot_identifier", "latest_restorable_time", // dynamic value of a DBInstance - "password", + names.AttrPassword, "restore_to_point_in_time", "skip_final_snapshot", }, @@ -5146,7 +5146,7 @@ func TestAccRDSInstance_license(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", }, @@ -5202,7 +5202,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateEngineVersion(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5255,7 +5255,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateParameterGroup(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "latest_restorable_time", // This causes intermittent failures when the value increments @@ -5307,7 +5307,7 @@ func TestAccRDSInstance_BlueGreenDeployment_tags(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5358,7 +5358,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateInstanceClass(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5414,7 +5414,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateAndPromoteReplica(t *testing.T "delete_automated_backups", "final_snapshot_identifier", "latest_restorable_time", - "password", + names.AttrPassword, "skip_final_snapshot", }, }, @@ -5463,7 +5463,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateAndEnableBackups(t *testing.T) ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5505,7 +5505,7 @@ func TestAccRDSInstance_BlueGreenDeployment_deletionProtectionBypassesBlueGreen( ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5528,7 +5528,7 @@ func TestAccRDSInstance_BlueGreenDeployment_deletionProtectionBypassesBlueGreen( ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5559,7 +5559,7 @@ func TestAccRDSInstance_BlueGreenDeployment_passwordBypassesBlueGreen(t *testing Config: testAccInstanceConfig_BlueGreenDeployment_password(rName, "valid-password-1"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v1), - resource.TestCheckResourceAttr(resourceName, "password", "valid-password-1"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "valid-password-1"), ), }, { @@ -5567,7 +5567,7 @@ func TestAccRDSInstance_BlueGreenDeployment_passwordBypassesBlueGreen(t *testing Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v2), testAccCheckDBInstanceNotRecreated(&v1, &v2), - resource.TestCheckResourceAttr(resourceName, "password", "valid-password-2"), + resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "valid-password-2"), ), }, }, @@ -5606,7 +5606,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateWithDeletionProtection(t *test ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5630,7 +5630,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateWithDeletionProtection(t *test ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5797,7 +5797,7 @@ func TestAccRDSInstance_BlueGreenDeployment_outOfBand(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5841,7 +5841,7 @@ func TestAccRDSInstance_Storage_gp3MySQL(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5894,7 +5894,7 @@ func TestAccRDSInstance_Storage_gp3Postgres(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -5947,7 +5947,7 @@ func TestAccRDSInstance_Storage_gp3SQLServer(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", @@ -6156,7 +6156,7 @@ func TestAccRDSInstance_Storage_typePostgres(t *testing.T) { ImportStateVerifyIgnore: []string{ "apply_immediately", "final_snapshot_identifier", - "password", + names.AttrPassword, "skip_final_snapshot", "delete_automated_backups", "blue_green_update", From bfb6709a92866dc5bcd16beed631c309c102df29 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:29:10 -0400 Subject: [PATCH 0975/1490] storagegateway: Use constant for password strings --- .../service/storagegateway/file_system_association.go | 6 +++--- .../storagegateway/file_system_association_test.go | 8 ++++---- internal/service/storagegateway/gateway.go | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/storagegateway/file_system_association.go b/internal/service/storagegateway/file_system_association.go index 62ef75c6215..4f8af433ba4 100644 --- a/internal/service/storagegateway/file_system_association.go +++ b/internal/service/storagegateway/file_system_association.go @@ -77,7 +77,7 @@ func ResourceFileSystemAssociation() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -109,7 +109,7 @@ func resourceFileSystemAssociationCreate(ctx context.Context, d *schema.Resource ClientToken: aws.String(id.UniqueId()), GatewayARN: aws.String(gatewayARN), LocationARN: aws.String(d.Get("location_arn").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), Tags: getTagsIn(ctx), UserName: aws.String(d.Get("username").(string)), } @@ -174,7 +174,7 @@ func resourceFileSystemAssociationUpdate(ctx context.Context, d *schema.Resource if d.HasChangesExcept(names.AttrTagsAll) { input := &storagegateway.UpdateFileSystemAssociationInput{ AuditDestinationARN: aws.String(d.Get("audit_destination_arn").(string)), - Password: aws.String(d.Get("password").(string)), + Password: aws.String(d.Get(names.AttrPassword).(string)), UserName: aws.String(d.Get("username").(string)), FileSystemAssociationARN: aws.String(d.Id()), } diff --git a/internal/service/storagegateway/file_system_association_test.go b/internal/service/storagegateway/file_system_association_test.go index 11dfab877e3..1b5016a983d 100644 --- a/internal/service/storagegateway/file_system_association_test.go +++ b/internal/service/storagegateway/file_system_association_test.go @@ -53,7 +53,7 @@ func TestAccStorageGatewayFileSystemAssociation_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"username", "password"}, + ImportStateVerifyIgnore: []string{"username", names.AttrPassword}, }, }, }) @@ -86,7 +86,7 @@ func TestAccStorageGatewayFileSystemAssociation_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"username", "password"}, + ImportStateVerifyIgnore: []string{"username", names.AttrPassword}, }, { Config: testAccFileSystemAssociationConfig_tags2(rName, domainName, username, "key1", "value1updated", "key2", "value2"), @@ -137,7 +137,7 @@ func TestAccStorageGatewayFileSystemAssociation_cacheAttributes(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"username", "password"}, + ImportStateVerifyIgnore: []string{"username", names.AttrPassword}, }, { Config: testAccFileSystemAssociationConfig_cache(rName, domainName, username, 0), @@ -175,7 +175,7 @@ func TestAccStorageGatewayFileSystemAssociation_auditDestination(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"username", "password"}, + ImportStateVerifyIgnore: []string{"username", names.AttrPassword}, }, { Config: testAccFileSystemAssociationConfig_auditDisabled(rName, domainName, username), diff --git a/internal/service/storagegateway/gateway.go b/internal/service/storagegateway/gateway.go index 37f42e5d3db..7b1f677adde 100644 --- a/internal/service/storagegateway/gateway.go +++ b/internal/service/storagegateway/gateway.go @@ -210,7 +210,7 @@ func ResourceGateway() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(1, 1024), }, - "password": { + names.AttrPassword: { Type: schema.TypeString, Required: true, Sensitive: true, @@ -559,7 +559,7 @@ func resourceGatewayRead(ctx context.Context, d *schema.ResourceData, meta inter // smb_active_directory_settings.0.username: "" => "Administrator" if v, ok := d.GetOk("smb_active_directory_settings"); ok && len(v.([]interface{})) > 0 { configM := v.([]interface{})[0].(map[string]interface{}) - m["password"] = configM["password"] + m[names.AttrPassword] = configM[names.AttrPassword] m["username"] = configM["username"] m["timeout_in_seconds"] = configM["timeout_in_seconds"] @@ -819,7 +819,7 @@ func expandGatewayDomain(l []interface{}, gatewayArn string) *storagegateway.Joi domain := &storagegateway.JoinDomainInput{ DomainName: aws.String(tfMap[names.AttrDomainName].(string)), GatewayARN: aws.String(gatewayArn), - Password: aws.String(tfMap["password"].(string)), + Password: aws.String(tfMap[names.AttrPassword].(string)), UserName: aws.String(tfMap["username"].(string)), TimeoutInSeconds: aws.Int64(int64(tfMap["timeout_in_seconds"].(int))), } From aa9bf6185b2943dc835f379abf57346afce500ac Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Fri, 10 May 2024 12:35:11 -0400 Subject: [PATCH 0976/1490] chore: make cleantidy (#37424) From 6567b875c48c52dbcb7220db9dff12510da9fab3 Mon Sep 17 00:00:00 2001 From: changelogbot Date: Fri, 10 May 2024 16:40:59 +0000 Subject: [PATCH 0977/1490] Update CHANGELOG.md for #37426 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3eb8a0129a..81bd3ede913 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ ## 5.50.0 (Unreleased) + +ENHANCEMENTS: + +* data-source/aws_instance: Add `launch_time` attribute ([#37002](https://github.com/hashicorp/terraform-provider-aws/issues/37002)) + ## 5.49.0 (May 10, 2024) FEATURES: From 3bc919991b187da40dc83426d90f7726dd508cbc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:43:53 -0400 Subject: [PATCH 0978/1490] s3: Fix up const replacement --- internal/service/s3/object_copy_test.go | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index cc936316fd7..ba76db1b86a 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -27,7 +27,6 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { rNameTarget := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" sourceName := "aws_s3_object.source" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -101,7 +100,6 @@ func TestAccS3ObjectCopy_disappears(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -127,7 +125,6 @@ func TestAccS3ObjectCopy_tags(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -173,7 +170,6 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnCreate(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -199,7 +195,6 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Add(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -234,7 +229,6 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -268,7 +262,6 @@ func TestAccS3ObjectCopy_metadata(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -295,7 +288,6 @@ func TestAccS3ObjectCopy_grant(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -325,7 +317,6 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_bucket(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -350,7 +341,6 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_object(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -406,7 +396,6 @@ func TestAccS3ObjectCopy_checksumAlgorithm(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -446,7 +435,6 @@ func TestAccS3ObjectCopy_objectLockLegalHold(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -478,7 +466,6 @@ func TestAccS3ObjectCopy_targetWithMultipleSlashes(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "/dir//target/" resource.ParallelTest(t, resource.TestCase{ @@ -503,7 +490,6 @@ func TestAccS3ObjectCopy_targetWithMultipleSlashesMigrated(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "/dir//target/" resource.ParallelTest(t, resource.TestCase{ @@ -539,7 +525,6 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -613,7 +598,6 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" sourceName := "aws_s3_object.source" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ From 729f0e706453abb5dcd54c3d5f8a560d21b24048 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:47:25 -0400 Subject: [PATCH 0979/1490] s3: Fix up const replacement --- internal/service/s3/object_copy_test.go | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index cc936316fd7..ba76db1b86a 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -27,7 +27,6 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { rNameTarget := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" sourceName := "aws_s3_object.source" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -101,7 +100,6 @@ func TestAccS3ObjectCopy_disappears(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -127,7 +125,6 @@ func TestAccS3ObjectCopy_tags(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -173,7 +170,6 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnCreate(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -199,7 +195,6 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Add(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -234,7 +229,6 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -268,7 +262,6 @@ func TestAccS3ObjectCopy_metadata(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -295,7 +288,6 @@ func TestAccS3ObjectCopy_grant(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -325,7 +317,6 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_bucket(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -350,7 +341,6 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_object(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -406,7 +396,6 @@ func TestAccS3ObjectCopy_checksumAlgorithm(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -446,7 +435,6 @@ func TestAccS3ObjectCopy_objectLockLegalHold(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -478,7 +466,6 @@ func TestAccS3ObjectCopy_targetWithMultipleSlashes(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "/dir//target/" resource.ParallelTest(t, resource.TestCase{ @@ -503,7 +490,6 @@ func TestAccS3ObjectCopy_targetWithMultipleSlashesMigrated(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "/dir//target/" resource.ParallelTest(t, resource.TestCase{ @@ -539,7 +525,6 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ @@ -613,7 +598,6 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" sourceName := "aws_s3_object.source" - sourceKey := names.AttrSource targetKey := "target" resource.ParallelTest(t, resource.TestCase{ From decf8a0025ed17ac55bfa0f3fef753509e66a8ba Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:08 -0400 Subject: [PATCH 0980/1490] ci: Prefer constant for string literal "target" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index a485e8c68aa..bfd66c6ae4a 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1355,3 +1355,13 @@ rules: - pattern: '"password"' severity: ERROR fix: "names.AttrPassword" + - id: literal-target-string-constant + languages: [go] + message: Use the constant `names.AttrTarget` for the string literal "target" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"target"' + severity: ERROR + fix: "names.AttrTarget" From e2e9077448721ef9ab79cc497dcfb6c409824cef Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:08 -0400 Subject: [PATCH 0981/1490] names: Add constant for string literal "target" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 80685b2831e..474a2e1061f 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -67,6 +67,7 @@ const ( AttrSubnetIDs = "subnet_ids" AttrTags = "tags" AttrTagsAll = "tags_all" + AttrTarget = "target" AttrTimeouts = "timeouts" // Should be explicitly declared only for Framework resources AttrTransitGatewayAttachmentID = "transit_gateway_attachment_id" AttrTransitGatewayID = "transit_gateway_id" From cfa794c59d5e0377b9a866bccc700f6a859d176c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:09 -0400 Subject: [PATCH 0982/1490] amplify: Use constant for target strings --- internal/service/amplify/app.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/amplify/app.go b/internal/service/amplify/app.go index bb94657b57a..973335c612a 100644 --- a/internal/service/amplify/app.go +++ b/internal/service/amplify/app.go @@ -202,7 +202,7 @@ func resourceApp() *schema.Resource { "404-200", }, false), }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 2048), @@ -708,7 +708,7 @@ func expandCustomRule(tfMap map[string]interface{}) *types.CustomRule { apiObject.Status = aws.String(v) } - if v, ok := tfMap["target"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrTarget].(string); ok && v != "" { apiObject.Target = aws.String(v) } @@ -757,7 +757,7 @@ func flattenCustomRule(apiObject types.CustomRule) map[string]interface{} { } if v := apiObject.Target; v != nil { - tfMap["target"] = aws.ToString(v) + tfMap[names.AttrTarget] = aws.ToString(v) } return tfMap From 1b926d1be1a6971bf9ec59b8428794d3559cd598 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:09 -0400 Subject: [PATCH 0983/1490] apigatewayv2: Use constant for target strings --- internal/service/apigatewayv2/api.go | 4 +-- internal/service/apigatewayv2/api_test.go | 4 +-- internal/service/apigatewayv2/route.go | 11 ++++---- internal/service/apigatewayv2/route_test.go | 30 ++++++++++----------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/internal/service/apigatewayv2/api.go b/internal/service/apigatewayv2/api.go index 3852bc2847e..1b70b3739eb 100644 --- a/internal/service/apigatewayv2/api.go +++ b/internal/service/apigatewayv2/api.go @@ -153,7 +153,7 @@ func resourceAPI() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "target": { + names.AttrTarget: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -208,7 +208,7 @@ func resourceAPICreate(ctx context.Context, d *schema.ResourceData, meta interfa input.RouteSelectionExpression = aws.String(v.(string)) } - if v, ok := d.GetOk("target"); ok { + if v, ok := d.GetOk(names.AttrTarget); ok { input.Target = aws.String(v.(string)) } diff --git a/internal/service/apigatewayv2/api_test.go b/internal/service/apigatewayv2/api_test.go index 0d27e6dffd5..d45c78047b4 100644 --- a/internal/service/apigatewayv2/api_test.go +++ b/internal/service/apigatewayv2/api_test.go @@ -762,7 +762,7 @@ func TestAccAPIGatewayV2API_quickCreate(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "route_key", "GET /pets"), resource.TestCheckResourceAttr(resourceName, "route_selection_expression", "$request.method $request.path"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "target", "http://www.example.com/"), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, "http://www.example.com/"), resource.TestCheckResourceAttr(resourceName, names.AttrVersion, ""), ), }, @@ -772,7 +772,7 @@ func TestAccAPIGatewayV2API_quickCreate(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "route_key", - "target", + names.AttrTarget, }, }, }, diff --git a/internal/service/apigatewayv2/route.go b/internal/service/apigatewayv2/route.go index 357bc5799dc..fb0313f6546 100644 --- a/internal/service/apigatewayv2/route.go +++ b/internal/service/apigatewayv2/route.go @@ -22,6 +22,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_apigatewayv2_route", name="Route") @@ -101,7 +102,7 @@ func resourceRoute() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(1, 128), @@ -149,7 +150,7 @@ func resourceRouteCreate(ctx context.Context, d *schema.ResourceData, meta inter input.RouteResponseSelectionExpression = aws.String(v.(string)) } - if v, ok := d.GetOk("target"); ok { + if v, ok := d.GetOk(names.AttrTarget); ok { input.Target = aws.String(v.(string)) } @@ -192,7 +193,7 @@ func resourceRouteRead(ctx context.Context, d *schema.ResourceData, meta interfa } d.Set("route_key", output.RouteKey) d.Set("route_response_selection_expression", output.RouteResponseSelectionExpression) - d.Set("target", output.Target) + d.Set(names.AttrTarget, output.Target) return diags } @@ -284,8 +285,8 @@ func resourceRouteUpdate(ctx context.Context, d *schema.ResourceData, meta inter input.RouteResponseSelectionExpression = aws.String(d.Get("route_response_selection_expression").(string)) } - if d.HasChange("target") { - input.Target = aws.String(d.Get("target").(string)) + if d.HasChange(names.AttrTarget) { + input.Target = aws.String(d.Get(names.AttrTarget).(string)) } _, err := conn.UpdateRoute(ctx, input) diff --git a/internal/service/apigatewayv2/route_test.go b/internal/service/apigatewayv2/route_test.go index c9b1dd74023..ddca4c2425e 100644 --- a/internal/service/apigatewayv2/route_test.go +++ b/internal/service/apigatewayv2/route_test.go @@ -47,7 +47,7 @@ func TestAccAPIGatewayV2Route_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "$default"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -113,7 +113,7 @@ func TestAccAPIGatewayV2Route_authorizer(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "$connect"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -136,7 +136,7 @@ func TestAccAPIGatewayV2Route_authorizer(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "$connect"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, }, @@ -170,7 +170,7 @@ func TestAccAPIGatewayV2Route_jwtAuthorization(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "GET /test"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -193,7 +193,7 @@ func TestAccAPIGatewayV2Route_jwtAuthorization(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "GET /test"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, }, @@ -229,7 +229,7 @@ func TestAccAPIGatewayV2Route_model(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "$default"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -272,7 +272,7 @@ func TestAccAPIGatewayV2Route_requestParameters(t *testing.T) { }), resource.TestCheckResourceAttr(resourceName, "route_key", "$connect"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -296,7 +296,7 @@ func TestAccAPIGatewayV2Route_requestParameters(t *testing.T) { }), resource.TestCheckResourceAttr(resourceName, "route_key", "$connect"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -318,7 +318,7 @@ func TestAccAPIGatewayV2Route_requestParameters(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "$connect"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, }, @@ -351,7 +351,7 @@ func TestAccAPIGatewayV2Route_simpleAttributes(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "$default"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", "$default"), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -367,7 +367,7 @@ func TestAccAPIGatewayV2Route_simpleAttributes(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "$default"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -383,7 +383,7 @@ func TestAccAPIGatewayV2Route_simpleAttributes(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "$default"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", "$default"), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -462,7 +462,7 @@ func TestAccAPIGatewayV2Route_updateRouteKey(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "GET /path"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -478,7 +478,7 @@ func TestAccAPIGatewayV2Route_updateRouteKey(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "request_parameter.#", "0"), resource.TestCheckResourceAttr(resourceName, "route_key", "POST /new/path"), resource.TestCheckResourceAttr(resourceName, "route_response_selection_expression", ""), - resource.TestCheckResourceAttr(resourceName, "target", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, ""), ), }, { @@ -557,7 +557,7 @@ func testAccCheckRouteTarget(resourceName, integrationResourceName string) resou return fmt.Errorf("Not Found: %s", integrationResourceName) } - return resource.TestCheckResourceAttr(resourceName, "target", fmt.Sprintf("integrations/%s", rs.Primary.ID))(s) + return resource.TestCheckResourceAttr(resourceName, names.AttrTarget, fmt.Sprintf("integrations/%s", rs.Primary.ID))(s) } } From 7fd3598e81e934d66d9883246b48a5c29ee08e72 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:09 -0400 Subject: [PATCH 0984/1490] appmesh: Use constant for target strings --- internal/service/appmesh/gateway_route.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/appmesh/gateway_route.go b/internal/service/appmesh/gateway_route.go index 788569e7a9e..ffa8d7abf8b 100644 --- a/internal/service/appmesh/gateway_route.go +++ b/internal/service/appmesh/gateway_route.go @@ -192,7 +192,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { }, }, }, - "target": { + names.AttrTarget: { Type: schema.TypeList, Required: true, MinItems: 1, @@ -433,7 +433,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "target": { + names.AttrTarget: { Type: schema.TypeList, Required: true, MinItems: 1, @@ -765,7 +765,7 @@ func expandGRPCGatewayRoute(vGrpcRoute []interface{}) *appmesh.GrpcGatewayRoute mRouteAction := vRouteAction[0].(map[string]interface{}) - if vRouteTarget, ok := mRouteAction["target"].([]interface{}); ok { + if vRouteTarget, ok := mRouteAction[names.AttrTarget].([]interface{}); ok { routeAction.Target = expandGatewayRouteTarget(vRouteTarget) } @@ -976,7 +976,7 @@ func expandHTTPGatewayRoute(vHttpRoute []interface{}) *appmesh.HttpGatewayRoute mRouteAction := vRouteAction[0].(map[string]interface{}) - if vRouteTarget, ok := mRouteAction["target"].([]interface{}); ok { + if vRouteTarget, ok := mRouteAction[names.AttrTarget].([]interface{}); ok { routeAction.Target = expandGatewayRouteTarget(vRouteTarget) } @@ -1038,7 +1038,7 @@ func flattenGRPCGatewayRoute(grpcRoute *appmesh.GrpcGatewayRoute) []interface{} if routeAction := grpcRoute.Action; routeAction != nil { mRouteAction := map[string]interface{}{ - "target": flattenGatewayRouteTarget(routeAction.Target), + names.AttrTarget: flattenGatewayRouteTarget(routeAction.Target), } mGrpcRoute[names.AttrAction] = []interface{}{mRouteAction} @@ -1198,8 +1198,8 @@ func flattenHTTPGatewayRoute(httpRoute *appmesh.HttpGatewayRoute) []interface{} if routeAction := httpRoute.Action; routeAction != nil { mRouteAction := map[string]interface{}{ - "target": flattenGatewayRouteTarget(routeAction.Target), - "rewrite": flattenHTTPGatewayRouteRewrite(routeAction.Rewrite), + names.AttrTarget: flattenGatewayRouteTarget(routeAction.Target), + "rewrite": flattenHTTPGatewayRouteRewrite(routeAction.Rewrite), } mHttpRoute[names.AttrAction] = []interface{}{mRouteAction} From 9bd24ee2574b4dcfa60ab2ac0c154965623c0ebd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:09 -0400 Subject: [PATCH 0985/1490] codestarnotifications: Use constant for target strings --- .../codestarnotifications/notification_rule.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/codestarnotifications/notification_rule.go b/internal/service/codestarnotifications/notification_rule.go index 46ff7ce8f84..dcee2ae0bf6 100644 --- a/internal/service/codestarnotifications/notification_rule.go +++ b/internal/service/codestarnotifications/notification_rule.go @@ -81,7 +81,7 @@ func resourceNotificationRule() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "target": { + names.AttrTarget: { Type: schema.TypeSet, Optional: true, MaxItems: 10, @@ -122,7 +122,7 @@ func resourceNotificationRuleCreate(ctx context.Context, d *schema.ResourceData, Resource: aws.String(d.Get("resource").(string)), Status: types.NotificationRuleStatus(d.Get(names.AttrStatus).(string)), Tags: getTagsIn(ctx), - Targets: expandNotificationRuleTargets(d.Get("target").(*schema.Set).List()), + Targets: expandNotificationRuleTargets(d.Get(names.AttrTarget).(*schema.Set).List()), } output, err := conn.CreateNotificationRule(ctx, input) @@ -170,7 +170,7 @@ func resourceNotificationRuleRead(ctx context.Context, d *schema.ResourceData, m names.AttrStatus: t.TargetStatus, }) } - if err := d.Set("target", targets); err != nil { + if err := d.Set(names.AttrTarget, targets); err != nil { return sdkdiag.AppendErrorf(diags, "setting target: %s", err) } @@ -189,15 +189,15 @@ func resourceNotificationRuleUpdate(ctx context.Context, d *schema.ResourceData, EventTypeIds: flex.ExpandStringValueSet(d.Get("event_type_ids").(*schema.Set)), Name: aws.String(d.Get(names.AttrName).(string)), Status: types.NotificationRuleStatus(d.Get(names.AttrStatus).(string)), - Targets: expandNotificationRuleTargets(d.Get("target").(*schema.Set).List()), + Targets: expandNotificationRuleTargets(d.Get(names.AttrTarget).(*schema.Set).List()), } if _, err := conn.UpdateNotificationRule(ctx, input); err != nil { return sdkdiag.AppendErrorf(diags, "updating CodeStar Notification Rule (%s): %s", d.Id(), err) } - if d.HasChange("target") { - o, n := d.GetChange("target") + if d.HasChange(names.AttrTarget) { + o, n := d.GetChange(names.AttrTarget) if err := cleanupNotificationRuleTargets(ctx, conn, o.(*schema.Set), n.(*schema.Set)); err != nil { return sdkdiag.AppendErrorf(diags, "deleting CodeStar Notification Rule (%s) targets: %s", d.Id(), err) } @@ -219,7 +219,7 @@ func resourceNotificationRuleDelete(ctx context.Context, d *schema.ResourceData, return sdkdiag.AppendErrorf(diags, "deleting CodeStar Notification Rule (%s): %s", d.Id(), err) } - if err = cleanupNotificationRuleTargets(ctx, conn, d.Get("target").(*schema.Set), nil); err != nil { + if err = cleanupNotificationRuleTargets(ctx, conn, d.Get(names.AttrTarget).(*schema.Set), nil); err != nil { return sdkdiag.AppendErrorf(diags, "deleting CodeStar Notification Rule (%s) targets: %s", d.Id(), err) } From e679931a043a431e8b49b5373cdece76e91a562d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:09 -0400 Subject: [PATCH 0986/1490] dlm: Use constant for target strings --- internal/service/dlm/lifecycle_policy.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/dlm/lifecycle_policy.go b/internal/service/dlm/lifecycle_policy.go index 4a3b9ef519b..79ff64415b3 100644 --- a/internal/service/dlm/lifecycle_policy.go +++ b/internal/service/dlm/lifecycle_policy.go @@ -113,7 +113,7 @@ func ResourceLifecyclePolicy() *schema.Resource { }, }, }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^[\w:\-\/\*]+$`), ""), @@ -333,7 +333,7 @@ func ResourceLifecyclePolicy() *schema.Resource { }, }, }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^[\w:\-\/\*]+$`), ""), @@ -788,7 +788,7 @@ func expandActionCrossRegionCopyRules(l []interface{}) []*dlm.CrossRegionCopyAct if v, ok := m["retain_rule"].([]interface{}); ok && len(v) > 0 && v[0] != nil { rule.RetainRule = expandCrossRegionCopyRuleRetainRule(v) } - if v, ok := m["target"].(string); ok && v != "" { + if v, ok := m[names.AttrTarget].(string); ok && v != "" { rule.Target = aws.String(v) } @@ -813,7 +813,7 @@ func flattenActionCrossRegionCopyRules(rules []*dlm.CrossRegionCopyAction) []int m := map[string]interface{}{ "encryption_configuration": flattenActionCrossRegionCopyRuleEncryptionConfiguration(rule.EncryptionConfiguration), "retain_rule": flattenCrossRegionCopyRuleRetainRule(rule.RetainRule), - "target": aws.StringValue(rule.Target), + names.AttrTarget: aws.StringValue(rule.Target), } result = append(result, m) @@ -941,7 +941,7 @@ func expandCrossRegionCopyRules(l []interface{}) []*dlm.CrossRegionCopyRule { if v, ok := m["retain_rule"].([]interface{}); ok && len(v) > 0 && v[0] != nil { rule.RetainRule = expandCrossRegionCopyRuleRetainRule(v) } - if v, ok := m["target"].(string); ok && v != "" { + if v, ok := m[names.AttrTarget].(string); ok && v != "" { rule.Target = aws.String(v) } @@ -969,7 +969,7 @@ func flattenCrossRegionCopyRules(rules []*dlm.CrossRegionCopyRule) []interface{} "deprecate_rule": flattenCrossRegionCopyRuleDeprecateRule(rule.DeprecateRule), names.AttrEncrypted: aws.BoolValue(rule.Encrypted), "retain_rule": flattenCrossRegionCopyRuleRetainRule(rule.RetainRule), - "target": aws.StringValue(rule.Target), + names.AttrTarget: aws.StringValue(rule.Target), } result = append(result, m) From 97c5c7394cdc67cd11b3ac54340246dd93591cc1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:10 -0400 Subject: [PATCH 0987/1490] ds: Use constant for target strings --- internal/service/ds/shared_directory.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/ds/shared_directory.go b/internal/service/ds/shared_directory.go index d03ff097035..91942d3826d 100644 --- a/internal/service/ds/shared_directory.go +++ b/internal/service/ds/shared_directory.go @@ -63,7 +63,7 @@ func ResourceSharedDirectory() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "target": { + names.AttrTarget: { Type: schema.TypeList, MaxItems: 1, Required: true, @@ -97,7 +97,7 @@ func resourceSharedDirectoryCreate(ctx context.Context, d *schema.ResourceData, input := directoryservice.ShareDirectoryInput{ DirectoryId: aws.String(dirId), ShareMethod: aws.String(d.Get("method").(string)), - ShareTarget: expandShareTarget(d.Get("target").([]interface{})[0].(map[string]interface{})), + ShareTarget: expandShareTarget(d.Get(names.AttrTarget).([]interface{})[0].(map[string]interface{})), } if v, ok := d.GetOk("notes"); ok { @@ -149,11 +149,11 @@ func resourceSharedDirectoryRead(ctx context.Context, d *schema.ResourceData, me d.Set("shared_directory_id", output.SharedDirectoryId) if output.SharedAccountId != nil { - if err := d.Set("target", []interface{}{flattenShareTarget(output)}); err != nil { + if err := d.Set(names.AttrTarget, []interface{}{flattenShareTarget(output)}); err != nil { return create.AppendDiagError(diags, names.DS, create.ErrActionSetting, ResNameSharedDirectory, d.Id(), err) } } else { - d.Set("target", nil) + d.Set(names.AttrTarget, nil) } return diags @@ -169,7 +169,7 @@ func resourceSharedDirectoryDelete(ctx context.Context, d *schema.ResourceData, input := directoryservice.UnshareDirectoryInput{ DirectoryId: aws.String(dirId), - UnshareTarget: expandUnshareTarget(d.Get("target").([]interface{})[0].(map[string]interface{})), + UnshareTarget: expandUnshareTarget(d.Get(names.AttrTarget).([]interface{})[0].(map[string]interface{})), } log.Printf("[DEBUG] Unsharing Directory Service Directory: %s", input) From 304d106e1a94ad54e3eae882afaf419cb395b337 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:10 -0400 Subject: [PATCH 0988/1490] elastictranscoder: Use constant for target strings --- internal/service/elastictranscoder/preset.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/elastictranscoder/preset.go b/internal/service/elastictranscoder/preset.go index eb75a9f2ca0..021016d478c 100644 --- a/internal/service/elastictranscoder/preset.go +++ b/internal/service/elastictranscoder/preset.go @@ -468,7 +468,7 @@ func ResourcePreset() *schema.Resource { "ShrinkToFit", }, false), }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -743,7 +743,7 @@ func expandETVideoWatermarks(d *schema.ResourceData) []*elastictranscoder.Preset MaxWidth: aws.String(p["max_width"].(string)), Opacity: aws.String(p["opacity"].(string)), SizingPolicy: aws.String(p["sizing_policy"].(string)), - Target: aws.String(p["target"].(string)), + Target: aws.String(p[names.AttrTarget].(string)), VerticalAlign: aws.String(p["vertical_align"].(string)), VerticalOffset: aws.String(p["vertical_offset"].(string)), } @@ -909,7 +909,7 @@ func flattenETWatermarks(watermarks []*elastictranscoder.PresetWatermark) []map[ "max_width": aws.StringValue(w.MaxWidth), "opacity": aws.StringValue(w.Opacity), "sizing_policy": aws.StringValue(w.SizingPolicy), - "target": aws.StringValue(w.Target), + names.AttrTarget: aws.StringValue(w.Target), "vertical_align": aws.StringValue(w.VerticalAlign), "vertical_offset": aws.StringValue(w.VerticalOffset), } From e1b0eb9f23a299c6e5ca22f2226c80d36916d317 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:10 -0400 Subject: [PATCH 0989/1490] elb: Use constant for target strings --- internal/service/elb/flex.go | 2 +- internal/service/elb/flex_test.go | 2 +- internal/service/elb/load_balancer.go | 4 ++-- internal/service/elb/load_balancer_data_source.go | 2 +- internal/service/elb/load_balancer_test.go | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/elb/flex.go b/internal/service/elb/flex.go index c685a6e5cd0..a5e04528162 100644 --- a/internal/service/elb/flex.go +++ b/internal/service/elb/flex.go @@ -63,7 +63,7 @@ func FlattenHealthCheck(check *elb.HealthCheck) []map[string]interface{} { chk := make(map[string]interface{}) chk["unhealthy_threshold"] = aws.Int64Value(check.UnhealthyThreshold) chk["healthy_threshold"] = aws.Int64Value(check.HealthyThreshold) - chk["target"] = aws.StringValue(check.Target) + chk[names.AttrTarget] = aws.StringValue(check.Target) chk["timeout"] = aws.Int64Value(check.Timeout) chk["interval"] = aws.Int64Value(check.Interval) diff --git a/internal/service/elb/flex_test.go b/internal/service/elb/flex_test.go index b07a91baad9..5c2bbe9abbc 100644 --- a/internal/service/elb/flex_test.go +++ b/internal/service/elb/flex_test.go @@ -97,7 +97,7 @@ func TestFlattenHealthCheck(t *testing.T) { { "unhealthy_threshold": int64(10), "healthy_threshold": int64(10), - "target": "HTTP:80/", + names.AttrTarget: "HTTP:80/", "timeout": int64(30), "interval": int64(30), }, diff --git a/internal/service/elb/load_balancer.go b/internal/service/elb/load_balancer.go index 9d74ed412ee..16e783c0ec5 100644 --- a/internal/service/elb/load_balancer.go +++ b/internal/service/elb/load_balancer.go @@ -151,7 +151,7 @@ func ResourceLoadBalancer() *schema.Resource { Required: true, ValidateFunc: validation.IntBetween(5, 300), }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Required: true, ValidateFunc: ValidHeathCheckTarget, @@ -621,7 +621,7 @@ func resourceLoadBalancerUpdate(ctx context.Context, d *schema.ResourceData, met HealthCheck: &elb.HealthCheck{ HealthyThreshold: aws.Int64(int64(check["healthy_threshold"].(int))), Interval: aws.Int64(int64(check["interval"].(int))), - Target: aws.String(check["target"].(string)), + Target: aws.String(check[names.AttrTarget].(string)), Timeout: aws.Int64(int64(check["timeout"].(int))), UnhealthyThreshold: aws.Int64(int64(check["unhealthy_threshold"].(int))), }, diff --git a/internal/service/elb/load_balancer_data_source.go b/internal/service/elb/load_balancer_data_source.go index 1db3d1eb304..42d6b87af71 100644 --- a/internal/service/elb/load_balancer_data_source.go +++ b/internal/service/elb/load_balancer_data_source.go @@ -101,7 +101,7 @@ func DataSourceLoadBalancer() *schema.Resource { Computed: true, }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/elb/load_balancer_test.go b/internal/service/elb/load_balancer_test.go index 9f146f3cbdc..70516bbd73a 100644 --- a/internal/service/elb/load_balancer_test.go +++ b/internal/service/elb/load_balancer_test.go @@ -186,7 +186,7 @@ func TestValidLoadBalancerHealthCheckTarget(t *testing.T) { } for _, tc := range validCases { - _, errors := tfelb.ValidHeathCheckTarget(tc.Value, "target") + _, errors := tfelb.ValidHeathCheckTarget(tc.Value, names.AttrTarget) if len(errors) != tc.ErrCount { t.Fatalf("Expected %q not to trigger a validation error.", tc.Value) } @@ -233,7 +233,7 @@ func TestValidLoadBalancerHealthCheckTarget(t *testing.T) { } for _, tc := range invalidCases { - _, errors := tfelb.ValidHeathCheckTarget(tc.Value, "target") + _, errors := tfelb.ValidHeathCheckTarget(tc.Value, names.AttrTarget) if len(errors) != tc.ErrCount { t.Fatalf("Expected %q to trigger a validation error.", tc.Value) } From cb0c642b1120f67798ff76ba5a2772468f45c949 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:10 -0400 Subject: [PATCH 0990/1490] fis: Use constant for target strings --- internal/service/fis/experiment_template.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/fis/experiment_template.go b/internal/service/fis/experiment_template.go index 135d536bdb0..a34d721dcfd 100644 --- a/internal/service/fis/experiment_template.go +++ b/internal/service/fis/experiment_template.go @@ -102,7 +102,7 @@ func ResourceExperimentTemplate() *schema.Resource { ValidateFunc: validation.StringLenBetween(0, 64), }, }, - "target": { + names.AttrTarget: { Type: schema.TypeList, Optional: true, MaxItems: 1, //API will accept more, but return only 1 @@ -195,7 +195,7 @@ func ResourceExperimentTemplate() *schema.Resource { }, }, }, - "target": { + names.AttrTarget: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -298,7 +298,7 @@ func resourceExperimentTemplateCreate(ctx context.Context, d *schema.ResourceDat Tags: getTagsIn(ctx), } - targets, err := expandExperimentTemplateTargets(d.Get("target").(*schema.Set)) + targets, err := expandExperimentTemplateTargets(d.Get(names.AttrTarget).(*schema.Set)) if err != nil { return create.AppendDiagError(diags, names.FIS, create.ErrActionCreating, ResNameExperimentTemplate, d.Get(names.AttrDescription).(string), err) } @@ -360,8 +360,8 @@ func resourceExperimentTemplateRead(ctx context.Context, d *schema.ResourceData, return create.AppendDiagSettingError(diags, names.FIS, ResNameExperimentTemplate, d.Id(), "stop_condition", err) } - if err := d.Set("target", flattenExperimentTemplateTargets(experimentTemplate.Targets)); err != nil { - return create.AppendDiagSettingError(diags, names.FIS, ResNameExperimentTemplate, d.Id(), "target", err) + if err := d.Set(names.AttrTarget, flattenExperimentTemplateTargets(experimentTemplate.Targets)); err != nil { + return create.AppendDiagSettingError(diags, names.FIS, ResNameExperimentTemplate, d.Id(), names.AttrTarget, err) } setTagsOut(ctx, experimentTemplate.Tags) @@ -400,8 +400,8 @@ func resourceExperimentTemplateUpdate(ctx context.Context, d *schema.ResourceDat input.StopConditions = expandExperimentTemplateStopConditionsForUpdate(d.Get("stop_condition").(*schema.Set)) } - if d.HasChange("target") { - targets, err := expandExperimentTemplateTargetsForUpdate(d.Get("target").(*schema.Set)) + if d.HasChange(names.AttrTarget) { + targets, err := expandExperimentTemplateTargetsForUpdate(d.Get(names.AttrTarget).(*schema.Set)) if err != nil { return create.AppendDiagError(diags, names.FIS, create.ErrActionUpdating, ResNameExperimentTemplate, d.Id(), err) } @@ -468,7 +468,7 @@ func expandExperimentTemplateActions(l *schema.Set) map[string]types.CreateExper config.StartAfter = flex.ExpandStringValueSet(v) } - if v, ok := raw["target"].([]interface{}); ok && len(v) > 0 { + if v, ok := raw[names.AttrTarget].([]interface{}); ok && len(v) > 0 { config.Targets = expandExperimentTemplateActionTargets(v) } @@ -507,7 +507,7 @@ func expandExperimentTemplateActionsForUpdate(l *schema.Set) map[string]types.Up config.StartAfter = flex.ExpandStringValueSet(v) } - if v, ok := raw["target"].([]interface{}); ok && len(v) > 0 { + if v, ok := raw[names.AttrTarget].([]interface{}); ok && len(v) > 0 { config.Targets = expandExperimentTemplateActionTargets(v) } @@ -827,7 +827,7 @@ func flattenExperimentTemplateActions(configured map[string]types.ExperimentTemp item[names.AttrDescription] = aws.ToString(v.Description) item["parameter"] = flattenExperimentTemplateActionParameters(v.Parameters) item["start_after"] = v.StartAfter - item["target"] = flattenExperimentTemplateActionTargets(v.Targets) + item[names.AttrTarget] = flattenExperimentTemplateActionTargets(v.Targets) item[names.AttrName] = k From e6593c4b424531405dbc5cad3e1791848bb650f0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:10 -0400 Subject: [PATCH 0991/1490] glue: Use constant for target strings --- internal/service/glue/script_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/glue/script_data_source.go b/internal/service/glue/script_data_source.go index b45e46f9251..b10b5991955 100644 --- a/internal/service/glue/script_data_source.go +++ b/internal/service/glue/script_data_source.go @@ -31,7 +31,7 @@ func DataSourceScript() *schema.Resource { Type: schema.TypeString, Required: true, }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Required: true, }, @@ -160,7 +160,7 @@ func expandCodeGenEdges(l []interface{}) []*glue.CodeGenEdge { m := mRaw.(map[string]interface{}) edge := &glue.CodeGenEdge{ Source: aws.String(m[names.AttrSource].(string)), - Target: aws.String(m["target"].(string)), + Target: aws.String(m[names.AttrTarget].(string)), } if v, ok := m["target_parameter"]; ok && v.(string) != "" { edge.TargetParameter = aws.String(v.(string)) From 510a158d34cb74d03a788db5bc479f74224b2e13 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:11 -0400 Subject: [PATCH 0992/1490] iot: Use constant for target strings --- internal/service/iot/policy_attachment.go | 4 ++-- internal/service/iot/policy_attachment_test.go | 4 ++-- internal/service/iot/sweep.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/iot/policy_attachment.go b/internal/service/iot/policy_attachment.go index 89c4d995dde..c57923c5595 100644 --- a/internal/service/iot/policy_attachment.go +++ b/internal/service/iot/policy_attachment.go @@ -35,7 +35,7 @@ func ResourcePolicyAttachment() *schema.Resource { Required: true, ForceNew: true, }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -49,7 +49,7 @@ func resourcePolicyAttachmentCreate(ctx context.Context, d *schema.ResourceData, conn := meta.(*conns.AWSClient).IoTConn(ctx) policyName := d.Get(names.AttrPolicy).(string) - target := d.Get("target").(string) + target := d.Get(names.AttrTarget).(string) id := policyAttachmentCreateResourceID(policyName, target) input := &iot.AttachPolicyInput{ PolicyName: aws.String(policyName), diff --git a/internal/service/iot/policy_attachment_test.go b/internal/service/iot/policy_attachment_test.go index 57dc1bcfafb..96731013e61 100644 --- a/internal/service/iot/policy_attachment_test.go +++ b/internal/service/iot/policy_attachment_test.go @@ -70,7 +70,7 @@ func testAccCheckPolicyAttchmentDestroy(ctx context.Context) resource.TestCheckF continue } - _, err := tfiot.FindAttachedPolicyByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrPolicy], rs.Primary.Attributes["target"]) + _, err := tfiot.FindAttachedPolicyByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrPolicy], rs.Primary.Attributes[names.AttrTarget]) if tfresource.NotFound(err) { continue @@ -96,7 +96,7 @@ func testAccCheckPolicyAttachmentExists(ctx context.Context, n string) resource. conn := acctest.Provider.Meta().(*conns.AWSClient).IoTConn(ctx) - _, err := tfiot.FindAttachedPolicyByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrPolicy], rs.Primary.Attributes["target"]) + _, err := tfiot.FindAttachedPolicyByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrPolicy], rs.Primary.Attributes[names.AttrTarget]) return err } diff --git a/internal/service/iot/sweep.go b/internal/service/iot/sweep.go index f8f218f8e9b..3e8f3c4f7d6 100644 --- a/internal/service/iot/sweep.go +++ b/internal/service/iot/sweep.go @@ -176,7 +176,7 @@ func sweepPolicyAttachments(region string) error { d := r.Data(nil) d.SetId(fmt.Sprintf("%s|%s", policyName, aws.StringValue(v))) d.Set(names.AttrPolicy, policyName) - d.Set("target", v) + d.Set(names.AttrTarget, v) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } From 28242e891b45e43d6a2c6a1b0262ab61285c41dd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:11 -0400 Subject: [PATCH 0993/1490] kendra: Use constant for target strings --- internal/service/kendra/data_source.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/kendra/data_source.go b/internal/service/kendra/data_source.go index 3394a263649..0d871c7357d 100644 --- a/internal/service/kendra/data_source.go +++ b/internal/service/kendra/data_source.go @@ -355,7 +355,7 @@ func ResourceDataSource() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "target": { + names.AttrTarget: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -1229,7 +1229,7 @@ func expandInlineCustomDocumentEnrichmentConfiguration(tfList []interface{}) []t inlineConfigExpanded.DocumentContentDeletion = v } - if v, ok := data["target"].([]interface{}); ok && len(v) > 0 { + if v, ok := data[names.AttrTarget].([]interface{}); ok && len(v) > 0 { inlineConfigExpanded.Target = expandDocumentAttributeTarget(v) } @@ -1592,7 +1592,7 @@ func flattenInlineConfigurations(inlineConfigurations []types.InlineCustomDocume } if v := inlineConfiguration.Target; v != nil { - m["target"] = flattenDocumentAttributeTarget(v) + m[names.AttrTarget] = flattenDocumentAttributeTarget(v) } inlineConfigurationList = append(inlineConfigurationList, m) From 4d558afcbc6f65b1154b8a990b3a2e86d13a128e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:11 -0400 Subject: [PATCH 0994/1490] lightsail: Use constant for target strings --- internal/service/lightsail/domain_entry.go | 8 ++++---- internal/service/lightsail/domain_entry_test.go | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/lightsail/domain_entry.go b/internal/service/lightsail/domain_entry.go index 14e5b8d16ee..73f290b71ec 100644 --- a/internal/service/lightsail/domain_entry.go +++ b/internal/service/lightsail/domain_entry.go @@ -55,7 +55,7 @@ func ResourceDomainEntry() *schema.Resource { Required: true, ForceNew: true, }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -90,7 +90,7 @@ func resourceDomainEntryCreate(ctx context.Context, d *schema.ResourceData, meta DomainEntry: &types.DomainEntry{ IsAlias: aws.Bool(d.Get("is_alias").(bool)), Name: aws.String(expandDomainEntryName(name, d.Get(names.AttrDomainName).(string))), - Target: aws.String(d.Get("target").(string)), + Target: aws.String(d.Get(names.AttrTarget).(string)), Type: aws.String(d.Get(names.AttrType).(string)), }, } @@ -112,7 +112,7 @@ func resourceDomainEntryCreate(ctx context.Context, d *schema.ResourceData, meta name, d.Get(names.AttrDomainName).(string), d.Get(names.AttrType).(string), - d.Get("target").(string), + d.Get(names.AttrTarget).(string), } id, err := flex.FlattenResourceId(idParts, DomainEntryIdPartsCount, true) @@ -174,7 +174,7 @@ func resourceDomainEntryRead(ctx context.Context, d *schema.ResourceData, meta i d.Set(names.AttrDomainName, domainName) d.Set(names.AttrType, entry.Type) d.Set("is_alias", entry.IsAlias) - d.Set("target", entry.Target) + d.Set(names.AttrTarget, entry.Target) return diags } diff --git a/internal/service/lightsail/domain_entry_test.go b/internal/service/lightsail/domain_entry_test.go index 8500565e013..c9ace65d891 100644 --- a/internal/service/lightsail/domain_entry_test.go +++ b/internal/service/lightsail/domain_entry_test.go @@ -41,7 +41,7 @@ func TestAccLightsailDomainEntry_basic(t *testing.T) { testAccCheckDomainEntryExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDomainName, domainName), resource.TestCheckResourceAttr(resourceName, names.AttrName, domainEntryName), - resource.TestCheckResourceAttr(resourceName, "target", "127.0.0.1"), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, "127.0.0.1"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "A"), ), }, @@ -81,7 +81,7 @@ func TestAccLightsailDomainEntry_underscore(t *testing.T) { testAccCheckDomainEntryExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDomainName, domainName), resource.TestCheckResourceAttr(resourceName, names.AttrName, domainEntryName), - resource.TestCheckResourceAttr(resourceName, "target", "127.0.0.1"), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, "127.0.0.1"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "A"), ), }, @@ -121,7 +121,7 @@ func TestAccLightsailDomainEntry_apex(t *testing.T) { testAccCheckDomainEntryExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDomainName, domainName), resource.TestCheckResourceAttr(resourceName, names.AttrName, domainEntryName), - resource.TestCheckResourceAttr(resourceName, "target", "127.0.0.1"), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, "127.0.0.1"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "A"), ), }, @@ -185,7 +185,7 @@ func TestAccLightsailDomainEntry_typeAAAA(t *testing.T) { testAccCheckDomainEntryExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDomainName, domainName), resource.TestCheckResourceAttr(resourceName, names.AttrName, domainEntryName), - resource.TestCheckResourceAttr(resourceName, "target", "::1"), + resource.TestCheckResourceAttr(resourceName, names.AttrTarget, "::1"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "AAAA"), ), }, @@ -298,6 +298,6 @@ func testAccDomainEntryStateLegacyIdFunc(resourceName string) resource.ImportSta return "", fmt.Errorf("Not found: %s", resourceName) } - return fmt.Sprintf("%s_%s_%s_%s", rs.Primary.Attributes[names.AttrName], rs.Primary.Attributes[names.AttrDomainName], rs.Primary.Attributes[names.AttrType], rs.Primary.Attributes["target"]), nil + return fmt.Sprintf("%s_%s_%s_%s", rs.Primary.Attributes[names.AttrName], rs.Primary.Attributes[names.AttrDomainName], rs.Primary.Attributes[names.AttrType], rs.Primary.Attributes[names.AttrTarget]), nil } } From 8fd76ad9c1ca03700b13d2a2edfd0a5f9de26981 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:12 -0400 Subject: [PATCH 0995/1490] macie2: Use constant for target strings --- internal/service/macie2/classification_job.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/macie2/classification_job.go b/internal/service/macie2/classification_job.go index d82c323402c..e00b8fb9a80 100644 --- a/internal/service/macie2/classification_job.go +++ b/internal/service/macie2/classification_job.go @@ -396,7 +396,7 @@ func ResourceClassificationJob() *schema.Resource { Computed: true, ValidateFunc: validation.StringInSlice(tagScopeTermKey_Values(), false), }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Optional: true, Computed: true, @@ -486,7 +486,7 @@ func ResourceClassificationJob() *schema.Resource { Computed: true, ValidateFunc: validation.StringInSlice(tagScopeTermKey_Values(), false), }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Optional: true, Computed: true, @@ -558,7 +558,7 @@ func resourceClassificationJobCustomizeDiff(_ context.Context, diff *schema.Reso //The following will clear the diff for these keys if the object exists already in the state. if diff.Id() != "" { for _, key := range diff.GetChangedKeysPrefix("s3_job_definition.0.scoping.0.excludes") { - if strings.Contains(key, "tag_scope_term") && strings.Contains(key, "target") { + if strings.Contains(key, "tag_scope_term") && strings.Contains(key, names.AttrTarget) { err := diff.Clear(key) if err != nil { return err @@ -566,7 +566,7 @@ func resourceClassificationJobCustomizeDiff(_ context.Context, diff *schema.Reso } } for _, key := range diff.GetChangedKeysPrefix("s3_job_definition.0.scoping.0.includes") { - if strings.Contains(key, "tag_scope_term") && strings.Contains(key, "target") { + if strings.Contains(key, "tag_scope_term") && strings.Contains(key, names.AttrTarget) { err := diff.Clear(key) if err != nil { return err @@ -996,7 +996,7 @@ func expandTagScopeTerm(tagScopeTerm []interface{}) *macie2.TagScopeTerm { if v, ok := tagScopeTermMap["comparator"]; ok && v.(string) != "" { tagTerm.Comparator = aws.String(v.(string)) } - if v, ok := tagScopeTermMap["target"]; ok && v.(string) != "" { + if v, ok := tagScopeTermMap[names.AttrTarget]; ok && v.(string) != "" { tagTerm.Target = aws.String(v.(string)) } @@ -1273,10 +1273,10 @@ func flattenTagScopeTerm(tagScopeTerm *macie2.TagScopeTerm) []map[string]interfa var tagScopeTermList []map[string]interface{} tagScopeTermList = append(tagScopeTermList, map[string]interface{}{ - names.AttrKey: aws.StringValue(tagScopeTerm.Key), - "comparator": aws.StringValue(tagScopeTerm.Comparator), - "target": aws.StringValue(tagScopeTerm.Target), - "tag_values": flattenTagValues(tagScopeTerm.TagValues), + names.AttrKey: aws.StringValue(tagScopeTerm.Key), + "comparator": aws.StringValue(tagScopeTerm.Comparator), + names.AttrTarget: aws.StringValue(tagScopeTerm.Target), + "tag_values": flattenTagValues(tagScopeTerm.TagValues), }) return tagScopeTermList From 343c7c5b9b1c9f97323c3f181de204eded6cd174 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:12 -0400 Subject: [PATCH 0996/1490] pipes: Use constant for target strings --- internal/service/pipes/pipe.go | 8 ++++---- internal/service/pipes/pipe_test.go | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/pipes/pipe.go b/internal/service/pipes/pipe.go index 14417570287..72c5398ee10 100644 --- a/internal/service/pipes/pipe.go +++ b/internal/service/pipes/pipe.go @@ -109,7 +109,7 @@ func resourcePipe() *schema.Resource { ), }, "source_parameters": sourceParametersSchema(), - "target": { + names.AttrTarget: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -135,7 +135,7 @@ func resourcePipeCreate(ctx context.Context, d *schema.ResourceData, meta interf RoleArn: aws.String(d.Get(names.AttrRoleARN).(string)), Source: aws.String(d.Get(names.AttrSource).(string)), Tags: getTagsIn(ctx), - Target: aws.String(d.Get("target").(string)), + Target: aws.String(d.Get(names.AttrTarget).(string)), } if v, ok := d.GetOk(names.AttrDescription); ok { @@ -210,7 +210,7 @@ func resourcePipeRead(ctx context.Context, d *schema.ResourceData, meta interfac } else { d.Set("source_parameters", nil) } - d.Set("target", output.Target) + d.Set(names.AttrTarget, output.Target) if v := output.TargetParameters; !types.IsZero(v) { if err := d.Set("target_parameters", []interface{}{flattenPipeTargetParameters(v)}); err != nil { return diag.Errorf("setting target_parameters: %s", err) @@ -231,7 +231,7 @@ func resourcePipeUpdate(ctx context.Context, d *schema.ResourceData, meta interf DesiredState: awstypes.RequestedPipeState(d.Get("desired_state").(string)), Name: aws.String(d.Id()), RoleArn: aws.String(d.Get(names.AttrRoleARN).(string)), - Target: aws.String(d.Get("target").(string)), + Target: aws.String(d.Get(names.AttrTarget).(string)), // Reset state in case it's a deletion, have to set the input to an empty string otherwise it doesn't get overwritten. TargetParameters: &awstypes.PipeTargetParameters{ InputTemplate: aws.String(""), diff --git a/internal/service/pipes/pipe_test.go b/internal/service/pipes/pipe_test.go index f6c20f58961..717932db174 100644 --- a/internal/service/pipes/pipe_test.go +++ b/internal/service/pipes/pipe_test.go @@ -64,7 +64,7 @@ func TestAccPipesPipe_basicSQS(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.0.batch_size", "10"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.0.maximum_batching_window_in_seconds", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_sqs_queue.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_sqs_queue.target", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "0"), ), }, @@ -574,7 +574,7 @@ func TestAccPipesPipe_targetUpdate(t *testing.T) { Config: testAccPipeConfig_basicSQS(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPipeExists(ctx, resourceName, &pipe), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_sqs_queue.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_sqs_queue.target", names.AttrARN), ), }, { @@ -586,7 +586,7 @@ func TestAccPipesPipe_targetUpdate(t *testing.T) { Config: testAccPipeConfig_targetUpdated(rName), Check: resource.ComposeTestCheckFunc( testAccCheckPipeExists(ctx, resourceName, &pipe), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_sqs_queue.target2", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_sqs_queue.target2", names.AttrARN), ), }, }, @@ -686,7 +686,7 @@ func TestAccPipesPipe_kinesisSourceAndTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.self_managed_kafka_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_kinesis_stream.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_kinesis_stream.target", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.cloudwatch_logs_parameters.#", "0"), @@ -739,7 +739,7 @@ func TestAccPipesPipe_kinesisSourceAndTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.self_managed_kafka_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_kinesis_stream.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_kinesis_stream.target", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.cloudwatch_logs_parameters.#", "0"), @@ -805,7 +805,7 @@ func TestAccPipesPipe_dynamoDBSourceCloudWatchLogsTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.self_managed_kafka_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_cloudwatch_log_group.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_cloudwatch_log_group.target", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.cloudwatch_logs_parameters.#", "1"), @@ -874,7 +874,7 @@ func TestAccPipesPipe_activeMQSourceStepFunctionTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.self_managed_kafka_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_sfn_state_machine.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_sfn_state_machine.target", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.cloudwatch_logs_parameters.#", "0"), @@ -943,7 +943,7 @@ func TestAccPipesPipe_rabbitMQSourceEventBusTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.self_managed_kafka_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_cloudwatch_event_bus.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_cloudwatch_event_bus.target", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "0"), ), }, @@ -1001,7 +1001,7 @@ func TestAccPipesPipe_mskSourceHTTPTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.self_managed_kafka_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrSet(resourceName, "target"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrTarget), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.cloudwatch_logs_parameters.#", "0"), @@ -1083,7 +1083,7 @@ func TestAccPipesPipe_selfManagedKafkaSourceLambdaFunctionTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.self_managed_kafka_parameters.0.vpc.0.subnets.#", "2"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_lambda_function.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_lambda_function.target", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.cloudwatch_logs_parameters.#", "0"), @@ -1148,7 +1148,7 @@ func TestAccPipesPipe_sqsSourceRedshiftTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.0.batch_size", "1"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.0.maximum_batching_window_in_seconds", "90"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_redshift_cluster.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_redshift_cluster.target", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.cloudwatch_logs_parameters.#", "0"), @@ -1218,7 +1218,7 @@ func TestAccPipesPipe_SourceSageMakerTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.self_managed_kafka_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_sagemaker_pipeline.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_sagemaker_pipeline.target", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.cloudwatch_logs_parameters.#", "0"), @@ -1285,7 +1285,7 @@ func TestAccPipesPipe_sqsSourceBatchJobTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.self_managed_kafka_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_batch_job_queue.target", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_batch_job_queue.target", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.0.array_properties.#", "1"), @@ -1369,7 +1369,7 @@ func TestAccPipesPipe_sqsSourceECSTaskTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source_parameters.0.self_managed_kafka_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_parameters.0.sqs_queue_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "target", "aws_ecs_cluster.target", names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTarget, "aws_ecs_cluster.target", names.AttrID), resource.TestCheckResourceAttr(resourceName, "target_parameters.#", "1"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.batch_job_parameters.#", "0"), resource.TestCheckResourceAttr(resourceName, "target_parameters.0.cloudwatch_logs_parameters.#", "0"), From 27ff487edfb274a29a0743728b18fdd4b96e89ec Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:12 -0400 Subject: [PATCH 0997/1490] schema: Use constant for target strings --- internal/service/quicksight/schema/visual_table.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/quicksight/schema/visual_table.go b/internal/service/quicksight/schema/visual_table.go index 1cf23693e26..29552e67eab 100644 --- a/internal/service/quicksight/schema/visual_table.go +++ b/internal/service/quicksight/schema/visual_table.go @@ -125,7 +125,7 @@ func tableVisualSchema() *schema.Schema { }, }, }, - "target": stringSchema(false, validation.StringInSlice(quicksight.URLTargetConfiguration_Values(), false)), + names.AttrTarget: stringSchema(false, validation.StringInSlice(quicksight.URLTargetConfiguration_Values(), false)), }, }, }, @@ -678,7 +678,7 @@ func expandTableFieldLinkConfiguration(tfList []interface{}) *quicksight.TableFi options := &quicksight.TableFieldLinkConfiguration{} - if v, ok := tfMap["target"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrTarget].(string); ok && v != "" { options.Target = aws.String(v) } if v, ok := tfMap["content"].([]interface{}); ok && len(v) > 0 { @@ -1156,7 +1156,7 @@ func flattenTableFieldLinkConfiguration(apiObject *quicksight.TableFieldLinkConf tfMap["content"] = flattenTableFieldLinkContentConfiguration(apiObject.Content) } if apiObject.Target != nil { - tfMap["target"] = aws.StringValue(apiObject.Target) + tfMap[names.AttrTarget] = aws.StringValue(apiObject.Target) } return []interface{}{tfMap} From 78d13851de844a760a750675a265d0d4b3c95567 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:12 -0400 Subject: [PATCH 0998/1490] s3: Use constant for target strings --- internal/service/s3/object_copy_test.go | 67 ++++++++++--------------- 1 file changed, 26 insertions(+), 41 deletions(-) diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index ba76db1b86a..dbbfe55c899 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -27,7 +27,6 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { rNameTarget := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" sourceName := "aws_s3_object.source" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -36,11 +35,11 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_basic(rNameSource, names.AttrSource, rNameTarget, targetKey), + Config: testAccObjectCopyConfig_basic(rNameSource, names.AttrSource, rNameTarget, names.AttrTarget), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckNoResourceAttr(resourceName, "acl"), - acctest.CheckResourceAttrGlobalARNNoAccount(resourceName, names.AttrARN, "s3", fmt.Sprintf("%s/%s", rNameTarget, targetKey)), + acctest.CheckResourceAttrGlobalARNNoAccount(resourceName, names.AttrARN, "s3", fmt.Sprintf("%s/%s", rNameTarget, names.AttrTarget)), resource.TestCheckResourceAttr(resourceName, names.AttrBucket, rNameTarget), resource.TestCheckResourceAttr(resourceName, "bucket_key_enabled", "false"), resource.TestCheckResourceAttr(resourceName, "cache_control", ""), @@ -67,7 +66,7 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { resource.TestCheckNoResourceAttr(resourceName, "expires"), resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), resource.TestCheckResourceAttr(resourceName, "grant.#", "0"), - resource.TestCheckResourceAttr(resourceName, names.AttrKey, targetKey), + resource.TestCheckResourceAttr(resourceName, names.AttrKey, names.AttrTarget), resource.TestCheckResourceAttr(resourceName, "kms_encryption_context", ""), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttrSet(resourceName, "last_modified"), @@ -100,7 +99,6 @@ func TestAccS3ObjectCopy_disappears(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -109,7 +107,7 @@ func TestAccS3ObjectCopy_disappears(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_basic(rName1, names.AttrSource, rName2, targetKey), + Config: testAccObjectCopyConfig_basic(rName1, names.AttrSource, rName2, names.AttrTarget), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), acctest.CheckResourceDisappears(ctx, acctest.Provider, tfs3.ResourceObjectCopy(), resourceName), @@ -125,7 +123,6 @@ func TestAccS3ObjectCopy_tags(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -134,7 +131,7 @@ func TestAccS3ObjectCopy_tags(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key1", "value1"), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, names.AttrTarget, "key1", "value1"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tagging_directive", "REPLACE"), @@ -143,7 +140,7 @@ func TestAccS3ObjectCopy_tags(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_tags2(rName1, names.AttrSource, rName2, targetKey, "key1", "value1updated", "key2", "value2"), + Config: testAccObjectCopyConfig_tags2(rName1, names.AttrSource, rName2, names.AttrTarget, "key1", "value1updated", "key2", "value2"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tagging_directive", "REPLACE"), @@ -153,7 +150,7 @@ func TestAccS3ObjectCopy_tags(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key2", "value2"), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, names.AttrTarget, "key2", "value2"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tagging_directive", "REPLACE"), @@ -170,7 +167,6 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnCreate(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -179,7 +175,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnCreate(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key1", ""), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, names.AttrTarget, "key1", ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -195,7 +191,6 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Add(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -204,7 +199,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Add(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key1", "value1"), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, names.AttrTarget, "key1", "value1"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -212,7 +207,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Add(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_tags2(rName1, names.AttrSource, rName2, targetKey, "key1", "value1", "key2", ""), + Config: testAccObjectCopyConfig_tags2(rName1, names.AttrSource, rName2, names.AttrTarget, "key1", "value1", "key2", ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), @@ -229,7 +224,6 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -238,7 +232,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key1", "value1"), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, names.AttrTarget, "key1", "value1"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -246,7 +240,7 @@ func TestAccS3ObjectCopy_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, targetKey, "key1", ""), + Config: testAccObjectCopyConfig_tags1(rName1, names.AttrSource, rName2, names.AttrTarget, "key1", ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -262,7 +256,6 @@ func TestAccS3ObjectCopy_metadata(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -271,7 +264,7 @@ func TestAccS3ObjectCopy_metadata(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_metadata(rName1, names.AttrSource, rName2, targetKey), + Config: testAccObjectCopyConfig_metadata(rName1, names.AttrSource, rName2, names.AttrTarget), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "metadata_directive", "REPLACE"), @@ -288,7 +281,6 @@ func TestAccS3ObjectCopy_grant(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -297,7 +289,7 @@ func TestAccS3ObjectCopy_grant(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_grant(rName1, names.AttrSource, rName2, targetKey), + Config: testAccObjectCopyConfig_grant(rName1, names.AttrSource, rName2, names.AttrTarget), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "grant.#", "1"), @@ -317,7 +309,6 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_bucket(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -326,7 +317,7 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_bucket(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_bucketKeyEnabledBucket(rName1, names.AttrSource, rName2, targetKey), + Config: testAccObjectCopyConfig_bucketKeyEnabledBucket(rName1, names.AttrSource, rName2, names.AttrTarget), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "bucket_key_enabled", "true"), @@ -341,7 +332,6 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_object(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -350,7 +340,7 @@ func TestAccS3ObjectCopy_BucketKeyEnabled_object(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_bucketKeyEnabledObject(rName1, names.AttrSource, rName2, targetKey), + Config: testAccObjectCopyConfig_bucketKeyEnabledObject(rName1, names.AttrSource, rName2, names.AttrTarget), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "bucket_key_enabled", "true"), @@ -366,7 +356,6 @@ func TestAccS3ObjectCopy_sourceWithSlashes(t *testing.T) { rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" sourceKey := "dir1/dir2/source" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -381,7 +370,7 @@ func TestAccS3ObjectCopy_sourceWithSlashes(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_externalSourceObject(rName1, sourceKey, rName2, targetKey), + Config: testAccObjectCopyConfig_externalSourceObject(rName1, sourceKey, rName2, names.AttrTarget), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrSource, fmt.Sprintf("%s/%s", rName1, sourceKey)), @@ -396,7 +385,6 @@ func TestAccS3ObjectCopy_checksumAlgorithm(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -405,7 +393,7 @@ func TestAccS3ObjectCopy_checksumAlgorithm(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_checksumAlgorithm(rName1, names.AttrSource, rName2, targetKey, "CRC32C"), + Config: testAccObjectCopyConfig_checksumAlgorithm(rName1, names.AttrSource, rName2, names.AttrTarget, "CRC32C"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "checksum_algorithm", "CRC32C"), @@ -416,7 +404,7 @@ func TestAccS3ObjectCopy_checksumAlgorithm(t *testing.T) { ), }, { - Config: testAccObjectCopyConfig_checksumAlgorithm(rName1, names.AttrSource, rName2, targetKey, "SHA1"), + Config: testAccObjectCopyConfig_checksumAlgorithm(rName1, names.AttrSource, rName2, names.AttrTarget, "SHA1"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "checksum_algorithm", "SHA1"), @@ -435,7 +423,6 @@ func TestAccS3ObjectCopy_objectLockLegalHold(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -444,14 +431,14 @@ func TestAccS3ObjectCopy_objectLockLegalHold(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_lockLegalHold(rName1, names.AttrSource, rName2, targetKey, "ON"), + Config: testAccObjectCopyConfig_lockLegalHold(rName1, names.AttrSource, rName2, names.AttrTarget, "ON"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", "ON"), ), }, { - Config: testAccObjectCopyConfig_lockLegalHold(rName1, names.AttrSource, rName2, targetKey, "OFF"), + Config: testAccObjectCopyConfig_lockLegalHold(rName1, names.AttrSource, rName2, names.AttrTarget, "OFF"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", "OFF"), @@ -525,7 +512,6 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -534,11 +520,11 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_directoryBucket(rName1, names.AttrSource, rName2, targetKey), + Config: testAccObjectCopyConfig_directoryBucket(rName1, names.AttrSource, rName2, names.AttrTarget), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckNoResourceAttr(resourceName, "acl"), - acctest.MatchResourceAttrGlobalARNNoAccount(resourceName, names.AttrARN, "s3", regexache.MustCompile(fmt.Sprintf(`%s--[-a-z0-9]+--x-s3/%s$`, rName2, targetKey))), + acctest.MatchResourceAttrGlobalARNNoAccount(resourceName, names.AttrARN, "s3", regexache.MustCompile(fmt.Sprintf(`%s--[-a-z0-9]+--x-s3/%s$`, rName2, names.AttrTarget))), resource.TestMatchResourceAttr(resourceName, names.AttrBucket, regexache.MustCompile(fmt.Sprintf(`^%s--[-a-z0-9]+--x-s3$`, rName2))), resource.TestCheckResourceAttr(resourceName, "bucket_key_enabled", "false"), resource.TestCheckResourceAttr(resourceName, "cache_control", ""), @@ -564,7 +550,7 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { resource.TestCheckNoResourceAttr(resourceName, "expires"), resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), resource.TestCheckResourceAttr(resourceName, "grant.#", "0"), - resource.TestCheckResourceAttr(resourceName, names.AttrKey, targetKey), + resource.TestCheckResourceAttr(resourceName, names.AttrKey, names.AttrTarget), resource.TestCheckResourceAttr(resourceName, "kms_encryption_context", ""), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttrSet(resourceName, "last_modified"), @@ -598,7 +584,6 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" sourceName := "aws_s3_object.source" - targetKey := "target" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -607,7 +592,7 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { CheckDestroy: testAccCheckObjectCopyDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccObjectCopyConfig_basicViaAccessPoint(rName1, names.AttrSource, rName2, targetKey), + Config: testAccObjectCopyConfig_basicViaAccessPoint(rName1, names.AttrSource, rName2, names.AttrTarget), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectCopyExists(ctx, resourceName), resource.TestCheckNoResourceAttr(resourceName, "acl"), @@ -637,7 +622,7 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { resource.TestCheckNoResourceAttr(resourceName, "expires"), resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), resource.TestCheckResourceAttr(resourceName, "grant.#", "0"), - resource.TestCheckResourceAttr(resourceName, names.AttrKey, targetKey), + resource.TestCheckResourceAttr(resourceName, names.AttrKey, names.AttrTarget), resource.TestCheckResourceAttr(resourceName, "kms_encryption_context", ""), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), resource.TestCheckResourceAttrSet(resourceName, "last_modified"), From ceffb89d454ce80293a6eaf962f75d89aa6428ae Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:12 -0400 Subject: [PATCH 0999/1490] scheduler: Use constant for target strings --- internal/service/scheduler/schedule.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/scheduler/schedule.go b/internal/service/scheduler/schedule.go index f871fa754ad..5d37a664a0d 100644 --- a/internal/service/scheduler/schedule.go +++ b/internal/service/scheduler/schedule.go @@ -136,7 +136,7 @@ func resourceSchedule() *schema.Resource { Default: types.ScheduleStateEnabled, ValidateDiagFunc: enum.Validate[types.ScheduleState](), }, - "target": { + names.AttrTarget: { Type: schema.TypeList, Required: true, MaxItems: 1, @@ -475,7 +475,7 @@ func resourceScheduleCreate(ctx context.Context, d *schema.ResourceData, meta in in.State = types.ScheduleState(v) } - if v, ok := d.Get("target").([]interface{}); ok && len(v) > 0 { + if v, ok := d.Get(names.AttrTarget).([]interface{}); ok && len(v) > 0 { in.Target = expandTarget(ctx, v[0].(map[string]interface{})) } @@ -558,7 +558,7 @@ func resourceScheduleRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrState, string(out.State)) - if err := d.Set("target", []interface{}{flattenTarget(ctx, out.Target)}); err != nil { + if err := d.Set(names.AttrTarget, []interface{}{flattenTarget(ctx, out.Target)}); err != nil { return create.DiagError(names.Scheduler, create.ErrActionSetting, ResNameSchedule, d.Id(), err) } @@ -573,7 +573,7 @@ func resourceScheduleUpdate(ctx context.Context, d *schema.ResourceData, meta in GroupName: aws.String(d.Get("group_name").(string)), Name: aws.String(d.Get(names.AttrName).(string)), ScheduleExpression: aws.String(d.Get("schedule_expression").(string)), - Target: expandTarget(ctx, d.Get("target").([]interface{})[0].(map[string]interface{})), + Target: expandTarget(ctx, d.Get(names.AttrTarget).([]interface{})[0].(map[string]interface{})), } if v, ok := d.Get(names.AttrDescription).(string); ok && v != "" { From 17dcfb4e304c4286c18a7d1b1536678386891613 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:13 -0400 Subject: [PATCH 1000/1490] ssmcontacts: Use constant for target strings --- internal/service/ssmcontacts/flex.go | 5 +++-- internal/service/ssmcontacts/plan.go | 2 +- internal/service/ssmcontacts/plan_data_source.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/ssmcontacts/flex.go b/internal/service/ssmcontacts/flex.go index ad5bfaec505..4b934ca60d3 100644 --- a/internal/service/ssmcontacts/flex.go +++ b/internal/service/ssmcontacts/flex.go @@ -6,6 +6,7 @@ package ssmcontacts import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/ssmcontacts/types" + "github.com/hashicorp/terraform-provider-aws/names" ) func expandContactChannelAddress(deliveryAddress []interface{}) *types.ContactChannelAddress { @@ -46,7 +47,7 @@ func expandStages(stages []interface{}) []types.Stage { s.DurationInMinutes = aws.Int32(int32(v)) } - if v, ok := stageData["target"].([]interface{}); ok { + if v, ok := stageData[names.AttrTarget].([]interface{}); ok { s.Targets = expandTargets(v) } @@ -67,7 +68,7 @@ func flattenStages(stages []types.Stage) []interface{} { } if v := stage.Targets; v != nil { - s["target"] = flattenTargets(v) + s[names.AttrTarget] = flattenTargets(v) } result = append(result, s) diff --git a/internal/service/ssmcontacts/plan.go b/internal/service/ssmcontacts/plan.go index 81ded8a6bbc..3097fce8ee4 100644 --- a/internal/service/ssmcontacts/plan.go +++ b/internal/service/ssmcontacts/plan.go @@ -45,7 +45,7 @@ func ResourcePlan() *schema.Resource { Type: schema.TypeInt, Required: true, }, - "target": { + names.AttrTarget: { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ diff --git a/internal/service/ssmcontacts/plan_data_source.go b/internal/service/ssmcontacts/plan_data_source.go index f816da18d7f..dfc2ff90681 100644 --- a/internal/service/ssmcontacts/plan_data_source.go +++ b/internal/service/ssmcontacts/plan_data_source.go @@ -33,7 +33,7 @@ func DataSourcePlan() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "target": { + names.AttrTarget: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ From f0183d86b3f083a91788fca23e0c5989d72c6b22 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:13 -0400 Subject: [PATCH 1001/1490] transfer: Use constant for target strings --- internal/service/transfer/access.go | 2 +- internal/service/transfer/user.go | 8 ++++---- internal/service/transfer/workflow.go | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/transfer/access.go b/internal/service/transfer/access.go index 419b7b00bd4..80ebc68a3a1 100644 --- a/internal/service/transfer/access.go +++ b/internal/service/transfer/access.go @@ -57,7 +57,7 @@ func ResourceAccess() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(0, 1024), }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(0, 1024), diff --git a/internal/service/transfer/user.go b/internal/service/transfer/user.go index aa76e0486f5..abdb2fb81c2 100644 --- a/internal/service/transfer/user.go +++ b/internal/service/transfer/user.go @@ -63,7 +63,7 @@ func ResourceUser() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(0, 1024), }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(0, 1024), @@ -371,7 +371,7 @@ func expandHomeDirectoryMappings(in []interface{}) []*transfer.HomeDirectoryMapE m := &transfer.HomeDirectoryMapEntry{ Entry: aws.String(config["entry"].(string)), - Target: aws.String(config["target"].(string)), + Target: aws.String(config[names.AttrTarget].(string)), } mappings = append(mappings, m) @@ -384,8 +384,8 @@ func flattenHomeDirectoryMappings(mappings []*transfer.HomeDirectoryMapEntry) [] l := make([]interface{}, len(mappings)) for i, m := range mappings { l[i] = map[string]interface{}{ - "entry": aws.StringValue(m.Entry), - "target": aws.StringValue(m.Target), + "entry": aws.StringValue(m.Entry), + names.AttrTarget: aws.StringValue(m.Target), } } return l diff --git a/internal/service/transfer/workflow.go b/internal/service/transfer/workflow.go index 517ac06c804..72c5aebfcf5 100644 --- a/internal/service/transfer/workflow.go +++ b/internal/service/transfer/workflow.go @@ -169,7 +169,7 @@ func ResourceWorkflow() *schema.Resource { validation.StringMatch(regexache.MustCompile(`^\$\{(\w+.)+\w+\}$`), "Must be of the pattern ^\\$\\{(\\w+.)+\\w+\\}$"), ), }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -482,7 +482,7 @@ func ResourceWorkflow() *schema.Resource { validation.StringMatch(regexache.MustCompile(`^\$\{(\w+.)+\w+\}$`), "Must be of the pattern ^\\$\\{(\\w+.)+\\w+\\}$"), ), }, - "target": { + names.AttrTarget: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -924,7 +924,7 @@ func expandCustomStepDetails(tfMap []interface{}) *transfer.CustomStepDetails { apiObject.SourceFileLocation = aws.String(v) } - if v, ok := tfMapRaw["target"].(string); ok && v != "" { + if v, ok := tfMapRaw[names.AttrTarget].(string); ok && v != "" { apiObject.Target = aws.String(v) } @@ -951,7 +951,7 @@ func flattenCustomStepDetails(apiObject *transfer.CustomStepDetails) []interface } if v := apiObject.Target; v != nil { - tfMap["target"] = aws.StringValue(v) + tfMap[names.AttrTarget] = aws.StringValue(v) } if v := apiObject.TimeoutSeconds; v != nil { From 210c4cca8cf350396e8f3ef70b266e21fdef58ca Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 12:33:13 -0400 Subject: [PATCH 1002/1490] vpclattice: Use constant for target strings --- internal/service/vpclattice/target_group_attachment.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/vpclattice/target_group_attachment.go b/internal/service/vpclattice/target_group_attachment.go index aff2abfe6be..8ca12e54aff 100644 --- a/internal/service/vpclattice/target_group_attachment.go +++ b/internal/service/vpclattice/target_group_attachment.go @@ -38,7 +38,7 @@ func resourceTargetGroupAttachment() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "target": { + names.AttrTarget: { Type: schema.TypeList, Required: true, ForceNew: true, @@ -75,7 +75,7 @@ func resourceTargetGroupAttachmentCreate(ctx context.Context, d *schema.Resource conn := meta.(*conns.AWSClient).VPCLatticeClient(ctx) targetGroupID := d.Get("target_group_identifier").(string) - target := expandTarget(d.Get("target").([]interface{})[0].(map[string]interface{})) + target := expandTarget(d.Get(names.AttrTarget).([]interface{})[0].(map[string]interface{})) targetID := aws.ToString(target.Id) targetPort := int(aws.ToInt32(target.Port)) id := strings.Join([]string{targetGroupID, targetID, strconv.Itoa(targetPort)}, "/") @@ -103,7 +103,7 @@ func resourceTargetGroupAttachmentRead(ctx context.Context, d *schema.ResourceDa conn := meta.(*conns.AWSClient).VPCLatticeClient(ctx) targetGroupID := d.Get("target_group_identifier").(string) - target := expandTarget(d.Get("target").([]interface{})[0].(map[string]interface{})) + target := expandTarget(d.Get(names.AttrTarget).([]interface{})[0].(map[string]interface{})) targetID := aws.ToString(target.Id) targetPort := int(aws.ToInt32(target.Port)) @@ -119,7 +119,7 @@ func resourceTargetGroupAttachmentRead(ctx context.Context, d *schema.ResourceDa return diag.Errorf("reading VPC Lattice Target Group Attachment (%s): %s", d.Id(), err) } - if err := d.Set("target", []interface{}{flattenTargetSummary(output)}); err != nil { + if err := d.Set(names.AttrTarget, []interface{}{flattenTargetSummary(output)}); err != nil { return diag.Errorf("setting target: %s", err) } d.Set("target_group_identifier", targetGroupID) @@ -131,7 +131,7 @@ func resourceTargetGroupAttachmentDelete(ctx context.Context, d *schema.Resource conn := meta.(*conns.AWSClient).VPCLatticeClient(ctx) targetGroupID := d.Get("target_group_identifier").(string) - target := expandTarget(d.Get("target").([]interface{})[0].(map[string]interface{})) + target := expandTarget(d.Get(names.AttrTarget).([]interface{})[0].(map[string]interface{})) targetID := aws.ToString(target.Id) targetPort := int(aws.ToInt32(target.Port)) From f9076d9f79acfe1697f0cbd8704243c138f9ec2f Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Fri, 10 May 2024 13:15:48 -0400 Subject: [PATCH 1003/1490] chore: tidy changelog --- .changelog/37361.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.changelog/37361.txt b/.changelog/37361.txt index 540da735168..c425fbe3cf6 100644 --- a/.changelog/37361.txt +++ b/.changelog/37361.txt @@ -1,11 +1,9 @@ ```release-note:enhancement resource/aws_budgets_budget: Add `tags` argument ``` - ```release-note:enhancement resource/aws_budgets_budget_action: Add `tags` argument ``` - ```release-note:enhancement -data-source/aws_budgets_budget: Add `tags` argument -``` \ No newline at end of file +data-source/aws_budgets_budget: Add `tags` attribute +``` From 945d0784a4d4a61e5d7e3551a2506943d1987d56 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 10 May 2024 11:48:18 -0500 Subject: [PATCH 1004/1490] aws_lakeformation_data_cells_filter: add validation for filter_expression and all_rows_wildcard --- .../lakeformation/data_cells_filter.go | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/internal/service/lakeformation/data_cells_filter.go b/internal/service/lakeformation/data_cells_filter.go index d5235c4d27a..7f1d0e2ac13 100644 --- a/internal/service/lakeformation/data_cells_filter.go +++ b/internal/service/lakeformation/data_cells_filter.go @@ -5,7 +5,6 @@ package lakeformation import ( "context" - "strings" "time" "github.com/YakDriver/regexache" @@ -132,6 +131,7 @@ func (r *resourceDataCellsFilter) Schema(ctx context.Context, _ resource.SchemaR "row_filter": schema.ListNestedBlock{ CustomType: fwtypes.NewListNestedObjectTypeOf[rowFilter](ctx), Validators: []validator.List{ + listvalidator.IsRequired(), listvalidator.SizeAtMost(1), }, NestedObject: schema.NestedBlockObject{ @@ -160,6 +160,10 @@ func (r *resourceDataCellsFilter) Schema(ctx context.Context, _ resource.SchemaR } } +const ( + dataCellsFilterIDPartCount = 4 +) + func (r *resourceDataCellsFilter) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { conn := r.Meta().LakeFormationClient(ctx) @@ -198,7 +202,7 @@ func (r *resourceDataCellsFilter) Create(ctx context.Context, req resource.Creat planTD.TableCatalogID.ValueString(), planTD.TableName.ValueString(), } - id, err := intflex.FlattenResourceId(idParts, len(idParts), false) + id, err := intflex.FlattenResourceId(idParts, dataCellsFilterIDPartCount, false) if err != nil { resp.Diagnostics.AddError( @@ -319,8 +323,7 @@ func (r *resourceDataCellsFilter) Delete(ctx context.Context, req resource.Delet return } - id := identifier(state.ID.ValueString()) - idParts, err := intflex.ExpandResourceId(id.String(), id.Len(), false) + idParts, err := intflex.ExpandResourceId(state.ID.ValueString(), dataCellsFilterIDPartCount, false) if err != nil { resp.Diagnostics.AddError( @@ -358,22 +361,15 @@ func (r *resourceDataCellsFilter) ConfigValidators(_ context.Context) []resource path.MatchRoot("table_data").AtListIndex(0).AtName("column_names"), path.MatchRoot("table_data").AtListIndex(0).AtName("column_wildcard"), ), + resourcevalidator.ExactlyOneOf( + path.MatchRoot("table_data").AtListIndex(0).AtName("row_filter").AtListIndex(0).AtName("filter_expression"), + path.MatchRoot("table_data").AtListIndex(0).AtName("row_filter").AtListIndex(0).AtName("all_rows_wildcard"), + ), } } -type identifier string - -func (i *identifier) String() string { - return string(*i) -} - -func (i *identifier) Len() int { - return len(strings.Split(string(*i), intflex.ResourceIdSeparator)) -} - func findDataCellsFilterByID(ctx context.Context, conn *lakeformation.Client, id string) (*awstypes.DataCellsFilter, error) { - identity := identifier(id) - idParts, err := intflex.ExpandResourceId(identity.String(), identity.Len(), false) + idParts, err := intflex.ExpandResourceId(id, dataCellsFilterIDPartCount, false) if err != nil { return nil, err From 339f5188f27484df4b9506dfbdd56b6595ecce1b Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 10 May 2024 12:32:24 -0500 Subject: [PATCH 1005/1490] aws_lakeformation_data_cells_filter: row_filter.filter_expression as computed --- .../lakeformation/data_cells_filter.go | 23 +++++- .../lakeformation/data_cells_filter_test.go | 74 +++++++++++++++++++ .../lakeformation/lakeformation_test.go | 1 + 3 files changed, 95 insertions(+), 3 deletions(-) diff --git a/internal/service/lakeformation/data_cells_filter.go b/internal/service/lakeformation/data_cells_filter.go index 7f1d0e2ac13..9b55883de03 100644 --- a/internal/service/lakeformation/data_cells_filter.go +++ b/internal/service/lakeformation/data_cells_filter.go @@ -108,9 +108,6 @@ func (r *resourceDataCellsFilter) Schema(ctx context.Context, _ resource.SchemaR Validators: []validator.String{ stringvalidator.RegexMatches(regexache.MustCompile(`^[0-9]+$`), "must be a number"), }, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, }, }, Blocks: map[string]schema.Block{ @@ -138,6 +135,7 @@ func (r *resourceDataCellsFilter) Schema(ctx context.Context, _ resource.SchemaR Attributes: map[string]schema.Attribute{ "filter_expression": schema.StringAttribute{ Optional: true, + Computed: true, }, }, Blocks: map[string]schema.Block{ @@ -303,6 +301,25 @@ func (r *resourceDataCellsFilter) Update(ctx context.Context, req resource.Updat ) return } + + output, err := findDataCellsFilterByID(ctx, conn, state.ID.ValueString()) + + if err != nil { + resp.Diagnostics.AddError( + create.ProblemStandardMessage(names.LakeFormation, create.ErrActionUpdating, ResNameDataCellsFilter, plan.ID.String(), err), + err.Error(), + ) + return + } + + td := tableData{} + resp.Diagnostics.Append(fwflex.Flatten(ctx, output, &td)...) + + if resp.Diagnostics.HasError() { + return + } + + plan.TableData = fwtypes.NewListNestedObjectValueOfPtrMust(ctx, &td) } resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) diff --git a/internal/service/lakeformation/data_cells_filter_test.go b/internal/service/lakeformation/data_cells_filter_test.go index 7fc5f7e018c..3541c7b9920 100644 --- a/internal/service/lakeformation/data_cells_filter_test.go +++ b/internal/service/lakeformation/data_cells_filter_test.go @@ -121,6 +121,57 @@ func testAccDataCellsFilter_disappears(t *testing.T) { }) } +func testAccDataCellsFilter_rowFilter(t *testing.T) { + ctx := acctest.Context(t) + + var datacellsfilter awstypes.DataCellsFilter + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_lakeformation_data_cells_filter.test" + + filterExpression := ` + filter_expression = "my_column_23='testing'" +` + allRowsildcard := ` + all_rows_wildcard {} +` + resource.Test(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(ctx, t) + acctest.PreCheckPartitionHasService(t, names.LakeFormation) + testAccDataCellsFilterPreCheck(ctx, t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.LakeFormationServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckDataCellsFilterDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccDataCellsFilterConfig_rowFilter(rName, filterExpression), + Check: resource.ComposeTestCheckFunc( + testAccCheckDataCellsFilterExists(ctx, resourceName, &datacellsfilter), + resource.TestCheckResourceAttr(resourceName, "table_data.0.database_name", rName), + resource.TestCheckResourceAttr(resourceName, "table_data.0.name", rName), + resource.TestCheckResourceAttr(resourceName, "table_data.0.table_name", rName), + resource.TestCheckResourceAttrSet(resourceName, "table_data.0.version_id"), + resource.TestCheckResourceAttr(resourceName, "table_data.0.column_names.#", "1"), + resource.TestCheckResourceAttr(resourceName, "table_data.0.row_filter.0.filter_expression", "my_column_23='testing'"), + ), + }, + { + Config: testAccDataCellsFilterConfig_rowFilter(rName, allRowsildcard), + Check: resource.ComposeTestCheckFunc( + testAccCheckDataCellsFilterExists(ctx, resourceName, &datacellsfilter), + resource.TestCheckResourceAttr(resourceName, "table_data.0.database_name", rName), + resource.TestCheckResourceAttr(resourceName, "table_data.0.name", rName), + resource.TestCheckResourceAttr(resourceName, "table_data.0.table_name", rName), + resource.TestCheckResourceAttrSet(resourceName, "table_data.0.version_id"), + resource.TestCheckResourceAttr(resourceName, "table_data.0.column_names.#", "1"), + resource.TestCheckResourceAttr(resourceName, "table_data.0.row_filter.0.all_rows_wildcard.#", "1"), + ), + }, + }, + }) +} + func testAccCheckDataCellsFilterDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).LakeFormationClient(ctx) @@ -292,3 +343,26 @@ resource "aws_lakeformation_data_cells_filter" "test" { } `, rName, column)) } + +func testAccDataCellsFilterConfig_rowFilter(rName, rowFilter string) string { + return acctest.ConfigCompose( + testAccDataCellsFilterConfigBase(rName), + fmt.Sprintf(` +resource "aws_lakeformation_data_cells_filter" "test" { + table_data { + database_name = aws_glue_catalog_database.test.name + name = %[1]q + table_catalog_id = data.aws_caller_identity.current.account_id + table_name = aws_glue_catalog_table.test.name + + column_names = ["my_column_22"] + + row_filter { +%[2]s + } + } + + depends_on = [aws_lakeformation_data_lake_settings.test] +} +`, rName, rowFilter)) +} diff --git a/internal/service/lakeformation/lakeformation_test.go b/internal/service/lakeformation/lakeformation_test.go index 6a651dd3f28..9e1958932f4 100644 --- a/internal/service/lakeformation/lakeformation_test.go +++ b/internal/service/lakeformation/lakeformation_test.go @@ -24,6 +24,7 @@ func TestAccLakeFormation_serial(t *testing.T) { "basic": testAccDataCellsFilter_basic, "columnWildcard": testAccDataCellsFilter_columnWildcard, "disappears": testAccDataCellsFilter_disappears, + "rowFilter": testAccDataCellsFilter_rowFilter, }, "DataLakeSettingsDataSource": { "basic": testAccDataLakeSettingsDataSource_basic, From f59edccaeb2401ba308b45ac09267886edaa08c1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:51 -0400 Subject: [PATCH 1006/1490] ci: Prefer constant for string literal "filter" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index bfd66c6ae4a..2fbb0428493 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1365,3 +1365,13 @@ rules: - pattern: '"target"' severity: ERROR fix: "names.AttrTarget" + - id: literal-filter-string-constant + languages: [go] + message: Use the constant `names.AttrFilter` for the string literal "filter" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"filter"' + severity: ERROR + fix: "names.AttrFilter" From e194620345097530704b5f79cbc3e8564c225aa9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:52 -0400 Subject: [PATCH 1007/1490] names: Add constant for string literal "filter" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 474a2e1061f..0207b68e9ed 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -29,6 +29,7 @@ const ( AttrEndpoints = "endpoints" AttrEngineVersion = "engine_version" AttrFileSystemID = "file_system_id" + AttrFilter = "filter" AttrHostedZoneID = "hosted_zone_id" AttrID = "id" // Should be explicitly declared only for Framework resources AttrInstanceID = "instance_id" From 9016da20f73fc7d5ba82250ad438295a937736b8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:52 -0400 Subject: [PATCH 1008/1490] accessanalyzer: Use constant for filter strings --- internal/service/accessanalyzer/archive_rule.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/service/accessanalyzer/archive_rule.go b/internal/service/accessanalyzer/archive_rule.go index 803582b92ad..9ca488a430c 100644 --- a/internal/service/accessanalyzer/archive_rule.go +++ b/internal/service/accessanalyzer/archive_rule.go @@ -23,6 +23,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/flex" "github.com/hashicorp/terraform-provider-aws/internal/sdkv2/types/nullable" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_accessanalyzer_archive_rule") @@ -43,7 +44,7 @@ func resourceArchiveRule() *schema.Resource { ForceNew: true, Required: true, }, - "filter": { + names.AttrFilter: { Type: schema.TypeSet, Required: true, Elem: &schema.Resource{ @@ -102,7 +103,7 @@ func resourceArchiveRuleCreate(ctx context.Context, d *schema.ResourceData, meta RuleName: aws.String(ruleName), } - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filter = expandFilter(v.(*schema.Set)) } @@ -141,7 +142,7 @@ func resourceArchiveRuleRead(ctx context.Context, d *schema.ResourceData, meta i } d.Set("analyzer_name", analyzerName) - d.Set("filter", flattenFilter(archiveRule.Filter)) + d.Set(names.AttrFilter, flattenFilter(archiveRule.Filter)) d.Set("rule_name", archiveRule.RuleName) return diags @@ -164,8 +165,8 @@ func resourceArchiveRuleUpdate(ctx context.Context, d *schema.ResourceData, meta RuleName: aws.String(ruleName), } - if d.HasChanges("filter") { - input.Filter = expandFilter(d.Get("filter").(*schema.Set)) + if d.HasChanges(names.AttrFilter) { + input.Filter = expandFilter(d.Get(names.AttrFilter).(*schema.Set)) } _, err = conn.UpdateArchiveRule(ctx, input) From 06e48cacc4d103c0b288a36f564d174cbb9bb9be Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:52 -0400 Subject: [PATCH 1009/1490] autoscaling: Use constant for filter strings --- internal/service/autoscaling/groups_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/autoscaling/groups_data_source.go b/internal/service/autoscaling/groups_data_source.go index b5b524907b5..460a2d9dc6e 100644 --- a/internal/service/autoscaling/groups_data_source.go +++ b/internal/service/autoscaling/groups_data_source.go @@ -29,7 +29,7 @@ func dataSourceGroups() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": { + names.AttrFilter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -93,7 +93,7 @@ func dataSourceGroupsRead(ctx context.Context, d *schema.ResourceData, meta inte input.AutoScalingGroupNames = flex.ExpandStringValueList(v.([]interface{})) } - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = buildFiltersDataSource(v.(*schema.Set)) } From 2f8f2e628050e4c35dcdd960a72bd0a79f6be904 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:52 -0400 Subject: [PATCH 1010/1490] ce: Use constant for filter strings --- internal/service/ce/tags_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ce/tags_data_source.go b/internal/service/ce/tags_data_source.go index b80612003de..821a0f44e35 100644 --- a/internal/service/ce/tags_data_source.go +++ b/internal/service/ce/tags_data_source.go @@ -28,7 +28,7 @@ func dataSourceTags() *schema.Resource { ReadWithoutTimeout: dataSourceTagsRead, Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeList, MaxItems: 1, Optional: true, @@ -102,7 +102,7 @@ func dataSourceTagsRead(ctx context.Context, d *schema.ResourceData, meta interf TimePeriod: expandTagsTimePeriod(d.Get("time_period").([]interface{})[0].(map[string]interface{})), } - if v, ok := d.GetOk("filter"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrFilter); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.Filter = expandExpression(v.([]interface{})[0].(map[string]interface{})) } From 754f5f1352e85804a0e39bbcb16bc2323d241d5a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:52 -0400 Subject: [PATCH 1011/1490] codebuild: Use constant for filter strings --- internal/service/codebuild/webhook.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/codebuild/webhook.go b/internal/service/codebuild/webhook.go index b6a2f4003f3..a90e68fed8f 100644 --- a/internal/service/codebuild/webhook.go +++ b/internal/service/codebuild/webhook.go @@ -48,7 +48,7 @@ func resourceWebhook() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ @@ -235,7 +235,7 @@ func expandWebhookFilterGroups(tfList []interface{}) [][]types.WebhookFilter { continue } - if v, ok := tfMap["filter"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrFilter].([]interface{}); ok && len(v) > 0 { apiObjects = append(apiObjects, expandWebhookFilters(v)) } } @@ -299,7 +299,7 @@ func flattenWebhookFilterGroups(apiObjects [][]types.WebhookFilter) []interface{ for _, apiObject := range apiObjects { tfMap := map[string]interface{}{ - "filter": flattenWebhookFilters(apiObject), + names.AttrFilter: flattenWebhookFilters(apiObject), } tfList = append(tfList, tfMap) } From c101f781101385e36a0a03f6132e8025693a0be2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:52 -0400 Subject: [PATCH 1012/1490] codepipeline: Use constant for filter strings --- internal/service/codepipeline/webhook.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/codepipeline/webhook.go b/internal/service/codepipeline/webhook.go index 560d68f2e10..9ab0870fba2 100644 --- a/internal/service/codepipeline/webhook.go +++ b/internal/service/codepipeline/webhook.go @@ -73,7 +73,7 @@ func resourceWebhook() *schema.Resource { }, }, }, - "filter": { + names.AttrFilter: { Type: schema.TypeSet, Required: true, MinItems: 1, @@ -136,7 +136,7 @@ func resourceWebhookCreate(ctx context.Context, d *schema.ResourceData, meta int Authentication: authType, // "missing required field, PutWebhookInput.Webhook.AuthenticationConfiguration". AuthenticationConfiguration: &types.WebhookAuthConfiguration{}, - Filters: expandWebhookFilterRules(d.Get("filter").(*schema.Set)), + Filters: expandWebhookFilterRules(d.Get(names.AttrFilter).(*schema.Set)), Name: aws.String(name), TargetAction: aws.String(d.Get("target_action").(string)), TargetPipeline: aws.String(d.Get("target_pipeline").(string)), @@ -180,7 +180,7 @@ func resourceWebhookRead(ctx context.Context, d *schema.ResourceData, meta inter if err := d.Set("authentication_configuration", flattenWebhookAuthConfiguration(webhookDef.AuthenticationConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting authentication_configuration: %s", err) } - if err := d.Set("filter", flattenWebhookFilterRules(webhookDef.Filters)); err != nil { + if err := d.Set(names.AttrFilter, flattenWebhookFilterRules(webhookDef.Filters)); err != nil { return sdkdiag.AppendErrorf(diags, "setting filter: %s", err) } d.Set(names.AttrName, webhookDef.Name) @@ -204,7 +204,7 @@ func resourceWebhookUpdate(ctx context.Context, d *schema.ResourceData, meta int Authentication: authType, // "missing required field, PutWebhookInput.Webhook.AuthenticationConfiguration". AuthenticationConfiguration: &types.WebhookAuthConfiguration{}, - Filters: expandWebhookFilterRules(d.Get("filter").(*schema.Set)), + Filters: expandWebhookFilterRules(d.Get(names.AttrFilter).(*schema.Set)), Name: aws.String(d.Get(names.AttrName).(string)), TargetAction: aws.String(d.Get("target_action").(string)), TargetPipeline: aws.String(d.Get("target_pipeline").(string)), From d6f4234b9af24bbf1cc06615e61dcc7d10f33a35 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:53 -0400 Subject: [PATCH 1013/1490] ec2: Use constant for filter strings --- internal/service/ec2/ebs_snapshot_data_source.go | 4 ++-- internal/service/ec2/ebs_snapshot_ids_data_source.go | 5 +++-- internal/service/ec2/ebs_volume_data_source.go | 4 ++-- internal/service/ec2/ebs_volumes_data_source.go | 4 ++-- internal/service/ec2/ec2_ami_data_source.go | 4 ++-- internal/service/ec2/ec2_ami_ids_data_source.go | 5 +++-- internal/service/ec2/ec2_availability_zone_data_source.go | 4 ++-- internal/service/ec2/ec2_availability_zones_data_source.go | 4 ++-- internal/service/ec2/ec2_eip_data_source.go | 4 ++-- internal/service/ec2/ec2_eips_data_source.go | 4 ++-- internal/service/ec2/ec2_host_data_source.go | 4 ++-- internal/service/ec2/ec2_instance_data_source.go | 4 ++-- .../service/ec2/ec2_instance_type_offering_data_source.go | 4 ++-- .../service/ec2/ec2_instance_type_offerings_data_source.go | 5 +++-- internal/service/ec2/ec2_instance_types_data_source.go | 5 +++-- internal/service/ec2/ec2_instances_data_source.go | 5 +++-- internal/service/ec2/ec2_key_pair_data_source.go | 4 ++-- internal/service/ec2/ec2_launch_template_data_source.go | 4 ++-- internal/service/ec2/ec2_public_ipv4_pools_data_source.go | 4 ++-- internal/service/ec2/ec2_spot_price_data_source.go | 4 ++-- internal/service/ec2/ipam_pool_cidrs_data_source.go | 4 ++-- internal/service/ec2/ipam_pool_data_source.go | 4 ++-- internal/service/ec2/ipam_pools_data_source.go | 4 ++-- internal/service/ec2/outposts_coip_pool_data_source.go | 4 ++-- internal/service/ec2/outposts_coip_pools_data_source.go | 4 ++-- internal/service/ec2/outposts_local_gateway_data_source.go | 4 ++-- .../ec2/outposts_local_gateway_route_table_data_source.go | 4 ++-- .../ec2/outposts_local_gateway_route_tables_data_source.go | 4 ++-- .../outposts_local_gateway_virtual_interface_data_source.go | 4 ++-- ...sts_local_gateway_virtual_interface_group_data_source.go | 4 ++-- ...ts_local_gateway_virtual_interface_groups_data_source.go | 4 ++-- internal/service/ec2/outposts_local_gateways_data_source.go | 4 ++-- .../service/ec2/transitgateway_attachment_data_source.go | 4 ++-- .../service/ec2/transitgateway_attachments_data_source.go | 4 ++-- internal/service/ec2/transitgateway_connect_data_source.go | 4 ++-- .../service/ec2/transitgateway_connect_peer_data_source.go | 4 ++-- internal/service/ec2/transitgateway_data_source.go | 4 ++-- .../ec2/transitgateway_dx_gateway_attachment_data_source.go | 6 +++--- .../ec2/transitgateway_multicast_domain_data_source.go | 4 ++-- .../ec2/transitgateway_peering_attachment_data_source.go | 4 ++-- .../transitgateway_route_table_associations_data_source.go | 5 +++-- .../service/ec2/transitgateway_route_table_data_source.go | 4 ++-- .../transitgateway_route_table_propagations_data_source.go | 5 +++-- .../ec2/transitgateway_route_table_routes_data_source.go | 4 ++-- .../service/ec2/transitgateway_route_tables_data_source.go | 4 ++-- .../ec2/transitgateway_vpc_attachment_data_source.go | 4 ++-- .../ec2/transitgateway_vpc_attachments_data_source.go | 5 +++-- .../ec2/transitgateway_vpn_attachment_data_source.go | 6 +++--- internal/service/ec2/vpc_data_source.go | 4 ++-- internal/service/ec2/vpc_dhcp_options_data_source.go | 4 ++-- internal/service/ec2/vpc_endpoint_data_source.go | 4 ++-- internal/service/ec2/vpc_endpoint_service_data_source.go | 4 ++-- internal/service/ec2/vpc_internet_gateway_data_source.go | 4 ++-- internal/service/ec2/vpc_managed_prefix_list_data_source.go | 4 ++-- .../service/ec2/vpc_managed_prefix_lists_data_source.go | 4 ++-- internal/service/ec2/vpc_nat_gateway_data_source.go | 4 ++-- internal/service/ec2/vpc_nat_gateways_data_source.go | 4 ++-- internal/service/ec2/vpc_network_acls_data_source.go | 4 ++-- .../ec2/vpc_network_insights_analysis_data_source.go | 6 +++--- .../service/ec2/vpc_network_insights_path_data_source.go | 4 ++-- internal/service/ec2/vpc_network_interface_data_source.go | 4 ++-- internal/service/ec2/vpc_network_interfaces_data_source.go | 4 ++-- internal/service/ec2/vpc_peering_connection_data_source.go | 4 ++-- internal/service/ec2/vpc_peering_connections_data_source.go | 4 ++-- internal/service/ec2/vpc_prefix_list_data_source.go | 4 ++-- internal/service/ec2/vpc_route_table_data_source.go | 6 +++--- internal/service/ec2/vpc_route_tables_data_source.go | 4 ++-- internal/service/ec2/vpc_security_group_data_source.go | 4 ++-- internal/service/ec2/vpc_security_group_rule_data_source.go | 2 +- .../service/ec2/vpc_security_group_rules_data_source.go | 2 +- internal/service/ec2/vpc_security_groups_data_source.go | 4 ++-- internal/service/ec2/vpc_subnet_data_source.go | 4 ++-- internal/service/ec2/vpc_subnets_data_source.go | 4 ++-- internal/service/ec2/vpc_vpcs_data_source.go | 4 ++-- internal/service/ec2/vpnclient_endpoint_data_source.go | 4 ++-- .../service/ec2/vpnsite_customer_gateway_data_source.go | 4 ++-- internal/service/ec2/vpnsite_gateway_data_source.go | 4 ++-- 77 files changed, 164 insertions(+), 156 deletions(-) diff --git a/internal/service/ec2/ebs_snapshot_data_source.go b/internal/service/ec2/ebs_snapshot_data_source.go index 1b1d6028fce..48346ea53b1 100644 --- a/internal/service/ec2/ebs_snapshot_data_source.go +++ b/internal/service/ec2/ebs_snapshot_data_source.go @@ -47,7 +47,7 @@ func DataSourceEBSSnapshot() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrKMSKeyID: { Type: schema.TypeString, Computed: true, @@ -129,7 +129,7 @@ func dataSourceEBSSnapshotRead(ctx context.Context, d *schema.ResourceData, meta } input.Filters = append(input.Filters, newCustomFilterListV2( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/ebs_snapshot_ids_data_source.go b/internal/service/ec2/ebs_snapshot_ids_data_source.go index b92c666b755..171e5810d09 100644 --- a/internal/service/ec2/ebs_snapshot_ids_data_source.go +++ b/internal/service/ec2/ebs_snapshot_ids_data_source.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_ebs_snapshot_ids") @@ -27,7 +28,7 @@ func DataSourceEBSSnapshotIDs() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -62,7 +63,7 @@ func dataSourceEBSSnapshotIDsRead(ctx context.Context, d *schema.ResourceData, m } input.Filters = append(input.Filters, newCustomFilterListV2( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/ebs_volume_data_source.go b/internal/service/ec2/ebs_volume_data_source.go index fae8cb3a711..572b7b6dd10 100644 --- a/internal/service/ec2/ebs_volume_data_source.go +++ b/internal/service/ec2/ebs_volume_data_source.go @@ -43,7 +43,7 @@ func DataSourceEBSVolume() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "iops": { Type: schema.TypeInt, Computed: true, @@ -98,7 +98,7 @@ func dataSourceEBSVolumeRead(ctx context.Context, d *schema.ResourceData, meta i input := &ec2.DescribeVolumesInput{} input.Filters = append(input.Filters, newCustomFilterListV2( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/ebs_volumes_data_source.go b/internal/service/ec2/ebs_volumes_data_source.go index 0db92809630..6a965ba2d21 100644 --- a/internal/service/ec2/ebs_volumes_data_source.go +++ b/internal/service/ec2/ebs_volumes_data_source.go @@ -27,7 +27,7 @@ func DataSourceEBSVolumes() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -49,7 +49,7 @@ func dataSourceEBSVolumesRead(ctx context.Context, d *schema.ResourceData, meta )...) input.Filters = append(input.Filters, newCustomFilterListV2( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/ec2_ami_data_source.go b/internal/service/ec2/ec2_ami_data_source.go index 9fac910b0e0..42a8d469455 100644 --- a/internal/service/ec2/ec2_ami_data_source.go +++ b/internal/service/ec2/ec2_ami_data_source.go @@ -95,7 +95,7 @@ func DataSourceAMI() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "hypervisor": { Type: schema.TypeString, Computed: true, @@ -244,7 +244,7 @@ func dataSourceAMIRead(ctx context.Context, d *schema.ResourceData, meta interfa input.ExecutableUsers = flex.ExpandStringList(v.([]interface{})) } - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = newCustomFilterList(v.(*schema.Set)) } diff --git a/internal/service/ec2/ec2_ami_ids_data_source.go b/internal/service/ec2/ec2_ami_ids_data_source.go index 032369e9f42..f142d0adc4f 100644 --- a/internal/service/ec2/ec2_ami_ids_data_source.go +++ b/internal/service/ec2/ec2_ami_ids_data_source.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/create" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_ami_ids") @@ -36,7 +37,7 @@ func DataSourceAMIIDs() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -83,7 +84,7 @@ func dataSourceAMIIDsRead(ctx context.Context, d *schema.ResourceData, meta inte input.ExecutableUsers = flex.ExpandStringList(v.([]interface{})) } - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = newCustomFilterList(v.(*schema.Set)) } diff --git a/internal/service/ec2/ec2_availability_zone_data_source.go b/internal/service/ec2/ec2_availability_zone_data_source.go index 4c6e8cfb667..88d8ba74dc2 100644 --- a/internal/service/ec2/ec2_availability_zone_data_source.go +++ b/internal/service/ec2/ec2_availability_zone_data_source.go @@ -32,7 +32,7 @@ func DataSourceAvailabilityZone() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "group_name": { Type: schema.TypeString, Computed: true, @@ -109,7 +109,7 @@ func dataSourceAvailabilityZoneRead(ctx context.Context, d *schema.ResourceData, ) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/ec2_availability_zones_data_source.go b/internal/service/ec2/ec2_availability_zones_data_source.go index 1a78aa1765a..8ab73e2a823 100644 --- a/internal/service/ec2/ec2_availability_zones_data_source.go +++ b/internal/service/ec2/ec2_availability_zones_data_source.go @@ -43,7 +43,7 @@ func DataSourceAvailabilityZones() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "group_names": { Type: schema.TypeSet, Computed: true, @@ -89,7 +89,7 @@ func dataSourceAvailabilityZonesRead(ctx context.Context, d *schema.ResourceData } } - if filters, filtersOk := d.GetOk("filter"); filtersOk { + if filters, filtersOk := d.GetOk(names.AttrFilter); filtersOk { request.Filters = append(request.Filters, newCustomFilterList( filters.(*schema.Set), )...) diff --git a/internal/service/ec2/ec2_eip_data_source.go b/internal/service/ec2/ec2_eip_data_source.go index 8365f52289e..52bb4a28295 100644 --- a/internal/service/ec2/ec2_eip_data_source.go +++ b/internal/service/ec2/ec2_eip_data_source.go @@ -54,7 +54,7 @@ func dataSourceEIP() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -121,7 +121,7 @@ func dataSourceEIPRead(ctx context.Context, d *schema.ResourceData, meta interfa )...) input.Filters = append(input.Filters, newCustomFilterListV2( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/ec2_eips_data_source.go b/internal/service/ec2/ec2_eips_data_source.go index 4b9b647ea26..93faf717018 100644 --- a/internal/service/ec2/ec2_eips_data_source.go +++ b/internal/service/ec2/ec2_eips_data_source.go @@ -33,7 +33,7 @@ func dataSourceEIPs() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "public_ips": { Type: schema.TypeList, Computed: true, @@ -56,7 +56,7 @@ func dataSourceEIPsRead(ctx context.Context, d *schema.ResourceData, meta interf )...) } - if filters, filtersOk := d.GetOk("filter"); filtersOk { + if filters, filtersOk := d.GetOk(names.AttrFilter); filtersOk { input.Filters = append(input.Filters, newCustomFilterListV2(filters.(*schema.Set))...) } diff --git a/internal/service/ec2/ec2_host_data_source.go b/internal/service/ec2/ec2_host_data_source.go index 207b9268fa7..7ab387a5584 100644 --- a/internal/service/ec2/ec2_host_data_source.go +++ b/internal/service/ec2/ec2_host_data_source.go @@ -50,7 +50,7 @@ func DataSourceHost() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "host_id": { Type: schema.TypeString, Optional: true, @@ -95,7 +95,7 @@ func dataSourceHostRead(ctx context.Context, d *schema.ResourceData, meta interf ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig input := &ec2.DescribeHostsInput{ - Filter: newCustomFilterList(d.Get("filter").(*schema.Set)), + Filter: newCustomFilterList(d.Get(names.AttrFilter).(*schema.Set)), } if v, ok := d.GetOk("host_id"); ok { diff --git a/internal/service/ec2/ec2_instance_data_source.go b/internal/service/ec2/ec2_instance_data_source.go index 42d9c2dfe7f..1ea8a39ac68 100644 --- a/internal/service/ec2/ec2_instance_data_source.go +++ b/internal/service/ec2/ec2_instance_data_source.go @@ -163,7 +163,7 @@ func DataSourceInstance() *schema.Resource { }, }, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "get_password_data": { Type: schema.TypeBool, Optional: true, @@ -416,7 +416,7 @@ func dataSourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta in } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { // Don't send an empty filters list; the EC2 API won't accept it. diff --git a/internal/service/ec2/ec2_instance_type_offering_data_source.go b/internal/service/ec2/ec2_instance_type_offering_data_source.go index 376d48e5ef3..79619b2af7c 100644 --- a/internal/service/ec2/ec2_instance_type_offering_data_source.go +++ b/internal/service/ec2/ec2_instance_type_offering_data_source.go @@ -27,7 +27,7 @@ func DataSourceInstanceTypeOffering() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrInstanceType: { Type: schema.TypeString, Computed: true, @@ -52,7 +52,7 @@ func dataSourceInstanceTypeOfferingRead(ctx context.Context, d *schema.ResourceD input := &ec2.DescribeInstanceTypeOfferingsInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = newCustomFilterList(v.(*schema.Set)) } diff --git a/internal/service/ec2/ec2_instance_type_offerings_data_source.go b/internal/service/ec2/ec2_instance_type_offerings_data_source.go index 2589c419efa..1f5c05297e3 100644 --- a/internal/service/ec2/ec2_instance_type_offerings_data_source.go +++ b/internal/service/ec2/ec2_instance_type_offerings_data_source.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_ec2_instance_type_offerings") @@ -26,7 +27,7 @@ func DataSourceInstanceTypeOfferings() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "instance_types": { Type: schema.TypeList, Computed: true, @@ -57,7 +58,7 @@ func dataSourceInstanceTypeOfferingsRead(ctx context.Context, d *schema.Resource input := &ec2.DescribeInstanceTypeOfferingsInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = newCustomFilterList(v.(*schema.Set)) } diff --git a/internal/service/ec2/ec2_instance_types_data_source.go b/internal/service/ec2/ec2_instance_types_data_source.go index 1ed0d355530..b2323abce8c 100644 --- a/internal/service/ec2/ec2_instance_types_data_source.go +++ b/internal/service/ec2/ec2_instance_types_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_ec2_instance_types") @@ -25,7 +26,7 @@ func DataSourceInstanceTypes() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "instance_types": { Type: schema.TypeList, Computed: true, @@ -41,7 +42,7 @@ func dataSourceInstanceTypesRead(ctx context.Context, d *schema.ResourceData, me input := &ec2.DescribeInstanceTypesInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = newCustomFilterList(v.(*schema.Set)) } diff --git a/internal/service/ec2/ec2_instances_data_source.go b/internal/service/ec2/ec2_instances_data_source.go index 0eb936485e5..3ebb6188c29 100644 --- a/internal/service/ec2/ec2_instances_data_source.go +++ b/internal/service/ec2/ec2_instances_data_source.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_instances") @@ -28,7 +29,7 @@ func DataSourceInstances() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -85,7 +86,7 @@ func dataSourceInstancesRead(ctx context.Context, d *schema.ResourceData, meta i )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/ec2_key_pair_data_source.go b/internal/service/ec2/ec2_key_pair_data_source.go index 8274735a834..b9b055cb439 100644 --- a/internal/service/ec2/ec2_key_pair_data_source.go +++ b/internal/service/ec2/ec2_key_pair_data_source.go @@ -38,7 +38,7 @@ func dataSourceKeyPair() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "fingerprint": { Type: schema.TypeString, Computed: true, @@ -75,7 +75,7 @@ func dataSourceKeyPairRead(ctx context.Context, d *schema.ResourceData, meta int input := &ec2.DescribeKeyPairsInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = newCustomFilterListV2(v.(*schema.Set)) } diff --git a/internal/service/ec2/ec2_launch_template_data_source.go b/internal/service/ec2/ec2_launch_template_data_source.go index 9a5d4cacb6b..084685df600 100644 --- a/internal/service/ec2/ec2_launch_template_data_source.go +++ b/internal/service/ec2/ec2_launch_template_data_source.go @@ -211,7 +211,7 @@ func DataSourceLaunchTemplate() *schema.Resource { }, }, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "hibernation_options": { Type: schema.TypeList, Computed: true, @@ -795,7 +795,7 @@ func dataSourceLaunchTemplateRead(ctx context.Context, d *schema.ResourceData, m } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) input.Filters = append(input.Filters, newTagFilterList( diff --git a/internal/service/ec2/ec2_public_ipv4_pools_data_source.go b/internal/service/ec2/ec2_public_ipv4_pools_data_source.go index 5ce5db237e3..04403197428 100644 --- a/internal/service/ec2/ec2_public_ipv4_pools_data_source.go +++ b/internal/service/ec2/ec2_public_ipv4_pools_data_source.go @@ -22,7 +22,7 @@ func DataSourcePublicIPv4Pools() *schema.Resource { ReadWithoutTimeout: dataSourcePublicIPv4PoolsRead, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "pool_ids": { Type: schema.TypeList, Computed: true, @@ -44,7 +44,7 @@ func dataSourcePublicIPv4PoolsRead(ctx context.Context, d *schema.ResourceData, )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/ec2_spot_price_data_source.go b/internal/service/ec2/ec2_spot_price_data_source.go index 98836cdb71a..d12443a47cc 100644 --- a/internal/service/ec2/ec2_spot_price_data_source.go +++ b/internal/service/ec2/ec2_spot_price_data_source.go @@ -26,7 +26,7 @@ func DataSourceSpotPrice() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrInstanceType: { Type: schema.TypeString, Optional: true, @@ -68,7 +68,7 @@ func dataSourceSpotPriceRead(ctx context.Context, d *schema.ResourceData, meta i input.AvailabilityZone = aws.String(availabilityZone) } - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = newCustomFilterList(v.(*schema.Set)) } diff --git a/internal/service/ec2/ipam_pool_cidrs_data_source.go b/internal/service/ec2/ipam_pool_cidrs_data_source.go index c812b219124..6aaff17fab3 100644 --- a/internal/service/ec2/ipam_pool_cidrs_data_source.go +++ b/internal/service/ec2/ipam_pool_cidrs_data_source.go @@ -26,7 +26,7 @@ func DataSourceIPAMPoolCIDRs() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ipam_pool_id": { Type: schema.TypeString, Required: true, @@ -61,7 +61,7 @@ func dataSourceIPAMPoolCIDRsRead(ctx context.Context, d *schema.ResourceData, me } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/ipam_pool_data_source.go b/internal/service/ec2/ipam_pool_data_source.go index 4cb6514da0d..3ff9eaedaa8 100644 --- a/internal/service/ec2/ipam_pool_data_source.go +++ b/internal/service/ec2/ipam_pool_data_source.go @@ -62,7 +62,7 @@ func DataSourceIPAMPool() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -116,7 +116,7 @@ func dataSourceIPAMPoolRead(ctx context.Context, d *schema.ResourceData, meta in } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/ipam_pools_data_source.go b/internal/service/ec2/ipam_pools_data_source.go index 14bd4dcac00..a79143c5c2c 100644 --- a/internal/service/ec2/ipam_pools_data_source.go +++ b/internal/service/ec2/ipam_pools_data_source.go @@ -23,7 +23,7 @@ func DataSourceIPAMPools() *schema.Resource { ReadWithoutTimeout: dataSourceIPAMPoolsRead, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ipam_pools": { Type: schema.TypeSet, Computed: true, @@ -110,7 +110,7 @@ func dataSourceIPAMPoolsRead(ctx context.Context, d *schema.ResourceData, meta i input := &ec2.DescribeIpamPoolsInput{} input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/outposts_coip_pool_data_source.go b/internal/service/ec2/outposts_coip_pool_data_source.go index d84acf03895..851db7b179c 100644 --- a/internal/service/ec2/outposts_coip_pool_data_source.go +++ b/internal/service/ec2/outposts_coip_pool_data_source.go @@ -54,7 +54,7 @@ func DataSourceCoIPPool() *schema.Resource { names.AttrTags: tftags.TagsSchemaComputed(), - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), }, } } @@ -85,7 +85,7 @@ func dataSourceCoIPPoolRead(ctx context.Context, d *schema.ResourceData, meta in } req.Filters = append(req.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(req.Filters) == 0 { // Don't send an empty filters list; the EC2 API won't accept it. diff --git a/internal/service/ec2/outposts_coip_pools_data_source.go b/internal/service/ec2/outposts_coip_pools_data_source.go index b82dce5300a..31d61825e35 100644 --- a/internal/service/ec2/outposts_coip_pools_data_source.go +++ b/internal/service/ec2/outposts_coip_pools_data_source.go @@ -27,7 +27,7 @@ func DataSourceCoIPPools() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "pool_ids": { Type: schema.TypeList, Computed: true, @@ -49,7 +49,7 @@ func dataSourceCoIPPoolsRead(ctx context.Context, d *schema.ResourceData, meta i )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/outposts_local_gateway_data_source.go b/internal/service/ec2/outposts_local_gateway_data_source.go index 30cef5e25e0..ec107565b70 100644 --- a/internal/service/ec2/outposts_local_gateway_data_source.go +++ b/internal/service/ec2/outposts_local_gateway_data_source.go @@ -39,7 +39,7 @@ func DataSourceLocalGateway() *schema.Resource { Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrState: { Type: schema.TypeString, @@ -81,7 +81,7 @@ func dataSourceLocalGatewayRead(ctx context.Context, d *schema.ResourceData, met } req.Filters = append(req.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(req.Filters) == 0 { // Don't send an empty filters list; the EC2 API won't accept it. diff --git a/internal/service/ec2/outposts_local_gateway_route_table_data_source.go b/internal/service/ec2/outposts_local_gateway_route_table_data_source.go index 773eece098d..95c1e3da3f4 100644 --- a/internal/service/ec2/outposts_local_gateway_route_table_data_source.go +++ b/internal/service/ec2/outposts_local_gateway_route_table_data_source.go @@ -54,7 +54,7 @@ func DataSourceLocalGatewayRouteTable() *schema.Resource { names.AttrTags: tftags.TagsSchemaComputed(), - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), }, } } @@ -83,7 +83,7 @@ func dataSourceLocalGatewayRouteTableRead(ctx context.Context, d *schema.Resourc )...) req.Filters = append(req.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(req.Filters) == 0 { // Don't send an empty filters list; the EC2 API won't accept it. diff --git a/internal/service/ec2/outposts_local_gateway_route_tables_data_source.go b/internal/service/ec2/outposts_local_gateway_route_tables_data_source.go index d2374e913b0..157bacda3c1 100644 --- a/internal/service/ec2/outposts_local_gateway_route_tables_data_source.go +++ b/internal/service/ec2/outposts_local_gateway_route_tables_data_source.go @@ -27,7 +27,7 @@ func DataSourceLocalGatewayRouteTables() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -49,7 +49,7 @@ func dataSourceLocalGatewayRouteTablesRead(ctx context.Context, d *schema.Resour )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/outposts_local_gateway_virtual_interface_data_source.go b/internal/service/ec2/outposts_local_gateway_virtual_interface_data_source.go index 8ed2e1b1a84..f0339b7f755 100644 --- a/internal/service/ec2/outposts_local_gateway_virtual_interface_data_source.go +++ b/internal/service/ec2/outposts_local_gateway_virtual_interface_data_source.go @@ -27,7 +27,7 @@ func DataSourceLocalGatewayVirtualInterface() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -83,7 +83,7 @@ func dataSourceLocalGatewayVirtualInterfaceRead(ctx context.Context, d *schema.R )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/outposts_local_gateway_virtual_interface_group_data_source.go b/internal/service/ec2/outposts_local_gateway_virtual_interface_group_data_source.go index ea1cf27f101..81c0117bbd5 100644 --- a/internal/service/ec2/outposts_local_gateway_virtual_interface_group_data_source.go +++ b/internal/service/ec2/outposts_local_gateway_virtual_interface_group_data_source.go @@ -27,7 +27,7 @@ func DataSourceLocalGatewayVirtualInterfaceGroup() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -70,7 +70,7 @@ func dataSourceLocalGatewayVirtualInterfaceGroupRead(ctx context.Context, d *sch )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/outposts_local_gateway_virtual_interface_groups_data_source.go b/internal/service/ec2/outposts_local_gateway_virtual_interface_groups_data_source.go index 9912598aacf..e394a3a10be 100644 --- a/internal/service/ec2/outposts_local_gateway_virtual_interface_groups_data_source.go +++ b/internal/service/ec2/outposts_local_gateway_virtual_interface_groups_data_source.go @@ -27,7 +27,7 @@ func DataSourceLocalGatewayVirtualInterfaceGroups() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -54,7 +54,7 @@ func dataSourceLocalGatewayVirtualInterfaceGroupsRead(ctx context.Context, d *sc )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/outposts_local_gateways_data_source.go b/internal/service/ec2/outposts_local_gateways_data_source.go index c88696ba9da..c62fda34f05 100644 --- a/internal/service/ec2/outposts_local_gateways_data_source.go +++ b/internal/service/ec2/outposts_local_gateways_data_source.go @@ -27,7 +27,7 @@ func DataSourceLocalGateways() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -49,7 +49,7 @@ func dataSourceLocalGatewaysRead(ctx context.Context, d *schema.ResourceData, me )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/transitgateway_attachment_data_source.go b/internal/service/ec2/transitgateway_attachment_data_source.go index e7ff14bc65d..1d4cea56283 100644 --- a/internal/service/ec2/transitgateway_attachment_data_source.go +++ b/internal/service/ec2/transitgateway_attachment_data_source.go @@ -37,7 +37,7 @@ func DataSourceTransitGatewayAttachment() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "resource_id": { Type: schema.TypeString, Computed: true, @@ -80,7 +80,7 @@ func dataSourceTransitGatewayAttachmentRead(ctx context.Context, d *schema.Resou input := &ec2.DescribeTransitGatewayAttachmentsInput{} input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/transitgateway_attachments_data_source.go b/internal/service/ec2/transitgateway_attachments_data_source.go index fe33d2bc36a..ed584fb0579 100644 --- a/internal/service/ec2/transitgateway_attachments_data_source.go +++ b/internal/service/ec2/transitgateway_attachments_data_source.go @@ -27,7 +27,7 @@ func DataSourceTransitGatewayAttachments() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -45,7 +45,7 @@ func dataSourceTransitGatewayAttachmentsRead(ctx context.Context, d *schema.Reso input := &ec2.DescribeTransitGatewayAttachmentsInput{} input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if v, ok := d.GetOk(names.AttrTags); ok { diff --git a/internal/service/ec2/transitgateway_connect_data_source.go b/internal/service/ec2/transitgateway_connect_data_source.go index eb7e7673a31..7e810ee3cd8 100644 --- a/internal/service/ec2/transitgateway_connect_data_source.go +++ b/internal/service/ec2/transitgateway_connect_data_source.go @@ -28,7 +28,7 @@ func DataSourceTransitGatewayConnect() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrProtocol: { Type: schema.TypeString, Computed: true, @@ -64,7 +64,7 @@ func dataSourceTransitGatewayConnectRead(ctx context.Context, d *schema.Resource } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) transitGatewayConnect, err := FindTransitGatewayConnect(ctx, conn, input) diff --git a/internal/service/ec2/transitgateway_connect_peer_data_source.go b/internal/service/ec2/transitgateway_connect_peer_data_source.go index f497f3c8f98..0896029cd6e 100644 --- a/internal/service/ec2/transitgateway_connect_peer_data_source.go +++ b/internal/service/ec2/transitgateway_connect_peer_data_source.go @@ -49,7 +49,7 @@ func DataSourceTransitGatewayConnectPeer() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "inside_cidr_blocks": { Type: schema.TypeList, Computed: true, @@ -90,7 +90,7 @@ func dataSourceTransitGatewayConnectPeerRead(ctx context.Context, d *schema.Reso } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) transitGatewayConnectPeer, err := FindTransitGatewayConnectPeer(ctx, conn, input) diff --git a/internal/service/ec2/transitgateway_data_source.go b/internal/service/ec2/transitgateway_data_source.go index e015939eb96..ed1d07caa4b 100644 --- a/internal/service/ec2/transitgateway_data_source.go +++ b/internal/service/ec2/transitgateway_data_source.go @@ -60,7 +60,7 @@ func DataSourceTransitGateway() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -100,7 +100,7 @@ func dataSourceTransitGatewayRead(ctx context.Context, d *schema.ResourceData, m input := &ec2.DescribeTransitGatewaysInput{} input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/transitgateway_dx_gateway_attachment_data_source.go b/internal/service/ec2/transitgateway_dx_gateway_attachment_data_source.go index d6eaf967d93..c85e5eed990 100644 --- a/internal/service/ec2/transitgateway_dx_gateway_attachment_data_source.go +++ b/internal/service/ec2/transitgateway_dx_gateway_attachment_data_source.go @@ -32,8 +32,8 @@ func DataSourceTransitGatewayDxGatewayAttachment() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "filter": customFiltersSchema(), - names.AttrTags: tftags.TagsSchemaComputed(), + names.AttrFilter: customFiltersSchema(), + names.AttrTags: tftags.TagsSchemaComputed(), names.AttrTransitGatewayID: { Type: schema.TypeString, Optional: true, @@ -54,7 +54,7 @@ func dataSourceTransitGatewayDxGatewayAttachmentRead(ctx context.Context, d *sch } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if v, ok := d.GetOk(names.AttrTags); ok { diff --git a/internal/service/ec2/transitgateway_multicast_domain_data_source.go b/internal/service/ec2/transitgateway_multicast_domain_data_source.go index fc84bef2f5b..d2069cb6f4f 100644 --- a/internal/service/ec2/transitgateway_multicast_domain_data_source.go +++ b/internal/service/ec2/transitgateway_multicast_domain_data_source.go @@ -52,7 +52,7 @@ func DataSourceTransitGatewayMulticastDomain() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "igmpv2_support": { Type: schema.TypeString, Computed: true, @@ -132,7 +132,7 @@ func dataSourceTransitGatewayMulticastDomainRead(ctx context.Context, d *schema. } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/transitgateway_peering_attachment_data_source.go b/internal/service/ec2/transitgateway_peering_attachment_data_source.go index a4403a1b137..1fbc9fcd29a 100644 --- a/internal/service/ec2/transitgateway_peering_attachment_data_source.go +++ b/internal/service/ec2/transitgateway_peering_attachment_data_source.go @@ -29,7 +29,7 @@ func dataSourceTransitGatewayPeeringAttachment() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -67,7 +67,7 @@ func dataSourceTransitGatewayPeeringAttachmentRead(ctx context.Context, d *schem input := &ec2.DescribeTransitGatewayPeeringAttachmentsInput{} input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if v, ok := d.GetOk(names.AttrID); ok { diff --git a/internal/service/ec2/transitgateway_route_table_associations_data_source.go b/internal/service/ec2/transitgateway_route_table_associations_data_source.go index dab11f7aaab..f7a80792046 100644 --- a/internal/service/ec2/transitgateway_route_table_associations_data_source.go +++ b/internal/service/ec2/transitgateway_route_table_associations_data_source.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_ec2_transit_gateway_route_table_associations") @@ -26,7 +27,7 @@ func DataSourceTransitGatewayRouteTableAssociations() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -52,7 +53,7 @@ func dataSourceTransitGatewayRouteTableAssociationsRead(ctx context.Context, d * } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/transitgateway_route_table_data_source.go b/internal/service/ec2/transitgateway_route_table_data_source.go index 23d32e089e7..9dd9e2c45d5 100644 --- a/internal/service/ec2/transitgateway_route_table_data_source.go +++ b/internal/service/ec2/transitgateway_route_table_data_source.go @@ -42,7 +42,7 @@ func DataSourceTransitGatewayRouteTable() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -65,7 +65,7 @@ func dataSourceTransitGatewayRouteTableRead(ctx context.Context, d *schema.Resou input := &ec2.DescribeTransitGatewayRouteTablesInput{} input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/transitgateway_route_table_propagations_data_source.go b/internal/service/ec2/transitgateway_route_table_propagations_data_source.go index b8c9f856572..7cde6097242 100644 --- a/internal/service/ec2/transitgateway_route_table_propagations_data_source.go +++ b/internal/service/ec2/transitgateway_route_table_propagations_data_source.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_ec2_transit_gateway_route_table_propagations") @@ -26,7 +27,7 @@ func DataSourceTransitGatewayRouteTablePropagations() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -52,7 +53,7 @@ func dataSourceTransitGatewayRouteTablePropagationsRead(ctx context.Context, d * } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/transitgateway_route_table_routes_data_source.go b/internal/service/ec2/transitgateway_route_table_routes_data_source.go index 7d7a6dd47f9..756edff5a11 100644 --- a/internal/service/ec2/transitgateway_route_table_routes_data_source.go +++ b/internal/service/ec2/transitgateway_route_table_routes_data_source.go @@ -22,7 +22,7 @@ func DataSourceTransitGatewayRouteTableRoutes() *schema.Resource { ReadWithoutTimeout: dataSourceTransitGatewayRouteTableRoutesRead, Schema: map[string]*schema.Schema{ - "filter": customRequiredFiltersSchema(), + names.AttrFilter: customRequiredFiltersSchema(), "routes": { Type: schema.TypeList, Computed: true, @@ -66,7 +66,7 @@ func dataSourceTransitGatewayRouteTableRoutesRead(ctx context.Context, d *schema tgwRouteTableID := d.Get("transit_gateway_route_table_id").(string) input := &ec2.SearchTransitGatewayRoutesInput{ - Filters: newCustomFilterList(d.Get("filter").(*schema.Set)), + Filters: newCustomFilterList(d.Get(names.AttrFilter).(*schema.Set)), TransitGatewayRouteTableId: aws.String(tgwRouteTableID), } diff --git a/internal/service/ec2/transitgateway_route_tables_data_source.go b/internal/service/ec2/transitgateway_route_tables_data_source.go index 113ac06a169..0c6f76eaeeb 100644 --- a/internal/service/ec2/transitgateway_route_tables_data_source.go +++ b/internal/service/ec2/transitgateway_route_tables_data_source.go @@ -27,7 +27,7 @@ func DataSourceTransitGatewayRouteTables() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -49,7 +49,7 @@ func dataSourceTransitGatewayRouteTablesRead(ctx context.Context, d *schema.Reso )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/transitgateway_vpc_attachment_data_source.go b/internal/service/ec2/transitgateway_vpc_attachment_data_source.go index 3883eb95efb..ac6a56533ef 100644 --- a/internal/service/ec2/transitgateway_vpc_attachment_data_source.go +++ b/internal/service/ec2/transitgateway_vpc_attachment_data_source.go @@ -36,7 +36,7 @@ func DataSourceTransitGatewayVPCAttachment() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -76,7 +76,7 @@ func dataSourceTransitGatewayVPCAttachmentRead(ctx context.Context, d *schema.Re input := &ec2.DescribeTransitGatewayVpcAttachmentsInput{} input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/transitgateway_vpc_attachments_data_source.go b/internal/service/ec2/transitgateway_vpc_attachments_data_source.go index e000aecc3e2..c82e18a2211 100644 --- a/internal/service/ec2/transitgateway_vpc_attachments_data_source.go +++ b/internal/service/ec2/transitgateway_vpc_attachments_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_ec2_transit_gateway_vpc_attachments") @@ -25,7 +26,7 @@ func DataSourceTransitGatewayVPCAttachments() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -43,7 +44,7 @@ func dataSourceTransitGatewayVPCAttachmentsRead(ctx context.Context, d *schema.R input := &ec2.DescribeTransitGatewayVpcAttachmentsInput{} input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/transitgateway_vpn_attachment_data_source.go b/internal/service/ec2/transitgateway_vpn_attachment_data_source.go index 8fa43efea50..29a0080c2ad 100644 --- a/internal/service/ec2/transitgateway_vpn_attachment_data_source.go +++ b/internal/service/ec2/transitgateway_vpn_attachment_data_source.go @@ -28,8 +28,8 @@ func DataSourceTransitGatewayVPNAttachment() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), - names.AttrTags: tftags.TagsSchemaComputed(), + names.AttrFilter: customFiltersSchema(), + names.AttrTags: tftags.TagsSchemaComputed(), names.AttrTransitGatewayID: { Type: schema.TypeString, Optional: true, @@ -54,7 +54,7 @@ func dataSourceTransitGatewayVPNAttachmentRead(ctx context.Context, d *schema.Re } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if v, ok := d.GetOk(names.AttrTags); ok { diff --git a/internal/service/ec2/vpc_data_source.go b/internal/service/ec2/vpc_data_source.go index 35186156062..6cd79c0d188 100644 --- a/internal/service/ec2/vpc_data_source.go +++ b/internal/service/ec2/vpc_data_source.go @@ -83,7 +83,7 @@ func DataSourceVPC() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -147,7 +147,7 @@ func dataSourceVPCRead(ctx context.Context, d *schema.ResourceData, meta interfa input.VpcIds = []string{v.(string)} } - input.Filters = append(input.Filters, newCustomFilterListV2(d.Get("filter").(*schema.Set))...) + input.Filters = append(input.Filters, newCustomFilterListV2(d.Get(names.AttrFilter).(*schema.Set))...) input.Filters = append(input.Filters, tagFilters(ctx)...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_dhcp_options_data_source.go b/internal/service/ec2/vpc_dhcp_options_data_source.go index 7f024cae73c..dabdad472f8 100644 --- a/internal/service/ec2/vpc_dhcp_options_data_source.go +++ b/internal/service/ec2/vpc_dhcp_options_data_source.go @@ -48,7 +48,7 @@ func DataSourceVPCDHCPOptions() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ipv6_address_preferred_lease_time": { Type: schema.TypeString, Computed: true, @@ -88,7 +88,7 @@ func dataSourceVPCDHCPOptionsRead(ctx context.Context, d *schema.ResourceData, m } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { // Don't send an empty filters list; the EC2 API won't accept it. diff --git a/internal/service/ec2/vpc_endpoint_data_source.go b/internal/service/ec2/vpc_endpoint_data_source.go index 5e34bc683c5..841381a8747 100644 --- a/internal/service/ec2/vpc_endpoint_data_source.go +++ b/internal/service/ec2/vpc_endpoint_data_source.go @@ -72,7 +72,7 @@ func DataSourceVPCEndpoint() *schema.Resource { }, }, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -169,7 +169,7 @@ func dataSourceVPCEndpointRead(ctx context.Context, d *schema.ResourceData, meta Tags(tftags.New(ctx, d.Get(names.AttrTags).(map[string]interface{}))), )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { // Don't send an empty filters list; the EC2 API won't accept it. diff --git a/internal/service/ec2/vpc_endpoint_service_data_source.go b/internal/service/ec2/vpc_endpoint_service_data_source.go index 68b834b415e..d8257857fa2 100644 --- a/internal/service/ec2/vpc_endpoint_service_data_source.go +++ b/internal/service/ec2/vpc_endpoint_service_data_source.go @@ -50,7 +50,7 @@ func DataSourceVPCEndpointService() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "manages_vpc_endpoints": { Type: schema.TypeBool, Computed: true, @@ -130,7 +130,7 @@ func dataSourceVPCEndpointServiceRead(ctx context.Context, d *schema.ResourceDat } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_internet_gateway_data_source.go b/internal/service/ec2/vpc_internet_gateway_data_source.go index 51664f89621..fc6e2cb147c 100644 --- a/internal/service/ec2/vpc_internet_gateway_data_source.go +++ b/internal/service/ec2/vpc_internet_gateway_data_source.go @@ -50,7 +50,7 @@ func DataSourceInternetGateway() *schema.Resource { }, }, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "internet_gateway_id": { Type: schema.TypeString, Optional: true, @@ -72,7 +72,7 @@ func dataSourceInternetGatewayRead(ctx context.Context, d *schema.ResourceData, internetGatewayId, internetGatewayIdOk := d.GetOk("internet_gateway_id") tags, tagsOk := d.GetOk(names.AttrTags) - filter, filterOk := d.GetOk("filter") + filter, filterOk := d.GetOk(names.AttrFilter) if !internetGatewayIdOk && !filterOk && !tagsOk { return sdkdiag.AppendErrorf(diags, "One of internet_gateway_id or filter or tags must be assigned") diff --git a/internal/service/ec2/vpc_managed_prefix_list_data_source.go b/internal/service/ec2/vpc_managed_prefix_list_data_source.go index 99e674bcce2..326b973d076 100644 --- a/internal/service/ec2/vpc_managed_prefix_list_data_source.go +++ b/internal/service/ec2/vpc_managed_prefix_list_data_source.go @@ -52,7 +52,7 @@ func DataSourceManagedPrefixList() *schema.Resource { }, }, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Computed: true, @@ -97,7 +97,7 @@ func dataSourceManagedPrefixListRead(ctx context.Context, d *schema.ResourceData } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_managed_prefix_lists_data_source.go b/internal/service/ec2/vpc_managed_prefix_lists_data_source.go index d8eee055d43..93360fa5b93 100644 --- a/internal/service/ec2/vpc_managed_prefix_lists_data_source.go +++ b/internal/service/ec2/vpc_managed_prefix_lists_data_source.go @@ -22,7 +22,7 @@ func DataSourceManagedPrefixLists() *schema.Resource { ReadWithoutTimeout: dataSourceManagedPrefixListsRead, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -45,7 +45,7 @@ func dataSourceManagedPrefixListsRead(ctx context.Context, d *schema.ResourceDat )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_nat_gateway_data_source.go b/internal/service/ec2/vpc_nat_gateway_data_source.go index 7bfa50c1012..b824089d4e7 100644 --- a/internal/service/ec2/vpc_nat_gateway_data_source.go +++ b/internal/service/ec2/vpc_nat_gateway_data_source.go @@ -40,7 +40,7 @@ func DataSourceNATGateway() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -119,7 +119,7 @@ func dataSourceNATGatewayRead(ctx context.Context, d *schema.ResourceData, meta } input.Filter = append(input.Filter, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filter) == 0 { // Don't send an empty filters list; the EC2 API won't accept it. diff --git a/internal/service/ec2/vpc_nat_gateways_data_source.go b/internal/service/ec2/vpc_nat_gateways_data_source.go index 079b0f4cce8..819eedf7895 100644 --- a/internal/service/ec2/vpc_nat_gateways_data_source.go +++ b/internal/service/ec2/vpc_nat_gateways_data_source.go @@ -27,7 +27,7 @@ func DataSourceNATGateways() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -64,7 +64,7 @@ func dataSourceNATGatewaysRead(ctx context.Context, d *schema.ResourceData, meta } input.Filter = append(input.Filter, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filter) == 0 { diff --git a/internal/service/ec2/vpc_network_acls_data_source.go b/internal/service/ec2/vpc_network_acls_data_source.go index 5ec64099e9a..518e0b3f1a5 100644 --- a/internal/service/ec2/vpc_network_acls_data_source.go +++ b/internal/service/ec2/vpc_network_acls_data_source.go @@ -27,7 +27,7 @@ func DataSourceNetworkACLs() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -61,7 +61,7 @@ func dataSourceNetworkACLsRead(ctx context.Context, d *schema.ResourceData, meta )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_network_insights_analysis_data_source.go b/internal/service/ec2/vpc_network_insights_analysis_data_source.go index dfcf398529b..11c78eabd0f 100644 --- a/internal/service/ec2/vpc_network_insights_analysis_data_source.go +++ b/internal/service/ec2/vpc_network_insights_analysis_data_source.go @@ -44,8 +44,8 @@ func DataSourceNetworkInsightsAnalysis() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "explanations": networkInsightsAnalysisExplanationsSchema, - "filter": customFiltersSchema(), + "explanations": networkInsightsAnalysisExplanationsSchema, + names.AttrFilter: customFiltersSchema(), "filter_in_arns": { Type: schema.TypeList, Computed: true, @@ -100,7 +100,7 @@ func dataSourceNetworkInsightsAnalysisRead(ctx context.Context, d *schema.Resour } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_network_insights_path_data_source.go b/internal/service/ec2/vpc_network_insights_path_data_source.go index 975460683d5..7fad1bbb3b6 100644 --- a/internal/service/ec2/vpc_network_insights_path_data_source.go +++ b/internal/service/ec2/vpc_network_insights_path_data_source.go @@ -43,7 +43,7 @@ func DataSourceNetworkInsightsPath() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "network_insights_path_id": { Type: schema.TypeString, Optional: true, @@ -83,7 +83,7 @@ func dataSourceNetworkInsightsPathRead(ctx context.Context, d *schema.ResourceDa } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_network_interface_data_source.go b/internal/service/ec2/vpc_network_interface_data_source.go index ef0bf911108..84f8aa571fe 100644 --- a/internal/service/ec2/vpc_network_interface_data_source.go +++ b/internal/service/ec2/vpc_network_interface_data_source.go @@ -103,7 +103,7 @@ func dataSourceNetworkInterface() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -171,7 +171,7 @@ func dataSourceNetworkInterfaceRead(ctx context.Context, d *schema.ResourceData, input := &ec2.DescribeNetworkInterfacesInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = newCustomFilterListV2(v.(*schema.Set)) } diff --git a/internal/service/ec2/vpc_network_interfaces_data_source.go b/internal/service/ec2/vpc_network_interfaces_data_source.go index 460a644be8d..2e78c22a3c7 100644 --- a/internal/service/ec2/vpc_network_interfaces_data_source.go +++ b/internal/service/ec2/vpc_network_interfaces_data_source.go @@ -27,7 +27,7 @@ func DataSourceNetworkInterfaces() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -49,7 +49,7 @@ func dataSourceNetworkInterfacesRead(ctx context.Context, d *schema.ResourceData )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_peering_connection_data_source.go b/internal/service/ec2/vpc_peering_connection_data_source.go index 318a4ad51f1..0daa0205fa3 100644 --- a/internal/service/ec2/vpc_peering_connection_data_source.go +++ b/internal/service/ec2/vpc_peering_connection_data_source.go @@ -50,7 +50,7 @@ func DataSourceVPCPeeringConnection() *schema.Resource { }, }, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -172,7 +172,7 @@ func dataSourceVPCPeeringConnectionRead(ctx context.Context, d *schema.ResourceD } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_peering_connections_data_source.go b/internal/service/ec2/vpc_peering_connections_data_source.go index e40bfab2542..8bbb612a780 100644 --- a/internal/service/ec2/vpc_peering_connections_data_source.go +++ b/internal/service/ec2/vpc_peering_connections_data_source.go @@ -27,7 +27,7 @@ func DataSourceVPCPeeringConnections() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -48,7 +48,7 @@ func dataSourceVPCPeeringConnectionsRead(ctx context.Context, d *schema.Resource Tags(tftags.New(ctx, d.Get(names.AttrTags).(map[string]interface{}))), )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { input.Filters = nil diff --git a/internal/service/ec2/vpc_prefix_list_data_source.go b/internal/service/ec2/vpc_prefix_list_data_source.go index e6404786627..0dd68ccccce 100644 --- a/internal/service/ec2/vpc_prefix_list_data_source.go +++ b/internal/service/ec2/vpc_prefix_list_data_source.go @@ -32,7 +32,7 @@ func DataSourcePrefixList() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrName: { Type: schema.TypeString, Optional: true, @@ -63,7 +63,7 @@ func dataSourcePrefixListRead(ctx context.Context, d *schema.ResourceData, meta } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) pl, err := FindPrefixList(ctx, conn, input) diff --git a/internal/service/ec2/vpc_route_table_data_source.go b/internal/service/ec2/vpc_route_table_data_source.go index a1c93585e05..168c29ab52b 100644 --- a/internal/service/ec2/vpc_route_table_data_source.go +++ b/internal/service/ec2/vpc_route_table_data_source.go @@ -51,8 +51,8 @@ func DataSourceRouteTable() *schema.Resource { Optional: true, Computed: true, }, - "filter": customFiltersSchema(), - names.AttrTags: tftags.TagsSchemaComputed(), + names.AttrFilter: customFiltersSchema(), + names.AttrTags: tftags.TagsSchemaComputed(), "routes": { Type: schema.TypeList, Computed: true, @@ -194,7 +194,7 @@ func dataSourceRouteTableRead(ctx context.Context, d *schema.ResourceData, meta gatewayId, gatewayIdOk := d.GetOk("gateway_id") rtbId, rtbOk := d.GetOk("route_table_id") tags, tagsOk := d.GetOk(names.AttrTags) - filter, filterOk := d.GetOk("filter") + filter, filterOk := d.GetOk(names.AttrFilter) if !rtbOk && !vpcIdOk && !subnetIdOk && !gatewayIdOk && !filterOk && !tagsOk { return sdkdiag.AppendErrorf(diags, "one of route_table_id, vpc_id, subnet_id, gateway_id, filters, or tags must be assigned") diff --git a/internal/service/ec2/vpc_route_tables_data_source.go b/internal/service/ec2/vpc_route_tables_data_source.go index ee089105347..93fe510e61a 100644 --- a/internal/service/ec2/vpc_route_tables_data_source.go +++ b/internal/service/ec2/vpc_route_tables_data_source.go @@ -27,7 +27,7 @@ func DataSourceRouteTables() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -61,7 +61,7 @@ func dataSourceRouteTablesRead(ctx context.Context, d *schema.ResourceData, meta )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_security_group_data_source.go b/internal/service/ec2/vpc_security_group_data_source.go index 7590bb58080..675a7e296ff 100644 --- a/internal/service/ec2/vpc_security_group_data_source.go +++ b/internal/service/ec2/vpc_security_group_data_source.go @@ -38,7 +38,7 @@ func DataSourceSecurityGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -83,7 +83,7 @@ func dataSourceSecurityGroupRead(ctx context.Context, d *schema.ResourceData, me )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_security_group_rule_data_source.go b/internal/service/ec2/vpc_security_group_rule_data_source.go index af9472e44b1..69429f49125 100644 --- a/internal/service/ec2/vpc_security_group_rule_data_source.go +++ b/internal/service/ec2/vpc_security_group_rule_data_source.go @@ -77,7 +77,7 @@ func (d *securityGroupRuleDataSource) Schema(ctx context.Context, request dataso }, }, Blocks: map[string]schema.Block{ - "filter": customFiltersBlock(), + names.AttrFilter: customFiltersBlock(), }, } } diff --git a/internal/service/ec2/vpc_security_group_rules_data_source.go b/internal/service/ec2/vpc_security_group_rules_data_source.go index 7a7a448af3f..7b7c30657c9 100644 --- a/internal/service/ec2/vpc_security_group_rules_data_source.go +++ b/internal/service/ec2/vpc_security_group_rules_data_source.go @@ -44,7 +44,7 @@ func (d *securityGroupRulesDataSource) Schema(ctx context.Context, request datas names.AttrTags: tftags.TagsAttribute(), }, Blocks: map[string]schema.Block{ - "filter": customFiltersBlock(), + names.AttrFilter: customFiltersBlock(), }, } } diff --git a/internal/service/ec2/vpc_security_groups_data_source.go b/internal/service/ec2/vpc_security_groups_data_source.go index 62d743e8ed8..147ba1e7a81 100644 --- a/internal/service/ec2/vpc_security_groups_data_source.go +++ b/internal/service/ec2/vpc_security_groups_data_source.go @@ -34,7 +34,7 @@ func DataSourceSecurityGroups() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -62,7 +62,7 @@ func dataSourceSecurityGroupsRead(ctx context.Context, d *schema.ResourceData, m )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpc_subnet_data_source.go b/internal/service/ec2/vpc_subnet_data_source.go index 92a22b9f61e..8346f51000c 100644 --- a/internal/service/ec2/vpc_subnet_data_source.go +++ b/internal/service/ec2/vpc_subnet_data_source.go @@ -80,7 +80,7 @@ func DataSourceSubnet() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -180,7 +180,7 @@ func dataSourceSubnetRead(ctx context.Context, d *schema.ResourceData, meta inte } input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { // Don't send an empty filters list; the EC2 API won't accept it. diff --git a/internal/service/ec2/vpc_subnets_data_source.go b/internal/service/ec2/vpc_subnets_data_source.go index 347513181b8..e5987c0bb7b 100644 --- a/internal/service/ec2/vpc_subnets_data_source.go +++ b/internal/service/ec2/vpc_subnets_data_source.go @@ -27,7 +27,7 @@ func DataSourceSubnets() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -50,7 +50,7 @@ func dataSourceSubnetsRead(ctx context.Context, d *schema.ResourceData, meta int )...) } - if filters, filtersOk := d.GetOk("filter"); filtersOk { + if filters, filtersOk := d.GetOk(names.AttrFilter); filtersOk { input.Filters = append(input.Filters, newCustomFilterList(filters.(*schema.Set))...) } diff --git a/internal/service/ec2/vpc_vpcs_data_source.go b/internal/service/ec2/vpc_vpcs_data_source.go index d5bf6da2d96..4eef6722e5e 100644 --- a/internal/service/ec2/vpc_vpcs_data_source.go +++ b/internal/service/ec2/vpc_vpcs_data_source.go @@ -27,7 +27,7 @@ func DataSourceVPCs() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -50,7 +50,7 @@ func dataSourceVPCsRead(ctx context.Context, d *schema.ResourceData, meta interf )...) } - if filters, filtersOk := d.GetOk("filter"); filtersOk { + if filters, filtersOk := d.GetOk(names.AttrFilter); filtersOk { input.Filters = append(input.Filters, newCustomFilterList(filters.(*schema.Set))...) } diff --git a/internal/service/ec2/vpnclient_endpoint_data_source.go b/internal/service/ec2/vpnclient_endpoint_data_source.go index c2e093d4a3a..3aadbeb4f65 100644 --- a/internal/service/ec2/vpnclient_endpoint_data_source.go +++ b/internal/service/ec2/vpnclient_endpoint_data_source.go @@ -136,7 +136,7 @@ func DataSourceClientVPNEndpoint() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrSecurityGroupIDs: { Type: schema.TypeList, Computed: true, @@ -195,7 +195,7 @@ func dataSourceClientVPNEndpointRead(ctx context.Context, d *schema.ResourceData )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { diff --git a/internal/service/ec2/vpnsite_customer_gateway_data_source.go b/internal/service/ec2/vpnsite_customer_gateway_data_source.go index e689d49f512..41ef1c39578 100644 --- a/internal/service/ec2/vpnsite_customer_gateway_data_source.go +++ b/internal/service/ec2/vpnsite_customer_gateway_data_source.go @@ -47,7 +47,7 @@ func dataSourceCustomerGateway() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -74,7 +74,7 @@ func dataSourceCustomerGatewayRead(ctx context.Context, d *schema.ResourceData, input := &ec2.DescribeCustomerGatewaysInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = newCustomFilterList(v.(*schema.Set)) } diff --git a/internal/service/ec2/vpnsite_gateway_data_source.go b/internal/service/ec2/vpnsite_gateway_data_source.go index a80ec4e740f..2a7780fbf6c 100644 --- a/internal/service/ec2/vpnsite_gateway_data_source.go +++ b/internal/service/ec2/vpnsite_gateway_data_source.go @@ -50,7 +50,7 @@ func dataSourceVPNGateway() *schema.Resource { Optional: true, Computed: true, }, - "filter": customFiltersSchema(), + names.AttrFilter: customFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -102,7 +102,7 @@ func dataSourceVPNGatewayRead(ctx context.Context, d *schema.ResourceData, meta Tags(tftags.New(ctx, d.Get(names.AttrTags).(map[string]interface{}))), )...) input.Filters = append(input.Filters, newCustomFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { // Don't send an empty filters list; the EC2 API won't accept it. From 586ccf8c6a7dcd8a4b84c7315df3f5aa250ac7ed Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:55 -0400 Subject: [PATCH 1014/1490] ecr: Use constant for filter strings --- .../service/ecr/registry_scanning_configuration.go | 9 +++++---- .../ecr/registry_scanning_configuration_test.go | 12 ++++++------ internal/service/ecr/replication_configuration.go | 8 ++++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/internal/service/ecr/registry_scanning_configuration.go b/internal/service/ecr/registry_scanning_configuration.go index bea726b0e6e..0656d307723 100644 --- a/internal/service/ecr/registry_scanning_configuration.go +++ b/internal/service/ecr/registry_scanning_configuration.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/enum" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_ecr_registry_scanning_configuration", name="Registry Scanning Configuration") @@ -50,7 +51,7 @@ func resourceRegistryScanningConfiguration() *schema.Resource { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -204,7 +205,7 @@ func expandScanningRegistryRuleRepositoryFilters(l []interface{}) []types.Scanni } m := f.(map[string]interface{}) filters = append(filters, types.ScanningRepositoryFilter{ - Filter: aws.String(m["filter"].(string)), + Filter: aws.String(m[names.AttrFilter].(string)), FilterType: types.ScanningRepositoryFilterType((m["filter_type"].(string))), }) } @@ -231,8 +232,8 @@ func flattenScanningConfigurationFilters(l []types.ScanningRepositoryFilter) []i out := make([]interface{}, len(l)) for i, filter := range l { out[i] = map[string]interface{}{ - "filter": aws.ToString(filter.Filter), - "filter_type": filter.FilterType, + names.AttrFilter: aws.ToString(filter.Filter), + "filter_type": filter.FilterType, } } diff --git a/internal/service/ecr/registry_scanning_configuration_test.go b/internal/service/ecr/registry_scanning_configuration_test.go index 6671686e074..1f1d0c89eff 100644 --- a/internal/service/ecr/registry_scanning_configuration_test.go +++ b/internal/service/ecr/registry_scanning_configuration_test.go @@ -78,8 +78,8 @@ func testAccRegistryScanningConfiguration_update(t *testing.T) { "scan_frequency": "SCAN_ON_PUSH", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.repository_filter.*", map[string]string{ - "filter": "example", - "filter_type": "WILDCARD", + names.AttrFilter: "example", + "filter_type": "WILDCARD", }), resource.TestCheckResourceAttr(resourceName, "scan_type", "BASIC"), ), @@ -98,15 +98,15 @@ func testAccRegistryScanningConfiguration_update(t *testing.T) { "scan_frequency": "CONTINUOUS_SCAN", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.repository_filter.*", map[string]string{ - "filter": "example", - "filter_type": "WILDCARD", + names.AttrFilter: "example", + "filter_type": "WILDCARD", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ "scan_frequency": "SCAN_ON_PUSH", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.repository_filter.*", map[string]string{ - "filter": "*", - "filter_type": "WILDCARD", + names.AttrFilter: "*", + "filter_type": "WILDCARD", }), resource.TestCheckResourceAttr(resourceName, "scan_type", "ENHANCED"), ), diff --git a/internal/service/ecr/replication_configuration.go b/internal/service/ecr/replication_configuration.go index b6dacf9a8cc..270951f7441 100644 --- a/internal/service/ecr/replication_configuration.go +++ b/internal/service/ecr/replication_configuration.go @@ -75,7 +75,7 @@ func resourceReplicationConfiguration() *schema.Resource { MaxItems: 100, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeString, Required: true, }, @@ -288,7 +288,7 @@ func expandReplicationConfigurationReplicationConfigurationRulesRepositoryFilter for _, filter := range data { ec := filter.(map[string]interface{}) config := types.RepositoryFilter{ - Filter: aws.String(ec["filter"].(string)), + Filter: aws.String(ec[names.AttrFilter].(string)), FilterType: types.RepositoryFilterType((ec["filter_type"].(string))), } @@ -306,8 +306,8 @@ func flattenReplicationConfigurationReplicationConfigurationRulesRepositoryFilte for _, apiObject := range ec { tfMap := map[string]interface{}{ - "filter": aws.ToString(apiObject.Filter), - "filter_type": apiObject.FilterType, + names.AttrFilter: aws.ToString(apiObject.Filter), + "filter_type": apiObject.FilterType, } tfList = append(tfList, tfMap) From e9062ae9a0ba996b89894d2c532d1f3f3a606b7c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:56 -0400 Subject: [PATCH 1015/1490] fis: Use constant for filter strings --- internal/service/fis/experiment_template.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/fis/experiment_template.go b/internal/service/fis/experiment_template.go index a34d721dcfd..f347306060e 100644 --- a/internal/service/fis/experiment_template.go +++ b/internal/service/fis/experiment_template.go @@ -200,7 +200,7 @@ func ResourceExperimentTemplate() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ @@ -634,7 +634,7 @@ func expandExperimentTemplateTargets(l *schema.Set) (map[string]types.CreateExpe config := types.CreateExperimentTemplateTargetInput{} var hasSeenResourceArns bool - if v, ok := raw["filter"].([]interface{}); ok && len(v) > 0 { + if v, ok := raw[names.AttrFilter].([]interface{}); ok && len(v) > 0 { config.Filters = expandExperimentTemplateTargetFilters(v) } @@ -684,7 +684,7 @@ func expandExperimentTemplateTargetsForUpdate(l *schema.Set) (map[string]types.U config := types.UpdateExperimentTemplateTargetInput{} var hasSeenResourceArns bool - if v, ok := raw["filter"].([]interface{}); ok && len(v) > 0 { + if v, ok := raw[names.AttrFilter].([]interface{}); ok && len(v) > 0 { config.Filters = expandExperimentTemplateTargetFilters(v) } @@ -859,7 +859,7 @@ func flattenExperimentTemplateTargets(configured map[string]types.ExperimentTemp for k, v := range configured { item := make(map[string]interface{}) - item["filter"] = flattenExperimentTemplateTargetFilters(v.Filters) + item[names.AttrFilter] = flattenExperimentTemplateTargetFilters(v.Filters) item["resource_arns"] = v.ResourceArns item["resource_tag"] = flattenExperimentTemplateTargetResourceTags(v.ResourceTags) item["resource_type"] = aws.ToString(v.ResourceType) From 619ba8c5b6f4061f845895af8d453feecf1bab34 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:56 -0400 Subject: [PATCH 1016/1490] fsx: Use constant for filter strings --- .../service/fsx/ontap_storage_virtual_machine_data_source.go | 4 ++-- .../fsx/ontap_storage_virtual_machines_data_source.go | 5 +++-- internal/service/fsx/openzfs_snapshot_data_source.go | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) 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 a895dc024b6..9c06ca80a7e 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go @@ -154,7 +154,7 @@ func dataSourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": storageVirtualMachineFiltersSchema(), + names.AttrFilter: storageVirtualMachineFiltersSchema(), names.AttrID: { Type: schema.TypeString, Optional: true, @@ -206,7 +206,7 @@ func dataSourceONTAPStorageVirtualMachineRead(ctx context.Context, d *schema.Res } input.Filters = newStorageVirtualMachineFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), ) if len(input.Filters) == 0 { diff --git a/internal/service/fsx/ontap_storage_virtual_machines_data_source.go b/internal/service/fsx/ontap_storage_virtual_machines_data_source.go index d718fa9358c..652d6151bf1 100644 --- a/internal/service/fsx/ontap_storage_virtual_machines_data_source.go +++ b/internal/service/fsx/ontap_storage_virtual_machines_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_fsx_ontap_storage_virtual_machines", name="ONTAP Storage Virtual Machines") @@ -21,7 +22,7 @@ func dataSourceONTAPStorageVirtualMachines() *schema.Resource { ReadWithoutTimeout: dataSourceONTAPStorageVirtualMachinesRead, Schema: map[string]*schema.Schema{ - "filter": storageVirtualMachineFiltersSchema(), + names.AttrFilter: storageVirtualMachineFiltersSchema(), "ids": { Type: schema.TypeList, Computed: true, @@ -38,7 +39,7 @@ func dataSourceONTAPStorageVirtualMachinesRead(ctx context.Context, d *schema.Re input := &fsx.DescribeStorageVirtualMachinesInput{} input.Filters = newStorageVirtualMachineFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), ) if len(input.Filters) == 0 { diff --git a/internal/service/fsx/openzfs_snapshot_data_source.go b/internal/service/fsx/openzfs_snapshot_data_source.go index 7204af6ce20..21c390051d6 100644 --- a/internal/service/fsx/openzfs_snapshot_data_source.go +++ b/internal/service/fsx/openzfs_snapshot_data_source.go @@ -35,7 +35,7 @@ func dataSourceOpenzfsSnapshot() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": snapshotFiltersSchema(), + names.AttrFilter: snapshotFiltersSchema(), "most_recent": { Type: schema.TypeBool, Optional: true, @@ -74,7 +74,7 @@ func dataSourceOpenZFSSnapshotRead(ctx context.Context, d *schema.ResourceData, } input.Filters = append(input.Filters, newSnapshotFilterList( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), )...) if len(input.Filters) == 0 { From d3349a0fc93a2d92d0ac551f60f24156fd7aa117 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:56 -0400 Subject: [PATCH 1017/1490] identitystore: Use constant for filter strings --- internal/service/identitystore/group_data_source.go | 12 ++++++------ internal/service/identitystore/user_data_source.go | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/identitystore/group_data_source.go b/internal/service/identitystore/group_data_source.go index b726a0b5717..a3776edaa23 100644 --- a/internal/service/identitystore/group_data_source.go +++ b/internal/service/identitystore/group_data_source.go @@ -70,7 +70,7 @@ func DataSourceGroup() *schema.Resource { }, }, }, - ConflictsWith: []string{"filter", "group_id"}, + ConflictsWith: []string{names.AttrFilter, "group_id"}, }, names.AttrDescription: { Type: schema.TypeString, @@ -96,12 +96,12 @@ func DataSourceGroup() *schema.Resource { }, }, }, - "filter": { + names.AttrFilter: { Deprecated: "Use the alternate_identifier attribute instead.", Type: schema.TypeList, Optional: true, MaxItems: 1, - AtLeastOneOf: []string{"alternate_identifier", "filter", "group_id"}, + AtLeastOneOf: []string{"alternate_identifier", names.AttrFilter, "group_id"}, ConflictsWith: []string{"alternate_identifier"}, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -124,7 +124,7 @@ func DataSourceGroup() *schema.Resource { validation.StringLenBetween(1, 47), validation.StringMatch(regexache.MustCompile(`^([0-9a-f]{10}-|)[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$`), "must match ([0-9a-f]{10}-|)[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"), ), - AtLeastOneOf: []string{"alternate_identifier", "filter", "group_id"}, + AtLeastOneOf: []string{"alternate_identifier", names.AttrFilter, "group_id"}, ConflictsWith: []string{"alternate_identifier"}, }, "identity_store_id": { @@ -150,11 +150,11 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter identityStoreID := d.Get("identity_store_id").(string) - if v, ok := d.GetOk("filter"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrFilter); ok && len(v.([]interface{})) > 0 { // Use ListGroups for backwards compat. input := &identitystore.ListGroupsInput{ IdentityStoreId: aws.String(identityStoreID), - Filters: expandFilters(d.Get("filter").([]interface{})), + Filters: expandFilters(d.Get(names.AttrFilter).([]interface{})), } paginator := identitystore.NewListGroupsPaginator(conn, input) var results []types.Group diff --git a/internal/service/identitystore/user_data_source.go b/internal/service/identitystore/user_data_source.go index 6eec34742db..0e7ef2180e5 100644 --- a/internal/service/identitystore/user_data_source.go +++ b/internal/service/identitystore/user_data_source.go @@ -111,7 +111,7 @@ func DataSourceUser() *schema.Resource { }, }, }, - ConflictsWith: []string{"filter", "user_id"}, + ConflictsWith: []string{names.AttrFilter, "user_id"}, }, "display_name": { Type: schema.TypeString, @@ -153,12 +153,12 @@ func DataSourceUser() *schema.Resource { }, }, }, - "filter": { + names.AttrFilter: { Deprecated: "Use the alternate_identifier attribute instead.", Type: schema.TypeList, Optional: true, MaxItems: 1, - AtLeastOneOf: []string{"alternate_identifier", "filter", "user_id"}, + AtLeastOneOf: []string{"alternate_identifier", names.AttrFilter, "user_id"}, ConflictsWith: []string{"alternate_identifier"}, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -265,7 +265,7 @@ func DataSourceUser() *schema.Resource { validation.StringLenBetween(1, 47), validation.StringMatch(regexache.MustCompile(`^([0-9a-f]{10}-|)[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$`), "must match ([0-9a-f]{10}-|)[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"), ), - AtLeastOneOf: []string{"alternate_identifier", "filter", "user_id"}, + AtLeastOneOf: []string{"alternate_identifier", names.AttrFilter, "user_id"}, ConflictsWith: []string{"alternate_identifier"}, }, "user_name": { @@ -291,10 +291,10 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf identityStoreID := d.Get("identity_store_id").(string) - if v, ok := d.GetOk("filter"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrFilter); ok && len(v.([]interface{})) > 0 { // Use ListUsers for backwards compat. input := &identitystore.ListUsersInput{ - Filters: expandFilters(d.Get("filter").([]interface{})), + Filters: expandFilters(d.Get(names.AttrFilter).([]interface{})), IdentityStoreId: aws.String(identityStoreID), } paginator := identitystore.NewListUsersPaginator(conn, input) From bc0fe6be58f013c99898b20e0c3ec807312a91f9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:56 -0400 Subject: [PATCH 1018/1490] imagebuilder: Use constant for filter strings --- internal/service/imagebuilder/components_data_source.go | 5 +++-- .../service/imagebuilder/container_recipes_data_source.go | 5 +++-- .../imagebuilder/distribution_configurations_data_source.go | 5 +++-- internal/service/imagebuilder/image_pipelines_data_source.go | 5 +++-- internal/service/imagebuilder/image_recipes_data_source.go | 5 +++-- .../infrastructure_configurations_data_source.go | 5 +++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/internal/service/imagebuilder/components_data_source.go b/internal/service/imagebuilder/components_data_source.go index c17f065e910..615d135c1ee 100644 --- a/internal/service/imagebuilder/components_data_source.go +++ b/internal/service/imagebuilder/components_data_source.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/generate/namevaluesfilters" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_imagebuilder_components", name="Components") @@ -26,7 +27,7 @@ func DataSourceComponents() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": namevaluesfilters.Schema(), + names.AttrFilter: namevaluesfilters.Schema(), "names": { Type: schema.TypeSet, Computed: true, @@ -51,7 +52,7 @@ func dataSourceComponentsRead(ctx context.Context, d *schema.ResourceData, meta input.Owner = aws.String(v.(string)) } - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = namevaluesfilters.New(v.(*schema.Set)).ImagebuilderFilters() } diff --git a/internal/service/imagebuilder/container_recipes_data_source.go b/internal/service/imagebuilder/container_recipes_data_source.go index cb018f640e9..2756b51c5da 100644 --- a/internal/service/imagebuilder/container_recipes_data_source.go +++ b/internal/service/imagebuilder/container_recipes_data_source.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/generate/namevaluesfilters" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_imagebuilder_container_recipes", name="Container Recipes") @@ -26,7 +27,7 @@ func DataSourceContainerRecipes() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": namevaluesfilters.Schema(), + names.AttrFilter: namevaluesfilters.Schema(), "names": { Type: schema.TypeSet, Computed: true, @@ -51,7 +52,7 @@ func dataSourceContainerRecipesRead(ctx context.Context, d *schema.ResourceData, input.Owner = aws.String(v.(string)) } - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = namevaluesfilters.New(v.(*schema.Set)).ImagebuilderFilters() } diff --git a/internal/service/imagebuilder/distribution_configurations_data_source.go b/internal/service/imagebuilder/distribution_configurations_data_source.go index 297b019d0d8..0f41d555b46 100644 --- a/internal/service/imagebuilder/distribution_configurations_data_source.go +++ b/internal/service/imagebuilder/distribution_configurations_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/generate/namevaluesfilters" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_imagebuilder_distribution_configurations") @@ -25,7 +26,7 @@ func DataSourceDistributionConfigurations() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": namevaluesfilters.Schema(), + names.AttrFilter: namevaluesfilters.Schema(), "names": { Type: schema.TypeSet, Computed: true, @@ -41,7 +42,7 @@ func dataSourceDistributionConfigurationsRead(ctx context.Context, d *schema.Res input := &imagebuilder.ListDistributionConfigurationsInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = namevaluesfilters.New(v.(*schema.Set)).ImagebuilderFilters() } diff --git a/internal/service/imagebuilder/image_pipelines_data_source.go b/internal/service/imagebuilder/image_pipelines_data_source.go index e47d46ae286..6be2518c4c4 100644 --- a/internal/service/imagebuilder/image_pipelines_data_source.go +++ b/internal/service/imagebuilder/image_pipelines_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/generate/namevaluesfilters" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_imagebuilder_image_pipelines") @@ -25,7 +26,7 @@ func DataSourceImagePipelines() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": namevaluesfilters.Schema(), + names.AttrFilter: namevaluesfilters.Schema(), "names": { Type: schema.TypeSet, Computed: true, @@ -41,7 +42,7 @@ func dataSourceImagePipelinesRead(ctx context.Context, d *schema.ResourceData, m input := &imagebuilder.ListImagePipelinesInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = namevaluesfilters.New(v.(*schema.Set)).ImagebuilderFilters() } diff --git a/internal/service/imagebuilder/image_recipes_data_source.go b/internal/service/imagebuilder/image_recipes_data_source.go index 3f6217240aa..b2fb4f082c7 100644 --- a/internal/service/imagebuilder/image_recipes_data_source.go +++ b/internal/service/imagebuilder/image_recipes_data_source.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/generate/namevaluesfilters" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_imagebuilder_image_recipes", name="Image Recipes") @@ -26,7 +27,7 @@ func DataSourceImageRecipes() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": namevaluesfilters.Schema(), + names.AttrFilter: namevaluesfilters.Schema(), "names": { Type: schema.TypeSet, Computed: true, @@ -51,7 +52,7 @@ func dataSourceImageRecipesRead(ctx context.Context, d *schema.ResourceData, met input.Owner = aws.String(v.(string)) } - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = namevaluesfilters.New(v.(*schema.Set)).ImagebuilderFilters() } diff --git a/internal/service/imagebuilder/infrastructure_configurations_data_source.go b/internal/service/imagebuilder/infrastructure_configurations_data_source.go index 399c39f12a9..f198aea8683 100644 --- a/internal/service/imagebuilder/infrastructure_configurations_data_source.go +++ b/internal/service/imagebuilder/infrastructure_configurations_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/generate/namevaluesfilters" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_imagebuilder_infrastructure_configurations") @@ -25,7 +26,7 @@ func DataSourceInfrastructureConfigurations() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": namevaluesfilters.Schema(), + names.AttrFilter: namevaluesfilters.Schema(), "names": { Type: schema.TypeSet, Computed: true, @@ -41,7 +42,7 @@ func dataSourceInfrastructureConfigurationsRead(ctx context.Context, d *schema.R input := &imagebuilder.ListInfrastructureConfigurationsInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = namevaluesfilters.New(v.(*schema.Set)).ImagebuilderFilters() } From b73b5ebb7f6f3f105b8b79b85a97f2be8d9b6327 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:57 -0400 Subject: [PATCH 1019/1490] iot: Use constant for filter strings --- internal/service/iot/indexing_configuration.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/iot/indexing_configuration.go b/internal/service/iot/indexing_configuration.go index 41b954f3a9c..0328ed24c47 100644 --- a/internal/service/iot/indexing_configuration.go +++ b/internal/service/iot/indexing_configuration.go @@ -112,7 +112,7 @@ func ResourceIndexingConfiguration() *schema.Resource { Default: iot.DeviceDefenderIndexingModeOff, ValidateFunc: validation.StringInSlice(iot.DeviceDefenderIndexingMode_Values(), false), }, - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, Computed: true, @@ -270,7 +270,7 @@ func flattenThingIndexingConfiguration(apiObject *iot.ThingIndexingConfiguration } if v := apiObject.Filter; v != nil { - tfMap["filter"] = []interface{}{flattenIndexingFilter(v)} + tfMap[names.AttrFilter] = []interface{}{flattenIndexingFilter(v)} } if v := apiObject.ManagedFields; v != nil { @@ -379,7 +379,7 @@ func expandThingIndexingConfiguration(tfMap map[string]interface{}) *iot.ThingIn apiObject.DeviceDefenderIndexingMode = aws.String(v) } - if v, ok := tfMap["filter"]; ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := tfMap[names.AttrFilter]; ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { apiObject.Filter = expandIndexingFilter(v.([]interface{})[0].(map[string]interface{})) } From dd03030b4f9193705857c5751047e21db252aae3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:57 -0400 Subject: [PATCH 1020/1490] lambda: Use constant for filter strings --- internal/service/lambda/event_source_mapping.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/lambda/event_source_mapping.go b/internal/service/lambda/event_source_mapping.go index f0f51c204d3..2a90179a06b 100644 --- a/internal/service/lambda/event_source_mapping.go +++ b/internal/service/lambda/event_source_mapping.go @@ -165,7 +165,7 @@ func resourceEventSourceMapping() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeSet, Optional: true, MaxItems: 10, @@ -1148,7 +1148,7 @@ func expandFilterCriteria(tfMap map[string]interface{}) *awstypes.FilterCriteria apiObject := &awstypes.FilterCriteria{} - if v, ok := tfMap["filter"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := tfMap[names.AttrFilter].(*schema.Set); ok && v.Len() > 0 { apiObject.Filters = expandFilters(v.List()) } @@ -1163,7 +1163,7 @@ func flattenFilterCriteria(apiObject *awstypes.FilterCriteria) map[string]interf tfMap := map[string]interface{}{} if v := apiObject.Filters; len(v) > 0 { - tfMap["filter"] = flattenFilters(v) + tfMap[names.AttrFilter] = flattenFilters(v) } return tfMap From 89f52b2d0f358d809e3db90f135f8b876b255c89 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:57 -0400 Subject: [PATCH 1021/1490] licensemanager: Use constant for filter strings --- .../service/licensemanager/license_grants_data_source.go | 5 +++-- .../service/licensemanager/received_licenses_data_source.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/service/licensemanager/license_grants_data_source.go b/internal/service/licensemanager/license_grants_data_source.go index 920ac421c52..9397e5afa26 100644 --- a/internal/service/licensemanager/license_grants_data_source.go +++ b/internal/service/licensemanager/license_grants_data_source.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_licensemanager_grants") @@ -21,7 +22,7 @@ func DataSourceDistributedGrants() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceDistributedGrantsRead, Schema: map[string]*schema.Schema{ - "filter": DataSourceFiltersSchema(), + names.AttrFilter: DataSourceFiltersSchema(), "arns": { Type: schema.TypeList, Computed: true, @@ -38,7 +39,7 @@ func dataSourceDistributedGrantsRead(ctx context.Context, d *schema.ResourceData in := &licensemanager.ListDistributedGrantsInput{} in.Filters = BuildFiltersDataSource( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), ) if len(in.Filters) == 0 { diff --git a/internal/service/licensemanager/received_licenses_data_source.go b/internal/service/licensemanager/received_licenses_data_source.go index f03f65b3b9c..a443f709a0e 100644 --- a/internal/service/licensemanager/received_licenses_data_source.go +++ b/internal/service/licensemanager/received_licenses_data_source.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_licensemanager_received_licenses") @@ -26,7 +27,7 @@ func DataSourceReceivedLicenses() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": DataSourceFiltersSchema(), + names.AttrFilter: DataSourceFiltersSchema(), }, } } @@ -38,7 +39,7 @@ func dataSourceReceivedLicensesRead(ctx context.Context, d *schema.ResourceData, in := &licensemanager.ListReceivedLicensesInput{} in.Filters = BuildFiltersDataSource( - d.Get("filter").(*schema.Set), + d.Get(names.AttrFilter).(*schema.Set), ) if len(in.Filters) == 0 { From 7e829006815c797938232ce7bf16c1283589e40b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:57 -0400 Subject: [PATCH 1022/1490] meta: Use constant for filter strings --- internal/service/meta/regions_data_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/meta/regions_data_source.go b/internal/service/meta/regions_data_source.go index bf1611d52f0..aba5a26c2fb 100644 --- a/internal/service/meta/regions_data_source.go +++ b/internal/service/meta/regions_data_source.go @@ -51,7 +51,7 @@ func (d *dataSourceRegions) Schema(ctx context.Context, req datasource.SchemaReq }, }, Blocks: map[string]schema.Block{ - "filter": tfec2.CustomFiltersBlock(), + names.AttrFilter: tfec2.CustomFiltersBlock(), }, } } From cf121d8ecc7405bb62752686465537a2cc0e9c73 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:58 -0400 Subject: [PATCH 1023/1490] organizations: Use constant for filter strings --- internal/service/organizations/policies_data_source.go | 5 +++-- .../service/organizations/policies_for_target_data_source.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/service/organizations/policies_data_source.go b/internal/service/organizations/policies_data_source.go index 4eb615e8f96..1b1405a1ddc 100644 --- a/internal/service/organizations/policies_data_source.go +++ b/internal/service/organizations/policies_data_source.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_organizations_policies") @@ -20,7 +21,7 @@ func DataSourcePolicies() *schema.Resource { ReadWithoutTimeout: dataSourcePoliciesRead, Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeString, Required: true, }, @@ -37,7 +38,7 @@ func dataSourcePoliciesRead(ctx context.Context, d *schema.ResourceData, meta in var diags diag.Diagnostics conn := meta.(*conns.AWSClient).OrganizationsConn(ctx) - filter := d.Get("filter").(string) + filter := d.Get(names.AttrFilter).(string) policies, err := findPolicies(ctx, conn, filter) if err != nil { diff --git a/internal/service/organizations/policies_for_target_data_source.go b/internal/service/organizations/policies_for_target_data_source.go index dd057475c63..b53e80c2827 100644 --- a/internal/service/organizations/policies_for_target_data_source.go +++ b/internal/service/organizations/policies_for_target_data_source.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_organizations_policies_for_target") @@ -20,7 +21,7 @@ func DataSourcePoliciesForTarget() *schema.Resource { ReadWithoutTimeout: dataSourcePoliciesForTargetRead, Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeString, Required: true, }, @@ -43,7 +44,7 @@ func dataSourcePoliciesForTargetRead(ctx context.Context, d *schema.ResourceData conn := meta.(*conns.AWSClient).OrganizationsConn(ctx) targetID := d.Get("target_id").(string) - filter := d.Get("filter").(string) + filter := d.Get(names.AttrFilter).(string) policies, err := findPoliciesForTarget(ctx, conn, targetID, filter) if err != nil { From c1cf40a24dc9d840b415fb447a3dbe2c4ce24eb1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:58 -0400 Subject: [PATCH 1024/1490] pipes: Use constant for filter strings --- internal/service/pipes/source_parameters.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/pipes/source_parameters.go b/internal/service/pipes/source_parameters.go index 34ed615152c..a0cd18ef05c 100644 --- a/internal/service/pipes/source_parameters.go +++ b/internal/service/pipes/source_parameters.go @@ -162,7 +162,7 @@ func sourceParametersSchema() *schema.Schema { DiffSuppressFunc: suppressEmptyConfigurationBlock("source_parameters.0.filter_criteria"), Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, MaxItems: 5, @@ -656,7 +656,7 @@ func expandFilterCriteria(tfMap map[string]interface{}) *types.FilterCriteria { apiObject := &types.FilterCriteria{} - if v, ok := tfMap["filter"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrFilter].([]interface{}); ok && len(v) > 0 { apiObject.Filters = expandFilters(v) } @@ -1305,7 +1305,7 @@ func flattenFilterCriteria(apiObject *types.FilterCriteria) map[string]interface tfMap := map[string]interface{}{} if v := apiObject.Filters; v != nil { - tfMap["filter"] = flattenFilters(v) + tfMap[names.AttrFilter] = flattenFilters(v) } return tfMap From 8fb070903688d7ede5ba19ff11d9c1d5be8fc702 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:58 -0400 Subject: [PATCH 1025/1490] ram: Use constant for filter strings --- internal/service/ram/resource_share_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ram/resource_share_data_source.go b/internal/service/ram/resource_share_data_source.go index 97f485b1bd6..085707d6d23 100644 --- a/internal/service/ram/resource_share_data_source.go +++ b/internal/service/ram/resource_share_data_source.go @@ -31,7 +31,7 @@ func dataSourceResourceShare() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": { + names.AttrFilter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -96,7 +96,7 @@ func dataSourceResourceShareRead(ctx context.Context, d *schema.ResourceData, me inputG.Name = aws.String(v.(string)) } - if v, ok := d.GetOk("filter"); ok && v.(*schema.Set).Len() > 0 { + if v, ok := d.GetOk(names.AttrFilter); ok && v.(*schema.Set).Len() > 0 { inputG.TagFilters = expandTagFilters(v.(*schema.Set).List()) } From f51ba02e4b2d04db6841cad40470c17172a069b8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:59 -0400 Subject: [PATCH 1026/1490] rds: Use constant for filter strings --- internal/service/rds/clusters_data_source.go | 4 ++-- internal/service/rds/engine_version_data_source.go | 6 +++--- internal/service/rds/instances_data_source.go | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/rds/clusters_data_source.go b/internal/service/rds/clusters_data_source.go index 0d2bbc1000b..a13a08d384b 100644 --- a/internal/service/rds/clusters_data_source.go +++ b/internal/service/rds/clusters_data_source.go @@ -32,7 +32,7 @@ func DataSourceClusters() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": namevaluesfilters.Schema(), + names.AttrFilter: namevaluesfilters.Schema(), }, } } @@ -46,7 +46,7 @@ func dataSourceClustersRead(ctx context.Context, d *schema.ResourceData, meta in input := &rds.DescribeDBClustersInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = namevaluesfilters.New(v.(*schema.Set)).RDSFilters() } diff --git a/internal/service/rds/engine_version_data_source.go b/internal/service/rds/engine_version_data_source.go index 9a8404e8f87..d825e137144 100644 --- a/internal/service/rds/engine_version_data_source.go +++ b/internal/service/rds/engine_version_data_source.go @@ -52,7 +52,7 @@ func DataSourceEngineVersion() *schema.Resource { Set: schema.HashString, }, - "filter": namevaluesfilters.Schema(), + names.AttrFilter: namevaluesfilters.Schema(), "has_major_target": { Type: schema.TypeBool, @@ -204,7 +204,7 @@ func dataSourceEngineVersionRead(ctx context.Context, d *schema.ResourceData, me input.Engine = aws.String(v.(string)) } - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = namevaluesfilters.New(v.(*schema.Set)).RDSFilters() } @@ -226,7 +226,7 @@ func dataSourceEngineVersionRead(ctx context.Context, d *schema.ResourceData, me // Make sure any optional arguments in the schema are in this list except for "default_only" if _, ok := d.GetOk("default_only"); !ok && !criteriaSet(d, []string{ - "filter", + names.AttrFilter, "has_major_target", "has_minor_target", "include_all", diff --git a/internal/service/rds/instances_data_source.go b/internal/service/rds/instances_data_source.go index ae7eb5013fb..8df76e76339 100644 --- a/internal/service/rds/instances_data_source.go +++ b/internal/service/rds/instances_data_source.go @@ -24,7 +24,7 @@ func DataSourceInstances() *schema.Resource { ReadWithoutTimeout: dataSourceInstancesRead, Schema: map[string]*schema.Schema{ - "filter": namevaluesfilters.Schema(), + names.AttrFilter: namevaluesfilters.Schema(), "instance_arns": { Type: schema.TypeList, Computed: true, @@ -46,7 +46,7 @@ func dataSourceInstancesRead(ctx context.Context, d *schema.ResourceData, meta i input := &rds.DescribeDBInstancesInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = namevaluesfilters.New(v.(*schema.Set)).RDSFilters() } From ec847851f3039dbcba84dba2f726e40b9e271e0a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:59 -0400 Subject: [PATCH 1027/1490] resourceexplorer2: Use constant for filter strings --- .../resourceexplorer2/resourceexplorer2_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/resourceexplorer2/resourceexplorer2_test.go b/internal/service/resourceexplorer2/resourceexplorer2_test.go index 269034058f7..ffe7e84a2b7 100644 --- a/internal/service/resourceexplorer2/resourceexplorer2_test.go +++ b/internal/service/resourceexplorer2/resourceexplorer2_test.go @@ -21,11 +21,11 @@ func TestAccResourceExplorer2_serial(t *testing.T) { names.AttrType: testAccIndex_type, }, "View": { - "basic": testAccView_basic, - "defaultView": testAccView_defaultView, - "disappears": testAccView_disappears, - "filter": testAccView_filter, - names.AttrTags: testAccView_tags, + "basic": testAccView_basic, + "defaultView": testAccView_defaultView, + "disappears": testAccView_disappears, + names.AttrFilter: testAccView_filter, + names.AttrTags: testAccView_tags, }, "SearchDataSource": { "basic": testAccSearchDataSource_basic, From 066aed72c24d871254e4dd9ff92357352fea1529 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:00:59 -0400 Subject: [PATCH 1028/1490] route53resolver: Use constant for filter strings --- internal/service/route53resolver/endpoint_data_source.go | 4 ++-- .../service/route53resolver/query_log_config_data_source.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/route53resolver/endpoint_data_source.go b/internal/service/route53resolver/endpoint_data_source.go index 3c79c953c7a..3096abeb12d 100644 --- a/internal/service/route53resolver/endpoint_data_source.go +++ b/internal/service/route53resolver/endpoint_data_source.go @@ -28,7 +28,7 @@ func DataSourceEndpoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": { + names.AttrFilter: { Type: schema.TypeSet, Optional: true, MinItems: 1, @@ -86,7 +86,7 @@ func dataSourceEndpointRead(ctx context.Context, d *schema.ResourceData, meta in endpointID := d.Get("resolver_endpoint_id").(string) input := &route53resolver.ListResolverEndpointsInput{} - if v, ok := d.GetOk("filter"); ok && v.(*schema.Set).Len() > 0 { + if v, ok := d.GetOk(names.AttrFilter); ok && v.(*schema.Set).Len() > 0 { input.Filters = buildR53ResolverTagFilters(v.(*schema.Set)) } diff --git a/internal/service/route53resolver/query_log_config_data_source.go b/internal/service/route53resolver/query_log_config_data_source.go index 68e24fb6636..d738b652712 100644 --- a/internal/service/route53resolver/query_log_config_data_source.go +++ b/internal/service/route53resolver/query_log_config_data_source.go @@ -32,7 +32,7 @@ func DataSourceQueryLogConfig() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "filter": namevaluesfilters.Schema(), + names.AttrFilter: namevaluesfilters.Schema(), names.AttrName: { Type: schema.TypeString, Optional: true, @@ -66,7 +66,7 @@ func dataSourceQueryLogConfigRead(ctx context.Context, d *schema.ResourceData, m input := &route53resolver.ListResolverQueryLogConfigsInput{} - if v, ok := d.GetOk("filter"); ok && v.(*schema.Set).Len() > 0 { + if v, ok := d.GetOk(names.AttrFilter); ok && v.(*schema.Set).Len() > 0 { input.Filters = namevaluesfilters.New(v.(*schema.Set)).Route53resolverFilters() } From 320577bb786d713a2fe4fe1ad7c5e380e78514d1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:01:00 -0400 Subject: [PATCH 1029/1490] s3: Use constant for filter strings --- internal/service/s3/bucket.go | 6 +++--- internal/service/s3/bucket_analytics_configuration.go | 6 +++--- .../s3/bucket_intelligent_tiering_configuration.go | 8 ++++---- internal/service/s3/bucket_inventory.go | 6 +++--- internal/service/s3/bucket_lifecycle_configuration.go | 6 +++--- internal/service/s3/bucket_metric.go | 6 +++--- internal/service/s3/bucket_replication_configuration.go | 6 +++--- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index 35261febc26..b3429dc4a24 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -508,7 +508,7 @@ func resourceBucket() *schema.Resource { }, }, }, - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, MinItems: 1, @@ -2469,7 +2469,7 @@ func expandBucketReplicationRules(ctx context.Context, l []interface{}) []types. rule.SourceSelectionCriteria = expandBucketSourceSelectionCriteria(v) } - if v, ok := tfRuleMap["filter"].([]interface{}); ok && len(v) > 0 && v[0] != nil { + if v, ok := tfRuleMap[names.AttrFilter].([]interface{}); ok && len(v) > 0 && v[0] != nil { // XML schema V2. tfFilterMap := v[0].(map[string]interface{}) var filter types.ReplicationRuleFilter @@ -2642,7 +2642,7 @@ func flattenBucketReplicationRules(ctx context.Context, rules []types.Replicatio } if rule.Filter != nil { - m["filter"] = flattenBucketReplicationRuleFilter(ctx, rule.Filter) + m[names.AttrFilter] = flattenBucketReplicationRuleFilter(ctx, rule.Filter) } if rule.ID != nil { diff --git a/internal/service/s3/bucket_analytics_configuration.go b/internal/service/s3/bucket_analytics_configuration.go index e40f8bd4406..139a5de52fb 100644 --- a/internal/service/s3/bucket_analytics_configuration.go +++ b/internal/service/s3/bucket_analytics_configuration.go @@ -43,7 +43,7 @@ func resourceBucketAnalyticsConfiguration() *schema.Resource { Required: true, ForceNew: true, }, - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -144,7 +144,7 @@ func resourceBucketAnalyticsConfigurationPut(ctx context.Context, d *schema.Reso StorageClassAnalysis: expandStorageClassAnalysis(d.Get("storage_class_analysis").([]interface{})), } - if v, ok := d.GetOk("filter"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrFilter); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { analyticsConfiguration.Filter = expandAnalyticsFilter(ctx, v.([]interface{})[0].(map[string]interface{})) } @@ -204,7 +204,7 @@ func resourceBucketAnalyticsConfigurationRead(ctx context.Context, d *schema.Res } d.Set(names.AttrBucket, bucket) - if err := d.Set("filter", flattenAnalyticsFilter(ctx, ac.Filter)); err != nil { + if err := d.Set(names.AttrFilter, flattenAnalyticsFilter(ctx, ac.Filter)); err != nil { return sdkdiag.AppendErrorf(diags, "setting filter: %s", err) } d.Set(names.AttrName, name) diff --git a/internal/service/s3/bucket_intelligent_tiering_configuration.go b/internal/service/s3/bucket_intelligent_tiering_configuration.go index 698f6bf60f1..6e3f4c008a3 100644 --- a/internal/service/s3/bucket_intelligent_tiering_configuration.go +++ b/internal/service/s3/bucket_intelligent_tiering_configuration.go @@ -42,7 +42,7 @@ func resourceBucketIntelligentTieringConfiguration() *schema.Resource { Required: true, ForceNew: true, }, - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -105,7 +105,7 @@ func resourceBucketIntelligentTieringConfigurationPut(ctx context.Context, d *sc Status: types.IntelligentTieringStatus(d.Get(names.AttrStatus).(string)), } - if v, ok := d.GetOk("filter"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrFilter); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { intelligentTieringConfiguration.Filter = expandIntelligentTieringFilter(ctx, v.([]interface{})[0].(map[string]interface{})) } @@ -170,11 +170,11 @@ func resourceBucketIntelligentTieringConfigurationRead(ctx context.Context, d *s d.Set(names.AttrBucket, bucket) if output.Filter != nil { - if err := d.Set("filter", []interface{}{flattenIntelligentTieringFilter(ctx, output.Filter)}); err != nil { + if err := d.Set(names.AttrFilter, []interface{}{flattenIntelligentTieringFilter(ctx, output.Filter)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting filter: %s", err) } } else { - d.Set("filter", nil) + d.Set(names.AttrFilter, nil) } d.Set(names.AttrName, output.Id) d.Set(names.AttrStatus, output.Status) diff --git a/internal/service/s3/bucket_inventory.go b/internal/service/s3/bucket_inventory.go index 13e0347dfcc..5b731ef4426 100644 --- a/internal/service/s3/bucket_inventory.go +++ b/internal/service/s3/bucket_inventory.go @@ -122,7 +122,7 @@ func resourceBucketInventory() *schema.Resource { Default: true, Optional: true, }, - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -190,7 +190,7 @@ func resourceBucketInventoryPut(ctx context.Context, d *schema.ResourceData, met } } - if v, ok := d.GetOk("filter"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrFilter); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { inventoryConfiguration.Filter = expandInventoryFilter(v.([]interface{})[0].(map[string]interface{})) } @@ -274,7 +274,7 @@ func resourceBucketInventoryRead(ctx context.Context, d *schema.ResourceData, me } } d.Set(names.AttrEnabled, ic.IsEnabled) - if err := d.Set("filter", flattenInventoryFilter(ic.Filter)); err != nil { + if err := d.Set(names.AttrFilter, flattenInventoryFilter(ic.Filter)); err != nil { return sdkdiag.AppendErrorf(diags, "setting filter: %s", err) } d.Set("included_object_versions", ic.IncludedObjectVersions) diff --git a/internal/service/s3/bucket_lifecycle_configuration.go b/internal/service/s3/bucket_lifecycle_configuration.go index bc32c0bb0c6..aaad3a848b6 100644 --- a/internal/service/s3/bucket_lifecycle_configuration.go +++ b/internal/service/s3/bucket_lifecycle_configuration.go @@ -101,7 +101,7 @@ func resourceBucketLifecycleConfiguration() *schema.Resource { }, }, }, - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, // If neither the filter block nor the prefix parameter in the rule are specified, @@ -565,7 +565,7 @@ func expandLifecycleRules(ctx context.Context, l []interface{}) []types.Lifecycl result.Expiration = expandLifecycleExpiration(v) } - if v, ok := tfMap["filter"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrFilter].([]interface{}); ok && len(v) > 0 { result.Filter = expandLifecycleRuleFilter(ctx, v) } @@ -859,7 +859,7 @@ func flattenLifecycleRules(ctx context.Context, rules []types.LifecycleRule) []i } if rule.Filter != nil { - m["filter"] = flattenLifecycleRuleFilter(ctx, rule.Filter) + m[names.AttrFilter] = flattenLifecycleRuleFilter(ctx, rule.Filter) } if rule.ID != nil { diff --git a/internal/service/s3/bucket_metric.go b/internal/service/s3/bucket_metric.go index 47fa3a5c7c5..76dfb8c1c8d 100644 --- a/internal/service/s3/bucket_metric.go +++ b/internal/service/s3/bucket_metric.go @@ -43,7 +43,7 @@ func resourceBucketMetric() *schema.Resource { Required: true, ForceNew: true, }, - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -88,7 +88,7 @@ func resourceBucketMetricPut(ctx context.Context, d *schema.ResourceData, meta i Id: aws.String(name), } - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { if tfMap, ok := v.([]interface{})[0].(map[string]interface{}); ok { metricsConfiguration.Filter = expandMetricsFilter(ctx, tfMap) } @@ -151,7 +151,7 @@ func resourceBucketMetricRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrBucket, bucket) if mc.Filter != nil { - if err := d.Set("filter", []interface{}{flattenMetricsFilter(ctx, mc.Filter)}); err != nil { + if err := d.Set(names.AttrFilter, []interface{}{flattenMetricsFilter(ctx, mc.Filter)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting filter") } } diff --git a/internal/service/s3/bucket_replication_configuration.go b/internal/service/s3/bucket_replication_configuration.go index 136526a7ec5..dbea9146ba3 100644 --- a/internal/service/s3/bucket_replication_configuration.go +++ b/internal/service/s3/bucket_replication_configuration.go @@ -196,7 +196,7 @@ func resourceBucketReplicationConfiguration() *schema.Resource { }, }, }, - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -509,7 +509,7 @@ func expandReplicationRules(ctx context.Context, l []interface{}) []types.Replic // Support the empty filter block in terraform i.e. 'filter {}', // which implies the replication rule does not require a specific filter, // by expanding the "filter" array even if the first element is nil. - if v, ok := tfMap["filter"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrFilter].([]interface{}); ok && len(v) > 0 { // XML schema V2 rule.Filter = expandReplicationRuleFilter(ctx, v) rule.Priority = aws.Int32(int32(tfMap["priority"].(int))) @@ -889,7 +889,7 @@ func flattenReplicationRules(ctx context.Context, rules []types.ReplicationRule) } if rule.Filter != nil { - m["filter"] = flattenReplicationRuleFilter(ctx, rule.Filter) + m[names.AttrFilter] = flattenReplicationRuleFilter(ctx, rule.Filter) } if rule.ID != nil { From 1bac48a225aed464c2e23dff23bb354e431acc50 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:01:00 -0400 Subject: [PATCH 1030/1490] s3control: Use constant for filter strings --- .../service/s3control/bucket_lifecycle_configuration.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/s3control/bucket_lifecycle_configuration.go b/internal/service/s3control/bucket_lifecycle_configuration.go index ffdc79be27a..11bb1e6ee58 100644 --- a/internal/service/s3control/bucket_lifecycle_configuration.go +++ b/internal/service/s3control/bucket_lifecycle_configuration.go @@ -96,7 +96,7 @@ func resourceBucketLifecycleConfiguration() *schema.Resource { }, }, }, - "filter": { + names.AttrFilter: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -370,7 +370,7 @@ func expandLifecycleRule(ctx context.Context, tfMap map[string]interface{}) *typ apiObject.Expiration = expandLifecycleExpiration(v) } - if v, ok := tfMap["filter"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrFilter].([]interface{}); ok && len(v) > 0 { apiObject.Filter = expandLifecycleRuleFilter(ctx, v) } @@ -479,7 +479,7 @@ func flattenLifecycleRule(ctx context.Context, apiObject types.LifecycleRule) ma } if v := apiObject.Filter; v != nil { - tfMap["filter"] = flattenLifecycleRuleFilter(ctx, v) + tfMap[names.AttrFilter] = flattenLifecycleRuleFilter(ctx, v) } if v := apiObject.ID; v != nil { From eede79e39ecfaea52a9379182ae9552d8f78f3e1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:01:00 -0400 Subject: [PATCH 1031/1490] secretsmanager: Use constant for filter strings --- internal/service/secretsmanager/secrets_data_source.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/secretsmanager/secrets_data_source.go b/internal/service/secretsmanager/secrets_data_source.go index a38ae67d89c..27aea3b40f0 100644 --- a/internal/service/secretsmanager/secrets_data_source.go +++ b/internal/service/secretsmanager/secrets_data_source.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/generate/namevaluesfiltersv2" tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_secretsmanager_secrets", name="Secrets") @@ -27,7 +28,7 @@ func dataSourceSecrets() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "filter": namevaluesfiltersv2.Schema(), + names.AttrFilter: namevaluesfiltersv2.Schema(), "names": { Type: schema.TypeSet, Computed: true, @@ -43,7 +44,7 @@ func dataSourceSecretsRead(ctx context.Context, d *schema.ResourceData, meta int input := &secretsmanager.ListSecretsInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = namevaluesfiltersv2.New(v.(*schema.Set)).SecretsmanagerFilters() } From 14aba32da9d28e0d235b9e473639cad15153e0ae Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:01:01 -0400 Subject: [PATCH 1032/1490] ssm: Use constant for filter strings --- internal/service/ssm/instances_data_source.go | 4 ++-- internal/service/ssm/maintenance_windows_data_source.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/ssm/instances_data_source.go b/internal/service/ssm/instances_data_source.go index 70847394784..11dd8b23a2e 100644 --- a/internal/service/ssm/instances_data_source.go +++ b/internal/service/ssm/instances_data_source.go @@ -21,7 +21,7 @@ func DataSourceInstances() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceInstancesRead, Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -54,7 +54,7 @@ func dataSourceInstancesRead(ctx context.Context, d *schema.ResourceData, meta i input := &ssm.DescribeInstanceInformationInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = expandInstanceInformationStringFilters(v.(*schema.Set).List()) } diff --git a/internal/service/ssm/maintenance_windows_data_source.go b/internal/service/ssm/maintenance_windows_data_source.go index e3913ccd82a..cac81b7d63f 100644 --- a/internal/service/ssm/maintenance_windows_data_source.go +++ b/internal/service/ssm/maintenance_windows_data_source.go @@ -21,7 +21,7 @@ func DataSourceMaintenanceWindows() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataMaintenanceWindowsRead, Schema: map[string]*schema.Schema{ - "filter": { + names.AttrFilter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -54,7 +54,7 @@ func dataMaintenanceWindowsRead(ctx context.Context, d *schema.ResourceData, met input := &ssm.DescribeMaintenanceWindowsInput{} - if v, ok := d.GetOk("filter"); ok { + if v, ok := d.GetOk(names.AttrFilter); ok { input.Filters = expandMaintenanceWindowFilters(v.(*schema.Set).List()) } From 9a705386594aca12d1b8784ccc407ff8a344767b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:01:01 -0400 Subject: [PATCH 1033/1490] wafv2: Use constant for filter strings --- internal/service/wafv2/web_acl_logging_configuration.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/wafv2/web_acl_logging_configuration.go b/internal/service/wafv2/web_acl_logging_configuration.go index 9ac22a231d8..ff8c0794eb1 100644 --- a/internal/service/wafv2/web_acl_logging_configuration.go +++ b/internal/service/wafv2/web_acl_logging_configuration.go @@ -65,7 +65,7 @@ func resourceWebACLLoggingConfiguration() *schema.Resource { Required: true, ValidateDiagFunc: enum.Validate[awstypes.FilterBehavior](), }, - "filter": { + names.AttrFilter: { Type: schema.TypeSet, Required: true, Elem: &schema.Resource{ @@ -304,7 +304,7 @@ func expandLoggingFilter(l []interface{}) *awstypes.LoggingFilter { loggingFilter.DefaultBehavior = awstypes.FilterBehavior(v) } - if v, ok := tfMap["filter"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := tfMap[names.AttrFilter].(*schema.Set); ok && v.Len() > 0 { loggingFilter.Filters = expandFilters(v.List()) } @@ -454,7 +454,7 @@ func flattenLoggingFilter(filter *awstypes.LoggingFilter) []interface{} { m := map[string]interface{}{ "default_behavior": string(filter.DefaultBehavior), - "filter": flattenFilters(filter.Filters), + names.AttrFilter: flattenFilters(filter.Filters), } return []interface{}{m} From 7576d54f73c057f31b31dcec3c22eab65c988116 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 10 May 2024 12:41:31 -0500 Subject: [PATCH 1034/1490] add CHANGELOG entry --- .changelog/37433.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/37433.txt diff --git a/.changelog/37433.txt b/.changelog/37433.txt new file mode 100644 index 00000000000..b2514935218 --- /dev/null +++ b/.changelog/37433.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_lakeformation_data_cells_filter: Fix inconsistent `state` error when using `row_filter.all_rows_wildcard` +``` \ No newline at end of file From 0d53be04a2a830fe08cd6f1e4596c7d592e0da17 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:39 -0400 Subject: [PATCH 1035/1490] ci: Prefer constant for string literal "prefix" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 2fbb0428493..8136d99793e 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1375,3 +1375,13 @@ rules: - pattern: '"filter"' severity: ERROR fix: "names.AttrFilter" + - id: literal-prefix-string-constant + languages: [go] + message: Use the constant `names.AttrPrefix` for the string literal "prefix" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"prefix"' + severity: ERROR + fix: "names.AttrPrefix" From addca7507032b196604f8f7bf2c598df13653ebc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:39 -0400 Subject: [PATCH 1036/1490] names: Add constant for string literal "prefix" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 0207b68e9ed..980ad09adfb 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -49,6 +49,7 @@ const ( AttrPolicy = "policy" AttrPort = "port" AttrPreferredMaintenanceWindow = "preferred_maintenance_window" + AttrPrefix = "prefix" AttrProfile = "profile" AttrProtocol = "protocol" AttrRegion = "region" From 4af57a808324b3d1c8cfc020e30867fcf7423b7b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:40 -0400 Subject: [PATCH 1037/1490] amplify: Use constant for prefix strings --- internal/service/amplify/domain_association.go | 6 +++--- .../service/amplify/domain_association_test.go | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/amplify/domain_association.go b/internal/service/amplify/domain_association.go index 41618f728dd..6a44cd703a0 100644 --- a/internal/service/amplify/domain_association.go +++ b/internal/service/amplify/domain_association.go @@ -77,7 +77,7 @@ func resourceDomainAssociation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(0, 255), @@ -352,7 +352,7 @@ func expandSubDomainSetting(tfMap map[string]interface{}) *types.SubDomainSettin } // Empty prefix is allowed. - if v, ok := tfMap["prefix"].(string); ok { + if v, ok := tfMap[names.AttrPrefix].(string); ok { apiObject.Prefix = aws.String(v) } @@ -400,7 +400,7 @@ func flattenSubDomain(apiObject types.SubDomain) map[string]interface{} { } if v := apiObject.Prefix; v != nil { - tfMap["prefix"] = aws.ToString(v) + tfMap[names.AttrPrefix] = aws.ToString(v) } } diff --git a/internal/service/amplify/domain_association_test.go b/internal/service/amplify/domain_association_test.go index f4d87f61309..71aced08744 100644 --- a/internal/service/amplify/domain_association_test.go +++ b/internal/service/amplify/domain_association_test.go @@ -48,8 +48,8 @@ func testAccDomainAssociation_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_auto_sub_domain", "false"), resource.TestCheckResourceAttr(resourceName, "sub_domain.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "sub_domain.*", map[string]string{ - "branch_name": rName, - "prefix": "", + "branch_name": rName, + names.AttrPrefix: "", }), resource.TestCheckResourceAttr(resourceName, "wait_for_verification", "false"), ), @@ -121,8 +121,8 @@ func testAccDomainAssociation_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_auto_sub_domain", "false"), resource.TestCheckResourceAttr(resourceName, "sub_domain.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "sub_domain.*", map[string]string{ - "branch_name": rName, - "prefix": "", + "branch_name": rName, + names.AttrPrefix: "", }), resource.TestCheckResourceAttr(resourceName, "wait_for_verification", "true"), ), @@ -142,12 +142,12 @@ func testAccDomainAssociation_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_auto_sub_domain", "true"), resource.TestCheckResourceAttr(resourceName, "sub_domain.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "sub_domain.*", map[string]string{ - "branch_name": rName, - "prefix": "", + "branch_name": rName, + names.AttrPrefix: "", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "sub_domain.*", map[string]string{ - "branch_name": fmt.Sprintf("%s-2", rName), - "prefix": "www", + "branch_name": fmt.Sprintf("%s-2", rName), + names.AttrPrefix: "www", }), resource.TestCheckResourceAttr(resourceName, "wait_for_verification", "true"), ), From 72b6be6752e2f35cd5dcbcc40d3db88ee357f14b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:40 -0400 Subject: [PATCH 1038/1490] appmesh: Use constant for prefix strings --- internal/service/appmesh/flex.go | 24 +++++++++++------------ internal/service/appmesh/gateway_route.go | 24 +++++++++++------------ internal/service/appmesh/route.go | 8 ++++---- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/internal/service/appmesh/flex.go b/internal/service/appmesh/flex.go index 72ddd16a989..ccde51305d2 100644 --- a/internal/service/appmesh/flex.go +++ b/internal/service/appmesh/flex.go @@ -248,7 +248,7 @@ func expandGRPCRoute(vGrpcRoute []interface{}) *appmesh.GrpcRoute { if vExact, ok := mMatch["exact"].(string); ok && vExact != "" { grpcRouteMetadata.Match.Exact = aws.String(vExact) } - if vPrefix, ok := mMatch["prefix"].(string); ok && vPrefix != "" { + if vPrefix, ok := mMatch[names.AttrPrefix].(string); ok && vPrefix != "" { grpcRouteMetadata.Match.Prefix = aws.String(vPrefix) } if vRegex, ok := mMatch["regex"].(string); ok && vRegex != "" { @@ -388,7 +388,7 @@ func expandHTTPRoute(vHttpRoute []interface{}) *appmesh.HttpRoute { if vPort, ok := mHttpRouteMatch[names.AttrPort].(int); ok && vPort > 0 { httpRouteMatch.Port = aws.Int64(int64(vPort)) } - if vPrefix, ok := mHttpRouteMatch["prefix"].(string); ok && vPrefix != "" { + if vPrefix, ok := mHttpRouteMatch[names.AttrPrefix].(string); ok && vPrefix != "" { httpRouteMatch.Prefix = aws.String(vPrefix) } if vScheme, ok := mHttpRouteMatch["scheme"].(string); ok && vScheme != "" { @@ -418,7 +418,7 @@ func expandHTTPRoute(vHttpRoute []interface{}) *appmesh.HttpRoute { if vExact, ok := mMatch["exact"].(string); ok && vExact != "" { httpRouteHeader.Match.Exact = aws.String(vExact) } - if vPrefix, ok := mMatch["prefix"].(string); ok && vPrefix != "" { + if vPrefix, ok := mMatch[names.AttrPrefix].(string); ok && vPrefix != "" { httpRouteHeader.Match.Prefix = aws.String(vPrefix) } if vRegex, ok := mMatch["regex"].(string); ok && vRegex != "" { @@ -1348,10 +1348,10 @@ func flattenGRPCRoute(grpcRoute *appmesh.GrpcRoute) []interface{} { if match := grpcRouteMetadata.Match; match != nil { mMatch := map[string]interface{}{ - "exact": aws.StringValue(match.Exact), - "prefix": aws.StringValue(match.Prefix), - "regex": aws.StringValue(match.Regex), - "suffix": aws.StringValue(match.Suffix), + "exact": aws.StringValue(match.Exact), + names.AttrPrefix: aws.StringValue(match.Prefix), + "regex": aws.StringValue(match.Regex), + "suffix": aws.StringValue(match.Suffix), } if r := match.Range; r != nil { @@ -1449,10 +1449,10 @@ func flattenHTTPRoute(httpRoute *appmesh.HttpRoute) []interface{} { if match := httpRouteHeader.Match; match != nil { mMatch := map[string]interface{}{ - "exact": aws.StringValue(match.Exact), - "prefix": aws.StringValue(match.Prefix), - "regex": aws.StringValue(match.Regex), - "suffix": aws.StringValue(match.Suffix), + "exact": aws.StringValue(match.Exact), + names.AttrPrefix: aws.StringValue(match.Prefix), + "regex": aws.StringValue(match.Regex), + "suffix": aws.StringValue(match.Suffix), } if r := match.Range; r != nil { @@ -1505,7 +1505,7 @@ func flattenHTTPRoute(httpRoute *appmesh.HttpRoute) []interface{} { "method": aws.StringValue(httpRouteMatch.Method), "path": vHttpRoutePath, names.AttrPort: int(aws.Int64Value(httpRouteMatch.Port)), - "prefix": aws.StringValue(httpRouteMatch.Prefix), + names.AttrPrefix: aws.StringValue(httpRouteMatch.Prefix), "query_parameter": vHttpRouteQueryParameters, "scheme": aws.StringValue(httpRouteMatch.Scheme), }, diff --git a/internal/service/appmesh/gateway_route.go b/internal/service/appmesh/gateway_route.go index ffa8d7abf8b..6dabf7a823a 100644 --- a/internal/service/appmesh/gateway_route.go +++ b/internal/service/appmesh/gateway_route.go @@ -156,7 +156,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { fmt.Sprintf("spec.0.%s.0.action.0.rewrite.0.prefix", attrName), }, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeList, Optional: true, MinItems: 1, @@ -256,7 +256,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { Optional: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(1, 255), @@ -361,7 +361,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { Optional: true, ValidateFunc: validation.IsPortNumber, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^/`), "must start with /"), @@ -816,7 +816,7 @@ func expandHTTPGatewayRouteRewrite(vHttpRouteRewrite []interface{}) *appmesh.Htt routeRewrite.Path = routePathRewrite } - if vRoutePrefixRewrite, ok := mRouteRewrite["prefix"].([]interface{}); ok && len(vRoutePrefixRewrite) > 0 && vRoutePrefixRewrite[0] != nil { + if vRoutePrefixRewrite, ok := mRouteRewrite[names.AttrPrefix].([]interface{}); ok && len(vRoutePrefixRewrite) > 0 && vRoutePrefixRewrite[0] != nil { mRoutePrefixRewrite := vRoutePrefixRewrite[0].(map[string]interface{}) routePrefixRewrite := &appmesh.HttpGatewayRoutePrefixRewrite{} if vDefaultPrefix, ok := mRoutePrefixRewrite["default_prefix"].(string); ok && vDefaultPrefix != "" { @@ -844,7 +844,7 @@ func expandHTTPGatewayRouteMatch(vHttpRouteMatch []interface{}) *appmesh.HttpGat routeMatch.Port = aws.Int64(int64(vPort)) } - if vPrefix, ok := mRouteMatch["prefix"].(string); ok && vPrefix != "" { + if vPrefix, ok := mRouteMatch[names.AttrPrefix].(string); ok && vPrefix != "" { routeMatch.Prefix = aws.String(vPrefix) } @@ -871,7 +871,7 @@ func expandHTTPGatewayRouteMatch(vHttpRouteMatch []interface{}) *appmesh.HttpGat if vExact, ok := mMatch["exact"].(string); ok && vExact != "" { header.Match.Exact = aws.String(vExact) } - if vPrefix, ok := mMatch["prefix"].(string); ok && vPrefix != "" { + if vPrefix, ok := mMatch[names.AttrPrefix].(string); ok && vPrefix != "" { header.Match.Prefix = aws.String(vPrefix) } if vRegex, ok := mMatch["regex"].(string); ok && vRegex != "" { @@ -1070,7 +1070,7 @@ func flattenHTTPGatewayRouteMatch(routeMatch *appmesh.HttpGatewayRouteMatch) []i } if routeMatch.Prefix != nil { - mRouteMatch["prefix"] = aws.StringValue(routeMatch.Prefix) + mRouteMatch[names.AttrPrefix] = aws.StringValue(routeMatch.Prefix) } vHeaders := []interface{}{} @@ -1083,10 +1083,10 @@ func flattenHTTPGatewayRouteMatch(routeMatch *appmesh.HttpGatewayRouteMatch) []i if match := header.Match; match != nil { mMatch := map[string]interface{}{ - "exact": aws.StringValue(match.Exact), - "prefix": aws.StringValue(match.Prefix), - "regex": aws.StringValue(match.Regex), - "suffix": aws.StringValue(match.Suffix), + "exact": aws.StringValue(match.Exact), + names.AttrPrefix: aws.StringValue(match.Prefix), + "regex": aws.StringValue(match.Regex), + "suffix": aws.StringValue(match.Suffix), } if r := match.Range; r != nil { @@ -1183,7 +1183,7 @@ func flattenHTTPGatewayRouteRewrite(routeRewrite *appmesh.HttpGatewayRouteRewrit if rewritePrefixValue := rewritePrefix.Value; rewritePrefixValue != nil { mRewritePrefix[names.AttrValue] = aws.StringValue(rewritePrefix.Value) } - mRouteRewrite["prefix"] = []interface{}{mRewritePrefix} + mRouteRewrite[names.AttrPrefix] = []interface{}{mRewritePrefix} } return []interface{}{mRouteRewrite} diff --git a/internal/service/appmesh/route.go b/internal/service/appmesh/route.go index 0b5f59f675c..7c1684f1a55 100644 --- a/internal/service/appmesh/route.go +++ b/internal/service/appmesh/route.go @@ -168,7 +168,7 @@ func resourceRouteSpecSchema() *schema.Schema { Optional: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(1, 255), @@ -242,7 +242,7 @@ func resourceRouteSpecSchema() *schema.Schema { Optional: true, ValidateFunc: validation.IsPortNumber, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^/`), "must start with /"), @@ -462,7 +462,7 @@ func resourceRouteSpecSchema() *schema.Schema { Optional: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(1, 255), @@ -516,7 +516,7 @@ func resourceRouteSpecSchema() *schema.Schema { Optional: true, ValidateFunc: validation.IsPortNumber, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 50), From 803c9760901194c8bbb2a52c70d6fda4ba19d537 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:40 -0400 Subject: [PATCH 1039/1490] batch: Use constant for prefix strings --- internal/service/batch/validate_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/batch/validate_test.go b/internal/service/batch/validate_test.go index 2faf26831b9..2900768261f 100644 --- a/internal/service/batch/validate_test.go +++ b/internal/service/batch/validate_test.go @@ -42,7 +42,7 @@ func TestValidPrefix(t *testing.T) { strings.Repeat("W", 102), // <= 102 } for _, v := range validPrefixes { - _, errors := validPrefix(v, "prefix") + _, errors := validPrefix(v, names.AttrPrefix) if len(errors) != 0 { t.Fatalf("%q should be a valid Batch prefix: %q", v, errors) } @@ -53,7 +53,7 @@ func TestValidPrefix(t *testing.T) { strings.Repeat("W", 103), // >= 103 } for _, v := range invalidPrefixes { - _, errors := validPrefix(v, "prefix") + _, errors := validPrefix(v, names.AttrPrefix) if len(errors) == 0 { t.Fatalf("%q should be a invalid Batch prefix: %q", v, errors) } From 310d49fdf710cdb09eb0b93b9df9838617249994 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:40 -0400 Subject: [PATCH 1040/1490] cloudfront: Use constant for prefix strings --- internal/service/cloudfront/distribution.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/cloudfront/distribution.go b/internal/service/cloudfront/distribution.go index 7c7b7cb14fe..1a48075868f 100644 --- a/internal/service/cloudfront/distribution.go +++ b/internal/service/cloudfront/distribution.go @@ -325,7 +325,7 @@ func resourceDistribution() *schema.Resource { Optional: true, Default: false, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, Default: "", @@ -2482,7 +2482,7 @@ func expandLoggingConfig(tfMap map[string]interface{}) *awstypes.LoggingConfig { apiObject.Bucket = aws.String(tfMap[names.AttrBucket].(string)) apiObject.Enabled = aws.Bool(true) apiObject.IncludeCookies = aws.Bool(tfMap["include_cookies"].(bool)) - apiObject.Prefix = aws.String(tfMap["prefix"].(string)) + apiObject.Prefix = aws.String(tfMap[names.AttrPrefix].(string)) } else { apiObject.Bucket = aws.String("") apiObject.Enabled = aws.Bool(false) @@ -2501,7 +2501,7 @@ func flattenLoggingConfig(apiObject *awstypes.LoggingConfig) []interface{} { tfMap := map[string]interface{}{ names.AttrBucket: aws.ToString(apiObject.Bucket), "include_cookies": aws.ToBool(apiObject.IncludeCookies), - "prefix": aws.ToString(apiObject.Prefix), + names.AttrPrefix: aws.ToString(apiObject.Prefix), } return []interface{}{tfMap} From 67ae151aae3ef4a69531d539d49e505185824f23 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:40 -0400 Subject: [PATCH 1041/1490] cloudtrail: Use constant for prefix strings --- internal/service/cloudtrail/cloudtrail_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/cloudtrail/cloudtrail_test.go b/internal/service/cloudtrail/cloudtrail_test.go index b84f1ebd445..ff32b645d12 100644 --- a/internal/service/cloudtrail/cloudtrail_test.go +++ b/internal/service/cloudtrail/cloudtrail_test.go @@ -92,7 +92,7 @@ func testAccTrail_basic(t *testing.T) { Config: testAccCloudTrailConfig_modified(rName), Check: resource.ComposeTestCheckFunc( testAccCheckTrailExists(ctx, resourceName, &trail), - resource.TestCheckResourceAttr(resourceName, "s3_key_prefix", "prefix"), + resource.TestCheckResourceAttr(resourceName, "s3_key_prefix", names.AttrPrefix), resource.TestCheckResourceAttr(resourceName, "include_global_service_events", "false"), testAccCheckLogValidationEnabled(resourceName, false, &trail), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), From 0b72b2be46a54e9779ed9c8b89c79fd6a27fc590 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:41 -0400 Subject: [PATCH 1042/1490] connect: Use constant for prefix strings --- internal/service/connect/connect_test.go | 2 +- internal/service/connect/instance_storage_config.go | 6 +++--- .../service/connect/instance_storage_config_data_source.go | 2 +- internal/service/connect/phone_number.go | 4 ++-- internal/service/connect/phone_number_test.go | 4 ++-- internal/service/connect/validate_test.go | 6 ++++-- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/internal/service/connect/connect_test.go b/internal/service/connect/connect_test.go index b5f054d3e03..17c7fd359ce 100644 --- a/internal/service/connect/connect_test.go +++ b/internal/service/connect/connect_test.go @@ -74,7 +74,7 @@ func TestAccConnect_serial(t *testing.T) { "disappears": testAccPhoneNumber_disappears, names.AttrTags: testAccPhoneNumber_tags, names.AttrDescription: testAccPhoneNumber_description, - "prefix": testAccPhoneNumber_prefix, + names.AttrPrefix: testAccPhoneNumber_prefix, "targetARN": testAccPhoneNumber_targetARN, }, "Prompt": { diff --git a/internal/service/connect/instance_storage_config.go b/internal/service/connect/instance_storage_config.go index 44a99a853d8..55460343a5e 100644 --- a/internal/service/connect/instance_storage_config.go +++ b/internal/service/connect/instance_storage_config.go @@ -107,7 +107,7 @@ func ResourceInstanceStorageConfig() *schema.Resource { }, }, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 128), @@ -395,7 +395,7 @@ func expandKinesisVideoStreamConfig(tfList []interface{}) *connect.KinesisVideoS result := &connect.KinesisVideoStreamConfig{ EncryptionConfig: expandEncryptionConfig(tfMap["encryption_config"].([]interface{})), - Prefix: aws.String(tfMap["prefix"].(string)), + Prefix: aws.String(tfMap[names.AttrPrefix].(string)), RetentionPeriodHours: aws.Int64(int64(tfMap["retention_period_hours"].(int))), } @@ -503,7 +503,7 @@ func flattenKinesisVideoStreamConfig(apiObject *connect.KinesisVideoStreamConfig "encryption_config": flattenEncryptionConfig(apiObject.EncryptionConfig), // API returns -connect--contact- // DiffSuppressFunc used - "prefix": aws.StringValue(apiObject.Prefix), + names.AttrPrefix: aws.StringValue(apiObject.Prefix), "retention_period_hours": aws.Int64Value(apiObject.RetentionPeriodHours), } diff --git a/internal/service/connect/instance_storage_config_data_source.go b/internal/service/connect/instance_storage_config_data_source.go index 5524b975de8..6c278c5da52 100644 --- a/internal/service/connect/instance_storage_config_data_source.go +++ b/internal/service/connect/instance_storage_config_data_source.go @@ -87,7 +87,7 @@ func DataSourceInstanceStorageConfig() *schema.Resource { }, }, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/connect/phone_number.go b/internal/service/connect/phone_number.go index 396b324d44d..05d00170515 100644 --- a/internal/service/connect/phone_number.go +++ b/internal/service/connect/phone_number.go @@ -59,7 +59,7 @@ func ResourcePhoneNumber() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -112,7 +112,7 @@ func resourcePhoneNumberCreate(ctx context.Context, d *schema.ResourceData, meta TargetArn: aws.String(targetArn), } - if v, ok := d.GetOk("prefix"); ok { + if v, ok := d.GetOk(names.AttrPrefix); ok { input.PhoneNumberPrefix = aws.String(v.(string)) } diff --git a/internal/service/connect/phone_number_test.go b/internal/service/connect/phone_number_test.go index 6e93f33e899..262e6db304b 100644 --- a/internal/service/connect/phone_number_test.go +++ b/internal/service/connect/phone_number_test.go @@ -103,14 +103,14 @@ func testAccPhoneNumber_prefix(t *testing.T) { testAccCheckPhoneNumberExists(ctx, resourceName, &v), resource.TestCheckResourceAttrSet(resourceName, "phone_number"), resource.TestMatchResourceAttr(resourceName, "phone_number", regexache.MustCompile(fmt.Sprintf("\\%s[0-9]{0,10}", prefix))), - resource.TestCheckResourceAttr(resourceName, "prefix", prefix), + resource.TestCheckResourceAttr(resourceName, names.AttrPrefix, prefix), ), }, { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"prefix"}, + ImportStateVerifyIgnore: []string{names.AttrPrefix}, }, }, }) diff --git a/internal/service/connect/validate_test.go b/internal/service/connect/validate_test.go index 59c3113d65c..cf5122292eb 100644 --- a/internal/service/connect/validate_test.go +++ b/internal/service/connect/validate_test.go @@ -5,6 +5,8 @@ package connect import ( "testing" + + "github.com/hashicorp/terraform-provider-aws/names" ) func TestValidDeskPhoneNumber(t *testing.T) { @@ -44,7 +46,7 @@ func TestValidPhoneNumberPrefix(t *testing.T) { "+1", } for _, v := range validPrefixes { - _, errors := validPhoneNumberPrefix(v, "prefix") + _, errors := validPhoneNumberPrefix(v, names.AttrPrefix) if len(errors) != 0 { t.Fatalf("%q should be a valid phone number prefix: %q", v, errors) } @@ -56,7 +58,7 @@ func TestValidPhoneNumberPrefix(t *testing.T) { "invalid", } for _, v := range invalidPrefixes { - _, errors := validPhoneNumberPrefix(v, "prefix") + _, errors := validPhoneNumberPrefix(v, names.AttrPrefix) if len(errors) == 0 { t.Fatalf("%q should be a invalid phone number prefix: %q", v, errors) } From 1e77787f9e715e4ee607b66397b36e4a060ad83e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:41 -0400 Subject: [PATCH 1043/1490] ec2: Use constant for prefix strings --- internal/service/ec2/ec2_spot_datafeed_subscription.go | 6 +++--- .../ec2/verifiedaccess_instance_logging_configuration.go | 6 +++--- internal/service/ec2/vpc_subnet_cidr_reservation_test.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/ec2/ec2_spot_datafeed_subscription.go b/internal/service/ec2/ec2_spot_datafeed_subscription.go index e4f5af5c5d3..b2f4d89b3ec 100644 --- a/internal/service/ec2/ec2_spot_datafeed_subscription.go +++ b/internal/service/ec2/ec2_spot_datafeed_subscription.go @@ -34,7 +34,7 @@ func ResourceSpotDataFeedSubscription() *schema.Resource { Required: true, ForceNew: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -51,7 +51,7 @@ func resourceSpotDataFeedSubscriptionCreate(ctx context.Context, d *schema.Resou Bucket: aws.String(d.Get(names.AttrBucket).(string)), } - if v, ok := d.GetOk("prefix"); ok { + if v, ok := d.GetOk(names.AttrPrefix); ok { input.Prefix = aws.String(v.(string)) } @@ -83,7 +83,7 @@ func resourceSpotDataFeedSubscriptionRead(ctx context.Context, d *schema.Resourc } d.Set(names.AttrBucket, subscription.Bucket) - d.Set("prefix", subscription.Prefix) + d.Set(names.AttrPrefix, subscription.Prefix) return diags } diff --git a/internal/service/ec2/verifiedaccess_instance_logging_configuration.go b/internal/service/ec2/verifiedaccess_instance_logging_configuration.go index e757f0cb908..7f2c205c9e9 100644 --- a/internal/service/ec2/verifiedaccess_instance_logging_configuration.go +++ b/internal/service/ec2/verifiedaccess_instance_logging_configuration.go @@ -111,7 +111,7 @@ func ResourceVerifiedAccessInstanceLoggingConfiguration() *schema.Resource { Type: schema.TypeBool, Required: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -369,7 +369,7 @@ func expandVerifiedAccessLogS3(s3 []interface{}) *types.VerifiedAccessLogS3Desti } } - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { result.Prefix = aws.String(v) } @@ -440,7 +440,7 @@ func flattenVerifiedAccessLogS3(apiObject *types.VerifiedAccessLogS3Destination) } if v := apiObject.Prefix; v != nil { - tfMap["prefix"] = aws.ToString(v) + tfMap[names.AttrPrefix] = aws.ToString(v) } return []interface{}{tfMap} diff --git a/internal/service/ec2/vpc_subnet_cidr_reservation_test.go b/internal/service/ec2/vpc_subnet_cidr_reservation_test.go index d5a3879d860..3c62dc02b85 100644 --- a/internal/service/ec2/vpc_subnet_cidr_reservation_test.go +++ b/internal/service/ec2/vpc_subnet_cidr_reservation_test.go @@ -37,7 +37,7 @@ func TestAccVPCSubnetCIDRReservation_basic(t *testing.T) { testAccCheckSubnetCIDRReservationExists(ctx, resourceName, &res), resource.TestCheckResourceAttr(resourceName, "cidr_block", "10.1.1.16/28"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "test"), - resource.TestCheckResourceAttr(resourceName, "reservation_type", "prefix"), + resource.TestCheckResourceAttr(resourceName, "reservation_type", names.AttrPrefix), acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerID), ), }, From 66845039bd59e26daa5894680dc4ce44a3d1eb61 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:41 -0400 Subject: [PATCH 1044/1490] elbv2: Use constant for prefix strings --- internal/service/elbv2/load_balancer.go | 12 ++++++------ internal/service/elbv2/load_balancer_data_source.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/elbv2/load_balancer.go b/internal/service/elbv2/load_balancer.go index 983a8285b21..60a1fb481a6 100644 --- a/internal/service/elbv2/load_balancer.go +++ b/internal/service/elbv2/load_balancer.go @@ -83,7 +83,7 @@ func ResourceLoadBalancer() *schema.Resource { Optional: true, Default: false, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { @@ -126,7 +126,7 @@ func ResourceLoadBalancer() *schema.Resource { Optional: true, Default: false, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { @@ -1256,7 +1256,7 @@ func expandLoadBalancerAccessLogsAttributes(tfMap map[string]interface{}, update }) } - if v, ok := tfMap["prefix"].(string); ok && (update || v != "") { + if v, ok := tfMap[names.AttrPrefix].(string); ok && (update || v != "") { apiObjects = append(apiObjects, &elbv2.LoadBalancerAttribute{ Key: aws.String(loadBalancerAttributeAccessLogsS3Prefix), Value: aws.String(v), @@ -1289,7 +1289,7 @@ func expandLoadBalancerConnectionLogsAttributes(tfMap map[string]interface{}, up }) } - if v, ok := tfMap["prefix"].(string); ok && (update || v != "") { + if v, ok := tfMap[names.AttrPrefix].(string); ok && (update || v != "") { apiObjects = append(apiObjects, &elbv2.LoadBalancerAttribute{ Key: aws.String(loadBalancerAttributeConnectionLogsS3Prefix), Value: aws.String(v), @@ -1315,7 +1315,7 @@ func flattenLoadBalancerAccessLogsAttributes(apiObjects []*elbv2.LoadBalancerAtt case loadBalancerAttributeAccessLogsS3Bucket: tfMap[names.AttrBucket] = aws.StringValue(v) case loadBalancerAttributeAccessLogsS3Prefix: - tfMap["prefix"] = aws.StringValue(v) + tfMap[names.AttrPrefix] = aws.StringValue(v) } } @@ -1336,7 +1336,7 @@ func flattenLoadBalancerConnectionLogsAttributes(apiObjects []*elbv2.LoadBalance case loadBalancerAttributeConnectionLogsS3Bucket: tfMap[names.AttrBucket] = aws.StringValue(v) case loadBalancerAttributeConnectionLogsS3Prefix: - tfMap["prefix"] = aws.StringValue(v) + tfMap[names.AttrPrefix] = aws.StringValue(v) } } diff --git a/internal/service/elbv2/load_balancer_data_source.go b/internal/service/elbv2/load_balancer_data_source.go index 56764ab2514..437d32ce0e7 100644 --- a/internal/service/elbv2/load_balancer_data_source.go +++ b/internal/service/elbv2/load_balancer_data_source.go @@ -45,7 +45,7 @@ func DataSourceLoadBalancer() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Computed: true, }, @@ -79,7 +79,7 @@ func DataSourceLoadBalancer() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Computed: true, }, From 33d1030748b22a9f82bc527f9690ff4273d755c2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:42 -0400 Subject: [PATCH 1045/1490] emr: Use constant for prefix strings --- internal/service/emr/release_labels_data_source.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/emr/release_labels_data_source.go b/internal/service/emr/release_labels_data_source.go index 585145eca07..78172f71ecc 100644 --- a/internal/service/emr/release_labels_data_source.go +++ b/internal/service/emr/release_labels_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_emr_release_labels", name="Release Labels") @@ -31,7 +32,7 @@ func dataSourceReleaseLabels() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -88,7 +89,7 @@ func expandReleaseLabelsFilters(filters []interface{}) *emr.ReleaseLabelFilter { app.Application = aws.String(v) } - if v, ok := m["prefix"].(string); ok && v != "" { + if v, ok := m[names.AttrPrefix].(string); ok && v != "" { app.Prefix = aws.String(v) } From d0befb45a8e6a23ac301a2ce2459cf82f47b8b73 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:42 -0400 Subject: [PATCH 1046/1490] evidently: Use constant for prefix strings --- internal/service/evidently/project.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/evidently/project.go b/internal/service/evidently/project.go index 06e2e491990..ab11c1985bc 100644 --- a/internal/service/evidently/project.go +++ b/internal/service/evidently/project.go @@ -103,7 +103,7 @@ func ResourceProject() *schema.Resource { validation.StringMatch(regexache.MustCompile(`^[0-9a-z][0-9a-z-]*[0-9a-z]$`), "must be a valid Bucket name"), ), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.All( @@ -374,7 +374,7 @@ func expandS3Destination(s3Destination []interface{}) *awstypes.S3DestinationCon result.Bucket = aws.String(v) } - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { result.Prefix = aws.String(v) } @@ -425,7 +425,7 @@ func flattenS3Destination(s3Destination *awstypes.S3Destination) []interface{} { } if s3Destination.Prefix != nil { - values["prefix"] = aws.ToString(s3Destination.Prefix) + values[names.AttrPrefix] = aws.ToString(s3Destination.Prefix) } return []interface{}{values} From 60133038c4bd27f2adab8537b22e3553d8bc60c8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:42 -0400 Subject: [PATCH 1047/1490] firehose: Use constant for prefix strings --- internal/service/firehose/delivery_stream.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index 0138c5441ea..e56f4aa0202 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -262,7 +262,7 @@ func resourceDeliveryStream() *schema.Resource { Optional: true, ValidateFunc: verify.ValidARN, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -709,7 +709,7 @@ func resourceDeliveryStream() *schema.Resource { Optional: true, ValidateFunc: verify.ValidARN, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -2360,7 +2360,7 @@ func expandVPCConfiguration(es map[string]interface{}) *types.VpcConfiguration { } func expandPrefix(s3 map[string]interface{}) *string { - if v, ok := s3["prefix"]; ok { + if v, ok := s3[names.AttrPrefix]; ok { return aws.String(v.(string)) } @@ -3353,7 +3353,7 @@ func flattenExtendedS3DestinationDescription(description *types.ExtendedS3Destin "data_format_conversion_configuration": flattenDataFormatConversionConfiguration(description.DataFormatConversionConfiguration), "error_output_prefix": aws.ToString(description.ErrorOutputPrefix), "file_extension": aws.ToString(description.FileExtension), - "prefix": aws.ToString(description.Prefix), + names.AttrPrefix: aws.ToString(description.Prefix), "processing_configuration": flattenProcessingConfiguration(description.ProcessingConfiguration, destinationTypeExtendedS3, aws.ToString(description.RoleARN)), "dynamic_partitioning_configuration": flattenDynamicPartitioningConfiguration(description.DynamicPartitioningConfiguration), names.AttrRoleARN: aws.ToString(description.RoleARN), @@ -3473,7 +3473,7 @@ func flattenS3DestinationDescription(description *types.S3DestinationDescription "cloudwatch_logging_options": flattenCloudWatchLoggingOptions(description.CloudWatchLoggingOptions), "compression_format": description.CompressionFormat, "error_output_prefix": aws.ToString(description.ErrorOutputPrefix), - "prefix": aws.ToString(description.Prefix), + names.AttrPrefix: aws.ToString(description.Prefix), names.AttrRoleARN: aws.ToString(description.RoleARN), } From 523a08da035dff386ef6cb35412d5c4cc9e7e9c8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:42 -0400 Subject: [PATCH 1048/1490] fis: Use constant for prefix strings --- internal/service/fis/experiment_template.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/fis/experiment_template.go b/internal/service/fis/experiment_template.go index f347306060e..720d11d477a 100644 --- a/internal/service/fis/experiment_template.go +++ b/internal/service/fis/experiment_template.go @@ -162,7 +162,7 @@ func ResourceExperimentTemplate() *schema.Resource { Type: schema.TypeString, Required: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -589,7 +589,7 @@ func expandExperimentTemplateS3Configuration(l []interface{}) *types.ExperimentT config := types.ExperimentTemplateS3LogConfigurationInput{ BucketName: aws.String(raw[names.AttrBucketName].(string)), } - if v, ok := raw["prefix"].(string); ok && v != "" { + if v, ok := raw[names.AttrPrefix].(string); ok && v != "" { config.Prefix = aws.String(v) } @@ -909,7 +909,7 @@ func flattenS3Configuration(configured *types.ExperimentTemplateS3LogConfigurati dataResources[0] = make(map[string]interface{}) dataResources[0][names.AttrBucketName] = configured.BucketName if aws.ToString(configured.Prefix) != "" { - dataResources[0]["prefix"] = configured.Prefix + dataResources[0][names.AttrPrefix] = configured.Prefix } return dataResources From a832fd7cb487e979fa4027ae3abfc98fb47b42c3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:43 -0400 Subject: [PATCH 1049/1490] glue: Use constant for prefix strings --- internal/service/glue/crawler_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/glue/crawler_test.go b/internal/service/glue/crawler_test.go index f989a94045e..e30d5105722 100644 --- a/internal/service/glue/crawler_test.go +++ b/internal/service/glue/crawler_test.go @@ -1498,10 +1498,10 @@ func TestAccGlueCrawler_removeTablePrefix(t *testing.T) { CheckDestroy: testAccCheckCrawlerDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccCrawlerConfig_tablePrefix(rName, "prefix"), + Config: testAccCrawlerConfig_tablePrefix(rName, names.AttrPrefix), Check: resource.ComposeTestCheckFunc( testAccCheckCrawlerExists(ctx, resourceName, &crawler), - resource.TestCheckResourceAttr(resourceName, "table_prefix", "prefix"), + resource.TestCheckResourceAttr(resourceName, "table_prefix", names.AttrPrefix), ), }, { From add9fddf8576653d4ef6a356d04cd9c0ce39af0a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:43 -0400 Subject: [PATCH 1050/1490] kafka: Use constant for prefix strings --- internal/service/kafka/cluster.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/kafka/cluster.go b/internal/service/kafka/cluster.go index 07b9ca37b65..ce048095856 100644 --- a/internal/service/kafka/cluster.go +++ b/internal/service/kafka/cluster.go @@ -454,7 +454,7 @@ func resourceCluster() *schema.Resource { Type: schema.TypeBool, Required: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -1595,7 +1595,7 @@ func expandS3(tfMap map[string]interface{}) *types.S3 { apiObject.Enabled = aws.Bool(v) } - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { apiObject.Prefix = aws.String(v) } @@ -2033,7 +2033,7 @@ func flattenS3(apiObject *types.S3) map[string]interface{} { } if v := apiObject.Prefix; v != nil { - tfMap["prefix"] = aws.ToString(v) + tfMap[names.AttrPrefix] = aws.ToString(v) } return tfMap From 32673db0227f9c00c431713ec1a3a429389d27fa Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:43 -0400 Subject: [PATCH 1051/1490] kafkaconnect: Use constant for prefix strings --- internal/service/kafkaconnect/connector.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/kafkaconnect/connector.go b/internal/service/kafkaconnect/connector.go index eb37ef9dc0e..170f6daf82f 100644 --- a/internal/service/kafkaconnect/connector.go +++ b/internal/service/kafkaconnect/connector.go @@ -302,7 +302,7 @@ func ResourceConnector() *schema.Resource { Required: true, ForceNew: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -973,7 +973,7 @@ func expandS3LogDelivery(tfMap map[string]interface{}) *kafkaconnect.S3LogDelive apiObject.Enabled = aws.Bool(v) } - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { apiObject.Prefix = aws.String(v) } @@ -1308,7 +1308,7 @@ func flattenS3LogDeliveryDescription(apiObject *kafkaconnect.S3LogDeliveryDescri } if v := apiObject.Prefix; v != nil { - tfMap["prefix"] = aws.StringValue(v) + tfMap[names.AttrPrefix] = aws.StringValue(v) } return tfMap From b7af7fbb14c862b68d1a73aa941097c7f297f626 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:43 -0400 Subject: [PATCH 1052/1490] medialive: Use constant for prefix strings --- .../service/medialive/channel_encoder_settings_schema.go | 6 +++--- internal/service/medialive/channel_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index 11ca58852e2..c2af2bb1603 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -1854,7 +1854,7 @@ func channelEncoderSettingsSchema() *schema.Schema { Computed: true, ValidateDiagFunc: enum.Validate[types.TimecodeBurninPosition](), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, Computed: true, @@ -5736,7 +5736,7 @@ func expandH265TimecodeBurninSettings(tfList []interface{}) *types.TimecodeBurni if v, ok := m["timecode_burnin_position"].(string); ok && v != "" { out.Position = types.TimecodeBurninPosition(v) } - if v, ok := m["prefix"].(string); ok && v != "" { + if v, ok := m[names.AttrPrefix].(string); ok && v != "" { out.Prefix = &v } @@ -7107,7 +7107,7 @@ func flattenH265TimecodeBurninSettings(in *types.TimecodeBurninSettings) []inter m := map[string]interface{}{ "timecode_burnin_font_size": string(in.FontSize), "timecode_burnin_position": string(in.Position), - "prefix": in.Prefix, + names.AttrPrefix: in.Prefix, } return []interface{}{m} diff --git a/internal/service/medialive/channel_test.go b/internal/service/medialive/channel_test.go index 7d1539827d7..14f29a5ab74 100644 --- a/internal/service/medialive/channel_test.go +++ b/internal/service/medialive/channel_test.go @@ -575,7 +575,7 @@ func TestAccMediaLiveChannel_VideoDescriptions_CodecSettings_h265Settings(t *tes resource.TestCheckTypeSetElemNestedAttrs(resourceName, "encoder_settings.0.video_descriptions.0.codec_settings.0.h265_settings.0.timecode_burnin_settings.*", map[string]string{ "timecode_burnin_font_size": "SMALL_16", "timecode_burnin_position": "BOTTOM_CENTER", - "prefix": "terraform-test", + names.AttrPrefix: "terraform-test", }), ), }, From d7630f74d77b994fe37a33caacf8284042ac6ba7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:43 -0400 Subject: [PATCH 1053/1490] schema: Use constant for prefix strings --- .../quicksight/schema/template_format.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/quicksight/schema/template_format.go b/internal/service/quicksight/schema/template_format.go index d08e603186e..99836522d31 100644 --- a/internal/service/quicksight/schema/template_format.go +++ b/internal/service/quicksight/schema/template_format.go @@ -31,7 +31,7 @@ func numericFormatConfigurationSchema() *schema.Schema { "negative_value_configuration": negativeValueConfigurationSchema(), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_NegativeValueConfiguration.html "null_value_format_configuration": nullValueConfigurationSchema(), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_NullValueFormatConfiguration.html "number_scale": stringSchema(false, validation.StringInSlice(quicksight.NumberScale_Values(), false)), - "prefix": stringSchema(false, validation.StringLenBetween(1, 128)), + names.AttrPrefix: stringSchema(false, validation.StringLenBetween(1, 128)), "separator_configuration": separatorConfigurationSchema(), "suffix": stringSchema(false, validation.StringLenBetween(1, 128)), "symbol": stringSchema(false, validation.StringMatch(regexache.MustCompile(`[A-Z]{3}`), "must be a 3 character currency symbol")), @@ -73,7 +73,7 @@ func numberDisplayFormatConfigurationSchema() *schema.Schema { "negative_value_configuration": negativeValueConfigurationSchema(), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_NegativeValueConfiguration.html "null_value_format_configuration": nullValueConfigurationSchema(), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_NullValueFormatConfiguration.html "number_scale": stringSchema(false, validation.StringInSlice(quicksight.NumberScale_Values(), false)), - "prefix": stringSchema(false, validation.StringLenBetween(1, 128)), + names.AttrPrefix: stringSchema(false, validation.StringLenBetween(1, 128)), "separator_configuration": separatorConfigurationSchema(), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_NumericSeparatorConfiguration.html "suffix": stringSchema(false, validation.StringLenBetween(1, 128)), }, @@ -92,7 +92,7 @@ func percentageDisplayFormatConfigurationSchema() *schema.Schema { "decimal_places_configuration": decimalPlacesConfigurationSchema(), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DecimalPlacesConfiguration.html "negative_value_configuration": negativeValueConfigurationSchema(), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_NegativeValueConfiguration.html "null_value_format_configuration": nullValueConfigurationSchema(), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_NullValueFormatConfiguration.html - "prefix": stringSchema(false, validation.StringLenBetween(1, 128)), + names.AttrPrefix: stringSchema(false, validation.StringLenBetween(1, 128)), "separator_configuration": separatorConfigurationSchema(), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_NumericSeparatorConfiguration.html "suffix": stringSchema(false, validation.StringLenBetween(1, 128)), }, @@ -390,7 +390,7 @@ func expandCurrencyDisplayFormatConfiguration(tfList []interface{}) *quicksight. if v, ok := tfMap["number_scale"].(string); ok && v != "" { config.NumberScale = aws.String(v) } - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { config.Prefix = aws.String(v) } if v, ok := tfMap["separator_configuration"].([]interface{}); ok && len(v) > 0 { @@ -660,7 +660,7 @@ func expandNumberDisplayFormatConfiguration(tfList []interface{}) *quicksight.Nu if v, ok := tfMap["number_scale"].(string); ok && v != "" { config.NumberScale = aws.String(v) } - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { config.Prefix = aws.String(v) } if v, ok := tfMap["suffix"].(string); ok && v != "" { @@ -694,7 +694,7 @@ func expandPercentageDisplayFormatConfiguration(tfList []interface{}) *quicksigh config := &quicksight.PercentageDisplayFormatConfiguration{} - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { config.Prefix = aws.String(v) } if v, ok := tfMap["suffix"].(string); ok && v != "" { @@ -805,7 +805,7 @@ func flattenCurrencyDisplayFormatConfiguration(apiObject *quicksight.CurrencyDis tfMap["number_scale"] = aws.StringValue(apiObject.NumberScale) } if apiObject.Prefix != nil { - tfMap["prefix"] = aws.StringValue(apiObject.Prefix) + tfMap[names.AttrPrefix] = aws.StringValue(apiObject.Prefix) } if apiObject.SeparatorConfiguration != nil { tfMap["separator_configuration"] = flattenNumericSeparatorConfiguration(apiObject.SeparatorConfiguration) @@ -896,7 +896,7 @@ func flattenNumberDisplayFormatConfiguration(apiObject *quicksight.NumberDisplay tfMap["number_scale"] = aws.StringValue(apiObject.NumberScale) } if apiObject.Prefix != nil { - tfMap["prefix"] = aws.StringValue(apiObject.Prefix) + tfMap[names.AttrPrefix] = aws.StringValue(apiObject.Prefix) } if apiObject.SeparatorConfiguration != nil { tfMap["separator_configuration"] = flattenNumericSeparatorConfiguration(apiObject.SeparatorConfiguration) @@ -924,7 +924,7 @@ func flattenPercentageDisplayFormatConfiguration(apiObject *quicksight.Percentag tfMap["null_value_format_configuration"] = flattenNullValueFormatConfiguration(apiObject.NullValueFormatConfiguration) } if apiObject.Prefix != nil { - tfMap["prefix"] = aws.StringValue(apiObject.Prefix) + tfMap[names.AttrPrefix] = aws.StringValue(apiObject.Prefix) } if apiObject.SeparatorConfiguration != nil { tfMap["separator_configuration"] = flattenNumericSeparatorConfiguration(apiObject.SeparatorConfiguration) From 87c3146032ae099129e75f26c78ea3ee5303d5c0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:44 -0400 Subject: [PATCH 1054/1490] s3: Use constant for prefix strings --- internal/service/s3/bucket.go | 26 +++++++++---------- .../s3/bucket_analytics_configuration.go | 14 +++++----- ...ucket_intelligent_tiering_configuration.go | 8 +++--- internal/service/s3/bucket_inventory.go | 12 ++++----- .../s3/bucket_lifecycle_configuration.go | 18 ++++++------- .../s3/bucket_lifecycle_configuration_test.go | 2 +- internal/service/s3/bucket_metric.go | 8 +++--- .../service/s3/bucket_objects_data_source.go | 4 +-- .../s3/bucket_replication_configuration.go | 18 ++++++------- .../bucket_replication_configuration_test.go | 16 ++++++------ internal/service/s3/objects_data_source.go | 4 +-- 11 files changed, 65 insertions(+), 65 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index b3429dc4a24..cffaa892dcb 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -272,7 +272,7 @@ func resourceBucket() *schema.Resource { }, }, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -515,7 +515,7 @@ func resourceBucket() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 1024), @@ -529,7 +529,7 @@ func resourceBucket() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(0, 255), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 1024), @@ -2117,7 +2117,7 @@ func expandBucketLifecycleRules(ctx context.Context, l []interface{}) []types.Li } var filter types.LifecycleRuleFilter - prefix := tfMap["prefix"].(string) + prefix := tfMap[names.AttrPrefix].(string) if tags := Tags(tftags.New(ctx, tfMap[names.AttrTags]).IgnoreAWS()); len(tags) > 0 { filter = &types.LifecycleRuleFilterMemberAnd{ Value: types.LifecycleRuleAndOperator{ @@ -2295,13 +2295,13 @@ func flattenBucketLifecycleRules(ctx context.Context, rules []types.LifecycleRul switch v := filter.(type) { case *types.LifecycleRuleFilterMemberAnd: if v := v.Value.Prefix; v != nil { - m["prefix"] = aws.ToString(v) + m[names.AttrPrefix] = aws.ToString(v) } if v := v.Value.Tags; v != nil { m[names.AttrTags] = keyValueTags(ctx, v).IgnoreAWS().Map() } case *types.LifecycleRuleFilterMemberPrefix: - m["prefix"] = v.Value + m[names.AttrPrefix] = v.Value case *types.LifecycleRuleFilterMemberTag: m[names.AttrTags] = keyValueTags(ctx, []types.Tag{v.Value}).IgnoreAWS().Map() } @@ -2312,7 +2312,7 @@ func flattenBucketLifecycleRules(ctx context.Context, rules []types.LifecycleRul } if rule.Prefix != nil { - m["prefix"] = aws.ToString(rule.Prefix) + m[names.AttrPrefix] = aws.ToString(rule.Prefix) } m[names.AttrEnabled] = rule.Status == types.ExpirationStatusEnabled @@ -2477,13 +2477,13 @@ func expandBucketReplicationRules(ctx context.Context, l []interface{}) []types. if tags := Tags(tftags.New(ctx, tfFilterMap[names.AttrTags]).IgnoreAWS()); len(tags) > 0 { filter = &types.ReplicationRuleFilterMemberAnd{ Value: types.ReplicationRuleAndOperator{ - Prefix: aws.String(tfFilterMap["prefix"].(string)), + Prefix: aws.String(tfFilterMap[names.AttrPrefix].(string)), Tags: tags, }, } } else { filter = &types.ReplicationRuleFilterMemberPrefix{ - Value: tfFilterMap["prefix"].(string), + Value: tfFilterMap[names.AttrPrefix].(string), } } @@ -2501,7 +2501,7 @@ func expandBucketReplicationRules(ctx context.Context, l []interface{}) []types. } } else { // XML schema V1. - rule.Prefix = aws.String(tfRuleMap["prefix"].(string)) + rule.Prefix = aws.String(tfRuleMap[names.AttrPrefix].(string)) } rules = append(rules, rule) @@ -2650,7 +2650,7 @@ func flattenBucketReplicationRules(ctx context.Context, rules []types.Replicatio } if rule.Prefix != nil { - m["prefix"] = aws.ToString(rule.Prefix) + m[names.AttrPrefix] = aws.ToString(rule.Prefix) } if rule.Priority != nil { @@ -2731,10 +2731,10 @@ func flattenBucketReplicationRuleFilter(ctx context.Context, filter types.Replic switch v := filter.(type) { case *types.ReplicationRuleFilterMemberAnd: - m["prefix"] = aws.ToString(v.Value.Prefix) + m[names.AttrPrefix] = aws.ToString(v.Value.Prefix) m[names.AttrTags] = keyValueTags(ctx, v.Value.Tags).IgnoreAWS().Map() case *types.ReplicationRuleFilterMemberPrefix: - m["prefix"] = v.Value + m[names.AttrPrefix] = v.Value case *types.ReplicationRuleFilterMemberTag: m[names.AttrTags] = keyValueTags(ctx, []types.Tag{v.Value}).IgnoreAWS().Map() } diff --git a/internal/service/s3/bucket_analytics_configuration.go b/internal/service/s3/bucket_analytics_configuration.go index 139a5de52fb..ddb3cb34ff2 100644 --- a/internal/service/s3/bucket_analytics_configuration.go +++ b/internal/service/s3/bucket_analytics_configuration.go @@ -49,7 +49,7 @@ func resourceBucketAnalyticsConfiguration() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, AtLeastOneOf: []string{"filter.0.prefix", "filter.0.tags"}, @@ -114,7 +114,7 @@ func resourceBucketAnalyticsConfiguration() *schema.Resource { Default: types.AnalyticsS3ExportFileFormatCsv, ValidateDiagFunc: enum.Validate[types.AnalyticsS3ExportFileFormat](), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -261,7 +261,7 @@ func BucketAnalyticsConfigurationParseID(id string) (string, string, error) { func expandAnalyticsFilter(ctx context.Context, m map[string]interface{}) types.AnalyticsFilter { var prefix string - if v, ok := m["prefix"]; ok { + if v, ok := m[names.AttrPrefix]; ok { prefix = v.(string) } @@ -349,7 +349,7 @@ func expandAnalyticsS3BucketDestination(bdl []interface{}) *types.AnalyticsS3Buc result.BucketAccountId = aws.String(v.(string)) } - if v, ok := bdm["prefix"]; ok && v != "" { + if v, ok := bdm[names.AttrPrefix]; ok && v != "" { result.Prefix = aws.String(v.(string)) } } @@ -363,13 +363,13 @@ func flattenAnalyticsFilter(ctx context.Context, analyticsFilter types.Analytics switch v := analyticsFilter.(type) { case *types.AnalyticsFilterMemberAnd: if v := v.Value.Prefix; v != nil { - result["prefix"] = aws.ToString(v) + result[names.AttrPrefix] = aws.ToString(v) } if v := v.Value.Tags; v != nil { result[names.AttrTags] = keyValueTags(ctx, v).IgnoreAWS().Map() } case *types.AnalyticsFilterMemberPrefix: - result["prefix"] = v.Value + result[names.AttrPrefix] = v.Value case *types.AnalyticsFilterMemberTag: tags := []types.Tag{ v.Value, @@ -426,7 +426,7 @@ func flattenAnalyticsS3BucketDestination(bucketDestination *types.AnalyticsS3Buc result["bucket_account_id"] = aws.ToString(bucketDestination.BucketAccountId) } if bucketDestination.Prefix != nil { - result["prefix"] = aws.ToString(bucketDestination.Prefix) + result[names.AttrPrefix] = aws.ToString(bucketDestination.Prefix) } return []interface{}{result} diff --git a/internal/service/s3/bucket_intelligent_tiering_configuration.go b/internal/service/s3/bucket_intelligent_tiering_configuration.go index 6e3f4c008a3..e0442143f4d 100644 --- a/internal/service/s3/bucket_intelligent_tiering_configuration.go +++ b/internal/service/s3/bucket_intelligent_tiering_configuration.go @@ -48,7 +48,7 @@ func resourceBucketIntelligentTieringConfiguration() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, AtLeastOneOf: []string{"filter.0.prefix", "filter.0.tags"}, @@ -271,7 +271,7 @@ func expandIntelligentTieringFilter(ctx context.Context, tfMap map[string]interf var prefix string - if v, ok := tfMap["prefix"].(string); ok { + if v, ok := tfMap[names.AttrPrefix].(string); ok { prefix = v } @@ -362,7 +362,7 @@ func flattenIntelligentTieringFilter(ctx context.Context, apiObject *types.Intel if apiObject.And == nil { if v := apiObject.Prefix; v != nil { - tfMap["prefix"] = aws.ToString(v) + tfMap[names.AttrPrefix] = aws.ToString(v) } if v := apiObject.Tag; v != nil { @@ -372,7 +372,7 @@ func flattenIntelligentTieringFilter(ctx context.Context, apiObject *types.Intel apiObject := apiObject.And if v := apiObject.Prefix; v != nil { - tfMap["prefix"] = aws.ToString(v) + tfMap[names.AttrPrefix] = aws.ToString(v) } if v := apiObject.Tags; v != nil { diff --git a/internal/service/s3/bucket_inventory.go b/internal/service/s3/bucket_inventory.go index 5b731ef4426..e4eb5701a40 100644 --- a/internal/service/s3/bucket_inventory.go +++ b/internal/service/s3/bucket_inventory.go @@ -107,7 +107,7 @@ func resourceBucketInventory() *schema.Resource { Required: true, ValidateDiagFunc: enum.Validate[types.InventoryFormat](), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -128,7 +128,7 @@ func resourceBucketInventory() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -324,7 +324,7 @@ func resourceBucketInventoryDelete(ctx context.Context, d *schema.ResourceData, } func expandInventoryFilter(m map[string]interface{}) *types.InventoryFilter { - v, ok := m["prefix"] + v, ok := m[names.AttrPrefix] if !ok { return nil } @@ -342,7 +342,7 @@ func flattenInventoryFilter(filter *types.InventoryFilter) []map[string]interfac m := make(map[string]interface{}) if filter.Prefix != nil { - m["prefix"] = aws.ToString(filter.Prefix) + m[names.AttrPrefix] = aws.ToString(filter.Prefix) } result = append(result, m) @@ -370,7 +370,7 @@ func expandInventoryBucketDestination(m map[string]interface{}) *types.Inventory destination.AccountId = aws.String(v.(string)) } - if v, ok := m["prefix"]; ok && v.(string) != "" { + if v, ok := m[names.AttrPrefix]; ok && v.(string) != "" { destination.Prefix = aws.String(v.(string)) } @@ -415,7 +415,7 @@ func flattenInventoryBucketDestination(destination *types.InventoryS3BucketDesti m[names.AttrAccountID] = aws.ToString(destination.AccountId) } if destination.Prefix != nil { - m["prefix"] = aws.ToString(destination.Prefix) + m[names.AttrPrefix] = aws.ToString(destination.Prefix) } if destination.Encryption != nil { diff --git a/internal/service/s3/bucket_lifecycle_configuration.go b/internal/service/s3/bucket_lifecycle_configuration.go index aaad3a848b6..1bbd5bf49f7 100644 --- a/internal/service/s3/bucket_lifecycle_configuration.go +++ b/internal/service/s3/bucket_lifecycle_configuration.go @@ -128,7 +128,7 @@ func resourceBucketLifecycleConfiguration() *schema.Resource { Optional: true, ValidateFunc: validation.IntAtLeast(1), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -144,7 +144,7 @@ func resourceBucketLifecycleConfiguration() *schema.Resource { Type: nullable.TypeNullableInt, Optional: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -215,7 +215,7 @@ func resourceBucketLifecycleConfiguration() *schema.Resource { }, }, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, Deprecated: "Use filter instead", @@ -569,7 +569,7 @@ func expandLifecycleRules(ctx context.Context, l []interface{}) []types.Lifecycl result.Filter = expandLifecycleRuleFilter(ctx, v) } - if v, ok := tfMap["prefix"].(string); ok && result.Filter == nil { + if v, ok := tfMap[names.AttrPrefix].(string); ok && result.Filter == nil { // If neither the filter block nor the prefix are specified, // apply the Default behavior from v3.x of the provider; // otherwise, set the prefix as specified in Terraform. @@ -688,7 +688,7 @@ func expandLifecycleRuleFilter(ctx context.Context, l []interface{}) types.Lifec // Per AWS S3 API, "A Filter must have exactly one of Prefix, Tag, or And specified"; // Specifying more than one of the listed parameters results in a MalformedXML error. // In practice, this also includes ObjectSizeGreaterThan and ObjectSizeLessThan. - if v, ok := m["prefix"].(string); ok && result == nil { + if v, ok := m[names.AttrPrefix].(string); ok && result == nil { result = &types.LifecycleRuleFilterMemberPrefix{ Value: v, } @@ -714,7 +714,7 @@ func expandLifecycleRuleFilterMemberAnd(ctx context.Context, m map[string]interf result.Value.ObjectSizeLessThan = aws.Int64(int64(v)) } - if v, ok := m["prefix"].(string); ok { + if v, ok := m[names.AttrPrefix].(string); ok { result.Value.Prefix = aws.String(v) } @@ -875,7 +875,7 @@ func flattenLifecycleRules(ctx context.Context, rules []types.LifecycleRule) []i } if rule.Prefix != nil { - m["prefix"] = aws.ToString(rule.Prefix) + m[names.AttrPrefix] = aws.ToString(rule.Prefix) } if rule.Transitions != nil { @@ -939,7 +939,7 @@ func flattenLifecycleRuleFilter(ctx context.Context, filter types.LifecycleRuleF case *types.LifecycleRuleFilterMemberObjectSizeLessThan: m["object_size_less_than"] = strconv.FormatInt(v.Value, 10) case *types.LifecycleRuleFilterMemberPrefix: - m["prefix"] = v.Value + m[names.AttrPrefix] = v.Value case *types.LifecycleRuleFilterMemberTag: m["tag"] = flattenLifecycleRuleFilterMemberTag(v) default: @@ -960,7 +960,7 @@ func flattenLifecycleRuleFilterMemberAnd(ctx context.Context, andOp *types.Lifec } if v := andOp.Value.Prefix; v != nil { - m["prefix"] = aws.ToString(v) + m[names.AttrPrefix] = aws.ToString(v) } if v := andOp.Value.Tags; v != nil { diff --git a/internal/service/s3/bucket_lifecycle_configuration_test.go b/internal/service/s3/bucket_lifecycle_configuration_test.go index 30897523096..86f6c9e9db5 100644 --- a/internal/service/s3/bucket_lifecycle_configuration_test.go +++ b/internal/service/s3/bucket_lifecycle_configuration_test.go @@ -545,7 +545,7 @@ func TestAccS3BucketLifecycleConfiguration_prefix(t *testing.T) { "expiration.#": "1", "expiration.0.days": "365", names.AttrID: rName, - "prefix": "path1/", + names.AttrPrefix: "path1/", names.AttrStatus: tfs3.LifecycleRuleStatusEnabled, }), ), diff --git a/internal/service/s3/bucket_metric.go b/internal/service/s3/bucket_metric.go index 76dfb8c1c8d..39f98855d7e 100644 --- a/internal/service/s3/bucket_metric.go +++ b/internal/service/s3/bucket_metric.go @@ -55,7 +55,7 @@ func resourceBucketMetric() *schema.Resource { ValidateFunc: verify.ValidARN, AtLeastOneOf: []string{"filter.0.access_point", "filter.0.prefix", "filter.0.tags"}, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, AtLeastOneOf: []string{"filter.0.access_point", "filter.0.prefix", "filter.0.tags"}, @@ -201,7 +201,7 @@ func expandMetricsFilter(ctx context.Context, m map[string]interface{}) types.Me } var prefix string - if v, ok := m["prefix"]; ok { + if v, ok := m[names.AttrPrefix]; ok { prefix = v.(string) } @@ -272,7 +272,7 @@ func flattenMetricsFilter(ctx context.Context, metricsFilter types.MetricsFilter m["access_point"] = aws.ToString(v) } if v := v.Value.Prefix; v != nil { - m["prefix"] = aws.ToString(v) + m[names.AttrPrefix] = aws.ToString(v) } if v := v.Value.Tags; v != nil { m[names.AttrTags] = keyValueTags(ctx, v).IgnoreAWS().Map() @@ -280,7 +280,7 @@ func flattenMetricsFilter(ctx context.Context, metricsFilter types.MetricsFilter case *types.MetricsFilterMemberAccessPointArn: m["access_point"] = v.Value case *types.MetricsFilterMemberPrefix: - m["prefix"] = v.Value + m[names.AttrPrefix] = v.Value case *types.MetricsFilterMemberTag: tags := []types.Tag{ v.Value, diff --git a/internal/service/s3/bucket_objects_data_source.go b/internal/service/s3/bucket_objects_data_source.go index 80209b6e954..464349c4034 100644 --- a/internal/service/s3/bucket_objects_data_source.go +++ b/internal/service/s3/bucket_objects_data_source.go @@ -63,7 +63,7 @@ func dataSourceBucketObjects() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -102,7 +102,7 @@ func dataSourceBucketObjectsRead(ctx context.Context, d *schema.ResourceData, me input.MaxKeys = aws.Int32(int32(maxKeys)) } - if s, ok := d.GetOk("prefix"); ok { + if s, ok := d.GetOk(names.AttrPrefix); ok { input.Prefix = aws.String(s.(string)) } diff --git a/internal/service/s3/bucket_replication_configuration.go b/internal/service/s3/bucket_replication_configuration.go index dbea9146ba3..f9043c271ee 100644 --- a/internal/service/s3/bucket_replication_configuration.go +++ b/internal/service/s3/bucket_replication_configuration.go @@ -208,7 +208,7 @@ func resourceBucketReplicationConfiguration() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 1024), @@ -217,7 +217,7 @@ func resourceBucketReplicationConfiguration() *schema.Resource { }, }, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 1024), @@ -248,7 +248,7 @@ func resourceBucketReplicationConfiguration() *schema.Resource { Computed: true, ValidateFunc: validation.StringLenBetween(0, 255), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 1024), @@ -515,7 +515,7 @@ func expandReplicationRules(ctx context.Context, l []interface{}) []types.Replic rule.Priority = aws.Int32(int32(tfMap["priority"].(int))) } else { // XML schema V1 - rule.Prefix = aws.String(tfMap["prefix"].(string)) + rule.Prefix = aws.String(tfMap[names.AttrPrefix].(string)) } rules = append(rules, rule) @@ -800,7 +800,7 @@ func expandReplicationRuleFilter(ctx context.Context, l []interface{}) types.Rep // If a filter is specified as filter { prefix = "" } in Terraform, we should send the prefix value // in the API request even if it is an empty value, else Terraform will report non-empty plans. // Reference: https://github.com/hashicorp/terraform-provider-aws/issues/23487 - if v, ok := tfMap["prefix"].(string); ok && result == nil { + if v, ok := tfMap[names.AttrPrefix].(string); ok && result == nil { result = &types.ReplicationRuleFilterMemberPrefix{ Value: v, } @@ -824,7 +824,7 @@ func expandReplicationRuleFilterMemberAnd(ctx context.Context, l []interface{}) Value: types.ReplicationRuleAndOperator{}, } - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { result.Value.Prefix = aws.String(v) } @@ -897,7 +897,7 @@ func flattenReplicationRules(ctx context.Context, rules []types.ReplicationRule) } if rule.Prefix != nil { - m["prefix"] = aws.ToString(rule.Prefix) + m[names.AttrPrefix] = aws.ToString(rule.Prefix) } if rule.Priority != nil { @@ -1055,7 +1055,7 @@ func flattenReplicationRuleFilter(ctx context.Context, filter types.ReplicationR case *types.ReplicationRuleFilterMemberAnd: m["and"] = flattenReplicationRuleFilterMemberAnd(ctx, v) case *types.ReplicationRuleFilterMemberPrefix: - m["prefix"] = v.Value + m[names.AttrPrefix] = v.Value case *types.ReplicationRuleFilterMemberTag: m["tag"] = flattenReplicationRuleFilterMemberTag(v) default: @@ -1073,7 +1073,7 @@ func flattenReplicationRuleFilterMemberAnd(ctx context.Context, op *types.Replic m := make(map[string]interface{}) if v := op.Value.Prefix; v != nil { - m["prefix"] = aws.ToString(v) + m[names.AttrPrefix] = aws.ToString(v) } if v := op.Value.Tags; v != nil { diff --git a/internal/service/s3/bucket_replication_configuration_test.go b/internal/service/s3/bucket_replication_configuration_test.go index 95a70d8d9e3..d50abc3b55e 100644 --- a/internal/service/s3/bucket_replication_configuration_test.go +++ b/internal/service/s3/bucket_replication_configuration_test.go @@ -48,7 +48,7 @@ func TestAccS3BucketReplicationConfiguration_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "foobar", - "prefix": "foo", + names.AttrPrefix: "foo", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "destination.#": "1", "destination.0.storage_class": string(types.StorageClassStandard), @@ -64,7 +64,7 @@ func TestAccS3BucketReplicationConfiguration_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "foobar", - "prefix": "foo", + names.AttrPrefix: "foo", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "destination.#": "1", "destination.0.storage_class": string(types.StorageClassGlacier), @@ -80,7 +80,7 @@ func TestAccS3BucketReplicationConfiguration_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "foobar", - "prefix": "foo", + names.AttrPrefix: "foo", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "destination.#": "1", "destination.0.encryption_configuration.#": "1", @@ -329,7 +329,7 @@ func TestAccS3BucketReplicationConfiguration_configurationRuleDestinationAccessC resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "foobar", - "prefix": "foo", + names.AttrPrefix: "foo", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "destination.#": "1", "destination.0.access_control_translation.#": "1", @@ -353,7 +353,7 @@ func TestAccS3BucketReplicationConfiguration_configurationRuleDestinationAccessC resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "foobar", - "prefix": "foo", + names.AttrPrefix: "foo", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "destination.#": "1", "destination.0.access_control_translation.#": "1", @@ -407,7 +407,7 @@ func TestAccS3BucketReplicationConfiguration_configurationRuleDestinationAddAcce resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "foobar", - "prefix": "foo", + names.AttrPrefix: "foo", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "destination.#": "1", "destination.0.storage_class": string(types.StorageClassStandard), @@ -429,7 +429,7 @@ func TestAccS3BucketReplicationConfiguration_configurationRuleDestinationAddAcce resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "foobar", - "prefix": "foo", + names.AttrPrefix: "foo", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "destination.#": "1", "destination.0.access_control_translation.#": "1", @@ -621,7 +621,7 @@ func TestAccS3BucketReplicationConfiguration_withoutStorageClass(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "foobar", - "prefix": "foo", + names.AttrPrefix: "foo", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "destination.#": "1", }), diff --git a/internal/service/s3/objects_data_source.go b/internal/service/s3/objects_data_source.go index 294696b0545..40b28484053 100644 --- a/internal/service/s3/objects_data_source.go +++ b/internal/service/s3/objects_data_source.go @@ -63,7 +63,7 @@ func dataSourceObjects() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -121,7 +121,7 @@ func dataSourceObjectsRead(ctx context.Context, d *schema.ResourceData, meta int input.MaxKeys = aws.Int32(int32(maxKeys)) } - if v, ok := d.GetOk("prefix"); ok { + if v, ok := d.GetOk(names.AttrPrefix); ok { input.Prefix = aws.String(v.(string)) } From 69c75b7c0c4885dc662700f356233cac4fec08df Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:44 -0400 Subject: [PATCH 1055/1490] s3control: Use constant for prefix strings --- .../service/s3control/bucket_lifecycle_configuration.go | 8 ++++---- internal/service/s3control/storage_lens_configuration.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/s3control/bucket_lifecycle_configuration.go b/internal/service/s3control/bucket_lifecycle_configuration.go index 11bb1e6ee58..532ee8241da 100644 --- a/internal/service/s3control/bucket_lifecycle_configuration.go +++ b/internal/service/s3control/bucket_lifecycle_configuration.go @@ -102,7 +102,7 @@ func resourceBucketLifecycleConfiguration() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -406,7 +406,7 @@ func expandLifecycleRuleFilter(ctx context.Context, tfList []interface{}) *types apiObject := &types.LifecycleRuleFilter{} - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { apiObject.Prefix = aws.String(v) } @@ -498,7 +498,7 @@ func flattenLifecycleRuleFilter(ctx context.Context, apiObject *types.LifecycleR if apiObject.And != nil { if v := apiObject.And.Prefix; v != nil { - tfMap["prefix"] = aws.ToString(v) + tfMap[names.AttrPrefix] = aws.ToString(v) } if v := apiObject.And.Tags; v != nil { @@ -506,7 +506,7 @@ func flattenLifecycleRuleFilter(ctx context.Context, apiObject *types.LifecycleR } } else { if v := apiObject.Prefix; v != nil { - tfMap["prefix"] = aws.ToString(v) + tfMap[names.AttrPrefix] = aws.ToString(v) } if v := apiObject.Tag; v != nil { diff --git a/internal/service/s3control/storage_lens_configuration.go b/internal/service/s3control/storage_lens_configuration.go index 87cca565096..266b7e0316b 100644 --- a/internal/service/s3control/storage_lens_configuration.go +++ b/internal/service/s3control/storage_lens_configuration.go @@ -318,7 +318,7 @@ func resourceStorageLensConfiguration() *schema.Resource { Required: true, ValidateDiagFunc: enum.Validate[types.OutputSchemaVersion](), }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -929,7 +929,7 @@ func expandS3BucketDestination(tfMap map[string]interface{}) *types.S3BucketDest apiObject.OutputSchemaVersion = types.OutputSchemaVersion(v) } - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { apiObject.Prefix = aws.String(v) } @@ -1258,7 +1258,7 @@ func flattenS3BucketDestination(apiObject *types.S3BucketDestination) map[string tfMap["output_schema_version"] = apiObject.OutputSchemaVersion if v := apiObject.Prefix; v != nil { - tfMap["prefix"] = aws.ToString(v) + tfMap[names.AttrPrefix] = aws.ToString(v) } return tfMap From c6e2f950f94eaadd87846539f3a6e5b3298a5178 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:45 -0400 Subject: [PATCH 1056/1490] signer: Use constant for prefix strings --- internal/service/signer/signing_job.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/signer/signing_job.go b/internal/service/signer/signing_job.go index 617c09c27e5..e12c195cd04 100644 --- a/internal/service/signer/signing_job.go +++ b/internal/service/signer/signing_job.go @@ -91,7 +91,7 @@ func ResourceSigningJob() *schema.Resource { Required: true, ForceNew: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -469,8 +469,8 @@ func expandSigningJobS3Destination(tfList []interface{}) *types.S3Destination { s3Destination.BucketName = aws.String(tfMap[names.AttrBucket].(string)) } - if _, ok := tfMap["prefix"]; ok { - s3Destination.Prefix = aws.String(tfMap["prefix"].(string)) + if _, ok := tfMap[names.AttrPrefix]; ok { + s3Destination.Prefix = aws.String(tfMap[names.AttrPrefix].(string)) } return s3Destination From 99a0da4446328ec15522ac55295cfec5fe7501f2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:45 -0400 Subject: [PATCH 1057/1490] ssm: Use constant for prefix strings --- internal/service/ssm/resource_data_sync.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/ssm/resource_data_sync.go b/internal/service/ssm/resource_data_sync.go index f6008f94cd1..6943a55adf2 100644 --- a/internal/service/ssm/resource_data_sync.go +++ b/internal/service/ssm/resource_data_sync.go @@ -54,7 +54,7 @@ func ResourceResourceDataSync() *schema.Resource { Required: true, ForceNew: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -187,7 +187,7 @@ func flattenResourceDataSyncS3Destination(dest *ssm.ResourceDataSyncS3Destinatio result[names.AttrKMSKeyARN] = aws.StringValue(dest.AWSKMSKeyARN) } if dest.Prefix != nil { - result["prefix"] = aws.StringValue(dest.Prefix) + result[names.AttrPrefix] = aws.StringValue(dest.Prefix) } return []interface{}{result} } @@ -202,7 +202,7 @@ func expandResourceDataSyncS3Destination(d *schema.ResourceData) *ssm.ResourceDa if v, ok := raw[names.AttrKMSKeyARN].(string); ok && v != "" { s3dest.AWSKMSKeyARN = aws.String(v) } - if v, ok := raw["prefix"].(string); ok && v != "" { + if v, ok := raw[names.AttrPrefix].(string); ok && v != "" { s3dest.Prefix = aws.String(v) } return s3dest From 4858bf44f6ee67aecdd11b0f55b43707fbf47d7c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:06:45 -0400 Subject: [PATCH 1058/1490] vpclattice: Use constant for prefix strings --- internal/service/vpclattice/listener_rule.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/vpclattice/listener_rule.go b/internal/service/vpclattice/listener_rule.go index bf45f5e7d30..f507fe772dd 100644 --- a/internal/service/vpclattice/listener_rule.go +++ b/internal/service/vpclattice/listener_rule.go @@ -165,7 +165,7 @@ func ResourceListenerRule() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -199,7 +199,7 @@ func ResourceListenerRule() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "prefix": { + names.AttrPrefix: { Type: schema.TypeString, Optional: true, }, @@ -609,7 +609,7 @@ func flattenHeaderMatchTypeMemberPrefix(apiObject *types.HeaderMatchTypeMemberPr } tfMap := map[string]interface{}{ - "prefix": apiObject.Value, + names.AttrPrefix: apiObject.Value, } return tfMap @@ -667,7 +667,7 @@ func flattenPathMatchTypeMemberPrefix(apiObject *types.PathMatchTypeMemberPrefix } tfMap := map[string]interface{}{ - "prefix": apiObject.Value, + names.AttrPrefix: apiObject.Value, } return tfMap @@ -807,7 +807,7 @@ func expandHeaderMatch(tfMap map[string]interface{}) types.HeaderMatch { if matchV, ok := matchObj["exact"].(string); ok && matchV != "" { apiObject.Match = expandHeaderMatchTypeMemberExact(matchObj) } - if matchV, ok := matchObj["prefix"].(string); ok && matchV != "" { + if matchV, ok := matchObj[names.AttrPrefix].(string); ok && matchV != "" { apiObject.Match = expandHeaderMatchTypeMemberPrefix(matchObj) } if matchV, ok := matchObj["contains"].(string); ok && matchV != "" { @@ -830,7 +830,7 @@ func expandHeaderMatchTypeMemberContains(tfMap map[string]interface{}) types.Hea func expandHeaderMatchTypeMemberPrefix(tfMap map[string]interface{}) types.HeaderMatchType { apiObject := &types.HeaderMatchTypeMemberPrefix{} - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { apiObject.Value = v } return apiObject @@ -857,7 +857,7 @@ func expandPathMatch(tfMap map[string]interface{}) *types.PathMatch { if matchV, ok := matchObj["exact"].(string); ok && matchV != "" { apiObject.Match = expandPathMatchTypeMemberExact(matchObj) } - if matchV, ok := matchObj["prefix"].(string); ok && matchV != "" { + if matchV, ok := matchObj[names.AttrPrefix].(string); ok && matchV != "" { apiObject.Match = expandPathMatchTypeMemberPrefix(matchObj) } } @@ -878,7 +878,7 @@ func expandPathMatchTypeMemberExact(tfMap map[string]interface{}) types.PathMatc func expandPathMatchTypeMemberPrefix(tfMap map[string]interface{}) types.PathMatchType { apiObject := &types.PathMatchTypeMemberPrefix{} - if v, ok := tfMap["prefix"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPrefix].(string); ok && v != "" { apiObject.Value = v } return apiObject From 999e55d63377ec91bc5d0f786fd9c5d8c2496ae4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:02 -0400 Subject: [PATCH 1059/1490] ci: Prefer constant for string literal "priority" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 8136d99793e..caacfe8c35d 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1385,3 +1385,13 @@ rules: - pattern: '"prefix"' severity: ERROR fix: "names.AttrPrefix" + - id: literal-priority-string-constant + languages: [go] + message: Use the constant `names.AttrPriority` for the string literal "priority" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"priority"' + severity: ERROR + fix: "names.AttrPriority" From 4815e23ba42fb010c868ede39a3dacfd78ea4a9f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:02 -0400 Subject: [PATCH 1060/1490] names: Add constant for string literal "priority" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 980ad09adfb..1be175810f2 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -50,6 +50,7 @@ const ( AttrPort = "port" AttrPreferredMaintenanceWindow = "preferred_maintenance_window" AttrPrefix = "prefix" + AttrPriority = "priority" AttrProfile = "profile" AttrProtocol = "protocol" AttrRegion = "region" From c9b539e1dea00a88fe4c3e634c2178c3af912528 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:03 -0400 Subject: [PATCH 1061/1490] appmesh: Use constant for priority strings --- internal/service/appmesh/flex.go | 12 ++++++------ internal/service/appmesh/gateway_route.go | 12 ++++++------ internal/service/appmesh/route.go | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/appmesh/flex.go b/internal/service/appmesh/flex.go index ccde51305d2..71c05916782 100644 --- a/internal/service/appmesh/flex.go +++ b/internal/service/appmesh/flex.go @@ -598,7 +598,7 @@ func expandRouteSpec(vSpec []interface{}) *appmesh.RouteSpec { spec.HttpRoute = expandHTTPRoute(vHttpRoute) } - if vPriority, ok := mSpec["priority"].(int); ok && vPriority > 0 { + if vPriority, ok := mSpec[names.AttrPriority].(int); ok && vPriority > 0 { spec.Priority = aws.Int64(int64(vPriority)) } @@ -1573,11 +1573,11 @@ func flattenRouteSpec(spec *appmesh.RouteSpec) []interface{} { } mSpec := map[string]interface{}{ - "grpc_route": flattenGRPCRoute(spec.GrpcRoute), - "http2_route": flattenHTTPRoute(spec.Http2Route), - "http_route": flattenHTTPRoute(spec.HttpRoute), - "priority": int(aws.Int64Value(spec.Priority)), - "tcp_route": flattenTCPRoute(spec.TcpRoute), + "grpc_route": flattenGRPCRoute(spec.GrpcRoute), + "http2_route": flattenHTTPRoute(spec.Http2Route), + "http_route": flattenHTTPRoute(spec.HttpRoute), + names.AttrPriority: int(aws.Int64Value(spec.Priority)), + "tcp_route": flattenTCPRoute(spec.TcpRoute), } return []interface{}{mSpec} diff --git a/internal/service/appmesh/gateway_route.go b/internal/service/appmesh/gateway_route.go index 6dabf7a823a..df9ced0d3c1 100644 --- a/internal/service/appmesh/gateway_route.go +++ b/internal/service/appmesh/gateway_route.go @@ -495,7 +495,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { }, "http_route": httpRouteSchema("http_route"), "http2_route": httpRouteSchema("http2_route"), - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Optional: true, ValidateFunc: validation.IntBetween(0, 1000), @@ -716,7 +716,7 @@ func expandGatewayRouteSpec(vSpec []interface{}) *appmesh.GatewayRouteSpec { spec.HttpRoute = expandHTTPGatewayRoute(vHttpRoute) } - if vPriority, ok := mSpec["priority"].(int); ok && vPriority > 0 { + if vPriority, ok := mSpec[names.AttrPriority].(int); ok && vPriority > 0 { spec.Priority = aws.Int64(int64(vPriority)) } @@ -1000,10 +1000,10 @@ func flattenGatewayRouteSpec(spec *appmesh.GatewayRouteSpec) []interface{} { } mSpec := map[string]interface{}{ - "grpc_route": flattenGRPCGatewayRoute(spec.GrpcRoute), - "http2_route": flattenHTTPGatewayRoute(spec.Http2Route), - "http_route": flattenHTTPGatewayRoute(spec.HttpRoute), - "priority": int(aws.Int64Value(spec.Priority)), + "grpc_route": flattenGRPCGatewayRoute(spec.GrpcRoute), + "http2_route": flattenHTTPGatewayRoute(spec.Http2Route), + "http_route": flattenHTTPGatewayRoute(spec.HttpRoute), + names.AttrPriority: int(aws.Int64Value(spec.Priority)), } return []interface{}{mSpec} diff --git a/internal/service/appmesh/route.go b/internal/service/appmesh/route.go index 7c1684f1a55..e6efdf4ee21 100644 --- a/internal/service/appmesh/route.go +++ b/internal/service/appmesh/route.go @@ -640,7 +640,7 @@ func resourceRouteSpecSchema() *schema.Schema { schema.ConflictsWith = []string{"spec.0.grpc_route", "spec.0.http_route", "spec.0.tcp_route"} return schema }(), - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Optional: true, ValidateFunc: validation.IntBetween(0, 1000), From bb1f28f3787a346a4db56b8848f6ea4692fea5d2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:03 -0400 Subject: [PATCH 1062/1490] batch: Use constant for priority strings --- internal/service/batch/job_queue.go | 2 +- internal/service/batch/job_queue_data_source.go | 4 ++-- internal/service/batch/job_queue_data_source_test.go | 4 ++-- internal/service/batch/job_queue_schema.go | 2 +- internal/service/batch/job_queue_test.go | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/batch/job_queue.go b/internal/service/batch/job_queue.go index 0ed0652413c..9e41a479d96 100644 --- a/internal/service/batch/job_queue.go +++ b/internal/service/batch/job_queue.go @@ -92,7 +92,7 @@ func (r *resourceJobQueue) Schema(ctx context.Context, request resource.SchemaRe "must be up to 128 letters (uppercase and lowercase), numbers, underscores and dashes, and must start with an alphanumeric"), }, }, - "priority": schema.Int64Attribute{ + names.AttrPriority: schema.Int64Attribute{ Required: true, }, "scheduling_policy_arn": schema.StringAttribute{ diff --git a/internal/service/batch/job_queue_data_source.go b/internal/service/batch/job_queue_data_source.go index 054585247e0..8c42ca387d7 100644 --- a/internal/service/batch/job_queue_data_source.go +++ b/internal/service/batch/job_queue_data_source.go @@ -55,7 +55,7 @@ func DataSourceJobQueue() *schema.Resource { names.AttrTags: tftags.TagsSchemaComputed(), - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Computed: true, }, @@ -109,7 +109,7 @@ func dataSourceJobQueueRead(ctx context.Context, d *schema.ResourceData, meta in d.Set(names.AttrStatus, jobQueue.Status) d.Set("status_reason", jobQueue.StatusReason) d.Set(names.AttrState, jobQueue.State) - d.Set("priority", jobQueue.Priority) + d.Set(names.AttrPriority, jobQueue.Priority) ceos := make([]map[string]interface{}, 0) for _, v := range jobQueue.ComputeEnvironmentOrder { diff --git a/internal/service/batch/job_queue_data_source_test.go b/internal/service/batch/job_queue_data_source_test.go index 3efe79ac983..02c662ec7e0 100644 --- a/internal/service/batch/job_queue_data_source_test.go +++ b/internal/service/batch/job_queue_data_source_test.go @@ -30,7 +30,7 @@ func TestAccBatchJobQueueDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(datasourceName, "compute_environment_order.#", resourceName, "compute_environments.#"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), - resource.TestCheckResourceAttrPair(datasourceName, "priority", resourceName, "priority"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrPriority, resourceName, names.AttrPriority), resource.TestCheckResourceAttrPair(datasourceName, "scheduling_policy_arn", resourceName, "scheduling_policy_arn"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrState, resourceName, names.AttrState), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), @@ -57,7 +57,7 @@ func TestAccBatchJobQueueDataSource_schedulingPolicy(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(datasourceName, "compute_environment_order.#", resourceName, "compute_environments.#"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), - resource.TestCheckResourceAttrPair(datasourceName, "priority", resourceName, "priority"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrPriority, resourceName, names.AttrPriority), resource.TestCheckResourceAttrPair(datasourceName, "scheduling_policy_arn", resourceName, "scheduling_policy_arn"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrState, resourceName, names.AttrState), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), diff --git a/internal/service/batch/job_queue_schema.go b/internal/service/batch/job_queue_schema.go index b9291e0ff22..e8e1a272eb9 100644 --- a/internal/service/batch/job_queue_schema.go +++ b/internal/service/batch/job_queue_schema.go @@ -42,7 +42,7 @@ func jobQueueSchema0(ctx context.Context) schema.Schema { "must be up to 128 letters (uppercase and lowercase), numbers, underscores and dashes, and must start with an alphanumeric"), }, }, - "priority": schema.Int64Attribute{ + names.AttrPriority: schema.Int64Attribute{ Required: true, }, "scheduling_policy_arn": schema.StringAttribute{ diff --git a/internal/service/batch/job_queue_test.go b/internal/service/batch/job_queue_test.go index 3f83cf1397d..080cea406bd 100644 --- a/internal/service/batch/job_queue_test.go +++ b/internal/service/batch/job_queue_test.go @@ -54,7 +54,7 @@ func TestAccBatchJobQueue_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "compute_environments.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "compute_environments.0", "aws_batch_compute_environment.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "priority", "1"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "1"), resource.TestCheckResourceAttr(resourceName, names.AttrState, batch.JQStateEnabled), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), @@ -88,7 +88,7 @@ func TestAccBatchJobQueue_basicCEO(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "compute_environment_order.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "compute_environment_order.0.compute_environment", "aws_batch_compute_environment.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "priority", "1"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "1"), resource.TestCheckResourceAttr(resourceName, names.AttrState, batch.JQStateEnabled), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), @@ -314,14 +314,14 @@ func TestAccBatchJobQueue_priority(t *testing.T) { Config: testAccJobQueueConfig_priority(rName, 1), Check: resource.ComposeTestCheckFunc( testAccCheckJobQueueExists(ctx, resourceName, &jobQueue1), - resource.TestCheckResourceAttr(resourceName, "priority", "1"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "1"), ), }, { Config: testAccJobQueueConfig_priority(rName, 2), Check: resource.ComposeTestCheckFunc( testAccCheckJobQueueExists(ctx, resourceName, &jobQueue2), - resource.TestCheckResourceAttr(resourceName, "priority", "2"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "2"), ), }, { From 13261a0e0ed8fd82c13001959158304d616f2fbd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:03 -0400 Subject: [PATCH 1063/1490] chime: Use constant for priority strings --- internal/service/chime/voice_connector_group.go | 6 +++--- internal/service/chime/voice_connector_origination.go | 6 +++--- internal/service/chime/voice_connector_origination_test.go | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/chime/voice_connector_group.go b/internal/service/chime/voice_connector_group.go index b53b68615df..42d80c6f73f 100644 --- a/internal/service/chime/voice_connector_group.go +++ b/internal/service/chime/voice_connector_group.go @@ -45,7 +45,7 @@ func ResourceVoiceConnectorGroup() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 256), }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, ValidateFunc: validation.IntBetween(1, 99), @@ -174,7 +174,7 @@ func expandVoiceConnectorItems(data []interface{}) []awstypes.VoiceConnectorItem item := rItem.(map[string]interface{}) connectorsItems = append(connectorsItems, awstypes.VoiceConnectorItem{ VoiceConnectorId: aws.String(item["voice_connector_id"].(string)), - Priority: aws.Int32(int32(item["priority"].(int))), + Priority: aws.Int32(int32(item[names.AttrPriority].(int))), }) } @@ -186,7 +186,7 @@ func flattenVoiceConnectorItems(connectors []awstypes.VoiceConnectorItem) []inte for _, c := range connectors { rawC := map[string]interface{}{ - "priority": c.Priority, + names.AttrPriority: c.Priority, "voice_connector_id": aws.ToString(c.VoiceConnectorId), } rawConnectors = append(rawConnectors, rawC) diff --git a/internal/service/chime/voice_connector_origination.go b/internal/service/chime/voice_connector_origination.go index ce968cd95a6..9df678a136d 100644 --- a/internal/service/chime/voice_connector_origination.go +++ b/internal/service/chime/voice_connector_origination.go @@ -57,7 +57,7 @@ func ResourceVoiceConnectorOrigination() *schema.Resource { Default: 5060, ValidateFunc: validation.IsPortNumber, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, ValidateFunc: validation.IntBetween(1, 99), @@ -201,7 +201,7 @@ func expandOriginationRoutes(data []interface{}) []awstypes.OriginationRoute { originationRoutes = append(originationRoutes, awstypes.OriginationRoute{ Host: aws.String(item["host"].(string)), Port: aws.Int32(int32(item[names.AttrPort].(int))), - Priority: aws.Int32(int32(item["priority"].(int))), + Priority: aws.Int32(int32(item[names.AttrPriority].(int))), Protocol: awstypes.OriginationRouteProtocol(item[names.AttrProtocol].(string)), Weight: aws.Int32(int32(item["weight"].(int))), }) @@ -217,7 +217,7 @@ func flattenOriginationRoutes(routes []awstypes.OriginationRoute) []interface{} r := map[string]interface{}{ "host": aws.ToString(route.Host), names.AttrPort: aws.ToInt32(route.Port), - "priority": aws.ToInt32(route.Priority), + names.AttrPriority: aws.ToInt32(route.Priority), names.AttrProtocol: string(route.Protocol), "weight": aws.ToInt32(route.Weight), } diff --git a/internal/service/chime/voice_connector_origination_test.go b/internal/service/chime/voice_connector_origination_test.go index 3e0f5d33143..76b13f7972b 100644 --- a/internal/service/chime/voice_connector_origination_test.go +++ b/internal/service/chime/voice_connector_origination_test.go @@ -40,7 +40,7 @@ func testAccVoiceConnectorOrigination_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "route.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "route.*", map[string]string{ names.AttrProtocol: "TCP", - "priority": "1", + names.AttrPriority: "1", }), ), }, @@ -108,11 +108,11 @@ func testAccVoiceConnectorOrigination_update(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "route.*", map[string]string{ names.AttrProtocol: "TCP", names.AttrPort: "5060", - "priority": "1", + names.AttrPriority: "1", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "route.*", map[string]string{ names.AttrProtocol: "UDP", - "priority": "2", + names.AttrPriority: "2", }), ), }, From 9c802ade4bceeb5839beccbd0aba1d2813babafb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:03 -0400 Subject: [PATCH 1064/1490] chimesdkvoice: Use constant for priority strings --- internal/service/chimesdkvoice/sip_rule.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/chimesdkvoice/sip_rule.go b/internal/service/chimesdkvoice/sip_rule.go index fe45ca6161d..3a7a7909a22 100644 --- a/internal/service/chimesdkvoice/sip_rule.go +++ b/internal/service/chimesdkvoice/sip_rule.go @@ -56,7 +56,7 @@ func ResourceSipRule() *schema.Resource { Required: true, ForceNew: true, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, ValidateFunc: validation.IntAtLeast(1), @@ -180,7 +180,7 @@ func expandSipRuleTargetApplications(data []interface{}) []awstypes.SipRuleTarge item := rItem.(map[string]interface{}) application := awstypes.SipRuleTargetApplication{ SipMediaApplicationId: aws.String(item["sip_media_application_id"].(string)), - Priority: aws.Int32(int32(item["priority"].(int))), + Priority: aws.Int32(int32(item[names.AttrPriority].(int))), AwsRegion: aws.String(item["aws_region"].(string)), } @@ -196,7 +196,7 @@ func flattenSipRuleTargetApplications(apiObject []awstypes.SipRuleTargetApplicat for _, e := range apiObject { rawTargetApplication := map[string]interface{}{ "sip_media_application_id": aws.ToString(e.SipMediaApplicationId), - "priority": e.Priority, + names.AttrPriority: e.Priority, "aws_region": aws.ToString(e.AwsRegion), } From 5ad5b60023f57e6be07198864a62fc465c938f48 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:04 -0400 Subject: [PATCH 1065/1490] cognitoidp: Use constant for priority strings --- internal/service/cognitoidp/user_pool.go | 8 ++++---- internal/service/cognitoidp/user_pool_test.go | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/cognitoidp/user_pool.go b/internal/service/cognitoidp/user_pool.go index 881f054d0c1..c34d6079a7a 100644 --- a/internal/service/cognitoidp/user_pool.go +++ b/internal/service/cognitoidp/user_pool.go @@ -62,7 +62,7 @@ func resourceUserPool() *schema.Resource { Required: true, ValidateFunc: validation.StringInSlice(cognitoidentityprovider.RecoveryOptionNameType_Values(), false), }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, @@ -1319,7 +1319,7 @@ func expandUserPoolAccountRecoverySettingConfig(config map[string]interface{}) * opt.Name = aws.String(v.(string)) } - if v, ok := param["priority"]; ok { + if v, ok := param[names.AttrPriority]; ok { opt.Priority = aws.Int64(int64(v.(int))) } @@ -1343,8 +1343,8 @@ func flattenUserPoolAccountRecoverySettingConfig(config *cognitoidentityprovider for _, conf := range config.RecoveryMechanisms { mech := map[string]interface{}{ - names.AttrName: aws.StringValue(conf.Name), - "priority": aws.Int64Value(conf.Priority), + names.AttrName: aws.StringValue(conf.Name), + names.AttrPriority: aws.Int64Value(conf.Priority), } mechanisms = append(mechanisms, mech) } diff --git a/internal/service/cognitoidp/user_pool_test.go b/internal/service/cognitoidp/user_pool_test.go index afb9f7cf91a..c701e5388cb 100644 --- a/internal/service/cognitoidp/user_pool_test.go +++ b/internal/service/cognitoidp/user_pool_test.go @@ -141,8 +141,8 @@ func TestAccCognitoIDPUserPool_recovery(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "account_recovery_setting.#", "1"), resource.TestCheckResourceAttr(resourceName, "account_recovery_setting.0.recovery_mechanism.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "account_recovery_setting.0.recovery_mechanism.*", map[string]string{ - names.AttrName: "verified_email", - "priority": "1", + names.AttrName: "verified_email", + names.AttrPriority: "1", }), ), }, @@ -159,12 +159,12 @@ func TestAccCognitoIDPUserPool_recovery(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "account_recovery_setting.#", "1"), resource.TestCheckResourceAttr(resourceName, "account_recovery_setting.0.recovery_mechanism.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "account_recovery_setting.0.recovery_mechanism.*", map[string]string{ - names.AttrName: "verified_email", - "priority": "1", + names.AttrName: "verified_email", + names.AttrPriority: "1", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "account_recovery_setting.0.recovery_mechanism.*", map[string]string{ - names.AttrName: "verified_phone_number", - "priority": "2", + names.AttrName: "verified_phone_number", + names.AttrPriority: "2", }), ), }, @@ -176,8 +176,8 @@ func TestAccCognitoIDPUserPool_recovery(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "account_recovery_setting.#", "1"), resource.TestCheckResourceAttr(resourceName, "account_recovery_setting.0.recovery_mechanism.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "account_recovery_setting.0.recovery_mechanism.*", map[string]string{ - names.AttrName: "verified_phone_number", - "priority": "1", + names.AttrName: "verified_phone_number", + names.AttrPriority: "1", }), ), }, From 76ddda0164bc6feb822e4fff52bfa18687d36b18 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:04 -0400 Subject: [PATCH 1066/1490] connect: Use constant for priority strings --- internal/service/connect/routing_profile.go | 16 +- .../connect/routing_profile_data_source.go | 2 +- .../service/connect/routing_profile_test.go | 152 +++++++++--------- 3 files changed, 85 insertions(+), 85 deletions(-) diff --git a/internal/service/connect/routing_profile.go b/internal/service/connect/routing_profile.go index 1faec9fa3f8..eb77a77bff4 100644 --- a/internal/service/connect/routing_profile.go +++ b/internal/service/connect/routing_profile.go @@ -102,7 +102,7 @@ func ResourceRoutingProfile() *schema.Resource { Required: true, ValidateFunc: validation.IntBetween(0, 9999), }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, ValidateFunc: validation.IntBetween(1, 99), @@ -445,7 +445,7 @@ func expandRoutingProfileQueueConfigs(queueConfigs []interface{}) []*connect.Rou data := queueConfig.(map[string]interface{}) queueConfigExpanded := &connect.RoutingProfileQueueConfig{ Delay: aws.Int64(int64(data["delay"].(int))), - Priority: aws.Int64(int64(data["priority"].(int))), + Priority: aws.Int64(int64(data[names.AttrPriority].(int))), } qr := connect.RoutingProfileQueueReference{ @@ -500,12 +500,12 @@ func getRoutingProfileQueueConfigs(ctx context.Context, conn *connect.Connect, i } values := map[string]interface{}{ - "channel": aws.StringValue(qc.Channel), - "delay": aws.Int64Value(qc.Delay), - "priority": aws.Int64Value(qc.Priority), - "queue_arn": aws.StringValue(qc.QueueArn), - "queue_id": aws.StringValue(qc.QueueId), - "queue_name": aws.StringValue(qc.QueueName), + "channel": aws.StringValue(qc.Channel), + "delay": aws.Int64Value(qc.Delay), + names.AttrPriority: aws.Int64Value(qc.Priority), + "queue_arn": aws.StringValue(qc.QueueArn), + "queue_id": aws.StringValue(qc.QueueId), + "queue_name": aws.StringValue(qc.QueueName), } queueConfigsList = append(queueConfigsList, values) diff --git a/internal/service/connect/routing_profile_data_source.go b/internal/service/connect/routing_profile_data_source.go index 99bbc8cde10..cbd5565e37e 100644 --- a/internal/service/connect/routing_profile_data_source.go +++ b/internal/service/connect/routing_profile_data_source.go @@ -75,7 +75,7 @@ func DataSourceRoutingProfile() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/connect/routing_profile_test.go b/internal/service/connect/routing_profile_test.go index 9f0f1cb1e5b..3bcdf992ec9 100644 --- a/internal/service/connect/routing_profile_test.go +++ b/internal/service/connect/routing_profile_test.go @@ -407,83 +407,83 @@ func testAccRoutingProfile_createQueueConfigsBatchedAssociateDisassociate(t *tes testAccCheckRoutingProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "queue_configs.#", "16"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "1", - "priority": "1", + "delay": "1", + names.AttrPriority: "1", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.0", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "2", - "priority": "2", + "delay": "2", + names.AttrPriority: "2", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.1", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "3", - "priority": "3", + "delay": "3", + names.AttrPriority: "3", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.2", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "4", - "priority": "4", + "delay": "4", + names.AttrPriority: "4", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.3", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "5", - "priority": "5", + "delay": "5", + names.AttrPriority: "5", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.4", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "6", - "priority": "6", + "delay": "6", + names.AttrPriority: "6", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.5", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "7", - "priority": "7", + "delay": "7", + names.AttrPriority: "7", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.6", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "8", - "priority": "8", + "delay": "8", + names.AttrPriority: "8", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.7", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "9", - "priority": "9", + "delay": "9", + names.AttrPriority: "9", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.8", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "10", - "priority": "10", + "delay": "10", + names.AttrPriority: "10", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.9", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "11", - "priority": "11", + "delay": "11", + names.AttrPriority: "11", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.10", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "12", - "priority": "12", + "delay": "12", + names.AttrPriority: "12", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.11", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "13", - "priority": "13", + "delay": "13", + names.AttrPriority: "13", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.12", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "14", - "priority": "14", + "delay": "14", + names.AttrPriority: "14", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.13", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "15", - "priority": "15", + "delay": "15", + names.AttrPriority: "15", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.14", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "16", - "priority": "16", + "delay": "16", + names.AttrPriority: "16", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.15", "queue_id"), ), @@ -499,13 +499,13 @@ func testAccRoutingProfile_createQueueConfigsBatchedAssociateDisassociate(t *tes testAccCheckRoutingProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "queue_configs.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "1", - "priority": "1", + "delay": "1", + names.AttrPriority: "1", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.0", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "2", - "priority": "2", + "delay": "2", + names.AttrPriority: "2", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.1", "queue_id")), }, @@ -533,13 +533,13 @@ func testAccRoutingProfile_updateQueueConfigsBatchedAssociateDisassociate(t *tes testAccCheckRoutingProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "queue_configs.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "1", - "priority": "1", + "delay": "1", + names.AttrPriority: "1", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.0", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "2", - "priority": "2", + "delay": "2", + names.AttrPriority: "2", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.1", "queue_id")), }, @@ -554,83 +554,83 @@ func testAccRoutingProfile_updateQueueConfigsBatchedAssociateDisassociate(t *tes testAccCheckRoutingProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "queue_configs.#", "16"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "1", - "priority": "1", + "delay": "1", + names.AttrPriority: "1", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.0", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "2", - "priority": "2", + "delay": "2", + names.AttrPriority: "2", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.1", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "3", - "priority": "3", + "delay": "3", + names.AttrPriority: "3", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.2", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "4", - "priority": "4", + "delay": "4", + names.AttrPriority: "4", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.3", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "5", - "priority": "5", + "delay": "5", + names.AttrPriority: "5", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.4", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "6", - "priority": "6", + "delay": "6", + names.AttrPriority: "6", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.5", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "7", - "priority": "7", + "delay": "7", + names.AttrPriority: "7", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.6", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "8", - "priority": "8", + "delay": "8", + names.AttrPriority: "8", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.7", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "9", - "priority": "9", + "delay": "9", + names.AttrPriority: "9", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.8", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "10", - "priority": "10", + "delay": "10", + names.AttrPriority: "10", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.9", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "11", - "priority": "11", + "delay": "11", + names.AttrPriority: "11", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.10", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "12", - "priority": "12", + "delay": "12", + names.AttrPriority: "12", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.11", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "13", - "priority": "13", + "delay": "13", + names.AttrPriority: "13", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.12", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "14", - "priority": "14", + "delay": "14", + names.AttrPriority: "14", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.13", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "15", - "priority": "15", + "delay": "15", + names.AttrPriority: "15", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.14", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "16", - "priority": "16", + "delay": "16", + names.AttrPriority: "16", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.15", "queue_id"), ), @@ -641,13 +641,13 @@ func testAccRoutingProfile_updateQueueConfigsBatchedAssociateDisassociate(t *tes testAccCheckRoutingProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "queue_configs.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "1", - "priority": "1", + "delay": "1", + names.AttrPriority: "1", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.0", "queue_id"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "queue_configs.*", map[string]string{ - "delay": "2", - "priority": "2", + "delay": "2", + names.AttrPriority: "2", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "queue_configs.*.queue_id", "aws_connect_queue.test.1", "queue_id"), ), From 04b171b27b8eae8902050f0ddb1e8e2d01459d3d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:04 -0400 Subject: [PATCH 1067/1490] ec2: Use constant for priority strings --- internal/service/ec2/ec2_fleet.go | 6 +++--- internal/service/ec2/ec2_spot_fleet_request.go | 6 +++--- internal/service/ec2/ec2_spot_fleet_request_test.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/ec2/ec2_fleet.go b/internal/service/ec2/ec2_fleet.go index 51ae5a510b1..6db388018a4 100644 --- a/internal/service/ec2/ec2_fleet.go +++ b/internal/service/ec2/ec2_fleet.go @@ -449,7 +449,7 @@ func ResourceFleet() *schema.Resource { // }, // }, // }, - "priority": { + names.AttrPriority: { Type: schema.TypeFloat, Optional: true, }, @@ -1086,7 +1086,7 @@ func expandFleetLaunchTemplateOverridesRequest(tfMap map[string]interface{}) *ec if v, ok := tfMap["placement"]; ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { apiObject.Placement = expandPlacement(v.([]interface{})[0].(map[string]interface{})) } - if v, ok := tfMap["priority"].(float64); ok && v != 0 { + if v, ok := tfMap[names.AttrPriority].(float64); ok && v != 0 { apiObject.Priority = aws.Float64(v) } @@ -1457,7 +1457,7 @@ func flattenFleetLaunchTemplateOverrides(apiObject *ec2.FleetLaunchTemplateOverr } if v := apiObject.Priority; v != nil { - tfMap["priority"] = aws.Float64Value(v) + tfMap[names.AttrPriority] = aws.Float64Value(v) } if v := apiObject.SubnetId; v != nil { diff --git a/internal/service/ec2/ec2_spot_fleet_request.go b/internal/service/ec2/ec2_spot_fleet_request.go index e2970d44d95..ffd1d570cfe 100644 --- a/internal/service/ec2/ec2_spot_fleet_request.go +++ b/internal/service/ec2/ec2_spot_fleet_request.go @@ -720,7 +720,7 @@ func ResourceSpotFleetRequest() *schema.Resource { Optional: true, ForceNew: true, }, - "priority": { + names.AttrPriority: { Type: schema.TypeFloat, Optional: true, Computed: true, @@ -1546,7 +1546,7 @@ func expandLaunchTemplateOverrides(tfMap map[string]interface{}) *ec2.LaunchTemp apiObject.InstanceType = aws.String(v) } - if v, ok := tfMap["priority"].(float64); ok && v != 0.0 { + if v, ok := tfMap[names.AttrPriority].(float64); ok && v != 0.0 { apiObject.Priority = aws.Float64(v) } @@ -2194,7 +2194,7 @@ func flattenLaunchTemplateOverrides(apiObject *ec2.LaunchTemplateOverrides) map[ } if v := apiObject.Priority; v != nil { - tfMap["priority"] = aws.Float64Value(v) + tfMap[names.AttrPriority] = aws.Float64Value(v) } if v := apiObject.SpotPrice; v != nil { diff --git a/internal/service/ec2/ec2_spot_fleet_request_test.go b/internal/service/ec2/ec2_spot_fleet_request_test.go index 2a79e9162be..d5697e14700 100644 --- a/internal/service/ec2/ec2_spot_fleet_request_test.go +++ b/internal/service/ec2/ec2_spot_fleet_request_test.go @@ -360,7 +360,7 @@ func TestAccEC2SpotFleetRequest_launchTemplateWithInstanceTypeOverrides(t *testi resource.TestCheckTypeSetElemNestedAttrs(resourceName, "launch_template_config.*.overrides.*", map[string]string{ "instance_requirements.#": "0", names.AttrInstanceType: "m3.medium", - "priority": "1", + names.AttrPriority: "1", "spot_price": "0.26", }), ), From 020b25016c8ba921e0a770df78c377e803eccd3d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:05 -0400 Subject: [PATCH 1068/1490] ecr: Use constant for priority strings --- internal/service/ecr/lifecycle_policy_document_data_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/ecr/lifecycle_policy_document_data_source.go b/internal/service/ecr/lifecycle_policy_document_data_source.go index 02e336ba621..cb821e5c4c0 100644 --- a/internal/service/ecr/lifecycle_policy_document_data_source.go +++ b/internal/service/ecr/lifecycle_policy_document_data_source.go @@ -52,7 +52,7 @@ func (d *lifecyclePolicyDocumentDataSource) Schema(ctx context.Context, request names.AttrDescription: schema.StringAttribute{ Optional: true, }, - "priority": schema.Int64Attribute{ + names.AttrPriority: schema.Int64Attribute{ Required: true, Validators: []validator.Int64{ int64validator.AtLeast(1), From 323d8c3ad870f91c58345d842e866c38208147e0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:05 -0400 Subject: [PATCH 1069/1490] elbv2: Use constant for priority strings --- internal/service/elbv2/listener_rule.go | 12 ++-- internal/service/elbv2/listener_rule_test.go | 74 ++++++++++---------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/internal/service/elbv2/listener_rule.go b/internal/service/elbv2/listener_rule.go index 075ed753674..a2b1e04f930 100644 --- a/internal/service/elbv2/listener_rule.go +++ b/internal/service/elbv2/listener_rule.go @@ -69,7 +69,7 @@ func ResourceListenerRule() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Optional: true, Computed: true, @@ -603,12 +603,12 @@ func resourceListenerRuleRead(ctx context.Context, d *schema.ResourceData, meta // Rules are evaluated in priority order, from the lowest value to the highest value. The default rule has the lowest priority. if aws.ToString(rule.Priority) == "default" { - d.Set("priority", listenerRulePriorityDefault) + d.Set(names.AttrPriority, listenerRulePriorityDefault) } else { if priority, err := strconv.Atoi(aws.ToString(rule.Priority)); err != nil { return sdkdiag.AppendErrorf(diags, "Cannot convert rule priority %q to int: %s", aws.ToString(rule.Priority), err) } else { - d.Set("priority", priority) + d.Set(names.AttrPriority, priority) } } @@ -685,12 +685,12 @@ func resourceListenerRuleUpdate(ctx context.Context, d *schema.ResourceData, met conn := meta.(*conns.AWSClient).ELBV2Client(ctx) if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll) { - if d.HasChange("priority") { + if d.HasChange(names.AttrPriority) { params := &elasticloadbalancingv2.SetRulePrioritiesInput{ RulePriorities: []awstypes.RulePriorityPair{ { RuleArn: aws.String(d.Id()), - Priority: aws.Int32(int32(d.Get("priority").(int))), + Priority: aws.Int32(int32(d.Get(names.AttrPriority).(int))), }, }, } @@ -753,7 +753,7 @@ func resourceListenerRuleDelete(ctx context.Context, d *schema.ResourceData, met func retryListenerRuleCreate(ctx context.Context, conn *elasticloadbalancingv2.Client, d *schema.ResourceData, params *elasticloadbalancingv2.CreateRuleInput, listenerARN string) (*elasticloadbalancingv2.CreateRuleOutput, error) { var resp *elasticloadbalancingv2.CreateRuleOutput - if v, ok := d.GetOk("priority"); ok { + if v, ok := d.GetOk(names.AttrPriority); ok { var err error params.Priority = aws.Int32(int32(v.(int))) resp, err = conn.CreateRule(ctx, params) diff --git a/internal/service/elbv2/listener_rule_test.go b/internal/service/elbv2/listener_rule_test.go index 6c73be82eb8..627262d3833 100644 --- a/internal/service/elbv2/listener_rule_test.go +++ b/internal/service/elbv2/listener_rule_test.go @@ -89,7 +89,7 @@ func TestAccELBV2ListenerRule_basic(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, rName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", listenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "forward"), @@ -257,7 +257,7 @@ func TestAccELBV2ListenerRule_forwardWeighted(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "forward"), @@ -278,7 +278,7 @@ func TestAccELBV2ListenerRule_forwardWeighted(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "forward"), @@ -299,7 +299,7 @@ func TestAccELBV2ListenerRule_forwardWeighted(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "forward"), @@ -903,7 +903,7 @@ func TestAccELBV2ListenerRule_backwardsCompatibility(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "forward"), @@ -949,7 +949,7 @@ func TestAccELBV2ListenerRule_redirect(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "redirect"), @@ -973,7 +973,7 @@ func TestAccELBV2ListenerRule_redirect(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "redirect"), @@ -997,7 +997,7 @@ func TestAccELBV2ListenerRule_redirect(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "redirect"), @@ -1039,7 +1039,7 @@ func TestAccELBV2ListenerRule_fixedResponse(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "fixed-response"), @@ -1106,7 +1106,7 @@ func TestAccELBV2ListenerRule_updateRulePriority(t *testing.T) { Config: testAccListenerRuleConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckListenerRuleExists(ctx, resourceName, &before), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), ), }, { @@ -1114,7 +1114,7 @@ func TestAccELBV2ListenerRule_updateRulePriority(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckListenerRuleExists(ctx, resourceName, &after), testAccCheckListenerRuleNotRecreated(t, &before, &after), - resource.TestCheckResourceAttr(resourceName, "priority", "101"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "101"), ), }, }, @@ -1169,36 +1169,36 @@ func TestAccELBV2ListenerRule_priority(t *testing.T) { Config: testAccListenerRuleConfig_priorityFirst(rName), Check: resource.ComposeTestCheckFunc( testAccCheckListenerRuleExists(ctx, "aws_lb_listener_rule.first", &rule), - resource.TestCheckResourceAttr("aws_lb_listener_rule.first", "priority", "1"), - resource.TestCheckResourceAttr("aws_lb_listener_rule.third", "priority", "3"), + resource.TestCheckResourceAttr("aws_lb_listener_rule.first", names.AttrPriority, "1"), + resource.TestCheckResourceAttr("aws_lb_listener_rule.third", names.AttrPriority, "3"), ), }, { Config: testAccListenerRuleConfig_priorityLastNoPriority(rName), Check: resource.ComposeTestCheckFunc( testAccCheckListenerRuleExists(ctx, "aws_lb_listener_rule.last", &rule), - resource.TestCheckResourceAttr("aws_lb_listener_rule.last", "priority", "4"), + resource.TestCheckResourceAttr("aws_lb_listener_rule.last", names.AttrPriority, "4"), ), }, { Config: testAccListenerRuleConfig_priorityLastSpecifyPriority(rName, "7"), Check: resource.ComposeTestCheckFunc( testAccCheckListenerRuleExists(ctx, "aws_lb_listener_rule.last", &rule), - resource.TestCheckResourceAttr("aws_lb_listener_rule.last", "priority", "7"), + resource.TestCheckResourceAttr("aws_lb_listener_rule.last", names.AttrPriority, "7"), ), }, { Config: testAccListenerRuleConfig_priorityLastNoPriority(rName), Check: resource.ComposeTestCheckFunc( testAccCheckListenerRuleExists(ctx, "aws_lb_listener_rule.last", &rule), - resource.TestCheckResourceAttr("aws_lb_listener_rule.last", "priority", "7"), + resource.TestCheckResourceAttr("aws_lb_listener_rule.last", names.AttrPriority, "7"), ), }, { Config: testAccListenerRuleConfig_priorityLastSpecifyPriority(rName, "6"), Check: resource.ComposeTestCheckFunc( testAccCheckListenerRuleExists(ctx, "aws_lb_listener_rule.last", &rule), - resource.TestCheckResourceAttr("aws_lb_listener_rule.last", "priority", "6"), + resource.TestCheckResourceAttr("aws_lb_listener_rule.last", names.AttrPriority, "6"), ), }, { @@ -1214,23 +1214,23 @@ func TestAccELBV2ListenerRule_priority(t *testing.T) { testAccCheckListenerRuleExists(ctx, "aws_lb_listener_rule.parallelism.7", &rule), testAccCheckListenerRuleExists(ctx, "aws_lb_listener_rule.parallelism.8", &rule), testAccCheckListenerRuleExists(ctx, "aws_lb_listener_rule.parallelism.9", &rule), - resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.0", "priority"), - resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.1", "priority"), - resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.2", "priority"), - resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.3", "priority"), - resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.4", "priority"), - resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.5", "priority"), - resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.6", "priority"), - resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.7", "priority"), - resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.8", "priority"), - resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.9", "priority"), + resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.0", names.AttrPriority), + resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.1", names.AttrPriority), + resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.2", names.AttrPriority), + resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.3", names.AttrPriority), + resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.4", names.AttrPriority), + resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.5", names.AttrPriority), + resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.6", names.AttrPriority), + resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.7", names.AttrPriority), + resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.8", names.AttrPriority), + resource.TestCheckResourceAttrSet("aws_lb_listener_rule.parallelism.9", names.AttrPriority), ), }, { Config: testAccListenerRuleConfig_priority50000(rName), Check: resource.ComposeTestCheckFunc( testAccCheckListenerRuleExists(ctx, "aws_lb_listener_rule.priority50000", &rule), - resource.TestCheckResourceAttr("aws_lb_listener_rule.priority50000", "priority", "50000"), + resource.TestCheckResourceAttr("aws_lb_listener_rule.priority50000", names.AttrPriority, "50000"), ), }, { @@ -1270,7 +1270,7 @@ func TestAccELBV2ListenerRule_cognito(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, rName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", listenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "2"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "authenticate-cognito"), @@ -1311,7 +1311,7 @@ func TestAccELBV2ListenerRule_oidc(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, rName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", listenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "2"), resource.TestCheckResourceAttr(resourceName, "action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "action.0.type", "authenticate-oidc"), @@ -1607,7 +1607,7 @@ func TestAccELBV2ListenerRule_conditionHostHeader(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "condition.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "condition.*", map[string]string{ @@ -1647,7 +1647,7 @@ func TestAccELBV2ListenerRule_conditionHTTPHeader(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "condition.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "condition.*", map[string]string{ @@ -1715,7 +1715,7 @@ func TestAccELBV2ListenerRule_conditionHTTPRequestMethod(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "condition.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "condition.*", map[string]string{ @@ -1755,7 +1755,7 @@ func TestAccELBV2ListenerRule_conditionPathPattern(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "condition.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "condition.*", map[string]string{ @@ -1795,7 +1795,7 @@ func TestAccELBV2ListenerRule_conditionQueryString(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "condition.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "condition.*", map[string]string{ @@ -1859,7 +1859,7 @@ func TestAccELBV2ListenerRule_conditionSourceIP(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "condition.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "condition.*", map[string]string{ @@ -1978,7 +1978,7 @@ func TestAccELBV2ListenerRule_conditionMultiple(t *testing.T) { testAccCheckListenerRuleExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile(fmt.Sprintf(`listener-rule/app/%s/.+$`, lbName))), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", frontEndListenerResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), resource.TestCheckResourceAttr(resourceName, "action.#", "1"), resource.TestCheckResourceAttr(resourceName, "condition.#", "5"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "condition.*", map[string]string{ From 9e12ecca446d0ff9d8ba15b502120460deda37d2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:05 -0400 Subject: [PATCH 1070/1490] lexmodels: Use constant for priority strings --- internal/service/lexmodels/intent.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/lexmodels/intent.go b/internal/service/lexmodels/intent.go index 5de179620cd..7b1549f0942 100644 --- a/internal/service/lexmodels/intent.go +++ b/internal/service/lexmodels/intent.go @@ -200,7 +200,7 @@ func ResourceIntent() *schema.Resource { validation.StringMatch(regexache.MustCompile(`^([A-Za-z]_?)+$`), ""), ), }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Optional: true, Default: 0, @@ -753,10 +753,10 @@ func expandPrompt(rawObject interface{}) (prompt *lexmodelbuildingservice.Prompt func flattenSlots(slots []*lexmodelbuildingservice.Slot) (flattenedSlots []map[string]interface{}) { for _, slot := range slots { flattenedSlot := map[string]interface{}{ - names.AttrName: aws.StringValue(slot.Name), - "priority": aws.Int64Value(slot.Priority), - "slot_constraint": aws.StringValue(slot.SlotConstraint), - "slot_type": aws.StringValue(slot.SlotType), + names.AttrName: aws.StringValue(slot.Name), + names.AttrPriority: aws.Int64Value(slot.Priority), + "slot_constraint": aws.StringValue(slot.SlotConstraint), + "slot_type": aws.StringValue(slot.SlotType), } if slot.Description != nil { @@ -799,7 +799,7 @@ func expandSlots(rawValues []interface{}) []*lexmodelbuildingservice.Slot { slot := &lexmodelbuildingservice.Slot{ Name: aws.String(value[names.AttrName].(string)), - Priority: aws.Int64(int64(value["priority"].(int))), + Priority: aws.Int64(int64(value[names.AttrPriority].(int))), SlotConstraint: aws.String(value["slot_constraint"].(string)), SlotType: aws.String(value["slot_type"].(string)), } From 8d69ee15851f31811f8c29a1ec979f8ed16f07ed Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:05 -0400 Subject: [PATCH 1071/1490] lexv2models: Use constant for priority strings --- internal/service/lexv2models/intent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/lexv2models/intent.go b/internal/service/lexv2models/intent.go index 2a9032956b0..4f8a756642b 100644 --- a/internal/service/lexv2models/intent.go +++ b/internal/service/lexv2models/intent.go @@ -66,7 +66,7 @@ func (r *resourceIntent) Schema(ctx context.Context, req resource.SchemaRequest, CustomType: fwtypes.NewListNestedObjectTypeOf[SlotPriority](ctx), NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "priority": schema.Int64Attribute{ + names.AttrPriority: schema.Int64Attribute{ Required: true, }, "slot_id": schema.StringAttribute{ From ba99efe3e470d5ca18cf22c3b4d8f52c908d3d9d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:05 -0400 Subject: [PATCH 1072/1490] medialive: Use constant for priority strings --- internal/service/medialive/multiplex_program.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/medialive/multiplex_program.go b/internal/service/medialive/multiplex_program.go index 1fc69c323ec..5876c8be438 100644 --- a/internal/service/medialive/multiplex_program.go +++ b/internal/service/medialive/multiplex_program.go @@ -136,7 +136,7 @@ func (m *multiplexProgram) Schema(ctx context.Context, req resource.SchemaReques int64planmodifier.UseStateForUnknown(), }, }, - "priority": schema.Int64Attribute{ + names.AttrPriority: schema.Int64Attribute{ Optional: true, Computed: true, PlanModifiers: []planmodifier.Int64{ @@ -484,9 +484,9 @@ func (sms statmuxSettingsObject) expand(ctx context.Context) *mltypes.MultiplexS var ( statmuxAttrs = map[string]attr.Type{ - "minimum_bitrate": types.Int64Type, - "maximum_bitrate": types.Int64Type, - "priority": types.Int64Type, + "minimum_bitrate": types.Int64Type, + "maximum_bitrate": types.Int64Type, + names.AttrPriority: types.Int64Type, } videoSettingsAttrs = map[string]attr.Type{ @@ -551,7 +551,7 @@ func flattenStatMuxSettings(ctx context.Context, mps *mltypes.MultiplexStatmuxVi attrs := map[string]attr.Value{} attrs["minimum_bitrate"] = flex.Int32ToFramework(ctx, mps.MinimumBitrate) attrs["maximum_bitrate"] = flex.Int32ToFramework(ctx, mps.MaximumBitrate) - attrs["priority"] = flex.Int32ToFramework(ctx, mps.Priority) + attrs[names.AttrPriority] = flex.Int32ToFramework(ctx, mps.Priority) vals := types.ObjectValueMust(statmuxAttrs, attrs) From 9ac34eacf42d12e42ff3e8471ed275f066d6d9d1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:06 -0400 Subject: [PATCH 1073/1490] networkfirewall: Use constant for priority strings --- internal/service/networkfirewall/firewall_policy.go | 12 ++++++------ .../networkfirewall/firewall_policy_data_source.go | 4 ++-- .../service/networkfirewall/firewall_policy_test.go | 12 ++++++------ internal/service/networkfirewall/rule_group.go | 8 ++++---- internal/service/networkfirewall/rule_group_test.go | 6 +++--- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/internal/service/networkfirewall/firewall_policy.go b/internal/service/networkfirewall/firewall_policy.go index 69104f72fbb..bb92d2d2702 100644 --- a/internal/service/networkfirewall/firewall_policy.go +++ b/internal/service/networkfirewall/firewall_policy.go @@ -138,7 +138,7 @@ func ResourceFirewallPolicy() *schema.Resource { }, }, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Optional: true, ValidateFunc: validation.IntAtLeast(1), @@ -167,7 +167,7 @@ func ResourceFirewallPolicy() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, ValidateFunc: validation.IntAtLeast(1), @@ -449,7 +449,7 @@ func expandStatefulRuleGroupReferences(l []interface{}) []*networkfirewall.State } reference := &networkfirewall.StatefulRuleGroupReference{} - if v, ok := tfMap["priority"].(int); ok && v > 0 { + if v, ok := tfMap[names.AttrPriority].(int); ok && v > 0 { reference.Priority = aws.Int64(int64(v)) } if v, ok := tfMap[names.AttrResourceARN].(string); ok && v != "" { @@ -477,7 +477,7 @@ func expandStatelessRuleGroupReferences(l []interface{}) []*networkfirewall.Stat continue } reference := &networkfirewall.StatelessRuleGroupReference{} - if v, ok := tfMap["priority"].(int); ok && v > 0 { + if v, ok := tfMap[names.AttrPriority].(int); ok && v > 0 { reference.Priority = aws.Int64(int64(v)) } if v, ok := tfMap[names.AttrResourceARN].(string); ok && v != "" { @@ -612,7 +612,7 @@ func flattenPolicyStatefulRuleGroupReference(l []*networkfirewall.StatefulRuleGr names.AttrResourceARN: aws.StringValue(ref.ResourceArn), } if ref.Priority != nil { - reference["priority"] = int(aws.Int64Value(ref.Priority)) + reference[names.AttrPriority] = int(aws.Int64Value(ref.Priority)) } if ref.Override != nil { reference["override"] = flattenStatefulRuleGroupOverride(ref.Override) @@ -628,7 +628,7 @@ func flattenPolicyStatelessRuleGroupReference(l []*networkfirewall.StatelessRule references := make([]interface{}, 0, len(l)) for _, ref := range l { reference := map[string]interface{}{ - "priority": int(aws.Int64Value(ref.Priority)), + names.AttrPriority: int(aws.Int64Value(ref.Priority)), names.AttrResourceARN: aws.StringValue(ref.ResourceArn), } references = append(references, reference) diff --git a/internal/service/networkfirewall/firewall_policy_data_source.go b/internal/service/networkfirewall/firewall_policy_data_source.go index b5f8b30cfc7..a53040a7ca0 100644 --- a/internal/service/networkfirewall/firewall_policy_data_source.go +++ b/internal/service/networkfirewall/firewall_policy_data_source.go @@ -77,7 +77,7 @@ func DataSourceFirewallPolicy() *schema.Resource { }, }, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Computed: true, }, @@ -104,7 +104,7 @@ func DataSourceFirewallPolicy() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Computed: true, }, diff --git a/internal/service/networkfirewall/firewall_policy_test.go b/internal/service/networkfirewall/firewall_policy_test.go index 9055f914eeb..4711a5844c8 100644 --- a/internal/service/networkfirewall/firewall_policy_test.go +++ b/internal/service/networkfirewall/firewall_policy_test.go @@ -599,7 +599,7 @@ func TestAccNetworkFirewallFirewallPolicy_statelessRuleGroupReference(t *testing resource.TestCheckResourceAttr(resourceName, "firewall_policy.0.stateless_rule_group_reference.#", "1"), resource.TestCheckTypeSetElemAttrPair(resourceName, "firewall_policy.0.stateless_rule_group_reference.*.resource_arn", ruleGroupResourceName, names.AttrARN), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "firewall_policy.0.stateless_rule_group_reference.*", map[string]string{ - "priority": "20", + names.AttrPriority: "20", }), ), }, @@ -610,7 +610,7 @@ func TestAccNetworkFirewallFirewallPolicy_statelessRuleGroupReference(t *testing resource.TestCheckResourceAttr(resourceName, "firewall_policy.#", "1"), resource.TestCheckResourceAttr(resourceName, "firewall_policy.0.stateless_rule_group_reference.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "firewall_policy.0.stateless_rule_group_reference.*", map[string]string{ - "priority": "1", + names.AttrPriority: "1", }), ), }, @@ -649,7 +649,7 @@ func TestAccNetworkFirewallFirewallPolicy_updateStatelessRuleGroupReference(t *t resource.TestCheckResourceAttr(resourceName, "firewall_policy.#", "1"), resource.TestCheckTypeSetElemAttrPair(resourceName, "firewall_policy.0.stateless_rule_group_reference.*.resource_arn", ruleGroupResourceName, names.AttrARN), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "firewall_policy.0.stateless_rule_group_reference.*", map[string]string{ - "priority": "20", + names.AttrPriority: "20", }), ), }, @@ -692,11 +692,11 @@ func TestAccNetworkFirewallFirewallPolicy_multipleStatelessRuleGroupReferences(t resource.TestCheckResourceAttr(resourceName, "firewall_policy.0.stateless_rule_group_reference.#", "2"), resource.TestCheckTypeSetElemAttrPair(resourceName, "firewall_policy.0.stateless_rule_group_reference.*.resource_arn", ruleGroupResourceName1, names.AttrARN), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "firewall_policy.0.stateless_rule_group_reference.*", map[string]string{ - "priority": "1", + names.AttrPriority: "1", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "firewall_policy.0.stateless_rule_group_reference.*.resource_arn", ruleGroupResourceName2, names.AttrARN), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "firewall_policy.0.stateless_rule_group_reference.*", map[string]string{ - "priority": "2", + names.AttrPriority: "2", }), ), }, @@ -707,7 +707,7 @@ func TestAccNetworkFirewallFirewallPolicy_multipleStatelessRuleGroupReferences(t resource.TestCheckResourceAttr(resourceName, "firewall_policy.#", "1"), resource.TestCheckResourceAttr(resourceName, "firewall_policy.0.stateless_rule_group_reference.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "firewall_policy.0.stateless_rule_group_reference.*", map[string]string{ - "priority": "1", + names.AttrPriority: "1", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "firewall_policy.0.stateless_rule_group_reference.*.resource_arn", ruleGroupResourceName1, names.AttrARN), ), diff --git a/internal/service/networkfirewall/rule_group.go b/internal/service/networkfirewall/rule_group.go index 4701d379e83..899f739b54a 100644 --- a/internal/service/networkfirewall/rule_group.go +++ b/internal/service/networkfirewall/rule_group.go @@ -220,7 +220,7 @@ func ResourceRuleGroup() *schema.Resource { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, @@ -1056,7 +1056,7 @@ func expandStatelessRules(l []interface{}) []*networkfirewall.StatelessRule { continue } statelessRule := &networkfirewall.StatelessRule{} - if v, ok := tfMap["priority"].(int); ok && v > 0 { + if v, ok := tfMap[names.AttrPriority].(int); ok && v > 0 { statelessRule.Priority = aws.Int64(int64(v)) } if v, ok := tfMap["rule_definition"].([]interface{}); ok && len(v) > 0 && v[0] != nil { @@ -1307,8 +1307,8 @@ func flattenStatelessRules(sr []*networkfirewall.StatelessRule) []interface{} { rules := make([]interface{}, 0, len(sr)) for _, s := range sr { rule := map[string]interface{}{ - "priority": int(aws.Int64Value(s.Priority)), - "rule_definition": flattenRuleDefinition(s.RuleDefinition), + names.AttrPriority: int(aws.Int64Value(s.Priority)), + "rule_definition": flattenRuleDefinition(s.RuleDefinition), } rules = append(rules, rule) } diff --git a/internal/service/networkfirewall/rule_group_test.go b/internal/service/networkfirewall/rule_group_test.go index 83cbcd09204..b2225174572 100644 --- a/internal/service/networkfirewall/rule_group_test.go +++ b/internal/service/networkfirewall/rule_group_test.go @@ -227,7 +227,7 @@ func TestAccNetworkFirewallRuleGroup_Basic_statelessRule(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule_group.0.rules_source.#", "1"), resource.TestCheckResourceAttr(resourceName, "rule_group.0.rules_source.0.stateless_rules_and_custom_actions.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule_group.0.rules_source.0.stateless_rules_and_custom_actions.0.stateless_rule.*", map[string]string{ - "priority": "1", + names.AttrPriority: "1", "rule_definition.#": "1", "rule_definition.0.actions.#": "1", "rule_definition.0.match_attributes.#": "1", @@ -388,7 +388,7 @@ func TestAccNetworkFirewallRuleGroup_statelessRuleWithCustomAction(t *testing.T) resource.TestCheckResourceAttr(resourceName, "rule_group.0.rules_source.#", "1"), resource.TestCheckResourceAttr(resourceName, "rule_group.0.rules_source.0.stateless_rules_and_custom_actions.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule_group.0.rules_source.0.stateless_rules_and_custom_actions.0.stateless_rule.*", map[string]string{ - "priority": "1", + names.AttrPriority: "1", "rule_definition.#": "1", "rule_definition.0.actions.#": "2", "rule_definition.0.match_attributes.#": "1", @@ -868,7 +868,7 @@ func TestAccNetworkFirewallRuleGroup_updateStatelessRule(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRuleGroupExists(ctx, resourceName, &ruleGroup), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule_group.0.rules_source.0.stateless_rules_and_custom_actions.0.stateless_rule.*", map[string]string{ - "priority": "10", + names.AttrPriority: "10", "rule_definition.#": "1", "rule_definition.0.actions.#": "1", "rule_definition.0.match_attributes.#": "1", From 256d51e7f145a77aa8d3a65501a27d49938a32d7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:06 -0400 Subject: [PATCH 1074/1490] route53resolver: Use constant for priority strings --- internal/service/route53resolver/firewall_rule.go | 8 ++++---- .../route53resolver/firewall_rule_group_association.go | 10 +++++----- .../firewall_rule_group_association_data_source.go | 4 ++-- ...firewall_rule_group_association_data_source_test.go | 2 +- .../firewall_rule_group_association_test.go | 6 +++--- internal/service/route53resolver/firewall_rule_test.go | 2 +- .../route53resolver/firewall_rules_data_source.go | 8 ++++---- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/internal/service/route53resolver/firewall_rule.go b/internal/service/route53resolver/firewall_rule.go index 91c381df44f..9b5eecdc534 100644 --- a/internal/service/route53resolver/firewall_rule.go +++ b/internal/service/route53resolver/firewall_rule.go @@ -77,7 +77,7 @@ func ResourceFirewallRule() *schema.Resource { Required: true, ValidateFunc: validResolverName, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, @@ -98,7 +98,7 @@ func resourceFirewallRuleCreate(ctx context.Context, d *schema.ResourceData, met FirewallRuleGroupId: aws.String(firewallRuleGroupID), FirewallDomainListId: aws.String(firewallDomainListID), Name: aws.String(name), - Priority: aws.Int64(int64(d.Get("priority").(int))), + Priority: aws.Int64(int64(d.Get(names.AttrPriority).(int))), } if v, ok := d.GetOk("block_override_dns_type"); ok { @@ -157,7 +157,7 @@ func resourceFirewallRuleRead(ctx context.Context, d *schema.ResourceData, meta d.Set("firewall_rule_group_id", firewallRule.FirewallRuleGroupId) d.Set("firewall_domain_list_id", firewallRule.FirewallDomainListId) d.Set(names.AttrName, firewallRule.Name) - d.Set("priority", firewallRule.Priority) + d.Set(names.AttrPriority, firewallRule.Priority) return nil } @@ -176,7 +176,7 @@ func resourceFirewallRuleUpdate(ctx context.Context, d *schema.ResourceData, met FirewallDomainListId: aws.String(firewallDomainListID), FirewallRuleGroupId: aws.String(firewallRuleGroupID), Name: aws.String(d.Get(names.AttrName).(string)), - Priority: aws.Int64(int64(d.Get("priority").(int))), + Priority: aws.Int64(int64(d.Get(names.AttrPriority).(int))), } if v, ok := d.GetOk("block_override_dns_type"); ok { diff --git a/internal/service/route53resolver/firewall_rule_group_association.go b/internal/service/route53resolver/firewall_rule_group_association.go index 3fea634e980..68504d9540c 100644 --- a/internal/service/route53resolver/firewall_rule_group_association.go +++ b/internal/service/route53resolver/firewall_rule_group_association.go @@ -58,7 +58,7 @@ func ResourceFirewallRuleGroupAssociation() *schema.Resource { Required: true, ValidateFunc: validResolverName, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, @@ -83,7 +83,7 @@ func resourceFirewallRuleGroupAssociationCreate(ctx context.Context, d *schema.R CreatorRequestId: aws.String(id.PrefixedUniqueId("tf-r53-rslvr-frgassoc-")), FirewallRuleGroupId: aws.String(d.Get("firewall_rule_group_id").(string)), Name: aws.String(name), - Priority: aws.Int64(int64(d.Get("priority").(int))), + Priority: aws.Int64(int64(d.Get(names.AttrPriority).(int))), Tags: getTagsIn(ctx), VpcId: aws.String(d.Get(names.AttrVPCID).(string)), } @@ -127,7 +127,7 @@ func resourceFirewallRuleGroupAssociationRead(ctx context.Context, d *schema.Res d.Set(names.AttrName, ruleGroupAssociation.Name) d.Set("firewall_rule_group_id", ruleGroupAssociation.FirewallRuleGroupId) d.Set("mutation_protection", ruleGroupAssociation.MutationProtection) - d.Set("priority", ruleGroupAssociation.Priority) + d.Set(names.AttrPriority, ruleGroupAssociation.Priority) d.Set(names.AttrVPCID, ruleGroupAssociation.VpcId) return nil @@ -136,11 +136,11 @@ func resourceFirewallRuleGroupAssociationRead(ctx context.Context, d *schema.Res func resourceFirewallRuleGroupAssociationUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { conn := meta.(*conns.AWSClient).Route53ResolverConn(ctx) - if d.HasChanges(names.AttrName, "mutation_protection", "priority") { + if d.HasChanges(names.AttrName, "mutation_protection", names.AttrPriority) { input := &route53resolver.UpdateFirewallRuleGroupAssociationInput{ FirewallRuleGroupAssociationId: aws.String(d.Id()), Name: aws.String(d.Get(names.AttrName).(string)), - Priority: aws.Int64(int64(d.Get("priority").(int))), + Priority: aws.Int64(int64(d.Get(names.AttrPriority).(int))), } if v, ok := d.GetOk("mutation_protection"); ok { diff --git a/internal/service/route53resolver/firewall_rule_group_association_data_source.go b/internal/service/route53resolver/firewall_rule_group_association_data_source.go index 44cc7ab237c..019563a272f 100644 --- a/internal/service/route53resolver/firewall_rule_group_association_data_source.go +++ b/internal/service/route53resolver/firewall_rule_group_association_data_source.go @@ -55,7 +55,7 @@ func DataSourceFirewallRuleGroupAssociation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Computed: true, }, @@ -95,7 +95,7 @@ func dataSourceRuleGroupAssociationRead(ctx context.Context, d *schema.ResourceD d.Set("modification_time", ruleGroupAssociation.ModificationTime) d.Set("mutation_protection", ruleGroupAssociation.MutationProtection) d.Set(names.AttrName, ruleGroupAssociation.Name) - d.Set("priority", ruleGroupAssociation.Priority) + d.Set(names.AttrPriority, ruleGroupAssociation.Priority) d.Set(names.AttrStatus, ruleGroupAssociation.Status) d.Set("status_message", ruleGroupAssociation.StatusMessage) d.Set(names.AttrVPCID, ruleGroupAssociation.VpcId) diff --git a/internal/service/route53resolver/firewall_rule_group_association_data_source_test.go b/internal/service/route53resolver/firewall_rule_group_association_data_source_test.go index 46c63e00f5b..5cf9e1c2c9e 100644 --- a/internal/service/route53resolver/firewall_rule_group_association_data_source_test.go +++ b/internal/service/route53resolver/firewall_rule_group_association_data_source_test.go @@ -34,7 +34,7 @@ func TestAccRoute53ResolverRuleGroupAssociationDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet(dataSourceName, "modification_time"), resource.TestCheckResourceAttrPair(dataSourceName, "mutation_protection", resourceName, "mutation_protection"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), - resource.TestCheckResourceAttrPair(dataSourceName, "priority", resourceName, "priority"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrPriority, resourceName, names.AttrPriority), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrStatus), resource.TestCheckResourceAttrSet(dataSourceName, "status_message"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrVPCID, resourceName, names.AttrVPCID), diff --git a/internal/service/route53resolver/firewall_rule_group_association_test.go b/internal/service/route53resolver/firewall_rule_group_association_test.go index 83f16dcffe1..54ec0bedfe3 100644 --- a/internal/service/route53resolver/firewall_rule_group_association_test.go +++ b/internal/service/route53resolver/firewall_rule_group_association_test.go @@ -38,7 +38,7 @@ func TestAccRoute53ResolverFirewallRuleGroupAssociation_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrPair(resourceName, "firewall_rule_group_id", "aws_route53_resolver_firewall_rule_group.test", names.AttrID), resource.TestCheckResourceAttr(resourceName, "mutation_protection", "DISABLED"), - resource.TestCheckResourceAttr(resourceName, "priority", "101"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "101"), resource.TestCheckResourceAttrPair(resourceName, names.AttrVPCID, "aws_vpc.test", names.AttrID), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), @@ -139,7 +139,7 @@ func TestAccRoute53ResolverFirewallRuleGroupAssociation_priority(t *testing.T) { Config: testAccFirewallRuleGroupAssociationConfig_priority(rName, 101), Check: resource.ComposeTestCheckFunc( testAccCheckFirewallRuleGroupAssociationExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "priority", "101"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "101"), ), }, { @@ -151,7 +151,7 @@ func TestAccRoute53ResolverFirewallRuleGroupAssociation_priority(t *testing.T) { Config: testAccFirewallRuleGroupAssociationConfig_priority(rName, 200), Check: resource.ComposeTestCheckFunc( testAccCheckFirewallRuleGroupAssociationExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "priority", "200"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "200"), ), }, }, diff --git a/internal/service/route53resolver/firewall_rule_test.go b/internal/service/route53resolver/firewall_rule_test.go index eb2c86e9b9b..d469247698f 100644 --- a/internal/service/route53resolver/firewall_rule_test.go +++ b/internal/service/route53resolver/firewall_rule_test.go @@ -39,7 +39,7 @@ func TestAccRoute53ResolverFirewallRule_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrAction, "ALLOW"), resource.TestCheckResourceAttrPair(resourceName, "firewall_rule_group_id", "aws_route53_resolver_firewall_rule_group.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "firewall_domain_list_id", "aws_route53_resolver_firewall_domain_list.test", names.AttrID), - resource.TestCheckResourceAttr(resourceName, "priority", "100"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "100"), ), }, { diff --git a/internal/service/route53resolver/firewall_rules_data_source.go b/internal/service/route53resolver/firewall_rules_data_source.go index fed718d5911..442fe35685c 100644 --- a/internal/service/route53resolver/firewall_rules_data_source.go +++ b/internal/service/route53resolver/firewall_rules_data_source.go @@ -77,14 +77,14 @@ func DataSourceResolverFirewallRules() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Computed: true, }, }, }, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Optional: true, }, @@ -101,7 +101,7 @@ func dataSourceResolverFirewallFirewallRulesRead(ctx context.Context, d *schema. return false } - if v, ok := d.GetOk("priority"); ok && aws.Int64Value(rule.Priority) != int64(v.(int)) { + if v, ok := d.GetOk(names.AttrPriority); ok && aws.Int64Value(rule.Priority) != int64(v.(int)) { return false } @@ -185,7 +185,7 @@ func flattenFirewallRule(apiObject *route53resolver.FirewallRule) map[string]int tfMap[names.AttrName] = aws.StringValue(apiObject.Name) } if apiObject.Priority != nil { - tfMap["priority"] = aws.Int64Value(apiObject.Priority) + tfMap[names.AttrPriority] = aws.Int64Value(apiObject.Priority) } return tfMap } From b5b45ef15bb48375f66926e2e9b9a0f52a39d115 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:06 -0400 Subject: [PATCH 1075/1490] s3: Use constant for priority strings --- internal/service/s3/bucket.go | 6 +++--- .../s3/bucket_replication_configuration.go | 6 +++--- .../s3/bucket_replication_configuration_test.go | 16 ++++++++-------- internal/service/s3/bucket_test.go | 16 ++++++++-------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index cffaa892dcb..9837b288ffa 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -534,7 +534,7 @@ func resourceBucket() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(0, 1024), }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Optional: true, }, @@ -2488,7 +2488,7 @@ func expandBucketReplicationRules(ctx context.Context, l []interface{}) []types. } rule.Filter = filter - rule.Priority = aws.Int32(int32(tfRuleMap["priority"].(int))) + rule.Priority = aws.Int32(int32(tfRuleMap[names.AttrPriority].(int))) if v, ok := tfRuleMap["delete_marker_replication_status"].(string); ok && v != "" { rule.DeleteMarkerReplication = &types.DeleteMarkerReplication{ @@ -2654,7 +2654,7 @@ func flattenBucketReplicationRules(ctx context.Context, rules []types.Replicatio } if rule.Priority != nil { - m["priority"] = aws.ToInt32(rule.Priority) + m[names.AttrPriority] = aws.ToInt32(rule.Priority) } if rule.SourceSelectionCriteria != nil { diff --git a/internal/service/s3/bucket_replication_configuration.go b/internal/service/s3/bucket_replication_configuration.go index f9043c271ee..3707b850651 100644 --- a/internal/service/s3/bucket_replication_configuration.go +++ b/internal/service/s3/bucket_replication_configuration.go @@ -254,7 +254,7 @@ func resourceBucketReplicationConfiguration() *schema.Resource { ValidateFunc: validation.StringLenBetween(0, 1024), Deprecated: "Use filter instead", }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Optional: true, }, @@ -512,7 +512,7 @@ func expandReplicationRules(ctx context.Context, l []interface{}) []types.Replic if v, ok := tfMap[names.AttrFilter].([]interface{}); ok && len(v) > 0 { // XML schema V2 rule.Filter = expandReplicationRuleFilter(ctx, v) - rule.Priority = aws.Int32(int32(tfMap["priority"].(int))) + rule.Priority = aws.Int32(int32(tfMap[names.AttrPriority].(int))) } else { // XML schema V1 rule.Prefix = aws.String(tfMap[names.AttrPrefix].(string)) @@ -901,7 +901,7 @@ func flattenReplicationRules(ctx context.Context, rules []types.ReplicationRule) } if rule.Priority != nil { - m["priority"] = aws.ToInt32(rule.Priority) + m[names.AttrPriority] = aws.ToInt32(rule.Priority) } if rule.SourceSelectionCriteria != nil { diff --git a/internal/service/s3/bucket_replication_configuration_test.go b/internal/service/s3/bucket_replication_configuration_test.go index d50abc3b55e..6e6e1f2682e 100644 --- a/internal/service/s3/bucket_replication_configuration_test.go +++ b/internal/service/s3/bucket_replication_configuration_test.go @@ -146,7 +146,7 @@ func TestAccS3BucketReplicationConfiguration_multipleDestinationsEmptyFilter(t * resource.TestCheckResourceAttr(resourceName, "rule.#", "3"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "rule1", - "priority": "1", + names.AttrPriority: "1", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "filter.#": "1", "filter.0.prefix": "", @@ -155,7 +155,7 @@ func TestAccS3BucketReplicationConfiguration_multipleDestinationsEmptyFilter(t * }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "rule2", - "priority": "2", + names.AttrPriority: "2", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "filter.#": "1", "filter.0.prefix": "", @@ -164,7 +164,7 @@ func TestAccS3BucketReplicationConfiguration_multipleDestinationsEmptyFilter(t * }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "rule3", - "priority": "3", + names.AttrPriority: "3", names.AttrStatus: string(types.ReplicationRuleStatusDisabled), "filter.#": "1", "filter.0.prefix": "", @@ -206,7 +206,7 @@ func TestAccS3BucketReplicationConfiguration_multipleDestinationsNonEmptyFilter( resource.TestCheckResourceAttr(resourceName, "rule.#", "3"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "rule1", - "priority": "1", + names.AttrPriority: "1", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "filter.#": "1", "filter.0.prefix": "prefix1", @@ -215,7 +215,7 @@ func TestAccS3BucketReplicationConfiguration_multipleDestinationsNonEmptyFilter( }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "rule2", - "priority": "2", + names.AttrPriority: "2", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "filter.#": "1", "filter.0.tag.#": "1", @@ -226,7 +226,7 @@ func TestAccS3BucketReplicationConfiguration_multipleDestinationsNonEmptyFilter( }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "rule3", - "priority": "3", + names.AttrPriority: "3", names.AttrStatus: string(types.ReplicationRuleStatusDisabled), "filter.#": "1", "filter.0.and.#": "1", @@ -273,7 +273,7 @@ func TestAccS3BucketReplicationConfiguration_twoDestination(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "rule1", - "priority": "1", + names.AttrPriority: "1", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "filter.#": "1", "filter.0.prefix": "prefix1", @@ -282,7 +282,7 @@ func TestAccS3BucketReplicationConfiguration_twoDestination(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrID: "rule2", - "priority": "2", + names.AttrPriority: "2", names.AttrStatus: string(types.ReplicationRuleStatusEnabled), "filter.#": "1", "filter.0.prefix": "prefix1", diff --git a/internal/service/s3/bucket_test.go b/internal/service/s3/bucket_test.go index 4f88a8036c3..bac329b3930 100644 --- a/internal/service/s3/bucket_test.go +++ b/internal/service/s3/bucket_test.go @@ -1398,7 +1398,7 @@ func TestAccS3Bucket_Replication_multipleDestinationsEmptyFilter(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "replication_configuration.0.rules.#", "3"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "replication_configuration.0.rules.*", map[string]string{ names.AttrID: "rule1", - "priority": "1", + names.AttrPriority: "1", names.AttrStatus: "Enabled", "filter.#": "1", "filter.0.prefix": "", @@ -1407,7 +1407,7 @@ func TestAccS3Bucket_Replication_multipleDestinationsEmptyFilter(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "replication_configuration.0.rules.*", map[string]string{ names.AttrID: "rule2", - "priority": "2", + names.AttrPriority: "2", names.AttrStatus: "Enabled", "filter.#": "1", "filter.0.prefix": "", @@ -1416,7 +1416,7 @@ func TestAccS3Bucket_Replication_multipleDestinationsEmptyFilter(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "replication_configuration.0.rules.*", map[string]string{ names.AttrID: "rule3", - "priority": "3", + names.AttrPriority: "3", names.AttrStatus: "Disabled", "filter.#": "1", "filter.0.prefix": "", @@ -1469,7 +1469,7 @@ func TestAccS3Bucket_Replication_multipleDestinationsNonEmptyFilter(t *testing.T resource.TestCheckResourceAttr(resourceName, "replication_configuration.0.rules.#", "3"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "replication_configuration.0.rules.*", map[string]string{ names.AttrID: "rule1", - "priority": "1", + names.AttrPriority: "1", names.AttrStatus: "Enabled", "filter.#": "1", "filter.0.prefix": "prefix1", @@ -1478,7 +1478,7 @@ func TestAccS3Bucket_Replication_multipleDestinationsNonEmptyFilter(t *testing.T }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "replication_configuration.0.rules.*", map[string]string{ names.AttrID: "rule2", - "priority": "2", + names.AttrPriority: "2", names.AttrStatus: "Enabled", "filter.#": "1", "filter.0.tags.%": "1", @@ -1488,7 +1488,7 @@ func TestAccS3Bucket_Replication_multipleDestinationsNonEmptyFilter(t *testing.T }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "replication_configuration.0.rules.*", map[string]string{ names.AttrID: "rule3", - "priority": "3", + names.AttrPriority: "3", names.AttrStatus: "Disabled", "filter.#": "1", "filter.0.prefix": "prefix3", @@ -1544,7 +1544,7 @@ func TestAccS3Bucket_Replication_twoDestination(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "replication_configuration.0.rules.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "replication_configuration.0.rules.*", map[string]string{ names.AttrID: "rule1", - "priority": "1", + names.AttrPriority: "1", names.AttrStatus: "Enabled", "filter.#": "1", "filter.0.prefix": "prefix1", @@ -1553,7 +1553,7 @@ func TestAccS3Bucket_Replication_twoDestination(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "replication_configuration.0.rules.*", map[string]string{ names.AttrID: "rule2", - "priority": "2", + names.AttrPriority: "2", names.AttrStatus: "Enabled", "filter.#": "1", "filter.0.tags.%": "1", From b09db280d12b23cd26006550bd11470a5df32a02 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:07 -0400 Subject: [PATCH 1076/1490] ssm: Use constant for priority strings --- internal/service/ssm/maintenance_window_task.go | 8 ++++---- internal/service/ssm/maintenance_window_task_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/ssm/maintenance_window_task.go b/internal/service/ssm/maintenance_window_task.go index 612e2d74b55..a35e3d1ab96 100644 --- a/internal/service/ssm/maintenance_window_task.go +++ b/internal/service/ssm/maintenance_window_task.go @@ -123,7 +123,7 @@ func ResourceMaintenanceWindowTask() *schema.Resource { ValidateFunc: validation.StringLenBetween(1, 128), }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Optional: true, ValidateFunc: validation.IntAtLeast(0), @@ -715,7 +715,7 @@ func resourceMaintenanceWindowTaskCreate(ctx context.Context, d *schema.Resource params.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("priority"); ok { + if v, ok := d.GetOk(names.AttrPriority); ok { params.Priority = aws.Int64(int64(v.(int))) } @@ -760,7 +760,7 @@ func resourceMaintenanceWindowTaskRead(ctx context.Context, d *schema.ResourceDa d.Set("task_type", resp.TaskType) d.Set("service_role_arn", resp.ServiceRoleArn) d.Set("task_arn", resp.TaskArn) - d.Set("priority", resp.Priority) + d.Set(names.AttrPriority, resp.Priority) d.Set(names.AttrName, resp.Name) d.Set(names.AttrDescription, resp.Description) d.Set("cutoff_behavior", resp.CutoffBehavior) @@ -793,7 +793,7 @@ func resourceMaintenanceWindowTaskUpdate(ctx context.Context, d *schema.Resource windowID := d.Get("window_id").(string) params := &ssm.UpdateMaintenanceWindowTaskInput{ - Priority: aws.Int64(int64(d.Get("priority").(int))), + Priority: aws.Int64(int64(d.Get(names.AttrPriority).(int))), WindowId: aws.String(windowID), WindowTaskId: aws.String(d.Id()), TaskArn: aws.String(d.Get("task_arn").(string)), diff --git a/internal/service/ssm/maintenance_window_task_test.go b/internal/service/ssm/maintenance_window_task_test.go index c29dc8e2253..2a408cb11f2 100644 --- a/internal/service/ssm/maintenance_window_task_test.go +++ b/internal/service/ssm/maintenance_window_task_test.go @@ -51,7 +51,7 @@ func TestAccSSMMaintenanceWindowTask_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "test description"), resource.TestCheckResourceAttr(resourceName, "task_type", "RUN_COMMAND"), resource.TestCheckResourceAttr(resourceName, "task_arn", "AWS-InstallPowerShellModule"), - resource.TestCheckResourceAttr(resourceName, "priority", "3"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "3"), resource.TestCheckResourceAttr(resourceName, "max_concurrency", "3"), resource.TestCheckResourceAttr(resourceName, "max_errors", "2"), testAccCheckWindowsTaskNotRecreated(t, &before, &after), From 88f5d8988ad1fb5c7bbe0189500332fd561f4115 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:07 -0400 Subject: [PATCH 1077/1490] vpclattice: Use constant for priority strings --- internal/service/vpclattice/listener_rule.go | 6 +++--- internal/service/vpclattice/listener_rule_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/vpclattice/listener_rule.go b/internal/service/vpclattice/listener_rule.go index f507fe772dd..3aa760eac1e 100644 --- a/internal/service/vpclattice/listener_rule.go +++ b/internal/service/vpclattice/listener_rule.go @@ -221,7 +221,7 @@ func ResourceListenerRule() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(3, 63), }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, ValidateFunc: validation.IntBetween(1, 100), @@ -263,7 +263,7 @@ func resourceListenerRuleCreate(ctx context.Context, d *schema.ResourceData, met Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("priority"); ok { + if v, ok := d.GetOk(names.AttrPriority); ok { in.Priority = aws.Int32(int32(v.(int))) } @@ -311,7 +311,7 @@ func resourceListenerRuleRead(ctx context.Context, d *schema.ResourceData, meta } d.Set(names.AttrARN, out.Arn) - d.Set("priority", out.Priority) + d.Set(names.AttrPriority, out.Priority) d.Set(names.AttrName, out.Name) d.Set("listener_identifier", listenerId) d.Set("service_identifier", serviceId) diff --git a/internal/service/vpclattice/listener_rule_test.go b/internal/service/vpclattice/listener_rule_test.go index 331074367f3..e34ec48e5e7 100644 --- a/internal/service/vpclattice/listener_rule_test.go +++ b/internal/service/vpclattice/listener_rule_test.go @@ -43,7 +43,7 @@ func TestAccVPCLatticeListenerRule_basic(t *testing.T) { Config: testAccListenerRuleConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckListenerRuleExists(ctx, resourceName, &listenerRule), - resource.TestCheckResourceAttr(resourceName, "priority", "20"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "20"), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "vpc-lattice", regexache.MustCompile(`service/svc-.*/listener/listener-.*/rule/rule.+`)), ), }, @@ -77,7 +77,7 @@ func TestAccVPCLatticeListenerRule_fixedResponse(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckListenerRuleExists(ctx, resourceName, &listenerRule), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "priority", "10"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "10"), resource.TestCheckResourceAttr(resourceName, "action.0.fixed_response.0.status_code", "404"), ), }, @@ -107,7 +107,7 @@ func TestAccVPCLatticeListenerRule_methodMatch(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckListenerRuleExists(ctx, resourceName, &listenerRule), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "priority", "40"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "40"), ), }, { From f786c81ec518d1996f79b47bc4c9484a272e0bde Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:07 -0400 Subject: [PATCH 1078/1490] waf: Use constant for priority strings --- internal/service/waf/flex.go | 6 ++--- internal/service/waf/helpers.go | 8 +++--- internal/service/waf/rule_group.go | 2 +- internal/service/waf/rule_group_test.go | 36 ++++++++++++------------- internal/service/waf/web_acl.go | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/internal/service/waf/flex.go b/internal/service/waf/flex.go index a08a6dcf5a2..f3522417991 100644 --- a/internal/service/waf/flex.go +++ b/internal/service/waf/flex.go @@ -40,14 +40,14 @@ func ExpandWebACLUpdate(updateAction string, aclRule map[string]interface{}) *wa case waf.WafRuleTypeGroup: rule = &waf.ActivatedRule{ OverrideAction: expandOverrideAction(aclRule["override_action"].([]interface{})), - Priority: aws.Int64(int64(aclRule["priority"].(int))), + Priority: aws.Int64(int64(aclRule[names.AttrPriority].(int))), RuleId: aws.String(aclRule["rule_id"].(string)), Type: aws.String(aclRule[names.AttrType].(string)), } default: rule = &waf.ActivatedRule{ Action: ExpandAction(aclRule[names.AttrAction].([]interface{})), - Priority: aws.Int64(int64(aclRule["priority"].(int))), + Priority: aws.Int64(int64(aclRule[names.AttrPriority].(int))), RuleId: aws.String(aclRule["rule_id"].(string)), Type: aws.String(aclRule[names.AttrType].(string)), } @@ -91,7 +91,7 @@ func FlattenWebACLRules(ts []*waf.ActivatedRule) []map[string]interface{} { m[names.AttrAction] = []map[string]interface{}{actionMap} } - m["priority"] = int(aws.Int64Value(r.Priority)) + m[names.AttrPriority] = int(aws.Int64Value(r.Priority)) m["rule_id"] = aws.StringValue(r.RuleId) m[names.AttrType] = aws.StringValue(r.Type) out[i] = m diff --git a/internal/service/waf/helpers.go b/internal/service/waf/helpers.go index aeacbe63775..492f3cc65b4 100644 --- a/internal/service/waf/helpers.go +++ b/internal/service/waf/helpers.go @@ -257,9 +257,9 @@ func FlattenActivatedRules(activatedRules []*waf.ActivatedRule) []interface{} { out := make([]interface{}, len(activatedRules)) for i, ar := range activatedRules { rule := map[string]interface{}{ - "priority": aws.Int64Value(ar.Priority), - "rule_id": aws.StringValue(ar.RuleId), - names.AttrType: aws.StringValue(ar.Type), + names.AttrPriority: aws.Int64Value(ar.Priority), + "rule_id": aws.StringValue(ar.RuleId), + names.AttrType: aws.StringValue(ar.Type), } if ar.Action != nil { rule[names.AttrAction] = []interface{}{ @@ -275,7 +275,7 @@ func FlattenActivatedRules(activatedRules []*waf.ActivatedRule) []interface{} { func ExpandActivatedRule(rule map[string]interface{}) *waf.ActivatedRule { r := &waf.ActivatedRule{ - Priority: aws.Int64(int64(rule["priority"].(int))), + Priority: aws.Int64(int64(rule[names.AttrPriority].(int))), RuleId: aws.String(rule["rule_id"].(string)), Type: aws.String(rule[names.AttrType].(string)), } diff --git a/internal/service/waf/rule_group.go b/internal/service/waf/rule_group.go index bb533dbdaa3..622401953e1 100644 --- a/internal/service/waf/rule_group.go +++ b/internal/service/waf/rule_group.go @@ -63,7 +63,7 @@ func ResourceRuleGroup() *schema.Resource { }, }, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, diff --git a/internal/service/waf/rule_group_test.go b/internal/service/waf/rule_group_test.go index 854bc01d63e..77eb8d3cad2 100644 --- a/internal/service/waf/rule_group_test.go +++ b/internal/service/waf/rule_group_test.go @@ -48,9 +48,9 @@ func TestAccWAFRuleGroup_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "metric_name", groupName), computeActivatedRuleWithRuleId(&rule, "COUNT", 50, &idx), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "activated_rule.*", map[string]string{ - "action.0.type": "COUNT", - "priority": "50", - names.AttrType: waf.WafRuleTypeRegular, + "action.0.type": "COUNT", + names.AttrPriority: "50", + names.AttrType: waf.WafRuleTypeRegular, }), acctest.MatchResourceAttrGlobalARN(resourceName, names.AttrARN, "waf", regexache.MustCompile(`rulegroup/.+`)), ), @@ -158,9 +158,9 @@ func TestAccWAFRuleGroup_changeActivatedRules(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "activated_rule.#", "1"), computeActivatedRuleWithRuleId(&rule0, "COUNT", 50, &idx0), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "activated_rule.*", map[string]string{ - "action.0.type": "COUNT", - "priority": "50", - names.AttrType: waf.WafRuleTypeRegular, + "action.0.type": "COUNT", + names.AttrPriority: "50", + names.AttrType: waf.WafRuleTypeRegular, }), ), }, @@ -174,25 +174,25 @@ func TestAccWAFRuleGroup_changeActivatedRules(t *testing.T) { testAccCheckRuleExists(ctx, "aws_waf_rule.test", &rule1), computeActivatedRuleWithRuleId(&rule1, "BLOCK", 10, &idx1), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "activated_rule.*", map[string]string{ - "action.0.type": "BLOCK", - "priority": "10", - names.AttrType: waf.WafRuleTypeRegular, + "action.0.type": "BLOCK", + names.AttrPriority: "10", + names.AttrType: waf.WafRuleTypeRegular, }), testAccCheckRuleExists(ctx, "aws_waf_rule.test2", &rule2), computeActivatedRuleWithRuleId(&rule2, "COUNT", 1, &idx2), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "activated_rule.*", map[string]string{ - "action.0.type": "COUNT", - "priority": "1", - names.AttrType: waf.WafRuleTypeRegular, + "action.0.type": "COUNT", + names.AttrPriority: "1", + names.AttrType: waf.WafRuleTypeRegular, }), testAccCheckRuleExists(ctx, "aws_waf_rule.test3", &rule3), computeActivatedRuleWithRuleId(&rule3, "BLOCK", 15, &idx3), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "activated_rule.*", map[string]string{ - "action.0.type": "BLOCK", - "priority": "15", - names.AttrType: waf.WafRuleTypeRegular, + "action.0.type": "BLOCK", + names.AttrPriority: "15", + names.AttrType: waf.WafRuleTypeRegular, }), ), }, @@ -217,9 +217,9 @@ func computeActivatedRuleWithRuleId(rule *waf.Rule, actionType string, priority names.AttrType: actionType, }, }, - "priority": priority, - "rule_id": *rule.RuleId, - names.AttrType: waf.WafRuleTypeRegular, + names.AttrPriority: priority, + "rule_id": *rule.RuleId, + names.AttrType: waf.WafRuleTypeRegular, } f := schema.HashResource(ruleResource) diff --git a/internal/service/waf/web_acl.go b/internal/service/waf/web_acl.go index 451bee5f479..ded5e8d8d8b 100644 --- a/internal/service/waf/web_acl.go +++ b/internal/service/waf/web_acl.go @@ -133,7 +133,7 @@ func ResourceWebACL() *schema.Resource { }, }, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, From 56f953ea53fb7ae1d2d78c1b5cfc9cb9a94a854d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:08 -0400 Subject: [PATCH 1079/1490] wafregional: Use constant for priority strings --- internal/service/wafregional/rule_group.go | 2 +- .../service/wafregional/rule_group_test.go | 36 +++++++++---------- internal/service/wafregional/web_acl.go | 2 +- internal/service/wafregional/web_acl_test.go | 12 +++---- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/internal/service/wafregional/rule_group.go b/internal/service/wafregional/rule_group.go index c6ace4277e6..6f5edfbd068 100644 --- a/internal/service/wafregional/rule_group.go +++ b/internal/service/wafregional/rule_group.go @@ -66,7 +66,7 @@ func resourceRuleGroup() *schema.Resource { }, }, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, diff --git a/internal/service/wafregional/rule_group_test.go b/internal/service/wafregional/rule_group_test.go index 2a8a2ad07c8..108a56e3a83 100644 --- a/internal/service/wafregional/rule_group_test.go +++ b/internal/service/wafregional/rule_group_test.go @@ -50,9 +50,9 @@ func TestAccWAFRegionalRuleGroup_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "metric_name", groupName), computeActivatedRuleWithRuleId(&rule, "COUNT", 50, &idx), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "activated_rule.*", map[string]string{ - "action.0.type": "COUNT", - "priority": "50", - names.AttrType: waf.WafRuleTypeRegular, + "action.0.type": "COUNT", + names.AttrPriority: "50", + names.AttrType: waf.WafRuleTypeRegular, }), ), }, @@ -211,9 +211,9 @@ func TestAccWAFRegionalRuleGroup_changeActivatedRules(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "activated_rule.#", "1"), computeActivatedRuleWithRuleId(&rule0, "COUNT", 50, &idx0), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "activated_rule.*", map[string]string{ - "action.0.type": "COUNT", - "priority": "50", - names.AttrType: waf.WafRuleTypeRegular, + "action.0.type": "COUNT", + names.AttrPriority: "50", + names.AttrType: waf.WafRuleTypeRegular, }), ), }, @@ -227,25 +227,25 @@ func TestAccWAFRegionalRuleGroup_changeActivatedRules(t *testing.T) { testAccCheckRuleExists(ctx, "aws_wafregional_rule.test", &rule1), computeActivatedRuleWithRuleId(&rule1, "BLOCK", 10, &idx1), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "activated_rule.*", map[string]string{ - "action.0.type": "BLOCK", - "priority": "10", - names.AttrType: waf.WafRuleTypeRegular, + "action.0.type": "BLOCK", + names.AttrPriority: "10", + names.AttrType: waf.WafRuleTypeRegular, }), testAccCheckRuleExists(ctx, "aws_wafregional_rule.test2", &rule2), computeActivatedRuleWithRuleId(&rule2, "COUNT", 1, &idx2), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "activated_rule.*", map[string]string{ - "action.0.type": "COUNT", - "priority": "1", - names.AttrType: waf.WafRuleTypeRegular, + "action.0.type": "COUNT", + names.AttrPriority: "1", + names.AttrType: waf.WafRuleTypeRegular, }), testAccCheckRuleExists(ctx, "aws_wafregional_rule.test3", &rule3), computeActivatedRuleWithRuleId(&rule3, "BLOCK", 15, &idx3), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "activated_rule.*", map[string]string{ - "action.0.type": "BLOCK", - "priority": "15", - names.AttrType: waf.WafRuleTypeRegular, + "action.0.type": "BLOCK", + names.AttrPriority: "15", + names.AttrType: waf.WafRuleTypeRegular, }), ), }, @@ -490,9 +490,9 @@ func computeActivatedRuleWithRuleId(rule *waf.Rule, actionType string, priority names.AttrType: actionType, }, }, - "priority": priority, - "rule_id": *rule.RuleId, - names.AttrType: waf.WafRuleTypeRegular, + names.AttrPriority: priority, + "rule_id": *rule.RuleId, + names.AttrType: waf.WafRuleTypeRegular, } f := schema.HashResource(ruleResource) diff --git a/internal/service/wafregional/web_acl.go b/internal/service/wafregional/web_acl.go index 226016556fd..3f1ee00208c 100644 --- a/internal/service/wafregional/web_acl.go +++ b/internal/service/wafregional/web_acl.go @@ -150,7 +150,7 @@ func resourceWebACL() *schema.Resource { }, }, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, diff --git a/internal/service/wafregional/web_acl_test.go b/internal/service/wafregional/web_acl_test.go index 9fe28f57c68..c435dd700b0 100644 --- a/internal/service/wafregional/web_acl_test.go +++ b/internal/service/wafregional/web_acl_test.go @@ -335,7 +335,7 @@ func TestAccWAFRegionalWebACL_changeRules(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), computeWebACLRuleIndex(&r.RuleId, 1, "REGULAR", "BLOCK", &idx), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ - "priority": "1", + names.AttrPriority: "1", }), ), }, @@ -413,11 +413,11 @@ func computeWebACLRuleIndex(ruleId **string, priority int, ruleType string, acti names.AttrType: actionType, } m := map[string]interface{}{ - "rule_id": **ruleId, - names.AttrType: ruleType, - "priority": priority, - names.AttrAction: []interface{}{actionMap}, - "override_action": []interface{}{}, + "rule_id": **ruleId, + names.AttrType: ruleType, + names.AttrPriority: priority, + names.AttrAction: []interface{}{actionMap}, + "override_action": []interface{}{}, } f := schema.HashResource(ruleResource) From dfc4f2347041a2e820dd0bdc262e13beb6c12921 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:08 -0400 Subject: [PATCH 1080/1490] wafv2: Use constant for priority strings --- internal/service/wafv2/flex.go | 12 ++-- internal/service/wafv2/rule_group.go | 2 +- internal/service/wafv2/rule_group_test.go | 68 ++++++++++---------- internal/service/wafv2/schemas.go | 2 +- internal/service/wafv2/web_acl.go | 2 +- internal/service/wafv2/web_acl_test.go | 76 +++++++++++------------ 6 files changed, 81 insertions(+), 81 deletions(-) diff --git a/internal/service/wafv2/flex.go b/internal/service/wafv2/flex.go index 5f59ae2846f..15029b8df92 100644 --- a/internal/service/wafv2/flex.go +++ b/internal/service/wafv2/flex.go @@ -34,7 +34,7 @@ func expandRule(m map[string]interface{}) awstypes.Rule { Action: expandRuleAction(m[names.AttrAction].([]interface{})), CaptchaConfig: expandCaptchaConfig(m["captcha_config"].([]interface{})), Name: aws.String(m[names.AttrName].(string)), - Priority: int32(m["priority"].(int)), + Priority: int32(m[names.AttrPriority].(int)), Statement: expandRuleGroupRootStatement(m["statement"].([]interface{})), VisibilityConfig: expandVisibilityConfig(m["visibility_config"].([]interface{})), } @@ -769,7 +769,7 @@ func expandTextTransformations(l []interface{}) []awstypes.TextTransformation { func expandTextTransformation(m map[string]interface{}) awstypes.TextTransformation { return awstypes.TextTransformation{ - Priority: int32(m["priority"].(int)), + Priority: int32(m[names.AttrPriority].(int)), Type: awstypes.TextTransformationType(m[names.AttrType].(string)), } } @@ -997,7 +997,7 @@ func expandWebACLRule(m map[string]interface{}) awstypes.Rule { CaptchaConfig: expandCaptchaConfig(m["captcha_config"].([]interface{})), Name: aws.String(m[names.AttrName].(string)), OverrideAction: expandOverrideAction(m["override_action"].([]interface{})), - Priority: int32(m["priority"].(int)), + Priority: int32(m[names.AttrPriority].(int)), Statement: expandWebACLRootStatement(m["statement"].([]interface{})), VisibilityConfig: expandVisibilityConfig(m["visibility_config"].([]interface{})), } @@ -1641,7 +1641,7 @@ func flattenRules(r []awstypes.Rule) interface{} { m[names.AttrAction] = flattenRuleAction(rule.Action) m["captcha_config"] = flattenCaptchaConfig(rule.CaptchaConfig) m[names.AttrName] = aws.ToString(rule.Name) - m["priority"] = rule.Priority + m[names.AttrPriority] = rule.Priority m["rule_label"] = flattenRuleLabels(rule.RuleLabels) m["statement"] = flattenRuleGroupRootStatement(rule.Statement) m["visibility_config"] = flattenVisibilityConfig(rule.VisibilityConfig) @@ -2194,7 +2194,7 @@ func flattenTextTransformations(l []awstypes.TextTransformation) []interface{} { out := make([]interface{}, len(l)) for i, t := range l { m := make(map[string]interface{}) - m["priority"] = t.Priority + m[names.AttrPriority] = t.Priority m[names.AttrType] = string(t.Type) out[i] = m } @@ -2489,7 +2489,7 @@ func flattenWebACLRules(r []awstypes.Rule) interface{} { m["captcha_config"] = flattenCaptchaConfig(rule.CaptchaConfig) m["override_action"] = flattenOverrideAction(rule.OverrideAction) m[names.AttrName] = aws.ToString(rule.Name) - m["priority"] = rule.Priority + m[names.AttrPriority] = rule.Priority m["rule_label"] = flattenRuleLabels(rule.RuleLabels) m["statement"] = flattenWebACLRootStatement(rule.Statement) m["visibility_config"] = flattenVisibilityConfig(rule.VisibilityConfig) diff --git a/internal/service/wafv2/rule_group.go b/internal/service/wafv2/rule_group.go index ad2757ae724..1537c7a1291 100644 --- a/internal/service/wafv2/rule_group.go +++ b/internal/service/wafv2/rule_group.go @@ -129,7 +129,7 @@ func resourceRuleGroup() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 128), }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, diff --git a/internal/service/wafv2/rule_group_test.go b/internal/service/wafv2/rule_group_test.go index 22213f37f6b..4e60ee464ee 100644 --- a/internal/service/wafv2/rule_group_test.go +++ b/internal/service/wafv2/rule_group_test.go @@ -166,7 +166,7 @@ func TestAccWAFV2RuleGroup_updateRule(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: "rule-1", - "priority": "1", + names.AttrPriority: "1", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "0", @@ -219,7 +219,7 @@ func TestAccWAFV2RuleGroup_updateRuleProperties(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: "rule-1", - "priority": "1", + names.AttrPriority: "1", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "0", @@ -253,7 +253,7 @@ func TestAccWAFV2RuleGroup_updateRuleProperties(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: "rule-1", - "priority": "1", + names.AttrPriority: "1", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "0", @@ -270,7 +270,7 @@ func TestAccWAFV2RuleGroup_updateRuleProperties(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: ruleName2, - "priority": "2", + names.AttrPriority: "2", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "1", @@ -290,12 +290,12 @@ func TestAccWAFV2RuleGroup_updateRuleProperties(t *testing.T) { "statement.0.size_constraint_statement.0.text_transformation.#": "2", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "CMD_LINE", + names.AttrPriority: "2", + names.AttrType: "CMD_LINE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "5", - names.AttrType: "NONE", + names.AttrPriority: "5", + names.AttrType: "NONE", }), ), }, @@ -317,7 +317,7 @@ func TestAccWAFV2RuleGroup_updateRuleProperties(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: "rule-1", - "priority": "5", + names.AttrPriority: "5", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "0", @@ -334,7 +334,7 @@ func TestAccWAFV2RuleGroup_updateRuleProperties(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: "updated", - "priority": "10", + names.AttrPriority: "10", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "1", @@ -354,12 +354,12 @@ func TestAccWAFV2RuleGroup_updateRuleProperties(t *testing.T) { "statement.0.size_constraint_statement.0.text_transformation.#": "2", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "CMD_LINE", + names.AttrPriority: "2", + names.AttrType: "CMD_LINE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "5", - names.AttrType: "NONE", + names.AttrPriority: "5", + names.AttrType: "NONE", }), ), }, @@ -399,12 +399,12 @@ func TestAccWAFV2RuleGroup_byteMatchStatement(t *testing.T) { "statement.0.byte_match_statement.0.text_transformation.#": "2", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.byte_match_statement.0.text_transformation.*", map[string]string{ - "priority": "5", - names.AttrType: "NONE", + names.AttrPriority: "5", + names.AttrType: "NONE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.byte_match_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "LOWERCASE", + names.AttrPriority: "2", + names.AttrType: "LOWERCASE", }), ), }, @@ -422,8 +422,8 @@ func TestAccWAFV2RuleGroup_byteMatchStatement(t *testing.T) { "statement.0.byte_match_statement.0.text_transformation.#": "1", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.byte_match_statement.0.text_transformation.*", map[string]string{ - "priority": "3", - names.AttrType: "CMD_LINE", + names.AttrPriority: "3", + names.AttrType: "CMD_LINE", }), ), }, @@ -1878,12 +1878,12 @@ func TestAccWAFV2RuleGroup_sqliMatchStatement(t *testing.T) { "statement.0.sqli_match_statement.0.text_transformation.#": "2", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.sqli_match_statement.0.text_transformation.*", map[string]string{ - "priority": "5", - names.AttrType: "URL_DECODE", + names.AttrPriority: "5", + names.AttrType: "URL_DECODE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.sqli_match_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "LOWERCASE", + names.AttrPriority: "2", + names.AttrType: "LOWERCASE", }), ), }, @@ -1901,16 +1901,16 @@ func TestAccWAFV2RuleGroup_sqliMatchStatement(t *testing.T) { "statement.0.sqli_match_statement.0.text_transformation.#": "3", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.sqli_match_statement.0.text_transformation.*", map[string]string{ - "priority": "5", - names.AttrType: "URL_DECODE", + names.AttrPriority: "5", + names.AttrType: "URL_DECODE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.sqli_match_statement.0.text_transformation.*", map[string]string{ - "priority": "4", - names.AttrType: "HTML_ENTITY_DECODE", + names.AttrPriority: "4", + names.AttrType: "HTML_ENTITY_DECODE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.sqli_match_statement.0.text_transformation.*", map[string]string{ - "priority": "3", - names.AttrType: "COMPRESS_WHITE_SPACE", + names.AttrPriority: "3", + names.AttrType: "COMPRESS_WHITE_SPACE", }), ), }, @@ -1997,8 +1997,8 @@ func TestAccWAFV2RuleGroup_xssMatchStatement(t *testing.T) { "statement.0.xss_match_statement.0.text_transformation.#": "1", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.xss_match_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "NONE", + names.AttrPriority: "2", + names.AttrType: "NONE", }), ), }, @@ -2016,8 +2016,8 @@ func TestAccWAFV2RuleGroup_xssMatchStatement(t *testing.T) { "statement.0.xss_match_statement.0.text_transformation.#": "1", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.xss_match_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "URL_DECODE", + names.AttrPriority: "2", + names.AttrType: "URL_DECODE", }), ), }, diff --git a/internal/service/wafv2/schemas.go b/internal/service/wafv2/schemas.go index 2487eee5f3b..26589a2ee37 100644 --- a/internal/service/wafv2/schemas.go +++ b/internal/service/wafv2/schemas.go @@ -478,7 +478,7 @@ func textTransformationSchema() *schema.Schema { MinItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, diff --git a/internal/service/wafv2/web_acl.go b/internal/service/wafv2/web_acl.go index 0d70895cd23..af3978f16eb 100644 --- a/internal/service/wafv2/web_acl.go +++ b/internal/service/wafv2/web_acl.go @@ -142,7 +142,7 @@ func resourceWebACL() *schema.Resource { }, }, }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, }, diff --git a/internal/service/wafv2/web_acl_test.go b/internal/service/wafv2/web_acl_test.go index 194dc720177..e104851f721 100644 --- a/internal/service/wafv2/web_acl_test.go +++ b/internal/service/wafv2/web_acl_test.go @@ -114,7 +114,7 @@ func TestAccWAFV2WebACL_Update_rule(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: ruleName1, - "priority": "10", + names.AttrPriority: "10", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "0", @@ -143,12 +143,12 @@ func TestAccWAFV2WebACL_Update_rule(t *testing.T) { "statement.0.size_constraint_statement.0.text_transformation.#": "2", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "CMD_LINE", + names.AttrPriority: "2", + names.AttrType: "CMD_LINE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "5", - names.AttrType: "NONE", + names.AttrPriority: "5", + names.AttrType: "NONE", }), ), }, @@ -172,7 +172,7 @@ func TestAccWAFV2WebACL_Update_rule(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: ruleName1, - "priority": "10", + names.AttrPriority: "10", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "0", @@ -190,16 +190,16 @@ func TestAccWAFV2WebACL_Update_rule(t *testing.T) { "statement.0.size_constraint_statement.0.text_transformation.#": "2", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "CMD_LINE", + names.AttrPriority: "2", + names.AttrType: "CMD_LINE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "5", - names.AttrType: "NONE", + names.AttrPriority: "5", + names.AttrType: "NONE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: ruleName2, - "priority": "5", + names.AttrPriority: "5", "action.#": "1", "action.0.allow.#": "1", "action.0.block.#": "0", @@ -257,7 +257,7 @@ func TestAccWAFV2WebACL_Update_ruleProperties(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: ruleName1, - "priority": "5", + names.AttrPriority: "5", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "0", @@ -275,16 +275,16 @@ func TestAccWAFV2WebACL_Update_ruleProperties(t *testing.T) { "statement.0.size_constraint_statement.0.text_transformation.#": "2", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "CMD_LINE", + names.AttrPriority: "2", + names.AttrType: "CMD_LINE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "5", - names.AttrType: "NONE", + names.AttrPriority: "5", + names.AttrType: "NONE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: ruleName2, - "priority": "10", + names.AttrPriority: "10", "action.#": "1", "action.0.allow.#": "1", "action.0.block.#": "0", @@ -318,7 +318,7 @@ func TestAccWAFV2WebACL_Update_ruleProperties(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: ruleName1, - "priority": "10", + names.AttrPriority: "10", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "0", @@ -336,16 +336,16 @@ func TestAccWAFV2WebACL_Update_ruleProperties(t *testing.T) { "statement.0.size_constraint_statement.0.text_transformation.#": "2", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "CMD_LINE", + names.AttrPriority: "2", + names.AttrType: "CMD_LINE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "5", - names.AttrType: "NONE", + names.AttrPriority: "5", + names.AttrType: "NONE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: ruleName2, - "priority": "5", + names.AttrPriority: "5", "action.#": "1", "action.0.allow.#": "1", "action.0.block.#": "0", @@ -379,7 +379,7 @@ func TestAccWAFV2WebACL_Update_ruleProperties(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "rule.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: ruleName1, - "priority": "10", + names.AttrPriority: "10", "action.#": "1", "action.0.allow.#": "0", "action.0.block.#": "0", @@ -397,16 +397,16 @@ func TestAccWAFV2WebACL_Update_ruleProperties(t *testing.T) { "statement.0.size_constraint_statement.0.text_transformation.#": "2", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "2", - names.AttrType: "CMD_LINE", + names.AttrPriority: "2", + names.AttrType: "CMD_LINE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*.statement.0.size_constraint_statement.0.text_transformation.*", map[string]string{ - "priority": "5", - names.AttrType: "NONE", + names.AttrPriority: "5", + names.AttrType: "NONE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ names.AttrName: "updated", - "priority": "5", + names.AttrPriority: "5", "action.#": "1", "action.0.allow.#": "1", "action.0.block.#": "0", @@ -1419,7 +1419,7 @@ func TestAccWAFV2WebACL_GeoMatch_basic(t *testing.T) { "action.0.allow.#": "0", "action.0.block.#": "1", "action.0.count.#": "0", - "priority": "1", + names.AttrPriority: "1", "statement.#": "1", "statement.0.geo_match_statement.#": "1", "statement.0.geo_match_statement.0.country_codes.#": "1", @@ -1453,7 +1453,7 @@ func TestAccWAFV2WebACL_GeoMatch_basic(t *testing.T) { "action.0.allow.#": "0", "action.0.block.#": "1", "action.0.count.#": "0", - "priority": "1", + names.AttrPriority: "1", "statement.#": "1", "statement.0.geo_match_statement.#": "1", "statement.0.geo_match_statement.0.country_codes.#": "2", @@ -2446,7 +2446,7 @@ func TestAccWAFV2WebACL_Custom_requestHandling(t *testing.T) { "action.0.captcha.#": "0", "action.0.challenge.#": "0", "action.0.count.#": "0", - "priority": "1", + names.AttrPriority: "1", }), resource.TestCheckResourceAttr(resourceName, "visibility_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "visibility_config.0.cloudwatch_metrics_enabled", "false"), @@ -2485,7 +2485,7 @@ func TestAccWAFV2WebACL_Custom_requestHandling(t *testing.T) { "action.0.count.0.custom_request_handling.0.insert_header.0.value": "test-value-1", "action.0.count.0.custom_request_handling.0.insert_header.1.name": "x-hdr2", "action.0.count.0.custom_request_handling.0.insert_header.1.value": "test-value-2", - "priority": "1", + names.AttrPriority: "1", }), resource.TestCheckResourceAttr(resourceName, "visibility_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "visibility_config.0.cloudwatch_metrics_enabled", "false"), @@ -2518,7 +2518,7 @@ func TestAccWAFV2WebACL_Custom_requestHandling(t *testing.T) { "action.0.captcha.0.custom_request_handling.0.insert_header.1.name": "x-hdr2", "action.0.captcha.0.custom_request_handling.0.insert_header.1.value": "test-value-2", "action.0.count.#": "0", - "priority": "1", + names.AttrPriority: "1", "captcha_config.#": "1", "captcha_config.0.immunity_time_property.0.immunity_time": "240", }), @@ -2550,7 +2550,7 @@ func TestAccWAFV2WebACL_Custom_requestHandling(t *testing.T) { "action.0.captcha.#": "0", "action.0.challenge.#": "1", "action.0.count.#": "0", - "priority": "1", + names.AttrPriority: "1", }), resource.TestCheckResourceAttr(resourceName, "visibility_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "visibility_config.0.cloudwatch_metrics_enabled", "false"), @@ -2598,7 +2598,7 @@ func TestAccWAFV2WebACL_Custom_response(t *testing.T) { "action.0.block.0.custom_response.0.response_header.0.name": "x-hdr1", "action.0.block.0.custom_response.0.response_header.0.value": "custom-response-header-value", "action.0.count.#": "0", - "priority": "1", + names.AttrPriority: "1", }), resource.TestCheckResourceAttr(resourceName, "visibility_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "visibility_config.0.cloudwatch_metrics_enabled", "false"), @@ -2630,7 +2630,7 @@ func TestAccWAFV2WebACL_Custom_response(t *testing.T) { "action.0.block.0.custom_response.0.response_header.0.name": "x-hdr2", "action.0.block.0.custom_response.0.response_header.0.value": "custom-response-header-value", "action.0.count.#": "0", - "priority": "1", + names.AttrPriority: "1", }), resource.TestCheckResourceAttr(resourceName, "visibility_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "visibility_config.0.cloudwatch_metrics_enabled", "false"), @@ -2664,7 +2664,7 @@ func TestAccWAFV2WebACL_Custom_response(t *testing.T) { "action.0.block.0.custom_response.0.response_code": "429", "action.0.block.0.custom_response.0.custom_response_body_key": "test_body", "action.0.count.#": "0", - "priority": "1", + names.AttrPriority: "1", }), resource.TestCheckResourceAttr(resourceName, "visibility_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "visibility_config.0.cloudwatch_metrics_enabled", "false"), From ff622d1bc9d2cd9f9d70c07d1c4522564d5a0265 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 13:10:08 -0400 Subject: [PATCH 1081/1490] xray: Use constant for priority strings --- internal/service/xray/sampling_rule.go | 8 ++++---- internal/service/xray/sampling_rule_test.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/xray/sampling_rule.go b/internal/service/xray/sampling_rule.go index 2b4916e5d63..5bc277282c2 100644 --- a/internal/service/xray/sampling_rule.go +++ b/internal/service/xray/sampling_rule.go @@ -67,7 +67,7 @@ func resourceSamplingRule() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(0, 10), }, - "priority": { + names.AttrPriority: { Type: schema.TypeInt, Required: true, ValidateFunc: validation.IntBetween(1, 9999), @@ -123,7 +123,7 @@ func resourceSamplingRuleCreate(ctx context.Context, d *schema.ResourceData, met FixedRate: d.Get("fixed_rate").(float64), Host: aws.String(d.Get("host").(string)), HTTPMethod: aws.String(d.Get("http_method").(string)), - Priority: aws.Int32(int32(d.Get("priority").(int))), + Priority: aws.Int32(int32(d.Get(names.AttrPriority).(int))), ReservoirSize: int32(d.Get("reservoir_size").(int)), ResourceARN: aws.String(d.Get(names.AttrResourceARN).(string)), RuleName: aws.String(name), @@ -174,7 +174,7 @@ func resourceSamplingRuleRead(ctx context.Context, d *schema.ResourceData, meta d.Set("fixed_rate", samplingRule.FixedRate) d.Set("host", samplingRule.Host) d.Set("http_method", samplingRule.HTTPMethod) - d.Set("priority", samplingRule.Priority) + d.Set(names.AttrPriority, samplingRule.Priority) d.Set("reservoir_size", samplingRule.ReservoirSize) d.Set(names.AttrResourceARN, samplingRule.ResourceARN) d.Set("rule_name", samplingRule.RuleName) @@ -195,7 +195,7 @@ func resourceSamplingRuleUpdate(ctx context.Context, d *schema.ResourceData, met FixedRate: aws.Float64(d.Get("fixed_rate").(float64)), Host: aws.String(d.Get("host").(string)), HTTPMethod: aws.String(d.Get("http_method").(string)), - Priority: aws.Int32(int32(d.Get("priority").(int))), + Priority: aws.Int32(int32(d.Get(names.AttrPriority).(int))), ReservoirSize: aws.Int32(int32(d.Get("reservoir_size").(int))), ResourceARN: aws.String(d.Get(names.AttrResourceARN).(string)), RuleName: aws.String(d.Id()), diff --git a/internal/service/xray/sampling_rule_test.go b/internal/service/xray/sampling_rule_test.go index b873da789a8..365399ef74a 100644 --- a/internal/service/xray/sampling_rule_test.go +++ b/internal/service/xray/sampling_rule_test.go @@ -36,7 +36,7 @@ func TestAccXRaySamplingRule_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSamplingRuleExists(ctx, resourceName, &v), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "xray", fmt.Sprintf("sampling-rule/%s", rName)), - resource.TestCheckResourceAttr(resourceName, "priority", "5"), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "5"), resource.TestCheckResourceAttr(resourceName, names.AttrVersion, "1"), resource.TestCheckResourceAttr(resourceName, "reservoir_size", "10"), resource.TestCheckResourceAttr(resourceName, "url_path", "*"), @@ -78,7 +78,7 @@ func TestAccXRaySamplingRule_update(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSamplingRuleExists(ctx, resourceName, &v), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "xray", fmt.Sprintf("sampling-rule/%s", rName)), - resource.TestCheckResourceAttrSet(resourceName, "priority"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrPriority), resource.TestCheckResourceAttrSet(resourceName, "reservoir_size"), resource.TestCheckResourceAttr(resourceName, names.AttrVersion, "1"), resource.TestCheckResourceAttr(resourceName, "url_path", "*"), @@ -96,7 +96,7 @@ func TestAccXRaySamplingRule_update(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSamplingRuleExists(ctx, resourceName, &v), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "xray", fmt.Sprintf("sampling-rule/%s", rName)), - resource.TestCheckResourceAttr(resourceName, "priority", fmt.Sprintf("%d", updatedPriority)), + resource.TestCheckResourceAttr(resourceName, names.AttrPriority, fmt.Sprintf("%d", updatedPriority)), resource.TestCheckResourceAttr(resourceName, "reservoir_size", fmt.Sprintf("%d", updatedReservoirSize)), resource.TestCheckResourceAttr(resourceName, names.AttrVersion, "1"), resource.TestCheckResourceAttr(resourceName, "url_path", "*"), From 611ef5e6fa905ae12174136af9a517d50ad34a99 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Fri, 10 May 2024 14:45:43 -0400 Subject: [PATCH 1082/1490] d/aws_budgets_budget(doc): add tags attribute --- website/docs/d/budgets_budget.html.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/d/budgets_budget.html.markdown b/website/docs/d/budgets_budget.html.markdown index 9c949509cfb..239f1aa32c7 100644 --- a/website/docs/d/budgets_budget.html.markdown +++ b/website/docs/d/budgets_budget.html.markdown @@ -44,6 +44,7 @@ This data source exports the following attributes in addition to the arguments a * `cost_types` - Object containing [CostTypes](#cost-types) The types of cost included in a budget, such as tax and subscriptions. * `notification` - Object containing [Budget Notifications](#budget-notification). Can be used multiple times to define more than one budget notification. * `planned_limit` - Object containing [Planned Budget Limits](#planned-budget-limits). Can be used multiple times to plan more than one budget limit. See [PlannedBudgetLimits](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Budget.html#awscostmanagement-Type-budgets_Budget-PlannedBudgetLimits) documentation. +* `tags` - Map of tags assigned to the resource. * `time_period_end` - The end of the time period covered by the budget. There are no restrictions on the end date. Format: `2017-01-01_12:00`. * `time_period_start` - The start of the time period covered by the budget. If you don't specify a start date, AWS defaults to the start of your chosen time period. The start date must come before the end date. Format: `2017-01-01_12:00`. * `time_unit` - The length of time until a budget resets the actual and forecasted spend. Valid values: `MONTHLY`, `QUARTERLY`, `ANNUALLY`, and `DAILY`. From 36b178e6b5c0d2d5087d41668834fefb540baca2 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Fri, 10 May 2024 14:46:10 -0400 Subject: [PATCH 1083/1490] r/aws_budgets_budget(doc): tidy tags attribute descriptions --- website/docs/r/budgets_budget.html.markdown | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/website/docs/r/budgets_budget.html.markdown b/website/docs/r/budgets_budget.html.markdown index ab049f3a136..d8a043cbe1c 100644 --- a/website/docs/r/budgets_budget.html.markdown +++ b/website/docs/r/budgets_budget.html.markdown @@ -192,7 +192,8 @@ This argument supports the following arguments: * `time_unit` - (Required) The length of time until a budget resets the actual and forecasted spend. Valid values: `MONTHLY`, `QUARTERLY`, `ANNUALLY`, and `DAILY`. * `notification` - (Optional) Object containing [Budget Notifications](#budget-notification). Can be used multiple times to define more than one budget notification. * `planned_limit` - (Optional) Object containing [Planned Budget Limits](#planned-budget-limits). Can be used multiple times to plan more than one budget limit. See [PlannedBudgetLimits](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Budget.html#awscostmanagement-Type-budgets_Budget-PlannedBudgetLimits) documentation. -* `tags` - Tags to apply to the domain. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. +* `tags` - (Optional) Map of tags assigned to the resource. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. + ## Attribute Reference @@ -200,7 +201,7 @@ This resource exports the following attributes in addition to the arguments abov * `id` - id of resource. * `arn` - The ARN of the budget. -* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). +* `tags_all` - Map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). ### Auto Adjust Data From b8f119bada89b5467a3963277bdaddc0d53cbb78 Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Fri, 10 May 2024 14:46:23 -0400 Subject: [PATCH 1084/1490] r/aws_budgets_budget_action(doc): tidy tags attribute descriptions --- website/docs/r/budgets_budget_action.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/r/budgets_budget_action.html.markdown b/website/docs/r/budgets_budget_action.html.markdown index 4fb9d6d35b0..ba895e59129 100644 --- a/website/docs/r/budgets_budget_action.html.markdown +++ b/website/docs/r/budgets_budget_action.html.markdown @@ -100,7 +100,7 @@ This resource supports the following arguments: * `execution_role_arn` - (Required) The role passed for action execution and reversion. Roles and actions must be in the same account. * `notification_type` - (Required) The type of a notification. Valid values are `ACTUAL` or `FORECASTED`. * `subscriber` - (Required) A list of subscribers. See [Subscriber](#subscriber). -* `tags` - Tags to apply to the domain. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. +* `tags` - (Optional) Map of tags assigned to the resource. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ### Action Threshold @@ -144,7 +144,7 @@ This resource exports the following attributes in addition to the arguments abov * `id` - ID of resource. * `arn` - The ARN of the budget action. * `status` - The status of the budget action. -* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). +* `tags_all` - Map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). ## Timeouts From 85df8514b15896e3685c08232dc677b4661a18fe Mon Sep 17 00:00:00 2001 From: Jared Baker Date: Fri, 10 May 2024 15:01:18 -0400 Subject: [PATCH 1085/1490] r/aws_budgets_budget(doc): alphabetize arguments --- website/docs/r/budgets_budget.html.markdown | 34 +++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/website/docs/r/budgets_budget.html.markdown b/website/docs/r/budgets_budget.html.markdown index d8a043cbe1c..faf77bc1f63 100644 --- a/website/docs/r/budgets_budget.html.markdown +++ b/website/docs/r/budgets_budget.html.markdown @@ -176,45 +176,47 @@ resource "aws_budgets_budget" "cost" { For more detailed documentation about each argument, refer to the [AWS official documentation](http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/data-type-budget.html). -This argument supports the following arguments: +The following arguments are required: -* `account_id` - (Optional) The ID of the target account for budget. Will use current user's account_id by default if omitted. -* `auto_adjust_data` - (Optional) Object containing [AutoAdjustData] which determines the budget amount for an auto-adjusting budget. -* `name` - (Optional) The name of a budget. Unique within accounts. -* `name_prefix` - (Optional) The prefix of the name of a budget. Unique within accounts. * `budget_type` - (Required) Whether this budget tracks monetary cost or usage. -* `cost_filter` - (Optional) A list of [CostFilter](#cost-filter) name/values pair to apply to budget. -* `cost_types` - (Optional) Object containing [CostTypes](#cost-types) The types of cost included in a budget, such as tax and subscriptions. * `limit_amount` - (Required) The amount of cost or usage being measured for a budget. * `limit_unit` - (Required) The unit of measurement used for the budget forecast, actual spend, or budget threshold, such as dollars or GB. See [Spend](http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/data-type-spend.html) documentation. -* `time_period_end` - (Optional) The end of the time period covered by the budget. There are no restrictions on the end date. Format: `2017-01-01_12:00`. -* `time_period_start` - (Optional) The start of the time period covered by the budget. If you don't specify a start date, AWS defaults to the start of your chosen time period. The start date must come before the end date. Format: `2017-01-01_12:00`. * `time_unit` - (Required) The length of time until a budget resets the actual and forecasted spend. Valid values: `MONTHLY`, `QUARTERLY`, `ANNUALLY`, and `DAILY`. + +The following arguments are optional: + +* `account_id` - (Optional) The ID of the target account for budget. Will use current user's account_id by default if omitted. +* `auto_adjust_data` - (Optional) Object containing [AutoAdjustData](#auto-adjust-data) which determines the budget amount for an auto-adjusting budget. +* `cost_filter` - (Optional) A list of [CostFilter](#cost-filter) name/values pair to apply to budget. +* `cost_types` - (Optional) Object containing [CostTypes](#cost-types) The types of cost included in a budget, such as tax and subscriptions. +* `name` - (Optional) The name of a budget. Unique within accounts. +* `name_prefix` - (Optional) The prefix of the name of a budget. Unique within accounts. * `notification` - (Optional) Object containing [Budget Notifications](#budget-notification). Can be used multiple times to define more than one budget notification. * `planned_limit` - (Optional) Object containing [Planned Budget Limits](#planned-budget-limits). Can be used multiple times to plan more than one budget limit. See [PlannedBudgetLimits](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_Budget.html#awscostmanagement-Type-budgets_Budget-PlannedBudgetLimits) documentation. * `tags` - (Optional) Map of tags assigned to the resource. If configured with a provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. - +* `time_period_end` - (Optional) The end of the time period covered by the budget. There are no restrictions on the end date. Format: `2017-01-01_12:00`. +* `time_period_start` - (Optional) The start of the time period covered by the budget. If you don't specify a start date, AWS defaults to the start of your chosen time period. The start date must come before the end date. Format: `2017-01-01_12:00`. ## Attribute Reference This resource exports the following attributes in addition to the arguments above: -* `id` - id of resource. * `arn` - The ARN of the budget. +* `id` - id of resource. * `tags_all` - Map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#default_tags-configuration-block). ### Auto Adjust Data The parameters that determine the budget amount for an auto-adjusting budget. -`auto_adjust_type` (Required) - The string that defines whether your budget auto-adjusts based on historical or forecasted data. Valid values: `FORECAST`,`HISTORICAL` -`historical_options` (Optional) - Configuration block of [Historical Options](#historical-options). Required for `auto_adjust_type` of `HISTORICAL` Configuration block that defines the historical data that your auto-adjusting budget is based on. -`last_auto_adjust_time` (Optional) - The last time that your budget was auto-adjusted. +* `auto_adjust_type` (Required) - The string that defines whether your budget auto-adjusts based on historical or forecasted data. Valid values: `FORECAST`,`HISTORICAL` +* `historical_options` (Optional) - Configuration block of [Historical Options](#historical-options). Required for `auto_adjust_type` of `HISTORICAL` Configuration block that defines the historical data that your auto-adjusting budget is based on. +* `last_auto_adjust_time` (Optional) - The last time that your budget was auto-adjusted. ### Historical Options -`budget_adjustment_period` (Required) - The number of budget periods included in the moving-average calculation that determines your auto-adjusted budget amount. -`lookback_available_periods` (Optional) - The integer that describes how many budget periods in your BudgetAdjustmentPeriod are included in the calculation of your current budget limit. If the first budget period in your BudgetAdjustmentPeriod has no cost data, then that budget period isn’t included in the average that determines your budget limit. You can’t set your own LookBackAvailablePeriods. The value is automatically calculated from the `budget_adjustment_period` and your historical cost data. +* `budget_adjustment_period` (Required) - The number of budget periods included in the moving-average calculation that determines your auto-adjusted budget amount. +* `lookback_available_periods` (Optional) - The integer that describes how many budget periods in your BudgetAdjustmentPeriod are included in the calculation of your current budget limit. If the first budget period in your BudgetAdjustmentPeriod has no cost data, then that budget period isn’t included in the average that determines your budget limit. You can’t set your own LookBackAvailablePeriods. The value is automatically calculated from the `budget_adjustment_period` and your historical cost data. ### Cost Types From 60a3e9d4b3fe012bcc64ca6b1c135d4077370dd0 Mon Sep 17 00:00:00 2001 From: changelogbot Date: Fri, 10 May 2024 19:09:01 +0000 Subject: [PATCH 1086/1490] Update CHANGELOG.md for #37433 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81bd3ede913..66b5683c61e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ ENHANCEMENTS: * data-source/aws_instance: Add `launch_time` attribute ([#37002](https://github.com/hashicorp/terraform-provider-aws/issues/37002)) +BUG FIXES: + +* resource/aws_glue_job: Fix `interface conversion: interface {} is nil, not map[string]interface {}` panic when `notify_delay_after` is empty (`null`) ([#37347](https://github.com/hashicorp/terraform-provider-aws/issues/37347)) +* resource/aws_lakeformation_data_cells_filter: Fix inconsistent `state` error when using `row_filter.all_rows_wildcard` ([#37433](https://github.com/hashicorp/terraform-provider-aws/issues/37433)) + ## 5.49.0 (May 10, 2024) FEATURES: From eff7e0a22cabe2a32097ab3d21ccb988f8a4d853 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:15 -0400 Subject: [PATCH 1087/1490] ci: Prefer constant for string literal "path" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index caacfe8c35d..61e3cc241df 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1395,3 +1395,13 @@ rules: - pattern: '"priority"' severity: ERROR fix: "names.AttrPriority" + - id: literal-path-string-constant + languages: [go] + message: Use the constant `names.AttrPath` for the string literal "path" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"path"' + severity: ERROR + fix: "names.AttrPath" From 50c68a8967496377d28b1322f3ace694e865bed4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:15 -0400 Subject: [PATCH 1088/1490] names: Add constant for string literal "path" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 1be175810f2..d63a613c8aa 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -46,6 +46,7 @@ const ( AttrOwnerID = "owner_id" AttrParameters = "parameters" AttrPassword = "password" + AttrPath = "path" AttrPolicy = "policy" AttrPort = "port" AttrPreferredMaintenanceWindow = "preferred_maintenance_window" From 7fd96634bc94ec9d89dcf99a4141015dd5ab48cd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:15 -0400 Subject: [PATCH 1089/1490] apigateway: Use constant for path strings --- internal/service/apigateway/documentation_part.go | 6 +++--- internal/service/apigateway/resource.go | 5 +++-- .../service/apigateway/resource_data_source.go | 5 +++-- internal/service/apigateway/resource_test.go | 8 ++++---- internal/service/apigateway/usage_plan.go | 14 +++++++------- internal/service/apigateway/usage_plan_test.go | 12 ++++++------ 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/internal/service/apigateway/documentation_part.go b/internal/service/apigateway/documentation_part.go index b947f78c1e4..151e2277d5d 100644 --- a/internal/service/apigateway/documentation_part.go +++ b/internal/service/apigateway/documentation_part.go @@ -56,7 +56,7 @@ func resourceDocumentationPart() *schema.Resource { Optional: true, ForceNew: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -257,7 +257,7 @@ func expandDocumentationPartLocation(l []interface{}) *types.DocumentationPartLo if v, ok := loc[names.AttrName]; ok { out.Name = aws.String(v.(string)) } - if v, ok := loc["path"]; ok { + if v, ok := loc[names.AttrPath]; ok { out.Path = aws.String(v.(string)) } if v, ok := loc["status_code"]; ok { @@ -282,7 +282,7 @@ func flattenDocumentationPartLocation(l *types.DocumentationPartLocation) []inte } if v := l.Path; v != nil { - m["path"] = aws.ToString(v) + m[names.AttrPath] = aws.ToString(v) } if v := l.StatusCode; v != nil { diff --git a/internal/service/apigateway/resource.go b/internal/service/apigateway/resource.go index 97f47e0d8d1..4a1d0f60ca9 100644 --- a/internal/service/apigateway/resource.go +++ b/internal/service/apigateway/resource.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_api_gateway_resource", name="Resource") @@ -48,7 +49,7 @@ func resourceResource() *schema.Resource { Type: schema.TypeString, Required: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -104,7 +105,7 @@ func resourceResourceRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("parent_id", resource.ParentId) d.Set("path_part", resource.PathPart) - d.Set("path", resource.Path) + d.Set(names.AttrPath, resource.Path) return diags } diff --git a/internal/service/apigateway/resource_data_source.go b/internal/service/apigateway/resource_data_source.go index 5d533c5812a..cf9d2d72399 100644 --- a/internal/service/apigateway/resource_data_source.go +++ b/internal/service/apigateway/resource_data_source.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_api_gateway_resource", name="Resource") @@ -29,7 +30,7 @@ func dataSourceResource() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, }, @@ -49,7 +50,7 @@ func dataSourceResourceRead(ctx context.Context, d *schema.ResourceData, meta in var diags diag.Diagnostics conn := meta.(*conns.AWSClient).APIGatewayClient(ctx) - path := d.Get("path").(string) + path := d.Get(names.AttrPath).(string) input := &apigateway.GetResourcesInput{ RestApiId: aws.String(d.Get("rest_api_id").(string)), } diff --git a/internal/service/apigateway/resource_test.go b/internal/service/apigateway/resource_test.go index 83430888a5a..4ee712fe963 100644 --- a/internal/service/apigateway/resource_test.go +++ b/internal/service/apigateway/resource_test.go @@ -36,7 +36,7 @@ func TestAccAPIGatewayResource_basic(t *testing.T) { Config: testAccResourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckResourceExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "path", "/test"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/test"), resource.TestCheckResourceAttr(resourceName, "path_part", "test"), ), }, @@ -66,7 +66,7 @@ func TestAccAPIGatewayResource_update(t *testing.T) { Config: testAccResourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckResourceExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "path", "/test"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/test"), resource.TestCheckResourceAttr(resourceName, "path_part", "test"), ), }, @@ -80,7 +80,7 @@ func TestAccAPIGatewayResource_update(t *testing.T) { Config: testAccResourceConfig_updatePathPart(rName), Check: resource.ComposeTestCheckFunc( testAccCheckResourceExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "path", "/test_changed"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/test_changed"), resource.TestCheckResourceAttr(resourceName, "path_part", "test_changed"), ), }, @@ -135,7 +135,7 @@ func TestAccAPIGatewayResource_withSleep(t *testing.T) { Config: testAccResourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckResourceExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "path", "/test"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/test"), resource.TestCheckResourceAttr(resourceName, "path_part", "test"), ), }, diff --git a/internal/service/apigateway/usage_plan.go b/internal/service/apigateway/usage_plan.go index 3bd563067b6..83fd3b61825 100644 --- a/internal/service/apigateway/usage_plan.go +++ b/internal/service/apigateway/usage_plan.go @@ -63,7 +63,7 @@ func resourceUsagePlan() *schema.Resource { Default: 0, Optional: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, }, @@ -331,12 +331,12 @@ func resourceUsagePlanUpdate(ctx context.Context, d *schema.ResourceData, meta i th := throttle.(map[string]interface{}) operations = append(operations, types.PatchOperation{ Op: types.OpReplace, - Path: aws.String(fmt.Sprintf("/apiStages/%s/throttle/%s/rateLimit", id, th["path"].(string))), + Path: aws.String(fmt.Sprintf("/apiStages/%s/throttle/%s/rateLimit", id, th[names.AttrPath].(string))), Value: aws.String(strconv.FormatFloat(th["rate_limit"].(float64), 'f', -1, 64)), }) operations = append(operations, types.PatchOperation{ Op: types.OpReplace, - Path: aws.String(fmt.Sprintf("/apiStages/%s/throttle/%s/burstLimit", id, th["path"].(string))), + Path: aws.String(fmt.Sprintf("/apiStages/%s/throttle/%s/burstLimit", id, th[names.AttrPath].(string))), Value: aws.String(strconv.Itoa(th["burst_limit"].(int))), }) } @@ -675,7 +675,7 @@ func expandThrottleSettingsList(tfList []interface{}) map[string]types.ThrottleS apiObject.RateLimit = v } - if v, ok := tfMap["path"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPath].(string); ok && v != "" { apiObjects[v] = apiObject } } @@ -692,9 +692,9 @@ func flattenThrottleSettingsMap(apiObjects map[string]types.ThrottleSettings) [] for k, apiObject := range apiObjects { tfList = append(tfList, map[string]interface{}{ - "path": k, - "rate_limit": apiObject.RateLimit, - "burst_limit": apiObject.BurstLimit, + names.AttrPath: k, + "rate_limit": apiObject.RateLimit, + "burst_limit": apiObject.BurstLimit, }) } diff --git a/internal/service/apigateway/usage_plan_test.go b/internal/service/apigateway/usage_plan_test.go index bd1210e1acc..3ac86e93ead 100644 --- a/internal/service/apigateway/usage_plan_test.go +++ b/internal/service/apigateway/usage_plan_test.go @@ -497,9 +497,9 @@ func TestAccAPIGatewayUsagePlan_APIStages_throttle(t *testing.T) { "throttle.#": "1", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "api_stages.0.throttle.*", map[string]string{ - "path": "/test/GET", - "burst_limit": "3", - "rate_limit": "6", + names.AttrPath: "/test/GET", + "burst_limit": "3", + "rate_limit": "6", }), ), }, @@ -518,9 +518,9 @@ func TestAccAPIGatewayUsagePlan_APIStages_throttle(t *testing.T) { "throttle.#": "1", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "api_stages.0.throttle.*", map[string]string{ - "path": "/test/GET", - "burst_limit": "3", - "rate_limit": "6", + names.AttrPath: "/test/GET", + "burst_limit": "3", + "rate_limit": "6", }), ), }, From 7251a4ddb3a23d76f92d6e5b8e55753bbbc3ecd6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:16 -0400 Subject: [PATCH 1090/1490] appmesh: Use constant for path strings --- internal/service/appmesh/flex.go | 12 ++++++------ internal/service/appmesh/gateway_route.go | 12 ++++++------ internal/service/appmesh/route.go | 2 +- internal/service/appmesh/virtual_gateway.go | 12 ++++++------ internal/service/appmesh/virtual_node.go | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/internal/service/appmesh/flex.go b/internal/service/appmesh/flex.go index 71c05916782..d26054eaef5 100644 --- a/internal/service/appmesh/flex.go +++ b/internal/service/appmesh/flex.go @@ -448,7 +448,7 @@ func expandHTTPRoute(vHttpRoute []interface{}) *appmesh.HttpRoute { httpRouteMatch.Headers = httpRouteHeaders } - if vHttpRoutePath, ok := mHttpRouteMatch["path"].([]interface{}); ok && len(vHttpRoutePath) > 0 && vHttpRoutePath[0] != nil { + if vHttpRoutePath, ok := mHttpRouteMatch[names.AttrPath].([]interface{}); ok && len(vHttpRoutePath) > 0 && vHttpRoutePath[0] != nil { httpRoutePath := &appmesh.HttpPathMatch{} mHttpRoutePath := vHttpRoutePath[0].(map[string]interface{}) @@ -812,7 +812,7 @@ func expandVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec { if vIntervalMillis, ok := mHealthCheck["interval_millis"].(int); ok && vIntervalMillis > 0 { healthCheck.IntervalMillis = aws.Int64(int64(vIntervalMillis)) } - if vPath, ok := mHealthCheck["path"].(string); ok && vPath != "" { + if vPath, ok := mHealthCheck[names.AttrPath].(string); ok && vPath != "" { healthCheck.Path = aws.String(vPath) } if vPort, ok := mHealthCheck[names.AttrPort].(int); ok && vPort > 0 { @@ -1057,7 +1057,7 @@ func expandVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec { file.Format = format } - if vPath, ok := mFile["path"].(string); ok && vPath != "" { + if vPath, ok := mFile[names.AttrPath].(string); ok && vPath != "" { file.Path = aws.String(vPath) } @@ -1503,7 +1503,7 @@ func flattenHTTPRoute(httpRoute *appmesh.HttpRoute) []interface{} { map[string]interface{}{ "header": vHttpRouteHeaders, "method": aws.StringValue(httpRouteMatch.Method), - "path": vHttpRoutePath, + names.AttrPath: vHttpRoutePath, names.AttrPort: int(aws.Int64Value(httpRouteMatch.Port)), names.AttrPrefix: aws.StringValue(httpRouteMatch.Prefix), "query_parameter": vHttpRouteQueryParameters, @@ -1718,7 +1718,7 @@ func flattenVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} { mHealthCheck := map[string]interface{}{ "healthy_threshold": int(aws.Int64Value(healthCheck.HealthyThreshold)), "interval_millis": int(aws.Int64Value(healthCheck.IntervalMillis)), - "path": aws.StringValue(healthCheck.Path), + names.AttrPath: aws.StringValue(healthCheck.Path), names.AttrPort: int(aws.Int64Value(healthCheck.Port)), names.AttrProtocol: aws.StringValue(healthCheck.Protocol), "timeout_millis": int(aws.Int64Value(healthCheck.TimeoutMillis)), @@ -1874,7 +1874,7 @@ func flattenVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} { mFile["format"] = []interface{}{mFormat} } - mFile["path"] = aws.StringValue(file.Path) + mFile[names.AttrPath] = aws.StringValue(file.Path) mAccessLog["file"] = []interface{}{mFile} } diff --git a/internal/service/appmesh/gateway_route.go b/internal/service/appmesh/gateway_route.go index df9ced0d3c1..bed450dd7cc 100644 --- a/internal/service/appmesh/gateway_route.go +++ b/internal/service/appmesh/gateway_route.go @@ -136,7 +136,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { fmt.Sprintf("spec.0.%s.0.action.0.rewrite.0.prefix", attrName), }, }, - "path": { + names.AttrPath: { Type: schema.TypeList, Optional: true, MinItems: 1, @@ -331,7 +331,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { fmt.Sprintf("spec.0.%s.0.match.0.prefix", attrName), }, }, - "path": { + names.AttrPath: { Type: schema.TypeList, Optional: true, MinItems: 0, @@ -807,7 +807,7 @@ func expandHTTPGatewayRouteRewrite(vHttpRouteRewrite []interface{}) *appmesh.Htt routeRewrite.Hostname = routeHostnameRewrite } - if vRoutePathRewrite, ok := mRouteRewrite["path"].([]interface{}); ok && len(vRoutePathRewrite) > 0 && vRoutePathRewrite[0] != nil { + if vRoutePathRewrite, ok := mRouteRewrite[names.AttrPath].([]interface{}); ok && len(vRoutePathRewrite) > 0 && vRoutePathRewrite[0] != nil { mRoutePathRewrite := vRoutePathRewrite[0].(map[string]interface{}) routePathRewrite := &appmesh.HttpGatewayRoutePathRewrite{} if vExact, ok := mRoutePathRewrite["exact"].(string); ok && vExact != "" { @@ -916,7 +916,7 @@ func expandHTTPGatewayRouteMatch(vHttpRouteMatch []interface{}) *appmesh.HttpGat routeMatch.Hostname = hostnameMatch } - if vPath, ok := mRouteMatch["path"].([]interface{}); ok && len(vPath) > 0 && vPath[0] != nil { + if vPath, ok := mRouteMatch[names.AttrPath].([]interface{}); ok && len(vPath) > 0 && vPath[0] != nil { pathMatch := &appmesh.HttpPathMatch{} mHostname := vPath[0].(map[string]interface{}) @@ -1129,7 +1129,7 @@ func flattenHTTPGatewayRouteMatch(routeMatch *appmesh.HttpGatewayRouteMatch) []i mPath["regex"] = aws.StringValue(path.Regex) } - mRouteMatch["path"] = []interface{}{mPath} + mRouteMatch[names.AttrPath] = []interface{}{mPath} } vQueryParameters := []interface{}{} @@ -1173,7 +1173,7 @@ func flattenHTTPGatewayRouteRewrite(routeRewrite *appmesh.HttpGatewayRouteRewrit mRewritePath := map[string]interface{}{ "exact": aws.StringValue(rewritePath.Exact), } - mRouteRewrite["path"] = []interface{}{mRewritePath} + mRouteRewrite[names.AttrPath] = []interface{}{mRewritePath} } if rewritePrefix := routeRewrite.Prefix; rewritePrefix != nil { diff --git a/internal/service/appmesh/route.go b/internal/service/appmesh/route.go index e6efdf4ee21..f5408cd1e6f 100644 --- a/internal/service/appmesh/route.go +++ b/internal/service/appmesh/route.go @@ -217,7 +217,7 @@ func resourceRouteSpecSchema() *schema.Schema { Optional: true, ValidateFunc: validation.StringInSlice(appmesh.HttpMethod_Values(), false), }, - "path": { + names.AttrPath: { Type: schema.TypeList, Optional: true, MinItems: 0, diff --git a/internal/service/appmesh/virtual_gateway.go b/internal/service/appmesh/virtual_gateway.go index e59b2e48df6..0f49aae6528 100644 --- a/internal/service/appmesh/virtual_gateway.go +++ b/internal/service/appmesh/virtual_gateway.go @@ -380,7 +380,7 @@ func resourceVirtualGatewaySpecSchema() *schema.Schema { Required: true, ValidateFunc: validation.IntBetween(5000, 300000), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, }, @@ -634,7 +634,7 @@ func resourceVirtualGatewaySpecSchema() *schema.Schema { }, }, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 255), @@ -877,7 +877,7 @@ func expandVirtualGatewaySpec(vSpec []interface{}) *appmesh.VirtualGatewaySpec { if vIntervalMillis, ok := mHealthCheck["interval_millis"].(int); ok && vIntervalMillis > 0 { healthCheck.IntervalMillis = aws.Int64(int64(vIntervalMillis)) } - if vPath, ok := mHealthCheck["path"].(string); ok && vPath != "" { + if vPath, ok := mHealthCheck[names.AttrPath].(string); ok && vPath != "" { healthCheck.Path = aws.String(vPath) } if vPort, ok := mHealthCheck[names.AttrPort].(int); ok && vPort > 0 { @@ -1122,7 +1122,7 @@ func expandVirtualGatewaySpec(vSpec []interface{}) *appmesh.VirtualGatewaySpec { file.Format = format } - if vPath, ok := mFile["path"].(string); ok && vPath != "" { + if vPath, ok := mFile[names.AttrPath].(string); ok && vPath != "" { file.Path = aws.String(vPath) } @@ -1325,7 +1325,7 @@ func flattenVirtualGatewaySpec(spec *appmesh.VirtualGatewaySpec) []interface{} { mHealthCheck := map[string]interface{}{ "healthy_threshold": int(aws.Int64Value(healthCheck.HealthyThreshold)), "interval_millis": int(aws.Int64Value(healthCheck.IntervalMillis)), - "path": aws.StringValue(healthCheck.Path), + names.AttrPath: aws.StringValue(healthCheck.Path), names.AttrPort: int(aws.Int64Value(healthCheck.Port)), names.AttrProtocol: aws.StringValue(healthCheck.Protocol), "timeout_millis": int(aws.Int64Value(healthCheck.TimeoutMillis)), @@ -1461,7 +1461,7 @@ func flattenVirtualGatewaySpec(spec *appmesh.VirtualGatewaySpec) []interface{} { mFile["format"] = []interface{}{mFormat} } - mFile["path"] = aws.StringValue(file.Path) + mFile[names.AttrPath] = aws.StringValue(file.Path) mAccessLog["file"] = []interface{}{mFile} } diff --git a/internal/service/appmesh/virtual_node.go b/internal/service/appmesh/virtual_node.go index 324f0782b64..0bfe4dd0c8b 100644 --- a/internal/service/appmesh/virtual_node.go +++ b/internal/service/appmesh/virtual_node.go @@ -394,7 +394,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { Required: true, ValidateFunc: validation.IntBetween(5000, 300000), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, }, @@ -889,7 +889,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { }, }, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 255), From e4d288c3645e458700ba7e59ae528ab780153934 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:16 -0400 Subject: [PATCH 1091/1490] apprunner: Use constant for path strings --- internal/service/apprunner/service.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/apprunner/service.go b/internal/service/apprunner/service.go index 1572f69b9eb..d938806a2e7 100644 --- a/internal/service/apprunner/service.go +++ b/internal/service/apprunner/service.go @@ -86,7 +86,7 @@ func resourceService() *schema.Resource { Default: 5, ValidateFunc: validation.IntBetween(1, 20), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", @@ -772,7 +772,7 @@ func expandServiceHealthCheckConfiguration(l []interface{}) *types.HealthCheckCo result.Interval = aws.Int32(int32(v)) } - if v, ok := tfMap["path"].(string); ok { + if v, ok := tfMap[names.AttrPath].(string); ok { result.Path = aws.String(v) } @@ -1171,7 +1171,7 @@ func flattenServiceHealthCheckConfiguration(config *types.HealthCheckConfigurati m := map[string]interface{}{ "healthy_threshold": config.HealthyThreshold, "interval": config.Interval, - "path": aws.ToString(config.Path), + names.AttrPath: aws.ToString(config.Path), names.AttrProtocol: string(config.Protocol), "timeout": config.Timeout, "unhealthy_threshold": config.UnhealthyThreshold, From f5033ac9d03eb7034dd8f0c9ef706fdb238a6c49 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:16 -0400 Subject: [PATCH 1092/1490] batch: Use constant for path strings --- internal/service/batch/eks_properties.go | 4 ++-- internal/service/batch/job_definition.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/batch/eks_properties.go b/internal/service/batch/eks_properties.go index 4240c75a99e..acbc4736a22 100644 --- a/internal/service/batch/eks_properties.go +++ b/internal/service/batch/eks_properties.go @@ -172,7 +172,7 @@ func expandVolumes(volumes []interface{}) []*batch.EksVolume { if h, ok := volumeMap["host_path"].([]interface{}); ok && len(h) > 0 { volume.HostPath = &batch.EksHostPath{} if host, ok := h[0].(map[string]interface{}); ok { - if v, ok := host["path"]; ok { + if v, ok := host[names.AttrPath]; ok { volume.HostPath.Path = aws.String(v.(string)) } } @@ -371,7 +371,7 @@ func flattenEKSVolumes(volumes []*batch.EksVolume) (tfList []interface{}) { if v := v.HostPath; v != nil { tfMap["host_path"] = []map[string]interface{}{{ - "path": aws.StringValue(v.Path), + names.AttrPath: aws.StringValue(v.Path), }} } diff --git a/internal/service/batch/job_definition.go b/internal/service/batch/job_definition.go index 8baa1e71d7f..581398205d3 100644 --- a/internal/service/batch/job_definition.go +++ b/internal/service/batch/job_definition.go @@ -288,7 +288,7 @@ func ResourceJobDefinition() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, }, From a2c4f9a036311fb06c30b38750538c5bdb96dfa5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:16 -0400 Subject: [PATCH 1093/1490] codebuild: Use constant for path strings --- internal/service/codebuild/project.go | 10 +++++----- internal/service/codebuild/project_test.go | 4 ++-- internal/service/codebuild/report_group.go | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/codebuild/project.go b/internal/service/codebuild/project.go index 3916686e2e1..7bd173325a2 100644 --- a/internal/service/codebuild/project.go +++ b/internal/service/codebuild/project.go @@ -111,7 +111,7 @@ func resourceProject() *schema.Resource { }, ValidateDiagFunc: enum.Validate[types.ArtifactPackaging](), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, }, @@ -490,7 +490,7 @@ func resourceProject() *schema.Resource { Default: types.ArtifactPackagingNone, ValidateDiagFunc: enum.Validate[types.ArtifactPackaging](), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, }, @@ -1283,7 +1283,7 @@ func expandProjectArtifacts(tfMap map[string]interface{}) *types.ProjectArtifact apiObject.Packaging = types.ArtifactPackaging(v) } - if v, ok := tfMap["path"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPath].(string); ok && v != "" { apiObject.Path = aws.String(v) } @@ -1727,7 +1727,7 @@ func flattenProjectArtifacts(apiObject *types.ProjectArtifacts) map[string]inter } if apiObject.Path != nil { - tfMap["path"] = aws.ToString(apiObject.Path) + tfMap[names.AttrPath] = aws.ToString(apiObject.Path) } return tfMap @@ -1765,7 +1765,7 @@ func resourceProjectArtifactsHash(v interface{}) int { buf.WriteString(fmt.Sprintf("%s-", v.(string))) } - if v, ok := tfMap["path"]; ok { + if v, ok := tfMap[names.AttrPath]; ok { buf.WriteString(fmt.Sprintf("%s-", v.(string))) } diff --git a/internal/service/codebuild/project_test.go b/internal/service/codebuild/project_test.go index a57cd3b3dd6..df5a401191c 100644 --- a/internal/service/codebuild/project_test.go +++ b/internal/service/codebuild/project_test.go @@ -2692,7 +2692,7 @@ func TestAccCodeBuildProject_SecondaryArtifacts_path(t *testing.T) { testAccCheckProjectExists(ctx, resourceName, &project), resource.TestCheckResourceAttr(resourceName, "secondary_artifacts.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "secondary_artifacts.*", map[string]string{ - "path": path1, + names.AttrPath: path1, }), ), }, @@ -2702,7 +2702,7 @@ func TestAccCodeBuildProject_SecondaryArtifacts_path(t *testing.T) { testAccCheckProjectExists(ctx, resourceName, &project), resource.TestCheckResourceAttr(resourceName, "secondary_artifacts.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "secondary_artifacts.*", map[string]string{ - "path": path2, + names.AttrPath: path2, }), ), }, diff --git a/internal/service/codebuild/report_group.go b/internal/service/codebuild/report_group.go index f37c97df30a..d0260f8346d 100644 --- a/internal/service/codebuild/report_group.go +++ b/internal/service/codebuild/report_group.go @@ -82,7 +82,7 @@ func resourceReportGroup() *schema.Resource { Default: types.ReportPackagingTypeNone, ValidateDiagFunc: enum.Validate[types.ReportPackagingType](), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, }, @@ -339,7 +339,7 @@ func expandReportGroupS3ReportExportConfig(tfList []interface{}) *types.S3Report apiObject.Packaging = types.ReportPackagingType(v.(string)) } - if v, ok := tfMap["path"]; ok { + if v, ok := tfMap[names.AttrPath]; ok { apiObject.Path = aws.String(v.(string)) } @@ -368,7 +368,7 @@ func flattenReportGroupS3ReportExportConfig(apiObject *types.S3ReportExportConfi } if v := apiObject.Path; v != nil { - tfMap["path"] = aws.ToString(v) + tfMap[names.AttrPath] = aws.ToString(v) } return []map[string]interface{}{tfMap} From 1bb2da509a6d42473da294cc99c43ff91f21a801 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:17 -0400 Subject: [PATCH 1094/1490] efs: Use constant for path strings --- internal/service/efs/access_point.go | 6 +++--- internal/service/efs/access_point_data_source.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/efs/access_point.go b/internal/service/efs/access_point.go index 6904ff745d1..222debd486f 100644 --- a/internal/service/efs/access_point.go +++ b/internal/service/efs/access_point.go @@ -89,7 +89,7 @@ func ResourceAccessPoint() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -280,7 +280,7 @@ func expandAccessPointRootDirectory(rDir []interface{}) *efs.RootDirectory { rootDir := &efs.RootDirectory{} - if v, ok := m["path"]; ok { + if v, ok := m[names.AttrPath]; ok { rootDir.Path = aws.String(v.(string)) } @@ -327,7 +327,7 @@ func flattenAccessPointRootDirectory(rDir *efs.RootDirectory) []interface{} { } m := map[string]interface{}{ - "path": aws.StringValue(rDir.Path), + names.AttrPath: aws.StringValue(rDir.Path), "creation_info": flattenAccessPointRootDirectoryCreationInfo(rDir.CreationInfo), } diff --git a/internal/service/efs/access_point_data_source.go b/internal/service/efs/access_point_data_source.go index 56e6104d559..653cc0b5126 100644 --- a/internal/service/efs/access_point_data_source.go +++ b/internal/service/efs/access_point_data_source.go @@ -71,7 +71,7 @@ func DataSourceAccessPoint() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, From f504a573b5c23f7400aba2754fa1731d463fedc1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:17 -0400 Subject: [PATCH 1095/1490] elbv2: Use constant for path strings --- internal/service/elbv2/listener.go | 6 +++--- internal/service/elbv2/listener_data_source.go | 2 +- internal/service/elbv2/listener_rule.go | 2 +- internal/service/elbv2/target_group.go | 12 ++++++------ internal/service/elbv2/target_group_data_source.go | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/elbv2/listener.go b/internal/service/elbv2/listener.go index d47935f9108..4a3befee1fb 100644 --- a/internal/service/elbv2/listener.go +++ b/internal/service/elbv2/listener.go @@ -286,7 +286,7 @@ func ResourceListener() *schema.Resource { Default: "#{host}", ValidateFunc: validation.StringLenBetween(1, 128), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/#{path}", @@ -855,7 +855,7 @@ func expandLbListenerRedirectActionConfig(l []interface{}) *awstypes.RedirectAct return &awstypes.RedirectActionConfig{ Host: aws.String(tfMap["host"].(string)), - Path: aws.String(tfMap["path"].(string)), + Path: aws.String(tfMap[names.AttrPath].(string)), Port: aws.String(tfMap[names.AttrPort].(string)), Protocol: aws.String(tfMap[names.AttrProtocol].(string)), Query: aws.String(tfMap["query"].(string)), @@ -1178,7 +1178,7 @@ func flattenLbListenerActionRedirectConfig(config *awstypes.RedirectActionConfig m := map[string]interface{}{ "host": aws.ToString(config.Host), - "path": aws.ToString(config.Path), + names.AttrPath: aws.ToString(config.Path), names.AttrPort: aws.ToString(config.Port), names.AttrProtocol: aws.ToString(config.Protocol), "query": aws.ToString(config.Query), diff --git a/internal/service/elbv2/listener_data_source.go b/internal/service/elbv2/listener_data_source.go index 6748be0f47a..7e3d4e93408 100644 --- a/internal/service/elbv2/listener_data_source.go +++ b/internal/service/elbv2/listener_data_source.go @@ -221,7 +221,7 @@ func DataSourceListener() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/elbv2/listener_rule.go b/internal/service/elbv2/listener_rule.go index a2b1e04f930..e93aed3fdf1 100644 --- a/internal/service/elbv2/listener_rule.go +++ b/internal/service/elbv2/listener_rule.go @@ -167,7 +167,7 @@ func ResourceListenerRule() *schema.Resource { ValidateFunc: validation.StringLenBetween(1, 128), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/#{path}", diff --git a/internal/service/elbv2/target_group.go b/internal/service/elbv2/target_group.go index 44c9641bce6..bf32a07f239 100644 --- a/internal/service/elbv2/target_group.go +++ b/internal/service/elbv2/target_group.go @@ -104,7 +104,7 @@ func ResourceTargetGroup() *schema.Resource { Computed: true, Optional: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Computed: true, @@ -412,7 +412,7 @@ func resourceTargetGroupCreate(ctx context.Context, d *schema.ResourceData, meta healthCheckProtocol := tfMap[names.AttrProtocol].(string) if healthCheckProtocol != elbv2.ProtocolEnumTcp { - if v, ok := tfMap["path"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPath].(string); ok && v != "" { input.HealthCheckPath = aws.String(v) } @@ -621,7 +621,7 @@ func resourceTargetGroupUpdate(ctx context.Context, d *schema.ResourceData, meta } } } - input.HealthCheckPath = aws.String(tfMap["path"].(string)) + input.HealthCheckPath = aws.String(tfMap[names.AttrPath].(string)) } if targetType != elbv2.TargetTypeEnumLambda { @@ -1003,9 +1003,9 @@ func resourceTargetGroupCustomizeDiff(_ context.Context, diff *schema.ResourceDi )) } - if m := healthCheck["path"].(string); m != "" { + if m := healthCheck[names.AttrPath].(string); m != "" { return sdkdiag.DiagnosticError(errs.NewAttributeConflictsWhenError( - healtCheckPath.GetAttr("path"), + healtCheckPath.GetAttr(names.AttrPath), healtCheckPath.GetAttr(names.AttrProtocol), elbv2.ProtocolEnumTcp, )) @@ -1107,7 +1107,7 @@ func flattenTargetGroupHealthCheck(apiObject *elbv2.TargetGroup) []interface{} { } if v := apiObject.HealthCheckPath; v != nil { - tfMap["path"] = aws.StringValue(v) + tfMap[names.AttrPath] = aws.StringValue(v) } if apiObject := apiObject.Matcher; apiObject != nil { diff --git a/internal/service/elbv2/target_group_data_source.go b/internal/service/elbv2/target_group_data_source.go index 9100c27d93d..c20a3ea8102 100644 --- a/internal/service/elbv2/target_group_data_source.go +++ b/internal/service/elbv2/target_group_data_source.go @@ -70,7 +70,7 @@ func DataSourceTargetGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, From 9989ba487cbc4ca1715692379dae784be525f2e8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:17 -0400 Subject: [PATCH 1096/1490] emr: Use constant for path strings --- internal/service/emr/cluster.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/emr/cluster.go b/internal/service/emr/cluster.go index 63b19e0706b..62e403b6a2e 100644 --- a/internal/service/emr/cluster.go +++ b/internal/service/emr/cluster.go @@ -288,7 +288,7 @@ func resourceCluster() *schema.Resource { Type: schema.TypeString, Required: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, }, @@ -1854,7 +1854,7 @@ func flattenBootstrapArguments(actions []*emr.Command) []map[string]interface{} for _, b := range actions { attrs := make(map[string]interface{}) attrs[names.AttrName] = aws.StringValue(b.Name) - attrs["path"] = aws.StringValue(b.ScriptPath) + attrs[names.AttrPath] = aws.StringValue(b.ScriptPath) attrs["args"] = flex.FlattenStringList(b.Args) result = append(result, attrs) } @@ -1877,7 +1877,7 @@ func expandBootstrapActions(bootstrapActions []interface{}) []*emr.BootstrapActi for _, raw := range bootstrapActions { actionAttributes := raw.(map[string]interface{}) actionName := actionAttributes[names.AttrName].(string) - actionPath := actionAttributes["path"].(string) + actionPath := actionAttributes[names.AttrPath].(string) actionArgs := actionAttributes["args"].([]interface{}) action := &emr.BootstrapActionConfig{ From 14f02e4197d306c579b07267738750928b551014 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:17 -0400 Subject: [PATCH 1097/1490] fis: Use constant for path strings --- internal/service/fis/experiment_template.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/fis/experiment_template.go b/internal/service/fis/experiment_template.go index 720d11d477a..ca736f72613 100644 --- a/internal/service/fis/experiment_template.go +++ b/internal/service/fis/experiment_template.go @@ -205,7 +205,7 @@ func ResourceExperimentTemplate() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(0, 256), @@ -787,7 +787,7 @@ func expandExperimentTemplateTargetFilters(l []interface{}) []types.ExperimentTe raw := m.(map[string]interface{}) config := types.ExperimentTemplateTargetInputFilter{} - if v, ok := raw["path"].(string); ok && v != "" { + if v, ok := raw[names.AttrPath].(string); ok && v != "" { config.Path = aws.String(v) } @@ -947,7 +947,7 @@ func flattenExperimentTemplateTargetFilters(configured []types.ExperimentTemplat for _, v := range configured { item := make(map[string]interface{}) - item["path"] = aws.ToString(v.Path) + item[names.AttrPath] = aws.ToString(v.Path) item[names.AttrValues] = v.Values dataResources = append(dataResources, item) From d74c98edd8d1714543f6c6e3b0d7dc4e69ae66d2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:18 -0400 Subject: [PATCH 1098/1490] glue: Use constant for path strings --- internal/service/glue/crawler.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/glue/crawler.go b/internal/service/glue/crawler.go index bd2329a3623..7af9e81bdee 100644 --- a/internal/service/glue/crawler.go +++ b/internal/service/glue/crawler.go @@ -144,7 +144,7 @@ func ResourceCrawler() *schema.Resource { AtLeastOneOf: targets(), Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, }, @@ -243,7 +243,7 @@ func ResourceCrawler() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, }, @@ -297,7 +297,7 @@ func ResourceCrawler() *schema.Resource { Type: schema.TypeString, Required: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, }, @@ -374,7 +374,7 @@ func ResourceCrawler() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, }, @@ -831,7 +831,7 @@ func expandDynamoDBTargets(targets []interface{}) []*glue.DynamoDBTarget { func expandDynamoDBTarget(cfg map[string]interface{}) *glue.DynamoDBTarget { target := &glue.DynamoDBTarget{ - Path: aws.String(cfg["path"].(string)), + Path: aws.String(cfg[names.AttrPath].(string)), ScanAll: aws.Bool(cfg["scan_all"].(bool)), } @@ -857,7 +857,7 @@ func expandS3Targets(targets []interface{}) []*glue.S3Target { func expandS3Target(cfg map[string]interface{}) *glue.S3Target { target := &glue.S3Target{ - Path: aws.String(cfg["path"].(string)), + Path: aws.String(cfg[names.AttrPath].(string)), } if v, ok := cfg["connection_name"]; ok { @@ -898,7 +898,7 @@ func expandJDBCTargets(targets []interface{}) []*glue.JdbcTarget { func expandJDBCTarget(cfg map[string]interface{}) *glue.JdbcTarget { target := &glue.JdbcTarget{ - Path: aws.String(cfg["path"].(string)), + Path: aws.String(cfg[names.AttrPath].(string)), ConnectionName: aws.String(cfg["connection_name"].(string)), } @@ -963,7 +963,7 @@ func expandMongoDBTargets(targets []interface{}) []*glue.MongoDBTarget { func expandMongoDBTarget(cfg map[string]interface{}) *glue.MongoDBTarget { target := &glue.MongoDBTarget{ ConnectionName: aws.String(cfg["connection_name"].(string)), - Path: aws.String(cfg["path"].(string)), + Path: aws.String(cfg[names.AttrPath].(string)), ScanAll: aws.Bool(cfg["scan_all"].(bool)), } @@ -1063,7 +1063,7 @@ func flattenS3Targets(s3Targets []*glue.S3Target) []map[string]interface{} { for _, s3Target := range s3Targets { attrs := make(map[string]interface{}) attrs["exclusions"] = flex.FlattenStringList(s3Target.Exclusions) - attrs["path"] = aws.StringValue(s3Target.Path) + attrs[names.AttrPath] = aws.StringValue(s3Target.Path) attrs["connection_name"] = aws.StringValue(s3Target.ConnectionName) if s3Target.SampleSize != nil { @@ -1099,7 +1099,7 @@ func flattenDynamoDBTargets(dynamodbTargets []*glue.DynamoDBTarget) []map[string for _, dynamodbTarget := range dynamodbTargets { attrs := make(map[string]interface{}) - attrs["path"] = aws.StringValue(dynamodbTarget.Path) + attrs[names.AttrPath] = aws.StringValue(dynamodbTarget.Path) attrs["scan_all"] = aws.BoolValue(dynamodbTarget.ScanAll) attrs["scan_rate"] = aws.Float64Value(dynamodbTarget.ScanRate) @@ -1116,7 +1116,7 @@ func flattenJDBCTargets(jdbcTargets []*glue.JdbcTarget) []map[string]interface{} attrs["connection_name"] = aws.StringValue(jdbcTarget.ConnectionName) attrs["exclusions"] = flex.FlattenStringList(jdbcTarget.Exclusions) attrs["enable_additional_metadata"] = flex.FlattenStringList(jdbcTarget.EnableAdditionalMetadata) - attrs["path"] = aws.StringValue(jdbcTarget.Path) + attrs[names.AttrPath] = aws.StringValue(jdbcTarget.Path) result = append(result, attrs) } @@ -1129,7 +1129,7 @@ func flattenMongoDBTargets(mongoDBTargets []*glue.MongoDBTarget) []map[string]in for _, mongoDBTarget := range mongoDBTargets { attrs := make(map[string]interface{}) attrs["connection_name"] = aws.StringValue(mongoDBTarget.ConnectionName) - attrs["path"] = aws.StringValue(mongoDBTarget.Path) + attrs[names.AttrPath] = aws.StringValue(mongoDBTarget.Path) attrs["scan_all"] = aws.BoolValue(mongoDBTarget.ScanAll) result = append(result, attrs) From a7c161f7652a01e11c92b430567327b137dcca8d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:18 -0400 Subject: [PATCH 1099/1490] iam: Use constant for path strings --- internal/service/iam/group.go | 10 +++++----- internal/service/iam/group_data_source.go | 8 ++++---- internal/service/iam/group_data_source_test.go | 4 ++-- internal/service/iam/group_test.go | 6 +++--- internal/service/iam/instance_profile.go | 6 +++--- internal/service/iam/instance_profile_data_source.go | 4 ++-- .../service/iam/instance_profile_data_source_test.go | 2 +- .../iam/instance_profiles_data_source_test.go | 2 +- internal/service/iam/policy.go | 6 +++--- internal/service/iam/policy_data_source.go | 4 ++-- internal/service/iam/policy_data_source_test.go | 12 ++++++------ internal/service/iam/policy_test.go | 4 ++-- internal/service/iam/role.go | 6 +++--- internal/service/iam/role_data_source.go | 4 ++-- internal/service/iam/role_data_source_test.go | 4 ++-- internal/service/iam/role_test.go | 6 +++--- internal/service/iam/server_certificate.go | 6 +++--- .../service/iam/server_certificate_data_source.go | 4 ++-- .../iam/server_certificate_data_source_test.go | 4 ++-- internal/service/iam/server_certificate_test.go | 4 ++-- internal/service/iam/service_linked_role.go | 4 ++-- internal/service/iam/service_linked_role_test.go | 2 +- internal/service/iam/user.go | 10 +++++----- internal/service/iam/user_data_source.go | 4 ++-- internal/service/iam/user_data_source_test.go | 2 +- internal/service/iam/virtual_mfa_device.go | 6 +++--- internal/service/iam/virtual_mfa_device_test.go | 4 ++-- 27 files changed, 69 insertions(+), 69 deletions(-) diff --git a/internal/service/iam/group.go b/internal/service/iam/group.go index 2f743585e47..2c3d7afd7e7 100644 --- a/internal/service/iam/group.go +++ b/internal/service/iam/group.go @@ -48,7 +48,7 @@ func resourceGroup() *schema.Resource { "must only contain alphanumeric characters, hyphens, underscores, commas, periods, @ symbols, plus and equals signs", ), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", @@ -60,7 +60,7 @@ func resourceGroup() *schema.Resource { }, CustomizeDiff: func(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { - if d.HasChanges(names.AttrName, "path") { + if d.HasChanges(names.AttrName, names.AttrPath) { return d.SetNewComputed(names.AttrARN) } @@ -76,7 +76,7 @@ func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta inter name := d.Get(names.AttrName).(string) input := &iam.CreateGroupInput{ GroupName: aws.String(name), - Path: aws.String(d.Get("path").(string)), + Path: aws.String(d.Get(names.AttrPath).(string)), } output, err := conn.CreateGroup(ctx, input) @@ -116,7 +116,7 @@ func resourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set(names.AttrARN, group.Arn) d.Set(names.AttrName, group.GroupName) - d.Set("path", group.Path) + d.Set(names.AttrPath, group.Path) d.Set("unique_id", group.GroupId) return diags @@ -130,7 +130,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter input := &iam.UpdateGroupInput{ GroupName: aws.String(o.(string)), NewGroupName: aws.String(n.(string)), - NewPath: aws.String(d.Get("path").(string)), + NewPath: aws.String(d.Get(names.AttrPath).(string)), } _, err := conn.UpdateGroup(ctx, input) diff --git a/internal/service/iam/group_data_source.go b/internal/service/iam/group_data_source.go index dae20ce2d0a..d78932cfc7f 100644 --- a/internal/service/iam/group_data_source.go +++ b/internal/service/iam/group_data_source.go @@ -26,7 +26,7 @@ func dataSourceGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -55,7 +55,7 @@ func dataSourceGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -98,7 +98,7 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter d.SetId(aws.ToString(group.GroupId)) d.Set(names.AttrARN, group.Arn) - d.Set("path", group.Path) + d.Set(names.AttrPath, group.Path) d.Set("group_id", group.GroupId) if err := d.Set("users", dataSourceGroupUsersRead(users)); err != nil { return sdkdiag.AppendErrorf(diags, "setting users: %s", err) @@ -114,7 +114,7 @@ func dataSourceGroupUsersRead(iamUsers []awstypes.User) []map[string]interface{} u[names.AttrARN] = aws.ToString(i.Arn) u["user_id"] = aws.ToString(i.UserId) u["user_name"] = aws.ToString(i.UserName) - u["path"] = aws.ToString(i.Path) + u[names.AttrPath] = aws.ToString(i.Path) users = append(users, u) } return users diff --git a/internal/service/iam/group_data_source_test.go b/internal/service/iam/group_data_source_test.go index 9e4cdf8b579..87542af7ce7 100644 --- a/internal/service/iam/group_data_source_test.go +++ b/internal/service/iam/group_data_source_test.go @@ -26,7 +26,7 @@ func TestAccIAMGroupDataSource_basic(t *testing.T) { Config: testAccGroupDataSourceConfig_basic(groupName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("data.aws_iam_group.test", "group_id"), - resource.TestCheckResourceAttr("data.aws_iam_group.test", "path", "/"), + resource.TestCheckResourceAttr("data.aws_iam_group.test", names.AttrPath, "/"), resource.TestCheckResourceAttr("data.aws_iam_group.test", "group_name", groupName), acctest.CheckResourceAttrGlobalARN("data.aws_iam_group.test", names.AttrARN, "iam", fmt.Sprintf("group/%s", groupName)), ), @@ -51,7 +51,7 @@ func TestAccIAMGroupDataSource_users(t *testing.T) { Config: testAccGroupDataSourceConfig_user(groupName, userName, groupMemberShipName, userCount), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("data.aws_iam_group.test", "group_id"), - resource.TestCheckResourceAttr("data.aws_iam_group.test", "path", "/"), + resource.TestCheckResourceAttr("data.aws_iam_group.test", names.AttrPath, "/"), resource.TestCheckResourceAttr("data.aws_iam_group.test", "group_name", groupName), acctest.CheckResourceAttrGlobalARN("data.aws_iam_group.test", names.AttrARN, "iam", fmt.Sprintf("group/%s", groupName)), resource.TestCheckResourceAttr("data.aws_iam_group.test", "users.#", fmt.Sprint(userCount)), diff --git a/internal/service/iam/group_test.go b/internal/service/iam/group_test.go index ecb050dba50..807ea56732c 100644 --- a/internal/service/iam/group_test.go +++ b/internal/service/iam/group_test.go @@ -38,7 +38,7 @@ func TestAccIAMGroup_basic(t *testing.T) { // arn:${Partition}:iam::${Account}:group/${GroupNameWithPath} acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrARN, "iam", fmt.Sprintf("group/%s", rName)), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "path", "/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/"), resource.TestCheckResourceAttrSet(resourceName, "unique_id"), ), }, @@ -126,7 +126,7 @@ func TestAccIAMGroup_path(t *testing.T) { testAccCheckGroupExists(ctx, resourceName, &conf), acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrARN, "iam", fmt.Sprintf("group/path1/%s", rName)), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "path", "/path1/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/path1/"), ), }, { @@ -140,7 +140,7 @@ func TestAccIAMGroup_path(t *testing.T) { testAccCheckGroupExists(ctx, resourceName, &conf), acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrARN, "iam", fmt.Sprintf("group/path2/%s", rName)), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "path", "/path2/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/path2/"), ), }, }, diff --git a/internal/service/iam/instance_profile.go b/internal/service/iam/instance_profile.go index bbd4605fc12..85d92a24f22 100644 --- a/internal/service/iam/instance_profile.go +++ b/internal/service/iam/instance_profile.go @@ -70,7 +70,7 @@ func resourceInstanceProfile() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validResourceName(instanceProfileNamePrefixMaxLen), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", @@ -99,7 +99,7 @@ func resourceInstanceProfileCreate(ctx context.Context, d *schema.ResourceData, name := create.Name(d.Get(names.AttrName).(string), d.Get(names.AttrNamePrefix).(string)) input := &iam.CreateInstanceProfileInput{ InstanceProfileName: aws.String(name), - Path: aws.String(d.Get("path").(string)), + Path: aws.String(d.Get(names.AttrPath).(string)), Tags: getTagsIn(ctx), } @@ -189,7 +189,7 @@ func resourceInstanceProfileRead(ctx context.Context, d *schema.ResourceData, me d.Set("create_date", instanceProfile.CreateDate.Format(time.RFC3339)) d.Set(names.AttrName, instanceProfile.InstanceProfileName) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.ToString(instanceProfile.InstanceProfileName))) - d.Set("path", instanceProfile.Path) + d.Set(names.AttrPath, instanceProfile.Path) if d.Get("role") != "" { d.Set("role", nil) diff --git a/internal/service/iam/instance_profile_data_source.go b/internal/service/iam/instance_profile_data_source.go index b2f8b6a6d12..53ed3321fcf 100644 --- a/internal/service/iam/instance_profile_data_source.go +++ b/internal/service/iam/instance_profile_data_source.go @@ -29,7 +29,7 @@ func dataSourceInstanceProfile() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -67,7 +67,7 @@ func dataSourceInstanceProfileRead(ctx context.Context, d *schema.ResourceData, d.SetId(aws.ToString(instanceProfile.InstanceProfileId)) d.Set(names.AttrARN, instanceProfile.Arn) d.Set("create_date", fmt.Sprintf("%v", instanceProfile.CreateDate)) - d.Set("path", instanceProfile.Path) + d.Set(names.AttrPath, instanceProfile.Path) if len(instanceProfile.Roles) > 0 { role := instanceProfile.Roles[0] d.Set(names.AttrRoleARN, role.Arn) diff --git a/internal/service/iam/instance_profile_data_source_test.go b/internal/service/iam/instance_profile_data_source_test.go index c7119218234..fecfdce9006 100644 --- a/internal/service/iam/instance_profile_data_source_test.go +++ b/internal/service/iam/instance_profile_data_source_test.go @@ -30,7 +30,7 @@ func TestAccIAMInstanceProfileDataSource_basic(t *testing.T) { Config: testAccInstanceProfileDataSourceConfig_basic(rName1, rName2), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttr(dataSourceName, "path", "/testpath/"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrPath, "/testpath/"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrRoleARN, roleResourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, "role_id", roleResourceName, "unique_id"), resource.TestCheckResourceAttr(dataSourceName, "role_name", rName1), diff --git a/internal/service/iam/instance_profiles_data_source_test.go b/internal/service/iam/instance_profiles_data_source_test.go index c76c24bbd78..946aa575193 100644 --- a/internal/service/iam/instance_profiles_data_source_test.go +++ b/internal/service/iam/instance_profiles_data_source_test.go @@ -31,7 +31,7 @@ func TestAccIAMInstanceProfilesDataSource_basic(t *testing.T) { resource.TestCheckResourceAttr(datasourceName, "paths.#", "1"), resource.TestCheckResourceAttr(datasourceName, "names.#", "1"), resource.TestCheckResourceAttrPair(datasourceName, "arns.0", resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(datasourceName, "paths.0", resourceName, "path"), + resource.TestCheckResourceAttrPair(datasourceName, "paths.0", resourceName, names.AttrPath), resource.TestCheckResourceAttrPair(datasourceName, "names.0", resourceName, names.AttrName), ), }, diff --git a/internal/service/iam/policy.go b/internal/service/iam/policy.go index 40da5007aea..a64558c44b4 100644 --- a/internal/service/iam/policy.go +++ b/internal/service/iam/policy.go @@ -78,7 +78,7 @@ func resourcePolicy() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validResourceName(policyNamePrefixMaxLen), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", @@ -119,7 +119,7 @@ func resourcePolicyCreate(ctx context.Context, d *schema.ResourceData, meta inte name := create.Name(d.Get(names.AttrName).(string), d.Get(names.AttrNamePrefix).(string)) input := &iam.CreatePolicyInput{ Description: aws.String(d.Get(names.AttrDescription).(string)), - Path: aws.String(d.Get("path").(string)), + Path: aws.String(d.Get(names.AttrPath).(string)), PolicyDocument: aws.String(policy), PolicyName: aws.String(name), Tags: getTagsIn(ctx), @@ -202,7 +202,7 @@ func resourcePolicyRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrDescription, policy.Description) d.Set(names.AttrName, policy.PolicyName) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.ToString(policy.PolicyName))) - d.Set("path", policy.Path) + d.Set(names.AttrPath, policy.Path) d.Set("policy_id", policy.PolicyId) setTagsOut(ctx, policy.Tags) diff --git a/internal/service/iam/policy_data_source.go b/internal/service/iam/policy_data_source.go index a867e028112..6c969394752 100644 --- a/internal/service/iam/policy_data_source.go +++ b/internal/service/iam/policy_data_source.go @@ -46,7 +46,7 @@ func dataSourcePolicy() *schema.Resource { Computed: true, ConflictsWith: []string{names.AttrARN}, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -105,7 +105,7 @@ func dataSourcePolicyRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("attachment_count", policy.AttachmentCount) d.Set(names.AttrDescription, policy.Description) d.Set(names.AttrName, policy.PolicyName) - d.Set("path", policy.Path) + d.Set(names.AttrPath, policy.Path) d.Set("policy_id", policy.PolicyId) if err := d.Set(names.AttrTags, KeyValueTags(ctx, policy.Tags).IgnoreAWS().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { diff --git a/internal/service/iam/policy_data_source_test.go b/internal/service/iam/policy_data_source_test.go index c4221d2cb7d..2d7ea6568cf 100644 --- a/internal/service/iam/policy_data_source_test.go +++ b/internal/service/iam/policy_data_source_test.go @@ -30,7 +30,7 @@ func TestAccIAMPolicyDataSource_arn(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(datasourceName, "path", resourceName, "path"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrPath, resourceName, names.AttrPath), resource.TestCheckResourceAttrPair(datasourceName, names.AttrPolicy, resourceName, names.AttrPolicy), resource.TestCheckResourceAttrPair(datasourceName, "policy_id", resourceName, "policy_id"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), @@ -58,7 +58,7 @@ func TestAccIAMPolicyDataSource_arnTags(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(datasourceName, "path", resourceName, "path"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrPath, resourceName, names.AttrPath), resource.TestCheckResourceAttrPair(datasourceName, names.AttrPolicy, resourceName, names.AttrPolicy), resource.TestCheckResourceAttrPair(datasourceName, "policy_id", resourceName, "policy_id"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), @@ -87,7 +87,7 @@ func TestAccIAMPolicyDataSource_name(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(datasourceName, "path", resourceName, "path"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrPath, resourceName, names.AttrPath), resource.TestCheckResourceAttrPair(datasourceName, names.AttrPolicy, resourceName, names.AttrPolicy), resource.TestCheckResourceAttrPair(datasourceName, "policy_id", resourceName, "policy_id"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), @@ -115,7 +115,7 @@ func TestAccIAMPolicyDataSource_nameTags(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(datasourceName, "path", resourceName, "path"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrPath, resourceName, names.AttrPath), resource.TestCheckResourceAttrPair(datasourceName, names.AttrPolicy, resourceName, names.AttrPolicy), resource.TestCheckResourceAttrPair(datasourceName, "policy_id", resourceName, "policy_id"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), @@ -146,7 +146,7 @@ func TestAccIAMPolicyDataSource_nameAndPathPrefix(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(datasourceName, "path", resourceName, "path"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrPath, resourceName, names.AttrPath), resource.TestCheckResourceAttrPair(datasourceName, names.AttrPolicy, resourceName, names.AttrPolicy), resource.TestCheckResourceAttrPair(datasourceName, "policy_id", resourceName, "policy_id"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), @@ -176,7 +176,7 @@ func TestAccIAMPolicyDataSource_nameAndPathPrefixTags(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(datasourceName, "path", resourceName, "path"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrPath, resourceName, names.AttrPath), resource.TestCheckResourceAttrPair(datasourceName, names.AttrPolicy, resourceName, names.AttrPolicy), resource.TestCheckResourceAttrPair(datasourceName, "policy_id", resourceName, "policy_id"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), diff --git a/internal/service/iam/policy_test.go b/internal/service/iam/policy_test.go index 11c88d56494..a6acb342ca5 100644 --- a/internal/service/iam/policy_test.go +++ b/internal/service/iam/policy_test.go @@ -41,7 +41,7 @@ func TestAccIAMPolicy_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "attachment_count", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "path", "/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/"), resource.TestCheckResourceAttr(resourceName, names.AttrPolicy, expectedPolicyText), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttrSet(resourceName, "policy_id"), @@ -189,7 +189,7 @@ func TestAccIAMPolicy_path(t *testing.T) { Config: testAccPolicyConfig_path(rName, "/path1/"), Check: resource.ComposeTestCheckFunc( testAccCheckPolicyExists(ctx, resourceName, &out), - resource.TestCheckResourceAttr(resourceName, "path", "/path1/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/path1/"), ), }, { diff --git a/internal/service/iam/role.go b/internal/service/iam/role.go index 86928a8b273..0c914cc1e53 100644 --- a/internal/service/iam/role.go +++ b/internal/service/iam/role.go @@ -153,7 +153,7 @@ func resourceRole() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validResourceName(roleNamePrefixMaxLen), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", @@ -189,7 +189,7 @@ func resourceRoleCreate(ctx context.Context, d *schema.ResourceData, meta interf name := create.Name(d.Get(names.AttrName).(string), d.Get(names.AttrNamePrefix).(string)) input := &iam.CreateRoleInput{ AssumeRolePolicyDocument: aws.String(assumeRolePolicy), - Path: aws.String(d.Get("path").(string)), + Path: aws.String(d.Get(names.AttrPath).(string)), RoleName: aws.String(name), Tags: getTagsIn(ctx), } @@ -286,7 +286,7 @@ func resourceRoleRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set("max_session_duration", role.MaxSessionDuration) d.Set(names.AttrName, role.RoleName) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.ToString(role.RoleName))) - d.Set("path", role.Path) + d.Set(names.AttrPath, role.Path) if role.PermissionsBoundary != nil { d.Set("permissions_boundary", role.PermissionsBoundary.PermissionsBoundaryArn) } else { diff --git a/internal/service/iam/role_data_source.go b/internal/service/iam/role_data_source.go index ff5dbbe1f0d..d7d396b0d6f 100644 --- a/internal/service/iam/role_data_source.go +++ b/internal/service/iam/role_data_source.go @@ -48,7 +48,7 @@ func dataSourceRole() *schema.Resource { Type: schema.TypeString, Required: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -99,7 +99,7 @@ func dataSourceRoleRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrDescription, role.Description) d.Set("max_session_duration", role.MaxSessionDuration) d.Set(names.AttrName, role.RoleName) - d.Set("path", role.Path) + d.Set(names.AttrPath, role.Path) if role.PermissionsBoundary != nil { d.Set("permissions_boundary", role.PermissionsBoundary.PermissionsBoundaryArn) } else { diff --git a/internal/service/iam/role_data_source_test.go b/internal/service/iam/role_data_source_test.go index 4c75e72a0c5..5bc28312aa2 100644 --- a/internal/service/iam/role_data_source_test.go +++ b/internal/service/iam/role_data_source_test.go @@ -33,7 +33,7 @@ func TestAccIAMRoleDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), resource.TestCheckResourceAttrPair(dataSourceName, "max_session_duration", resourceName, "max_session_duration"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), - resource.TestCheckResourceAttrPair(dataSourceName, "path", resourceName, "path"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrPath, resourceName, names.AttrPath), resource.TestCheckResourceAttrPair(dataSourceName, "unique_id", resourceName, "unique_id"), resource.TestCheckResourceAttr(dataSourceName, "tags.%", "0"), ), @@ -62,7 +62,7 @@ func TestAccIAMRoleDataSource_tags(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), resource.TestCheckResourceAttrPair(dataSourceName, "max_session_duration", resourceName, "max_session_duration"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), - resource.TestCheckResourceAttrPair(dataSourceName, "path", resourceName, "path"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrPath, resourceName, names.AttrPath), resource.TestCheckResourceAttrPair(dataSourceName, "unique_id", resourceName, "unique_id"), resource.TestCheckResourceAttr(dataSourceName, "tags.%", "2"), resource.TestCheckResourceAttr(dataSourceName, "tags.tag1", "test-value1"), diff --git a/internal/service/iam/role_test.go b/internal/service/iam/role_test.go index 6c85d068a8f..e70d98ba6a0 100644 --- a/internal/service/iam/role_test.go +++ b/internal/service/iam/role_test.go @@ -40,7 +40,7 @@ func TestAccIAMRole_basic(t *testing.T) { Config: testAccRoleConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "path", "/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/"), resource.TestCheckResourceAttrSet(resourceName, "create_date"), ), }, @@ -69,7 +69,7 @@ func TestAccIAMRole_description(t *testing.T) { Config: testAccRoleConfig_description(rName), Check: resource.ComposeTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "path", "/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "This 1s a D3scr!pti0n with weird content: &@90ë\"'{«¡Çø}"), ), }, @@ -82,7 +82,7 @@ func TestAccIAMRole_description(t *testing.T) { Config: testAccRoleConfig_updatedDescription(rName), Check: resource.ComposeTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "path", "/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "This 1s an Upd@ted D3scr!pti0n with weird content: &90ë\"'{«¡Çø}"), ), }, diff --git a/internal/service/iam/server_certificate.go b/internal/service/iam/server_certificate.go index e0fb2209aaf..2ebb8aff1b7 100644 --- a/internal/service/iam/server_certificate.go +++ b/internal/service/iam/server_certificate.go @@ -82,7 +82,7 @@ func resourceServerCertificate() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validation.StringLenBetween(0, 128-id.UniqueIDSuffixLength), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", @@ -124,7 +124,7 @@ func resourceServerCertificateCreate(ctx context.Context, d *schema.ResourceData input.CertificateChain = aws.String(v.(string)) } - if v, ok := d.GetOk("path"); ok { + if v, ok := d.GetOk(names.AttrPath); ok { input.Path = aws.String(v.(string)) } @@ -190,7 +190,7 @@ func resourceServerCertificateRead(ctx context.Context, d *schema.ResourceData, } d.Set(names.AttrName, metadata.ServerCertificateName) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.ToString(metadata.ServerCertificateName))) - d.Set("path", metadata.Path) + d.Set(names.AttrPath, metadata.Path) if metadata.UploadDate != nil { d.Set("upload_date", aws.ToTime(metadata.UploadDate).Format(time.RFC3339)) } else { diff --git a/internal/service/iam/server_certificate_data_source.go b/internal/service/iam/server_certificate_data_source.go index 4d3777e84a1..97b917349cd 100644 --- a/internal/service/iam/server_certificate_data_source.go +++ b/internal/service/iam/server_certificate_data_source.go @@ -59,7 +59,7 @@ func dataSourceServerCertificate() *schema.Resource { Computed: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -147,7 +147,7 @@ func dataSourceServerCertificateRead(ctx context.Context, d *schema.ResourceData metadata := metadatas[0] d.SetId(aws.ToString(metadata.ServerCertificateId)) d.Set(names.AttrARN, metadata.Arn) - d.Set("path", metadata.Path) + d.Set(names.AttrPath, metadata.Path) d.Set(names.AttrName, metadata.ServerCertificateName) if metadata.Expiration != nil { d.Set("expiration_date", metadata.Expiration.Format(time.RFC3339)) diff --git a/internal/service/iam/server_certificate_data_source_test.go b/internal/service/iam/server_certificate_data_source_test.go index 9afe09752d5..f85e82d54f6 100644 --- a/internal/service/iam/server_certificate_data_source_test.go +++ b/internal/service/iam/server_certificate_data_source_test.go @@ -62,7 +62,7 @@ func TestAccIAMServerCertificateDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet("data.aws_iam_server_certificate.test", names.AttrARN), resource.TestCheckResourceAttrSet("data.aws_iam_server_certificate.test", names.AttrID), resource.TestCheckResourceAttrSet("data.aws_iam_server_certificate.test", names.AttrName), - resource.TestCheckResourceAttrSet("data.aws_iam_server_certificate.test", "path"), + resource.TestCheckResourceAttrSet("data.aws_iam_server_certificate.test", names.AttrPath), resource.TestCheckResourceAttrSet("data.aws_iam_server_certificate.test", "upload_date"), resource.TestCheckResourceAttr("data.aws_iam_server_certificate.test", "certificate_chain", ""), resource.TestMatchResourceAttr("data.aws_iam_server_certificate.test", "certificate_body", regexache.MustCompile("^-----BEGIN CERTIFICATE-----")), @@ -106,7 +106,7 @@ func TestAccIAMServerCertificateDataSource_path(t *testing.T) { { Config: testAccServerCertificateDataSourceConfig_certPath(rName, path, pathPrefix, key, certificate), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.aws_iam_server_certificate.test", "path", path), + resource.TestCheckResourceAttr("data.aws_iam_server_certificate.test", names.AttrPath, path), ), }, }, diff --git a/internal/service/iam/server_certificate_test.go b/internal/service/iam/server_certificate_test.go index 07565f7b798..eb60037495e 100644 --- a/internal/service/iam/server_certificate_test.go +++ b/internal/service/iam/server_certificate_test.go @@ -45,7 +45,7 @@ func TestAccIAMServerCertificate_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, ""), - resource.TestCheckResourceAttr(resourceName, "path", "/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/"), resource.TestCheckResourceAttr(resourceName, "certificate_body", strings.TrimSpace(certificate)), ), }, @@ -241,7 +241,7 @@ func TestAccIAMServerCertificate_path(t *testing.T) { Config: testAccServerCertificateConfig_path(rName, "/test/", key, certificate), Check: resource.ComposeTestCheckFunc( testAccCheckCertExists(ctx, resourceName, &cert), - resource.TestCheckResourceAttr(resourceName, "path", "/test/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/test/"), ), }, { diff --git a/internal/service/iam/service_linked_role.go b/internal/service/iam/service_linked_role.go index 0e132fab8a2..d3a0e5cd118 100644 --- a/internal/service/iam/service_linked_role.go +++ b/internal/service/iam/service_linked_role.go @@ -77,7 +77,7 @@ func resourceServiceLinkedRole() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -172,7 +172,7 @@ func resourceServiceLinkedRoleRead(ctx context.Context, d *schema.ResourceData, d.Set("custom_suffix", customSuffix) d.Set(names.AttrDescription, role.Description) d.Set(names.AttrName, role.RoleName) - d.Set("path", role.Path) + d.Set(names.AttrPath, role.Path) d.Set("unique_id", role.RoleId) setTagsOut(ctx, role.Tags) diff --git a/internal/service/iam/service_linked_role_test.go b/internal/service/iam/service_linked_role_test.go index 49b8d27ecc7..ffb1479cc58 100644 --- a/internal/service/iam/service_linked_role_test.go +++ b/internal/service/iam/service_linked_role_test.go @@ -122,7 +122,7 @@ func TestAccIAMServiceLinkedRole_basic(t *testing.T) { acctest.CheckResourceAttrRFC3339(resourceName, "create_date"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, names.AttrName, name), - resource.TestCheckResourceAttr(resourceName, "path", path), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, path), resource.TestCheckResourceAttrSet(resourceName, "unique_id"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), diff --git a/internal/service/iam/user.go b/internal/service/iam/user.go index f21e331820a..0241f34e776 100644 --- a/internal/service/iam/user.go +++ b/internal/service/iam/user.go @@ -60,7 +60,7 @@ func resourceUser() *schema.Resource { "must only contain alphanumeric characters, hyphens, underscores, commas, periods, @ symbols, plus and equals signs", ), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", @@ -95,7 +95,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf conn := meta.(*conns.AWSClient).IAMClient(ctx) name := d.Get(names.AttrName).(string) - path := d.Get("path").(string) + path := d.Get(names.AttrPath).(string) input := &iam.CreateUserInput{ Path: aws.String(path), Tags: getTagsIn(ctx), @@ -161,7 +161,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set(names.AttrARN, user.Arn) d.Set(names.AttrName, user.UserName) - d.Set("path", user.Path) + d.Set(names.AttrPath, user.Path) if user.PermissionsBoundary != nil { d.Set("permissions_boundary", user.PermissionsBoundary.PermissionsBoundaryArn) } else { @@ -178,12 +178,12 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf var diags diag.Diagnostics conn := meta.(*conns.AWSClient).IAMClient(ctx) - if d.HasChanges(names.AttrName, "path") { + if d.HasChanges(names.AttrName, names.AttrPath) { o, n := d.GetChange(names.AttrName) input := &iam.UpdateUserInput{ UserName: aws.String(o.(string)), NewUserName: aws.String(n.(string)), - NewPath: aws.String(d.Get("path").(string)), + NewPath: aws.String(d.Get(names.AttrPath).(string)), } _, err := conn.UpdateUser(ctx, input) diff --git a/internal/service/iam/user_data_source.go b/internal/service/iam/user_data_source.go index 5ab1215bd58..48f581b409d 100644 --- a/internal/service/iam/user_data_source.go +++ b/internal/service/iam/user_data_source.go @@ -27,7 +27,7 @@ func dataSourceUser() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -67,7 +67,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf user := resp.User d.SetId(aws.ToString(user.UserId)) d.Set(names.AttrARN, user.Arn) - d.Set("path", user.Path) + d.Set(names.AttrPath, user.Path) d.Set("permissions_boundary", "") if user.PermissionsBoundary != nil { d.Set("permissions_boundary", user.PermissionsBoundary.PermissionsBoundaryArn) diff --git a/internal/service/iam/user_data_source_test.go b/internal/service/iam/user_data_source_test.go index ed8756f4b5b..5cf0d396421 100644 --- a/internal/service/iam/user_data_source_test.go +++ b/internal/service/iam/user_data_source_test.go @@ -29,7 +29,7 @@ func TestAccIAMUserDataSource_basic(t *testing.T) { Config: testAccUserDataSourceConfig_basic(userName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "user_id", resourceName, "unique_id"), - resource.TestCheckResourceAttrPair(dataSourceName, "path", resourceName, "path"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrPath, resourceName, names.AttrPath), resource.TestCheckResourceAttr(dataSourceName, "permissions_boundary", ""), resource.TestCheckResourceAttrPair(dataSourceName, "user_name", resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), diff --git a/internal/service/iam/virtual_mfa_device.go b/internal/service/iam/virtual_mfa_device.go index bb361252e74..c1d9e62d204 100644 --- a/internal/service/iam/virtual_mfa_device.go +++ b/internal/service/iam/virtual_mfa_device.go @@ -55,7 +55,7 @@ func resourceVirtualMFADevice() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", @@ -93,7 +93,7 @@ func resourceVirtualMFADeviceCreate(ctx context.Context, d *schema.ResourceData, name := d.Get("virtual_mfa_device_name").(string) input := &iam.CreateVirtualMFADeviceInput{ - Path: aws.String(d.Get("path").(string)), + Path: aws.String(d.Get(names.AttrPath).(string)), Tags: getTagsIn(ctx), VirtualMFADeviceName: aws.String(name), } @@ -159,7 +159,7 @@ func resourceVirtualMFADeviceRead(ctx context.Context, d *schema.ResourceData, m return sdkdiag.AppendErrorf(diags, "reading IAM Virtual MFA Device (%s): %s", d.Id(), err) } - d.Set("path", path) + d.Set(names.AttrPath, path) d.Set("virtual_mfa_device_name", name) if v := vMFA.EnableDate; v != nil { diff --git a/internal/service/iam/virtual_mfa_device_test.go b/internal/service/iam/virtual_mfa_device_test.go index b279d019e72..f4b91d1cf99 100644 --- a/internal/service/iam/virtual_mfa_device_test.go +++ b/internal/service/iam/virtual_mfa_device_test.go @@ -40,7 +40,7 @@ func TestAccIAMVirtualMFADevice_basic(t *testing.T) { acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrARN, "iam", fmt.Sprintf("mfa/%s", rName)), resource.TestCheckResourceAttrSet(resourceName, "base_32_string_seed"), resource.TestCheckNoResourceAttr(resourceName, "enable_date"), - resource.TestCheckResourceAttr(resourceName, "path", "/"), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/"), resource.TestCheckResourceAttrSet(resourceName, "qr_code_png"), resource.TestCheckNoResourceAttr(resourceName, "user_name"), ), @@ -78,7 +78,7 @@ func TestAccIAMVirtualMFADevice_path(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVirtualMFADeviceExists(ctx, resourceName, &conf), acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrARN, "iam", fmt.Sprintf("mfa%s%s", path, rName)), - resource.TestCheckResourceAttr(resourceName, "path", path), + resource.TestCheckResourceAttr(resourceName, names.AttrPath, path), ), }, { From f8fdd643240ed791cff8efd2172b19e392ea47f0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:19 -0400 Subject: [PATCH 1100/1490] lightsail: Use constant for path strings --- .../lightsail/container_service_deployment_version.go | 6 +++--- internal/service/lightsail/distribution.go | 6 +++--- internal/service/lightsail/distribution_test.go | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/lightsail/container_service_deployment_version.go b/internal/service/lightsail/container_service_deployment_version.go index 3305914dfba..b6329a3c07c 100644 --- a/internal/service/lightsail/container_service_deployment_version.go +++ b/internal/service/lightsail/container_service_deployment_version.go @@ -125,7 +125,7 @@ func ResourceContainerServiceDeploymentVersion() *schema.Resource { Default: 5, ValidateFunc: validation.IntBetween(5, 300), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -364,7 +364,7 @@ func expandContainerServiceDeploymentPublicEndpointHealthCheck(tfList []interfac healthCheck := &types.ContainerServiceHealthCheckConfig{ HealthyThreshold: aws.Int32(int32(tfMap["healthy_threshold"].(int))), IntervalSeconds: aws.Int32(int32(tfMap["interval_seconds"].(int))), - Path: aws.String(tfMap["path"].(string)), + Path: aws.String(tfMap[names.AttrPath].(string)), SuccessCodes: aws.String(tfMap["success_codes"].(string)), TimeoutSeconds: aws.Int32(int32(tfMap["timeout_seconds"].(int))), UnhealthyThreshold: aws.Int32(int32(tfMap["unhealthy_threshold"].(int))), @@ -417,7 +417,7 @@ func flattenContainerServiceDeploymentPublicEndpointHealthCheck(healthCheck *typ map[string]interface{}{ "healthy_threshold": int(aws.ToInt32(healthCheck.HealthyThreshold)), "interval_seconds": int(aws.ToInt32(healthCheck.IntervalSeconds)), - "path": aws.ToString(healthCheck.Path), + names.AttrPath: aws.ToString(healthCheck.Path), "success_codes": aws.ToString(healthCheck.SuccessCodes), "timeout_seconds": int(aws.ToInt32(healthCheck.TimeoutSeconds)), "unhealthy_threshold": int(aws.ToInt32(healthCheck.UnhealthyThreshold)), diff --git a/internal/service/lightsail/distribution.go b/internal/service/lightsail/distribution.go index e1eddc2e392..38a0f3e30a6 100644 --- a/internal/service/lightsail/distribution.go +++ b/internal/service/lightsail/distribution.go @@ -77,7 +77,7 @@ func ResourceDistribution() *schema.Resource { Description: "The cache behavior for the specified path.", ValidateFunc: validation.StringInSlice(flattenBehaviorEnumValues(types.BehaviorEnum("").Values()), false), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, Description: "The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories (path/to/assets/*), and file types (*.html, *jpg, *js). Directories and file paths are case-sensitive.", @@ -713,7 +713,7 @@ func flattenCacheBehaviorPerPath(apiObject types.CacheBehaviorPerPath) map[strin } if v := apiObject.Path; v != nil { - m["path"] = aws.ToString(v) + m[names.AttrPath] = aws.ToString(v) } return m @@ -810,7 +810,7 @@ func expandCacheBehaviorPerPath(tfMap map[string]interface{}) types.CacheBehavio a.Behavior = types.BehaviorEnum(v) } - if v, ok := tfMap["path"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPath].(string); ok && v != "" { a.Path = aws.String(v) } diff --git a/internal/service/lightsail/distribution_test.go b/internal/service/lightsail/distribution_test.go index 91e77c1565e..41ea0666ad8 100644 --- a/internal/service/lightsail/distribution_test.go +++ b/internal/service/lightsail/distribution_test.go @@ -183,7 +183,7 @@ func testAccDistribution_cacheBehavior(t *testing.T) { testAccCheckDistributionExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "cache_behavior.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "cache_behavior.*", map[string]string{ - "path": path1, + names.AttrPath: path1, }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "cache_behavior.*", map[string]string{ "behavior": behaviorCache, @@ -201,13 +201,13 @@ func testAccDistribution_cacheBehavior(t *testing.T) { testAccCheckDistributionExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "cache_behavior.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "cache_behavior.*", map[string]string{ - "path": path1, + names.AttrPath: path1, }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "cache_behavior.*", map[string]string{ "behavior": behaviorCache, }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "cache_behavior.*", map[string]string{ - "path": path2, + names.AttrPath: path2, }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "cache_behavior.*", map[string]string{ "behavior": behaviorCache, From d8f294015454f8360d57e18cf209c330260328b6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:20 -0400 Subject: [PATCH 1101/1490] ssm: Use constant for path strings --- internal/service/ssm/parameters_by_path_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ssm/parameters_by_path_data_source.go b/internal/service/ssm/parameters_by_path_data_source.go index 1f92843fa79..11f707f759c 100644 --- a/internal/service/ssm/parameters_by_path_data_source.go +++ b/internal/service/ssm/parameters_by_path_data_source.go @@ -31,7 +31,7 @@ func DataSourceParametersByPath() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Required: true, }, @@ -64,7 +64,7 @@ func dataSourceParametersReadByPath(ctx context.Context, d *schema.ResourceData, var diags diag.Diagnostics conn := meta.(*conns.AWSClient).SSMConn(ctx) - path := d.Get("path").(string) + path := d.Get(names.AttrPath).(string) input := &ssm.GetParametersByPathInput{ Path: aws.String(path), Recursive: aws.Bool(d.Get("recursive").(bool)), From a47ed6c6c6be84117eff6bb1dacb7972a1dfe6ec Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:20 -0400 Subject: [PATCH 1102/1490] ssoadmin: Use constant for path strings --- .../ssoadmin/customer_managed_policy_attachment.go | 8 ++++---- .../service/ssoadmin/permissions_boundary_attachment.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/ssoadmin/customer_managed_policy_attachment.go b/internal/service/ssoadmin/customer_managed_policy_attachment.go index acd2cdbc136..50a075c84cc 100644 --- a/internal/service/ssoadmin/customer_managed_policy_attachment.go +++ b/internal/service/ssoadmin/customer_managed_policy_attachment.go @@ -56,7 +56,7 @@ func ResourceCustomerManagedPolicyAttachment() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(0, 128), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", @@ -88,7 +88,7 @@ func resourceCustomerManagedPolicyAttachmentCreate(ctx context.Context, d *schem tfMap := d.Get("customer_managed_policy_reference").([]interface{})[0].(map[string]interface{}) policyName := tfMap[names.AttrName].(string) - policyPath := tfMap["path"].(string) + policyPath := tfMap[names.AttrPath].(string) instanceARN := d.Get("instance_arn").(string) permissionSetARN := d.Get("permission_set_arn").(string) id := CustomerManagedPolicyAttachmentCreateResourceID(policyName, policyPath, permissionSetARN, instanceARN) @@ -270,7 +270,7 @@ func expandCustomerManagedPolicyReference(tfMap map[string]interface{}) *awstype apiObject.Name = aws.String(v) } - if v, ok := tfMap["path"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPath].(string); ok && v != "" { apiObject.Path = aws.String(v) } @@ -289,7 +289,7 @@ func flattenCustomerManagedPolicyReference(apiObject *awstypes.CustomerManagedPo } if v := apiObject.Path; v != nil { - tfMap["path"] = aws.ToString(v) + tfMap[names.AttrPath] = aws.ToString(v) } return tfMap diff --git a/internal/service/ssoadmin/permissions_boundary_attachment.go b/internal/service/ssoadmin/permissions_boundary_attachment.go index bf8a818aeab..113ac7e096e 100644 --- a/internal/service/ssoadmin/permissions_boundary_attachment.go +++ b/internal/service/ssoadmin/permissions_boundary_attachment.go @@ -74,7 +74,7 @@ func ResourcePermissionsBoundaryAttachment() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(0, 128), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", From 38773c9aef0caeccc09b07bf56b7138006019223 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:20 -0400 Subject: [PATCH 1103/1490] storagegateway: Use constant for path strings --- internal/service/storagegateway/nfs_file_share.go | 4 ++-- internal/service/storagegateway/nfs_file_share_test.go | 2 +- internal/service/storagegateway/smb_file_share.go | 4 ++-- internal/service/storagegateway/smb_file_share_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/storagegateway/nfs_file_share.go b/internal/service/storagegateway/nfs_file_share.go index 077cc0eb8fe..270ea48ba22 100644 --- a/internal/service/storagegateway/nfs_file_share.go +++ b/internal/service/storagegateway/nfs_file_share.go @@ -178,7 +178,7 @@ func ResourceNFSFileShare() *schema.Resource { Default: storagegateway.ObjectACLPrivate, ValidateFunc: validation.StringInSlice(storagegateway.ObjectACL_Values(), false), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -326,7 +326,7 @@ func resourceNFSFileShareRead(ctx context.Context, d *schema.ResourceData, meta } d.Set("notification_policy", fileshare.NotificationPolicy) d.Set("object_acl", fileshare.ObjectACL) - d.Set("path", fileshare.Path) + d.Set(names.AttrPath, fileshare.Path) d.Set("read_only", fileshare.ReadOnly) d.Set("requester_pays", fileshare.RequesterPays) d.Set(names.AttrRoleARN, fileshare.Role) diff --git a/internal/service/storagegateway/nfs_file_share_test.go b/internal/service/storagegateway/nfs_file_share_test.go index f8abbe6b6c2..d65e8baabd8 100644 --- a/internal/service/storagegateway/nfs_file_share_test.go +++ b/internal/service/storagegateway/nfs_file_share_test.go @@ -55,7 +55,7 @@ func TestAccStorageGatewayNFSFileShare_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "nfs_file_share_defaults.#", "0"), resource.TestCheckResourceAttr(resourceName, "notification_policy", "{}"), resource.TestCheckResourceAttr(resourceName, "object_acl", storagegateway.ObjectACLPrivate), - resource.TestMatchResourceAttr(resourceName, "path", regexache.MustCompile(`^/.+`)), + resource.TestMatchResourceAttr(resourceName, names.AttrPath, regexache.MustCompile(`^/.+`)), resource.TestCheckResourceAttr(resourceName, "read_only", "false"), resource.TestCheckResourceAttr(resourceName, "requester_pays", "false"), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, iamResourceName, names.AttrARN), diff --git a/internal/service/storagegateway/smb_file_share.go b/internal/service/storagegateway/smb_file_share.go index 3c48fea23f7..4891e166e1e 100644 --- a/internal/service/storagegateway/smb_file_share.go +++ b/internal/service/storagegateway/smb_file_share.go @@ -165,7 +165,7 @@ func ResourceSMBFileShare() *schema.Resource { validation.StringLenBetween(2, 100), ), }, - "path": { + names.AttrPath: { Type: schema.TypeString, Computed: true, }, @@ -346,7 +346,7 @@ func resourceSMBFileShareRead(ctx context.Context, d *schema.ResourceData, meta d.Set("notification_policy", fileshare.NotificationPolicy) d.Set("object_acl", fileshare.ObjectACL) d.Set("oplocks_enabled", fileshare.OplocksEnabled) - d.Set("path", fileshare.Path) + d.Set(names.AttrPath, fileshare.Path) d.Set("read_only", fileshare.ReadOnly) d.Set("requester_pays", fileshare.RequesterPays) d.Set(names.AttrRoleARN, fileshare.Role) diff --git a/internal/service/storagegateway/smb_file_share_test.go b/internal/service/storagegateway/smb_file_share_test.go index 1ec24e2d5a0..94733dd9fba 100644 --- a/internal/service/storagegateway/smb_file_share_test.go +++ b/internal/service/storagegateway/smb_file_share_test.go @@ -52,7 +52,7 @@ func TestAccStorageGatewaySMBFileShare_Authentication_activeDirectory(t *testing resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyARN, ""), resource.TestCheckResourceAttrPair(resourceName, "location_arn", bucketResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "object_acl", storagegateway.ObjectACLPrivate), - resource.TestMatchResourceAttr(resourceName, "path", regexache.MustCompile(`^/.+`)), + resource.TestMatchResourceAttr(resourceName, names.AttrPath, regexache.MustCompile(`^/.+`)), resource.TestCheckResourceAttr(resourceName, "read_only", "false"), resource.TestCheckResourceAttr(resourceName, "requester_pays", "false"), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, iamResourceName, names.AttrARN), From 69552843a6851582577a7ee86aa75234affcdd70 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:21 -0400 Subject: [PATCH 1104/1490] transfer: Use constant for path strings --- internal/service/transfer/workflow.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/transfer/workflow.go b/internal/service/transfer/workflow.go index 72c5aebfcf5..e09c3aed49f 100644 --- a/internal/service/transfer/workflow.go +++ b/internal/service/transfer/workflow.go @@ -83,7 +83,7 @@ func ResourceWorkflow() *schema.Resource { Optional: true, ForceNew: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -210,7 +210,7 @@ func ResourceWorkflow() *schema.Resource { Optional: true, ForceNew: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -396,7 +396,7 @@ func ResourceWorkflow() *schema.Resource { Optional: true, ForceNew: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -523,7 +523,7 @@ func ResourceWorkflow() *schema.Resource { Optional: true, ForceNew: true, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -1158,7 +1158,7 @@ func expandEFSFileLocation(tfMap []interface{}) *transfer.EfsFileLocation { apiObject.FileSystemId = aws.String(v) } - if v, ok := tfMapRaw["path"].(string); ok && v != "" { + if v, ok := tfMapRaw[names.AttrPath].(string); ok && v != "" { apiObject.Path = aws.String(v) } @@ -1177,7 +1177,7 @@ func flattenEFSFileLocation(apiObject *transfer.EfsFileLocation) []interface{} { } if v := apiObject.Path; v != nil { - tfMap["path"] = aws.StringValue(v) + tfMap[names.AttrPath] = aws.StringValue(v) } return []interface{}{tfMap} From 7270d0afd3bd2ffebf2df219e194125d5237b719 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:17:21 -0400 Subject: [PATCH 1105/1490] vpclattice: Use constant for path strings --- internal/service/vpclattice/target_group.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/vpclattice/target_group.go b/internal/service/vpclattice/target_group.go index a8bd1862489..126ba9a8590 100644 --- a/internal/service/vpclattice/target_group.go +++ b/internal/service/vpclattice/target_group.go @@ -101,7 +101,7 @@ func ResourceTargetGroup() *schema.Resource { }, DiffSuppressFunc: verify.SuppressMissingOptionalConfigurationBlock, }, - "path": { + names.AttrPath: { Type: schema.TypeString, Optional: true, Default: "/", @@ -481,7 +481,7 @@ func flattenHealthCheckConfig(apiObject *types.HealthCheckConfig) map[string]int } if v := apiObject.Path; v != nil { - tfMap["path"] = aws.ToString(v) + tfMap[names.AttrPath] = aws.ToString(v) } if v := apiObject.Port; v != nil { @@ -568,7 +568,7 @@ func expandHealthCheckConfig(tfMap map[string]interface{}) *types.HealthCheckCon apiObject.Matcher = expandMatcherMemberHTTPCode(v[0].(map[string]interface{})) } - if v, ok := tfMap["path"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrPath].(string); ok && v != "" { apiObject.Path = aws.String(v) } From 10210f14e4f86d68b29221bc2095721ab075437b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:43 -0400 Subject: [PATCH 1106/1490] ci: Prefer constant for string literal "url" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 61e3cc241df..ffc68fb21f4 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1405,3 +1405,13 @@ rules: - pattern: '"path"' severity: ERROR fix: "names.AttrPath" + - id: literal-url-string-constant + languages: [go] + message: Use the constant `names.AttrURL` for the string literal "url" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"url"' + severity: ERROR + fix: "names.AttrURL" From 1d28b540411d69e43ee88f15b4a463220671ad7d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:43 -0400 Subject: [PATCH 1107/1490] names: Add constant for string literal "url" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index d63a613c8aa..477176b8cb9 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -76,6 +76,7 @@ const ( AttrTransitGatewayAttachmentID = "transit_gateway_attachment_id" AttrTransitGatewayID = "transit_gateway_id" AttrType = "type" + AttrURL = "url" AttrVPCID = "vpc_id" AttrVPCSecurityGroupIDs = "vpc_security_group_ids" AttrValue = "value" From 858acbe139abeba90b897848b5ad74319cb9c1ba Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:43 -0400 Subject: [PATCH 1108/1490] amplify: Use constant for url strings --- internal/service/amplify/webhook.go | 4 ++-- internal/service/amplify/webhook_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/amplify/webhook.go b/internal/service/amplify/webhook.go index d707fe042d5..68a4e2c9258 100644 --- a/internal/service/amplify/webhook.go +++ b/internal/service/amplify/webhook.go @@ -55,7 +55,7 @@ func resourceWebhook() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -121,7 +121,7 @@ func resourceWebhookRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set(names.AttrARN, webhookArn) d.Set("branch_name", webhook.BranchName) d.Set(names.AttrDescription, webhook.Description) - d.Set("url", webhook.WebhookUrl) + d.Set(names.AttrURL, webhook.WebhookUrl) return diags } diff --git a/internal/service/amplify/webhook_test.go b/internal/service/amplify/webhook_test.go index 01c9c443c69..054aa9ad6c9 100644 --- a/internal/service/amplify/webhook_test.go +++ b/internal/service/amplify/webhook_test.go @@ -39,7 +39,7 @@ func testAccWebhook_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "amplify", regexache.MustCompile(`apps/.+/webhooks/.+`)), resource.TestCheckResourceAttr(resourceName, "branch_name", rName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), - resource.TestMatchResourceAttr(resourceName, "url", regexache.MustCompile(fmt.Sprintf(`^https://webhooks.amplify.%s.%s/.+$`, acctest.Region(), acctest.PartitionDNSSuffix()))), + resource.TestMatchResourceAttr(resourceName, names.AttrURL, regexache.MustCompile(fmt.Sprintf(`^https://webhooks.amplify.%s.%s/.+$`, acctest.Region(), acctest.PartitionDNSSuffix()))), ), }, { From 4b9abb86eb34140422445a55b116c616f6c79fac Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:43 -0400 Subject: [PATCH 1109/1490] codebuild: Use constant for url strings --- internal/service/codebuild/webhook.go | 4 ++-- internal/service/codebuild/webhook_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/codebuild/webhook.go b/internal/service/codebuild/webhook.go index a90e68fed8f..bad6970d761 100644 --- a/internal/service/codebuild/webhook.go +++ b/internal/service/codebuild/webhook.go @@ -88,7 +88,7 @@ func resourceWebhook() *schema.Resource { Computed: true, Sensitive: true, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -152,7 +152,7 @@ func resourceWebhookRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("payload_url", webhook.PayloadUrl) d.Set("project_name", d.Id()) d.Set("secret", d.Get("secret").(string)) - d.Set("url", webhook.Url) + d.Set(names.AttrURL, webhook.Url) return diags } diff --git a/internal/service/codebuild/webhook_test.go b/internal/service/codebuild/webhook_test.go index 19fffb2a85a..65014e6e24e 100644 --- a/internal/service/codebuild/webhook_test.go +++ b/internal/service/codebuild/webhook_test.go @@ -49,7 +49,7 @@ func TestAccCodeBuildWebhook_bitbucket(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "project_name", rName), resource.TestMatchResourceAttr(resourceName, "payload_url", regexache.MustCompile(`^https://`)), resource.TestCheckResourceAttr(resourceName, "secret", ""), - resource.TestMatchResourceAttr(resourceName, "url", regexache.MustCompile(`^https://`)), + resource.TestMatchResourceAttr(resourceName, names.AttrURL, regexache.MustCompile(`^https://`)), ), }, { @@ -86,7 +86,7 @@ func TestAccCodeBuildWebhook_gitHub(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "project_name", rName), resource.TestMatchResourceAttr(resourceName, "payload_url", regexache.MustCompile(`^https://`)), resource.TestCheckResourceAttr(resourceName, "secret", ""), - resource.TestMatchResourceAttr(resourceName, "url", regexache.MustCompile(`^https://`)), + resource.TestMatchResourceAttr(resourceName, names.AttrURL, regexache.MustCompile(`^https://`)), ), }, { @@ -123,7 +123,7 @@ func TestAccCodeBuildWebhook_gitHubEnterprise(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "project_name", rName), resource.TestMatchResourceAttr(resourceName, "payload_url", regexache.MustCompile(`^https://`)), resource.TestMatchResourceAttr(resourceName, "secret", regexache.MustCompile(`.+`)), - resource.TestCheckResourceAttr(resourceName, "url", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrURL, ""), ), }, { @@ -140,7 +140,7 @@ func TestAccCodeBuildWebhook_gitHubEnterprise(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "project_name", rName), resource.TestMatchResourceAttr(resourceName, "payload_url", regexache.MustCompile(`^https://`)), resource.TestMatchResourceAttr(resourceName, "secret", regexache.MustCompile(`.+`)), - resource.TestCheckResourceAttr(resourceName, "url", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrURL, ""), ), }, { From cb42d15557aff580c272dc454f0d4077bab8c032 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:43 -0400 Subject: [PATCH 1110/1490] codepipeline: Use constant for url strings --- internal/service/codepipeline/webhook.go | 4 ++-- internal/service/codepipeline/webhook_test.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/codepipeline/webhook.go b/internal/service/codepipeline/webhook.go index 9ab0870fba2..446655462d2 100644 --- a/internal/service/codepipeline/webhook.go +++ b/internal/service/codepipeline/webhook.go @@ -114,7 +114,7 @@ func resourceWebhook() *schema.Resource { ForceNew: true, Required: true, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -186,7 +186,7 @@ func resourceWebhookRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set(names.AttrName, webhookDef.Name) d.Set("target_action", webhookDef.TargetAction) d.Set("target_pipeline", webhookDef.TargetPipeline) - d.Set("url", webhook.Url) + d.Set(names.AttrURL, webhook.Url) setTagsOut(ctx, webhook.Tags) diff --git a/internal/service/codepipeline/webhook_test.go b/internal/service/codepipeline/webhook_test.go index a3339f32956..827b580fe18 100644 --- a/internal/service/codepipeline/webhook_test.go +++ b/internal/service/codepipeline/webhook_test.go @@ -51,7 +51,7 @@ func TestAccCodePipelineWebhook_basic(t *testing.T) { "json_path": "$.ref", "match_equals": "refs/head/{Branch}", }), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttr(resourceName, "authentication_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "authentication_configuration.0.secret_token", "super-secret"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -113,7 +113,7 @@ func TestAccCodePipelineWebhook_ipAuth(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckWebhookExists(ctx, resourceName, &v), resource.TestCheckResourceAttrSet(resourceName, names.AttrID), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttr(resourceName, "authentication_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "authentication_configuration.0.allowed_ip_range", "0.0.0.0/0"), ), @@ -148,7 +148,7 @@ func TestAccCodePipelineWebhook_unauthenticated(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckWebhookExists(ctx, resourceName, &v), resource.TestCheckResourceAttrSet(resourceName, names.AttrID), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), ), }, { @@ -259,7 +259,7 @@ func TestAccCodePipelineWebhook_UpdateAuthentication_secretToken(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckWebhookExists(ctx, resourceName, &v1), resource.TestCheckResourceAttrSet(resourceName, names.AttrID), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttr(resourceName, "authentication_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "authentication_configuration.0.secret_token", "super-secret"), ), @@ -269,7 +269,7 @@ func TestAccCodePipelineWebhook_UpdateAuthentication_secretToken(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckWebhookExists(ctx, resourceName, &v2), resource.TestCheckResourceAttrSet(resourceName, names.AttrID), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttr(resourceName, "authentication_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "authentication_configuration.0.secret_token", "even-more-secret"), func(s *terraform.State) error { From 17ca917bccb693824dd293da7d0a23b1e54b90e0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:43 -0400 Subject: [PATCH 1111/1490] devicefarm: Use constant for url strings --- internal/service/devicefarm/upload.go | 4 ++-- internal/service/devicefarm/upload_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/devicefarm/upload.go b/internal/service/devicefarm/upload.go index 293c6daafc2..53f209758b8 100644 --- a/internal/service/devicefarm/upload.go +++ b/internal/service/devicefarm/upload.go @@ -66,7 +66,7 @@ func ResourceUpload() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringInSlice(devicefarm.UploadType_Values(), false), }, - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -120,7 +120,7 @@ func resourceUploadRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrName, upload.Name) d.Set(names.AttrType, upload.Type) d.Set("content_type", upload.ContentType) - d.Set("url", upload.Url) + d.Set(names.AttrURL, upload.Url) d.Set("category", upload.Category) d.Set("metadata", upload.Metadata) d.Set(names.AttrARN, arn) diff --git a/internal/service/devicefarm/upload_test.go b/internal/service/devicefarm/upload_test.go index 338a589ac6d..3ae0b5d1a9b 100644 --- a/internal/service/devicefarm/upload_test.go +++ b/internal/service/devicefarm/upload_test.go @@ -48,14 +48,14 @@ func TestAccDeviceFarmUpload_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "devicefarm", regexache.MustCompile(`upload:.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrType, "APPIUM_JAVA_TESTNG_TEST_SPEC"), resource.TestCheckResourceAttr(resourceName, "category", "PRIVATE"), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), ), }, { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"url"}, + ImportStateVerifyIgnore: []string{names.AttrURL}, }, { Config: testAccUploadConfig_basic(rNameUpdated), @@ -65,7 +65,7 @@ func TestAccDeviceFarmUpload_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "devicefarm", regexache.MustCompile(`upload:.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrType, "APPIUM_JAVA_TESTNG_TEST_SPEC"), resource.TestCheckResourceAttr(resourceName, "category", "PRIVATE"), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), ), }, }, From 381e7e4e06ed2219fdd7a07c0395e5242879201b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:44 -0400 Subject: [PATCH 1112/1490] ec2: Use constant for url strings --- internal/service/ec2/ebs_snapshot_import.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ec2/ebs_snapshot_import.go b/internal/service/ec2/ebs_snapshot_import.go index bd6ab0943ea..f0f8ead29d2 100644 --- a/internal/service/ec2/ebs_snapshot_import.go +++ b/internal/service/ec2/ebs_snapshot_import.go @@ -107,7 +107,7 @@ func ResourceEBSSnapshotImport() *schema.Resource { ForceNew: true, ValidateDiagFunc: enum.Validate[awstypes.DiskImageFormat](), }, - "url": { + names.AttrURL: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -351,7 +351,7 @@ func expandSnapshotDiskContainer(tfMap map[string]interface{}) *awstypes.Snapsho apiObject.Format = aws.String(v) } - if v, ok := tfMap["url"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrURL].(string); ok && v != "" { apiObject.Url = aws.String(v) } From 3099b57d9c866cab8e0461f2ffdd79f3e0ca5c20 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:44 -0400 Subject: [PATCH 1113/1490] emr: Use constant for url strings --- internal/service/emr/studio.go | 4 ++-- internal/service/emr/studio_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/emr/studio.go b/internal/service/emr/studio.go index 9c012a259d5..0cf93b0680a 100644 --- a/internal/service/emr/studio.go +++ b/internal/service/emr/studio.go @@ -99,7 +99,7 @@ func resourceStudio() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -236,7 +236,7 @@ func resourceStudioRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("idp_relay_state_parameter_name", studio.IdpRelayStateParameterName) d.Set(names.AttrName, studio.Name) d.Set("service_role", studio.ServiceRole) - d.Set("url", studio.Url) + d.Set(names.AttrURL, studio.Url) d.Set("user_role", studio.UserRole) d.Set(names.AttrVPCID, studio.VpcId) d.Set("workspace_security_group_id", studio.WorkspaceSecurityGroupId) diff --git a/internal/service/emr/studio_test.go b/internal/service/emr/studio_test.go index e7210587548..6b5fb77120b 100644 --- a/internal/service/emr/studio_test.go +++ b/internal/service/emr/studio_test.go @@ -40,7 +40,7 @@ func TestAccEMRStudio_sso(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticmapreduce", regexache.MustCompile(`studio/.+$`)), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName1), resource.TestCheckResourceAttr(resourceName, "auth_mode", "SSO"), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttrPair(resourceName, names.AttrVPCID, "aws_vpc.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "workspace_security_group_id", "aws_security_group.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "engine_security_group_id", "aws_security_group.test", names.AttrID), @@ -62,7 +62,7 @@ func TestAccEMRStudio_sso(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticmapreduce", regexache.MustCompile(`studio/.+$`)), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName2), resource.TestCheckResourceAttr(resourceName, "auth_mode", "SSO"), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttrPair(resourceName, names.AttrVPCID, "aws_vpc.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "workspace_security_group_id", "aws_security_group.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "engine_security_group_id", "aws_security_group.test", names.AttrID), @@ -94,7 +94,7 @@ func TestAccEMRStudio_iam(t *testing.T) { testAccCheckStudioExists(ctx, resourceName, &studio), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, "auth_mode", "IAM"), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttrPair(resourceName, names.AttrVPCID, "aws_vpc.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "workspace_security_group_id", "aws_security_group.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "engine_security_group_id", "aws_security_group.test", names.AttrID), From ecea7e4a78e222d0ee92bdc825e7a6b87a9bfb5b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:44 -0400 Subject: [PATCH 1114/1490] firehose: Use constant for url strings --- internal/service/firehose/delivery_stream.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index e56f4aa0202..9095e42e826 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -781,7 +781,7 @@ func resourceDeliveryStream() *schema.Resource { ValidateDiagFunc: enum.Validate[types.HttpEndpointS3BackupMode](), }, "s3_configuration": s3ConfigurationSchema(), - "url": { + names.AttrURL: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -2931,7 +2931,7 @@ func expandHTTPEndpointRequestConfiguration(rc map[string]interface{}) *types.Ht func expandHTTPEndpointConfiguration(ep map[string]interface{}) *types.HttpEndpointConfiguration { endpointConfiguration := &types.HttpEndpointConfiguration{ - Url: aws.String(ep["url"].(string)), + Url: aws.String(ep[names.AttrURL].(string)), } if Name, ok := ep[names.AttrName]; ok { @@ -3813,7 +3813,7 @@ func flattenHTTPEndpointDestinationDescription(description *types.HttpEndpointDe } m := map[string]interface{}{ names.AttrAccessKey: configuredAccessKey, - "url": aws.ToString(description.EndpointConfiguration.Url), + names.AttrURL: aws.ToString(description.EndpointConfiguration.Url), names.AttrName: aws.ToString(description.EndpointConfiguration.Name), names.AttrRoleARN: aws.ToString(description.RoleARN), "s3_backup_mode": description.S3BackupMode, From ce8d9205c5713f943a48481ad227453d0df29452 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:44 -0400 Subject: [PATCH 1115/1490] iam: Use constant for url strings --- internal/service/iam/openid_connect_provider.go | 6 +++--- .../service/iam/openid_connect_provider_data_source.go | 10 +++++----- .../iam/openid_connect_provider_data_source_test.go | 6 +++--- internal/service/iam/openid_connect_provider_test.go | 4 ++-- internal/service/iam/validate_test.go | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/iam/openid_connect_provider.go b/internal/service/iam/openid_connect_provider.go index 38821fe5c13..01ecafe69f4 100644 --- a/internal/service/iam/openid_connect_provider.go +++ b/internal/service/iam/openid_connect_provider.go @@ -62,7 +62,7 @@ func resourceOpenIDConnectProvider() *schema.Resource { ValidateFunc: validation.StringLenBetween(40, 40), }, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -83,7 +83,7 @@ func resourceOpenIDConnectProviderCreate(ctx context.Context, d *schema.Resource ClientIDList: flex.ExpandStringValueSet(d.Get("client_id_list").(*schema.Set)), Tags: getTagsIn(ctx), ThumbprintList: flex.ExpandStringValueList(d.Get("thumbprint_list").([]interface{})), - Url: aws.String(d.Get("url").(string)), + Url: aws.String(d.Get(names.AttrURL).(string)), } output, err := conn.CreateOpenIDConnectProvider(ctx, input) @@ -138,7 +138,7 @@ func resourceOpenIDConnectProviderRead(ctx context.Context, d *schema.ResourceDa d.Set(names.AttrARN, d.Id()) d.Set("client_id_list", output.ClientIDList) d.Set("thumbprint_list", output.ThumbprintList) - d.Set("url", output.Url) + d.Set(names.AttrURL, output.Url) setTagsOut(ctx, output.Tags) diff --git a/internal/service/iam/openid_connect_provider_data_source.go b/internal/service/iam/openid_connect_provider_data_source.go index dcc30b50acf..89a9f1e4779 100644 --- a/internal/service/iam/openid_connect_provider_data_source.go +++ b/internal/service/iam/openid_connect_provider_data_source.go @@ -33,7 +33,7 @@ func dataSourceOpenIDConnectProvider() *schema.Resource { Optional: true, Computed: true, ValidateFunc: verify.ValidARN, - ExactlyOneOf: []string{names.AttrARN, "url"}, + ExactlyOneOf: []string{names.AttrARN, names.AttrURL}, }, "client_id_list": { Type: schema.TypeList, @@ -46,13 +46,13 @@ func dataSourceOpenIDConnectProvider() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, }, names.AttrTags: tftags.TagsSchemaComputed(), - "url": { + names.AttrURL: { Type: schema.TypeString, Optional: true, Computed: true, ValidateFunc: validOpenIDURL, DiffSuppressFunc: suppressOpenIDURL, - ExactlyOneOf: []string{names.AttrARN, "url"}, + ExactlyOneOf: []string{names.AttrARN, names.AttrURL}, }, }, } @@ -68,7 +68,7 @@ func dataSourceOpenIDConnectProviderRead(ctx context.Context, d *schema.Resource if v, ok := d.GetOk(names.AttrARN); ok { input.OpenIDConnectProviderArn = aws.String(v.(string)) - } else if v, ok := d.GetOk("url"); ok { + } else if v, ok := d.GetOk(names.AttrURL); ok { url := v.(string) oidcpEntry, err := dataSourceGetOpenIDConnectProviderByURL(ctx, conn, url) @@ -90,7 +90,7 @@ func dataSourceOpenIDConnectProviderRead(ctx context.Context, d *schema.Resource d.SetId(aws.ToString(input.OpenIDConnectProviderArn)) d.Set(names.AttrARN, input.OpenIDConnectProviderArn) - d.Set("url", resp.Url) + d.Set(names.AttrURL, resp.Url) d.Set("client_id_list", flex.FlattenStringValueList(resp.ClientIDList)) d.Set("thumbprint_list", flex.FlattenStringValueList(resp.ThumbprintList)) diff --git a/internal/service/iam/openid_connect_provider_data_source_test.go b/internal/service/iam/openid_connect_provider_data_source_test.go index c9228a50b84..8aba0890601 100644 --- a/internal/service/iam/openid_connect_provider_data_source_test.go +++ b/internal/service/iam/openid_connect_provider_data_source_test.go @@ -30,7 +30,7 @@ func TestAccIAMOpenidConnectProviderDataSource_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "url", resourceName, "url"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrURL, resourceName, names.AttrURL), resource.TestCheckResourceAttrPair(dataSourceName, "client_id_list", resourceName, "client_id_list"), resource.TestCheckResourceAttrPair(dataSourceName, "thumbprint_list", resourceName, "thumbprint_list"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -57,7 +57,7 @@ func TestAccIAMOpenidConnectProviderDataSource_url(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "url", resourceName, "url"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrURL, resourceName, names.AttrURL), resource.TestCheckResourceAttrPair(dataSourceName, "client_id_list", resourceName, "client_id_list"), resource.TestCheckResourceAttrPair(dataSourceName, "thumbprint_list", resourceName, "thumbprint_list"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -84,7 +84,7 @@ func TestAccIAMOpenidConnectProviderDataSource_tags(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "url", resourceName, "url"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrURL, resourceName, names.AttrURL), resource.TestCheckResourceAttrPair(dataSourceName, "client_id_list", resourceName, "client_id_list"), resource.TestCheckResourceAttrPair(dataSourceName, "thumbprint_list", resourceName, "thumbprint_list"), resource.TestCheckResourceAttr(dataSourceName, "tags.%", "2"), diff --git a/internal/service/iam/openid_connect_provider_test.go b/internal/service/iam/openid_connect_provider_test.go index a4832b272d1..b8a594444c1 100644 --- a/internal/service/iam/openid_connect_provider_test.go +++ b/internal/service/iam/openid_connect_provider_test.go @@ -35,7 +35,7 @@ func TestAccIAMOpenIDConnectProvider_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrARN, "iam", fmt.Sprintf("oidc-provider/%s", url)), - resource.TestCheckResourceAttr(resourceName, "url", url), + resource.TestCheckResourceAttr(resourceName, names.AttrURL, url), resource.TestCheckResourceAttr(resourceName, "client_id_list.#", "1"), resource.TestCheckResourceAttr(resourceName, "client_id_list.0", "266362248691-re108qaeld573ia0l6clj2i5ac7r7291.apps.testleusercontent.com"), @@ -52,7 +52,7 @@ func TestAccIAMOpenIDConnectProvider_basic(t *testing.T) { Config: testAccOpenIDConnectProviderConfig_modified(rString), Check: resource.ComposeTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "url", url), + resource.TestCheckResourceAttr(resourceName, names.AttrURL, url), resource.TestCheckResourceAttr(resourceName, "client_id_list.#", "1"), resource.TestCheckResourceAttr(resourceName, "client_id_list.0", "266362248691-re108qaeld573ia0l6clj2i5ac7r7291.apps.testleusercontent.com"), diff --git a/internal/service/iam/validate_test.go b/internal/service/iam/validate_test.go index d54709404af..e1a5985a4c2 100644 --- a/internal/service/iam/validate_test.go +++ b/internal/service/iam/validate_test.go @@ -96,7 +96,7 @@ func TestValidOpenIDURL(t *testing.T) { } for _, tc := range cases { - _, errors := validOpenIDURL(tc.Value, "url") + _, errors := validOpenIDURL(tc.Value, names.AttrURL) if len(errors) != tc.ErrCount { t.Fatalf("Expected %d of OpenID URL validation errors, got %d", tc.ErrCount, len(errors)) From 6de37d5ad9fd745083b89c6d375e74da2a3b080d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:44 -0400 Subject: [PATCH 1116/1490] iot: Use constant for url strings --- internal/service/iot/topic_rule.go | 8 ++++---- internal/service/iot/topic_rule_test.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/iot/topic_rule.go b/internal/service/iot/topic_rule.go index ab9e84b4ab8..80ef1dc612d 100644 --- a/internal/service/iot/topic_rule.go +++ b/internal/service/iot/topic_rule.go @@ -496,7 +496,7 @@ func ResourceTopicRule() *schema.Resource { }, }, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Required: true, ValidateFunc: validation.IsURLWithHTTPS, @@ -874,7 +874,7 @@ func ResourceTopicRule() *schema.Resource { }, }, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Required: true, ValidateFunc: validation.IsURLWithHTTPS, @@ -1630,7 +1630,7 @@ func expandHTTPAction(tfList []interface{}) *iot.HttpAction { apiObject := &iot.HttpAction{} tfMap := tfList[0].(map[string]interface{}) - if v, ok := tfMap["url"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrURL].(string); ok && v != "" { apiObject.Url = aws.String(v) } @@ -2771,7 +2771,7 @@ func flattenHTTPAction(apiObject *iot.HttpAction) []interface{} { tfMap := make(map[string]interface{}) if v := apiObject.Url; v != nil { - tfMap["url"] = aws.StringValue(v) + tfMap[names.AttrURL] = aws.StringValue(v) } if v := apiObject.ConfirmationUrl; v != nil { diff --git a/internal/service/iot/topic_rule_test.go b/internal/service/iot/topic_rule_test.go index c9308f6e98a..69646d4a99e 100644 --- a/internal/service/iot/topic_rule_test.go +++ b/internal/service/iot/topic_rule_test.go @@ -927,7 +927,7 @@ func TestAccIoTTopicRule_http(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "http.*", map[string]string{ "confirmation_url": "", "http_header.#": "0", - "url": "https://example.com/ingress", + names.AttrURL: "https://example.com/ingress", }), resource.TestCheckResourceAttr(resourceName, "iot_analytics.#", "0"), resource.TestCheckResourceAttr(resourceName, "iot_events.#", "0"), @@ -963,7 +963,7 @@ func TestAccIoTTopicRule_http(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "http.*", map[string]string{ "confirmation_url": "https://example.com/", "http_header.#": "0", - "url": "https://example.com/ingress", + names.AttrURL: "https://example.com/ingress", }), resource.TestCheckResourceAttr(resourceName, "iot_analytics.#", "0"), resource.TestCheckResourceAttr(resourceName, "iot_events.#", "0"), @@ -998,7 +998,7 @@ func TestAccIoTTopicRule_http(t *testing.T) { "http_header.0.value": "v1", "http_header.1.key": "X-Header-2", "http_header.1.value": "v2", - "url": "https://example.com/ingress", + names.AttrURL: "https://example.com/ingress", }), resource.TestCheckResourceAttr(resourceName, "iot_analytics.#", "0"), resource.TestCheckResourceAttr(resourceName, "iot_events.#", "0"), @@ -1049,7 +1049,7 @@ func TestAccIoTTopicRule_http(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "http.*", map[string]string{ "confirmation_url": "", "http_header.#": "0", - "url": "https://example.com/ingress", + names.AttrURL: "https://example.com/ingress", }), resource.TestCheckResourceAttr(resourceName, "iot_analytics.#", "0"), resource.TestCheckResourceAttr(resourceName, "iot_events.#", "0"), From 3aacff94c2fd9bc9b035eb27612650c34811882d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:45 -0400 Subject: [PATCH 1117/1490] kendra: Use constant for url strings --- internal/service/kendra/index.go | 6 +++--- internal/service/kendra/index_data_source.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/kendra/index.go b/internal/service/kendra/index.go index 0b69d1a485f..5b6c7efeb0a 100644 --- a/internal/service/kendra/index.go +++ b/internal/service/kendra/index.go @@ -351,7 +351,7 @@ func ResourceIndex() *schema.Resource { Optional: true, ValidateFunc: verify.ValidARN, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.All( @@ -935,7 +935,7 @@ func expandJwtTokenTypeConfiguration(jwtTokenTypeConfiguration []interface{}) *t result.SecretManagerArn = aws.String(v) } - if v, ok := tfMap["url"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrURL].(string); ok && v != "" { result.URL = aws.String(v) } @@ -1142,7 +1142,7 @@ func flattenJwtTokenTypeConfiguration(jwtTokenTypeConfiguration *types.JwtTokenT } if v := jwtTokenTypeConfiguration.URL; v != nil { - values["url"] = aws.ToString(v) + values[names.AttrURL] = aws.ToString(v) } if v := jwtTokenTypeConfiguration.UserNameAttributeField; v != nil { diff --git a/internal/service/kendra/index_data_source.go b/internal/service/kendra/index_data_source.go index d9cbe8ed461..a31b0decee7 100644 --- a/internal/service/kendra/index_data_source.go +++ b/internal/service/kendra/index_data_source.go @@ -264,7 +264,7 @@ func DataSourceIndex() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, From 4df03747ccdf822e45a3e7bd680ae1126306e5e0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:45 -0400 Subject: [PATCH 1118/1490] lightsail: Use constant for url strings --- internal/service/lightsail/bucket.go | 4 ++-- internal/service/lightsail/bucket_test.go | 2 +- internal/service/lightsail/container_service.go | 4 ++-- internal/service/lightsail/container_service_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/lightsail/bucket.go b/internal/service/lightsail/bucket.go index 0515ff8f281..9b1f71ebfaf 100644 --- a/internal/service/lightsail/bucket.go +++ b/internal/service/lightsail/bucket.go @@ -73,7 +73,7 @@ func ResourceBucket() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -136,7 +136,7 @@ func resourceBucketRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrName, out.Name) d.Set(names.AttrRegion, out.Location.RegionName) d.Set("support_code", out.SupportCode) - d.Set("url", out.Url) + d.Set(names.AttrURL, out.Url) setTagsOut(ctx, out.Tags) diff --git a/internal/service/lightsail/bucket_test.go b/internal/service/lightsail/bucket_test.go index 703daecdc5a..f3e037c6cff 100644 --- a/internal/service/lightsail/bucket_test.go +++ b/internal/service/lightsail/bucket_test.go @@ -50,7 +50,7 @@ func TestAccLightsailBucket_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrRegion), resource.TestCheckResourceAttrSet(resourceName, "support_code"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttrSet(resourceName, "force_delete"), resource.TestCheckResourceAttr(resourceName, "force_delete", "false"), ), diff --git a/internal/service/lightsail/container_service.go b/internal/service/lightsail/container_service.go index 1b2cccbe65c..b81bd4ae071 100644 --- a/internal/service/lightsail/container_service.go +++ b/internal/service/lightsail/container_service.go @@ -161,7 +161,7 @@ func ResourceContainerService() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -257,7 +257,7 @@ func resourceContainerServiceRead(ctx context.Context, d *schema.ResourceData, m d.Set("private_domain_name", cs.PrivateDomainName) d.Set("resource_type", cs.ResourceType) d.Set(names.AttrState, cs.State) - d.Set("url", cs.Url) + d.Set(names.AttrURL, cs.Url) setTagsOut(ctx, cs.Tags) diff --git a/internal/service/lightsail/container_service_test.go b/internal/service/lightsail/container_service_test.go index 6c32dc7e164..fe110ea4f38 100644 --- a/internal/service/lightsail/container_service_test.go +++ b/internal/service/lightsail/container_service_test.go @@ -53,7 +53,7 @@ func TestAccLightsailContainerService_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "private_domain_name"), resource.TestCheckResourceAttr(resourceName, "resource_type", "ContainerService"), resource.TestCheckResourceAttr(resourceName, names.AttrState, "READY"), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), ), }, { From 4fd22abbf30a6499eb686beba9b681467c56cfb4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:45 -0400 Subject: [PATCH 1119/1490] medialive: Use constant for url strings --- internal/service/medialive/channel.go | 6 +++--- internal/service/medialive/input.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/medialive/channel.go b/internal/service/medialive/channel.go index 2cb836438f8..e061b9f34d7 100644 --- a/internal/service/medialive/channel.go +++ b/internal/service/medialive/channel.go @@ -130,7 +130,7 @@ func ResourceChannel() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Optional: true, }, @@ -2259,7 +2259,7 @@ func expandChannelDestinationsSettings(tfList []interface{}) []types.OutputDesti if v, ok := m["stream_name"].(string); ok { s.StreamName = aws.String(v) } - if v, ok := m["url"].(string); ok { + if v, ok := m[names.AttrURL].(string); ok { s.Url = aws.String(v) } if v, ok := m["username"].(string); ok { @@ -2332,7 +2332,7 @@ func flattenChannelDestinationsSettings(apiObject []types.OutputDestinationSetti m := map[string]interface{}{ "password_param": aws.ToString(v.PasswordParam), "stream_name": aws.ToString(v.StreamName), - "url": aws.ToString(v.Url), + names.AttrURL: aws.ToString(v.Url), "username": aws.ToString(v.Username), } diff --git a/internal/service/medialive/input.go b/internal/service/medialive/input.go index 7704d4a237b..04eb22627ca 100644 --- a/internal/service/medialive/input.go +++ b/internal/service/medialive/input.go @@ -134,7 +134,7 @@ func ResourceInput() *schema.Resource { Type: schema.TypeString, Required: true, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Required: true, }, @@ -541,7 +541,7 @@ func flattenSource(apiObject types.InputSource) map[string]interface{} { m := map[string]interface{}{} if v := apiObject.Url; v != nil { - m["url"] = aws.ToString(v) + m[names.AttrURL] = aws.ToString(v) } if v := apiObject.PasswordParam; v != nil { m["password_param"] = aws.ToString(v) @@ -682,7 +682,7 @@ func expandSources(tfList []interface{}) []types.InputSourceRequest { if val, ok := m["password_param"]; ok { id.PasswordParam = aws.String(val.(string)) } - if val, ok := m["url"]; ok { + if val, ok := m[names.AttrURL]; ok { id.Url = aws.String(val.(string)) } if val, ok := m["username"]; ok { From 9abe1bc3c007768d797d5a2e73da139315c41d16 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:45 -0400 Subject: [PATCH 1120/1490] mediapackage: Use constant for url strings --- internal/service/mediapackage/channel.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/mediapackage/channel.go b/internal/service/mediapackage/channel.go index 49d5f6f637b..39a050180c9 100644 --- a/internal/service/mediapackage/channel.go +++ b/internal/service/mediapackage/channel.go @@ -68,7 +68,7 @@ func ResourceChannel() *schema.Resource { Computed: true, Sensitive: true, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -207,7 +207,7 @@ func flattenHLSIngest(h *types.HlsIngest) []map[string]interface{} { for _, e := range h.IngestEndpoints { endpoint := map[string]interface{}{ names.AttrPassword: aws.ToString(e.Password), - "url": aws.ToString(e.Url), + names.AttrURL: aws.ToString(e.Url), "username": aws.ToString(e.Username), } From 703d5da6cf2dd379672cf6cd75c9a177da51c19e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:45 -0400 Subject: [PATCH 1121/1490] meta: Use constant for url strings --- internal/service/meta/ip_ranges_data_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/meta/ip_ranges_data_source.go b/internal/service/meta/ip_ranges_data_source.go index 8cd0572057f..9213f0cc0cb 100644 --- a/internal/service/meta/ip_ranges_data_source.go +++ b/internal/service/meta/ip_ranges_data_source.go @@ -71,7 +71,7 @@ func (d *dataSourceIPRanges) Schema(ctx context.Context, req datasource.SchemaRe "sync_token": schema.Int64Attribute{ Computed: true, }, - "url": schema.StringAttribute{ + names.AttrURL: schema.StringAttribute{ Optional: true, }, }, From 8775daf6f9577a7350b45fae6c8edf3b090d1c5f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:46 -0400 Subject: [PATCH 1122/1490] opsworks: Use constant for url strings --- internal/service/opsworks/application.go | 4 ++-- internal/service/opsworks/ganglia_layer.go | 2 +- internal/service/opsworks/ganglia_layer_test.go | 2 +- internal/service/opsworks/stack.go | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/opsworks/application.go b/internal/service/opsworks/application.go index e78928b559f..b761684e15f 100644 --- a/internal/service/opsworks/application.go +++ b/internal/service/opsworks/application.go @@ -86,7 +86,7 @@ func ResourceApplication() *schema.Resource { ValidateFunc: validation.StringInSlice(append(opsworks.SourceType_Values(), "other"), false), }, - "url": { + names.AttrURL: { Type: schema.TypeString, Optional: true, }, @@ -474,7 +474,7 @@ func resourceSetApplicationSource(d *schema.ResourceData, v *opsworks.Source) er m[names.AttrType] = aws.StringValue(v.Type) } if v.Url != nil { - m["url"] = aws.StringValue(v.Url) + m[names.AttrURL] = aws.StringValue(v.Url) } if v.Username != nil { m["username"] = aws.StringValue(v.Username) diff --git a/internal/service/opsworks/ganglia_layer.go b/internal/service/opsworks/ganglia_layer.go index 67f882f827f..8631f77634e 100644 --- a/internal/service/opsworks/ganglia_layer.go +++ b/internal/service/opsworks/ganglia_layer.go @@ -23,7 +23,7 @@ func ResourceGangliaLayer() *schema.Resource { Required: true, WriteOnly: true, }, - "url": { + names.AttrURL: { AttrName: opsworks.LayerAttributesKeysGangliaUrl, Type: schema.TypeString, Default: "/ganglia", diff --git a/internal/service/opsworks/ganglia_layer_test.go b/internal/service/opsworks/ganglia_layer_test.go index e7f7b700730..a3552d42fad 100644 --- a/internal/service/opsworks/ganglia_layer_test.go +++ b/internal/service/opsworks/ganglia_layer_test.go @@ -33,7 +33,7 @@ func TestAccOpsWorksGangliaLayer_basic(t *testing.T) { testAccCheckLayerExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrName, "Ganglia"), resource.TestCheckResourceAttrSet(resourceName, names.AttrPassword), - resource.TestCheckResourceAttr(resourceName, "url", "/ganglia"), + resource.TestCheckResourceAttr(resourceName, names.AttrURL, "/ganglia"), resource.TestCheckResourceAttr(resourceName, "username", "opsworks"), ), }, diff --git a/internal/service/opsworks/stack.go b/internal/service/opsworks/stack.go index 7fd499d14df..54f3ff7ee7d 100644 --- a/internal/service/opsworks/stack.go +++ b/internal/service/opsworks/stack.go @@ -102,7 +102,7 @@ func ResourceStack() *schema.Resource { Required: true, ValidateFunc: validation.StringInSlice(opsworks.SourceType_Values(), false), }, - "url": { + names.AttrURL: { Type: schema.TypeString, Required: true, }, @@ -621,7 +621,7 @@ func expandSource(tfMap map[string]interface{}) *opsworks.Source { apiObject.Type = aws.String(v) } - if v, ok := tfMap["url"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrURL].(string); ok && v != "" { apiObject.Url = aws.String(v) } @@ -656,7 +656,7 @@ func flattenSource(apiObject *opsworks.Source) map[string]interface{} { } if v := apiObject.Url; v != nil { - tfMap["url"] = aws.StringValue(v) + tfMap[names.AttrURL] = aws.StringValue(v) } if v := apiObject.Username; v != nil { From e275e4d56eb5f3e33da45f3fbcf6bcdd076d08de Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:46 -0400 Subject: [PATCH 1123/1490] sagemaker: Use constant for url strings --- internal/service/sagemaker/domain.go | 4 ++-- internal/service/sagemaker/domain_test.go | 4 ++-- internal/service/sagemaker/human_task_ui.go | 4 ++-- internal/service/sagemaker/notebook_instance.go | 4 ++-- internal/service/sagemaker/notebook_instance_test.go | 2 +- internal/service/sagemaker/space.go | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/sagemaker/domain.go b/internal/service/sagemaker/domain.go index 4eb6a59c8e8..ba7cbbb8753 100644 --- a/internal/service/sagemaker/domain.go +++ b/internal/service/sagemaker/domain.go @@ -987,7 +987,7 @@ func ResourceDomain() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -1078,7 +1078,7 @@ func resourceDomainRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("security_group_id_for_domain_boundary", domain.SecurityGroupIdForDomainBoundary) d.Set("single_sign_on_managed_application_instance_id", domain.SingleSignOnManagedApplicationInstanceId) d.Set("single_sign_on_application_arn", domain.SingleSignOnApplicationArn) - d.Set("url", domain.Url) + d.Set(names.AttrURL, domain.Url) d.Set(names.AttrVPCID, domain.VpcId) if err := d.Set(names.AttrSubnetIDs, flex.FlattenStringSet(domain.SubnetIds)); err != nil { diff --git a/internal/service/sagemaker/domain_test.go b/internal/service/sagemaker/domain_test.go index e0690910022..6c1be3f5aec 100644 --- a/internal/service/sagemaker/domain_test.go +++ b/internal/service/sagemaker/domain_test.go @@ -48,7 +48,7 @@ func testAccDomain_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "sagemaker", regexache.MustCompile(`domain/.+`)), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttrPair(resourceName, names.AttrVPCID, "aws_vpc.test", names.AttrID), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttrSet(resourceName, "home_efs_file_system_id"), resource.TestCheckResourceAttr(resourceName, "domain_settings.#", "0"), ), @@ -916,7 +916,7 @@ func testAccDomain_defaultUserSettingsUpdated(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "sagemaker", regexache.MustCompile(`domain/.+`)), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttrPair(resourceName, names.AttrVPCID, "aws_vpc.test", names.AttrID), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttrSet(resourceName, "home_efs_file_system_id"), ), }, diff --git a/internal/service/sagemaker/human_task_ui.go b/internal/service/sagemaker/human_task_ui.go index ae4727a864e..f90ee88cee6 100644 --- a/internal/service/sagemaker/human_task_ui.go +++ b/internal/service/sagemaker/human_task_ui.go @@ -56,7 +56,7 @@ func ResourceHumanTaskUI() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -178,7 +178,7 @@ func flattenHumanTaskUiUiTemplate(config *sagemaker.UiTemplateInfo, content stri m := map[string]interface{}{ "content_sha256": aws.StringValue(config.ContentSha256), - "url": aws.StringValue(config.Url), + names.AttrURL: aws.StringValue(config.Url), "content": content, } diff --git a/internal/service/sagemaker/notebook_instance.go b/internal/service/sagemaker/notebook_instance.go index dade079e5d6..1850f84ea57 100644 --- a/internal/service/sagemaker/notebook_instance.go +++ b/internal/service/sagemaker/notebook_instance.go @@ -149,7 +149,7 @@ func ResourceNotebookInstance() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -263,7 +263,7 @@ func resourceNotebookInstanceRead(ctx context.Context, d *schema.ResourceData, m d.Set("root_access", notebookInstance.RootAccess) d.Set(names.AttrSecurityGroups, aws.StringValueSlice(notebookInstance.SecurityGroups)) d.Set(names.AttrSubnetID, notebookInstance.SubnetId) - d.Set("url", notebookInstance.Url) + d.Set(names.AttrURL, notebookInstance.Url) d.Set("volume_size", notebookInstance.VolumeSizeInGB) if err := d.Set("instance_metadata_service_configuration", flattenNotebookInstanceMetadataServiceConfiguration(notebookInstance.InstanceMetadataServiceConfiguration)); err != nil { diff --git a/internal/service/sagemaker/notebook_instance_test.go b/internal/service/sagemaker/notebook_instance_test.go index ed149e5728c..b1284e0234c 100644 --- a/internal/service/sagemaker/notebook_instance_test.go +++ b/internal/service/sagemaker/notebook_instance_test.go @@ -55,7 +55,7 @@ func TestAccSageMakerNotebookInstance_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "root_access", "Enabled"), resource.TestCheckResourceAttr(resourceName, "security_groups.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrSet(resourceName, "url"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), resource.TestCheckResourceAttr(resourceName, "volume_size", "5"), ), }, diff --git a/internal/service/sagemaker/space.go b/internal/service/sagemaker/space.go index 05906f12042..257cd44be96 100644 --- a/internal/service/sagemaker/space.go +++ b/internal/service/sagemaker/space.go @@ -387,7 +387,7 @@ func ResourceSpace() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -465,7 +465,7 @@ func resourceSpaceRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set("home_efs_file_system_uid", space.HomeEfsFileSystemUid) d.Set("space_display_name", space.SpaceDisplayName) d.Set("space_name", space.SpaceName) - d.Set("url", space.Url) + d.Set(names.AttrURL, space.Url) if err := d.Set("ownership_settings", flattenOwnershipSettings(space.OwnershipSettings)); err != nil { return sdkdiag.AppendErrorf(diags, "setting ownership_settings for SageMaker Space (%s): %s", d.Id(), err) From ec06931073b9c26ea708aca9bbf5c4689f98da19 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:46 -0400 Subject: [PATCH 1124/1490] scheduler: Use constant for url strings --- internal/service/scheduler/schedule_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/scheduler/schedule_test.go b/internal/service/scheduler/schedule_test.go index 8f871205d76..6333743b809 100644 --- a/internal/service/scheduler/schedule_test.go +++ b/internal/service/scheduler/schedule_test.go @@ -1219,7 +1219,7 @@ func TestAccSchedulerSchedule_targetInput(t *testing.T) { Config: testAccScheduleConfig_targetInput(name, "test1"), Check: resource.ComposeTestCheckFunc( testAccCheckScheduleExists(ctx, t, resourceName, &schedule), - resource.TestCheckResourceAttrWith("aws_sqs_queue.test", "url", func(value string) error { + resource.TestCheckResourceAttrWith("aws_sqs_queue.test", names.AttrURL, func(value string) error { queueUrl = value return nil }), From 6bc943a4563cb607a6b78b7810a53b366e0c0881 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:47 -0400 Subject: [PATCH 1125/1490] sqs: Use constant for url strings --- internal/service/sqs/queue.go | 4 ++-- internal/service/sqs/queue_data_source.go | 4 ++-- internal/service/sqs/queue_test.go | 2 +- internal/service/sqs/queues_data_source_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/sqs/queue.go b/internal/service/sqs/queue.go index 597ff577194..36f2c3a632c 100644 --- a/internal/service/sqs/queue.go +++ b/internal/service/sqs/queue.go @@ -155,7 +155,7 @@ var ( }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -303,7 +303,7 @@ func resourceQueueRead(ctx context.Context, d *schema.ResourceData, meta interfa } else { d.Set(names.AttrNamePrefix, create.NamePrefixFromName(name)) } - d.Set("url", d.Id()) + d.Set(names.AttrURL, d.Id()) return nil } diff --git a/internal/service/sqs/queue_data_source.go b/internal/service/sqs/queue_data_source.go index 13c3f983f0e..12f242e22d0 100644 --- a/internal/service/sqs/queue_data_source.go +++ b/internal/service/sqs/queue_data_source.go @@ -36,7 +36,7 @@ func dataSourceQueue() *schema.Resource { Required: true, }, names.AttrTags: tftags.TagsSchemaComputed(), - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -64,7 +64,7 @@ func dataSourceQueueRead(ctx context.Context, d *schema.ResourceData, meta inter d.SetId(queueURL) d.Set(names.AttrARN, attributesOutput) - d.Set("url", queueURL) + d.Set(names.AttrURL, queueURL) tags, err := listTags(ctx, conn, queueURL) diff --git a/internal/service/sqs/queue_test.go b/internal/service/sqs/queue_test.go index 61d7c258848..23a719a9443 100644 --- a/internal/service/sqs/queue_test.go +++ b/internal/service/sqs/queue_test.go @@ -123,7 +123,7 @@ func TestAccSQSQueue_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "redrive_policy", ""), resource.TestCheckResourceAttr(resourceName, "redrive_allow_policy", ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "url", resourceName, names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrURL, resourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, "visibility_timeout_seconds", strconv.Itoa(tfsqs.DefaultQueueVisibilityTimeout)), ), }, diff --git a/internal/service/sqs/queues_data_source_test.go b/internal/service/sqs/queues_data_source_test.go index a662948cd0f..3cc6bb8380b 100644 --- a/internal/service/sqs/queues_data_source_test.go +++ b/internal/service/sqs/queues_data_source_test.go @@ -31,7 +31,7 @@ func TestAccSQSQueuesDataSource_queueNamePrefix(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckQueueExists(ctx, resourceName, &queueAttributes), resource.TestCheckResourceAttr(dataSourceName, "queue_urls.#", "1"), - resource.TestCheckResourceAttrPair(dataSourceName, "queue_urls.0", resourceName, "url"), + resource.TestCheckResourceAttrPair(dataSourceName, "queue_urls.0", resourceName, names.AttrURL), ), }, }, From 9f9d66fbd39950ae94911b24644a4a6ef906e222 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:20:47 -0400 Subject: [PATCH 1126/1490] transfer: Use constant for url strings --- internal/service/transfer/connector.go | 10 +++++----- internal/service/transfer/connector_test.go | 6 +++--- internal/service/transfer/server.go | 12 ++++++------ internal/service/transfer/server_data_source.go | 6 +++--- internal/service/transfer/server_data_source_test.go | 4 ++-- internal/service/transfer/server_test.go | 4 ++-- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/internal/service/transfer/connector.go b/internal/service/transfer/connector.go index 58dd3a6f3ca..3daff653adb 100644 --- a/internal/service/transfer/connector.go +++ b/internal/service/transfer/connector.go @@ -134,7 +134,7 @@ func ResourceConnector() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "url": { + names.AttrURL: { Type: schema.TypeString, Required: true, }, @@ -151,7 +151,7 @@ func resourceConnectorCreate(ctx context.Context, d *schema.ResourceData, meta i input := &transfer.CreateConnectorInput{ AccessRole: aws.String(d.Get("access_role").(string)), Tags: getTagsIn(ctx), - Url: aws.String(d.Get("url").(string)), + Url: aws.String(d.Get(names.AttrURL).(string)), } if v, ok := d.GetOk("as2_config"); ok { @@ -208,7 +208,7 @@ func resourceConnectorRead(ctx context.Context, d *schema.ResourceData, meta int if err := d.Set("sftp_config", flattenSftpConfig(output.SftpConfig)); err != nil { return sdkdiag.AppendErrorf(diags, "setting sftp_config: %s", err) } - d.Set("url", output.Url) + d.Set(names.AttrURL, output.Url) setTagsOut(ctx, output.Tags) return diags @@ -243,8 +243,8 @@ func resourceConnectorUpdate(ctx context.Context, d *schema.ResourceData, meta i input.SftpConfig = expandSftpConfig(d.Get("sftp_config").([]interface{})) } - if d.HasChange("url") { - input.Url = aws.String(d.Get("url").(string)) + if d.HasChange(names.AttrURL) { + input.Url = aws.String(d.Get(names.AttrURL).(string)) } _, err := conn.UpdateConnectorWithContext(ctx, input) diff --git a/internal/service/transfer/connector_test.go b/internal/service/transfer/connector_test.go index efc75d3dd77..e20e958f3e0 100644 --- a/internal/service/transfer/connector_test.go +++ b/internal/service/transfer/connector_test.go @@ -41,7 +41,7 @@ func TestAccTransferConnector_basic(t *testing.T) { testAccCheckConnectorExists(ctx, resourceName, &conf), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "url", "http://www.example.com"), + resource.TestCheckResourceAttr(resourceName, names.AttrURL, "http://www.example.com"), ), }, { @@ -54,7 +54,7 @@ func TestAccTransferConnector_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckConnectorExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "url", "http://www.example.net"), + resource.TestCheckResourceAttr(resourceName, names.AttrURL, "http://www.example.net"), ), }, }, @@ -84,7 +84,7 @@ func TestAccTransferConnector_sftpConfig(t *testing.T) { testAccCheckConnectorExists(ctx, resourceName, &conf), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "url", "sftp://s-fakeserver.server.transfer.test.amazonaws.com"), + resource.TestCheckResourceAttr(resourceName, names.AttrURL, "sftp://s-fakeserver.server.transfer.test.amazonaws.com"), ), }, { diff --git a/internal/service/transfer/server.go b/internal/service/transfer/server.go index c5668f3851d..0000c186832 100644 --- a/internal/service/transfer/server.go +++ b/internal/service/transfer/server.go @@ -260,7 +260,7 @@ func resourceServer() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "url": { + names.AttrURL: { Type: schema.TypeString, Optional: true, }, @@ -418,7 +418,7 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte input.StructuredLogDestinations = flex.ExpandStringSet(v.(*schema.Set)) } - if v, ok := d.GetOk("url"); ok { + if v, ok := d.GetOk(names.AttrURL); ok { if input.IdentityProviderDetails == nil { input.IdentityProviderDetails = &transfer.IdentityProviderDetails{} } @@ -546,9 +546,9 @@ func resourceServerRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("security_policy_name", output.SecurityPolicyName) d.Set("structured_log_destinations", aws.StringValueSlice(output.StructuredLogDestinations)) if output.IdentityProviderDetails != nil { - d.Set("url", output.IdentityProviderDetails.Url) + d.Set(names.AttrURL, output.IdentityProviderDetails.Url) } else { - d.Set("url", "") + d.Set(names.AttrURL, "") } if err := d.Set("workflow_details", flattenWorkflowDetails(output.WorkflowDetails)); err != nil { return sdkdiag.AppendErrorf(diags, "setting workflow_details: %s", err) @@ -676,7 +676,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte } } - if d.HasChanges("directory_id", "function", "invocation_role", "sftp_authentication_methods", "url") { + if d.HasChanges("directory_id", "function", "invocation_role", "sftp_authentication_methods", names.AttrURL) { identityProviderDetails := &transfer.IdentityProviderDetails{} if attr, ok := d.GetOk("directory_id"); ok { @@ -695,7 +695,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte identityProviderDetails.SftpAuthenticationMethods = aws.String(attr.(string)) } - if attr, ok := d.GetOk("url"); ok { + if attr, ok := d.GetOk(names.AttrURL); ok { identityProviderDetails.Url = aws.String(attr.(string)) } diff --git a/internal/service/transfer/server_data_source.go b/internal/service/transfer/server_data_source.go index 1dee73dfbc7..a4476401956 100644 --- a/internal/service/transfer/server_data_source.go +++ b/internal/service/transfer/server_data_source.go @@ -73,7 +73,7 @@ func DataSourceServer() *schema.Resource { Type: schema.TypeString, }, }, - "url": { + names.AttrURL: { Type: schema.TypeString, Computed: true, }, @@ -112,9 +112,9 @@ func dataSourceServerRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("security_policy_name", output.SecurityPolicyName) d.Set("structured_log_destinations", aws.StringValueSlice(output.StructuredLogDestinations)) if output.IdentityProviderDetails != nil { - d.Set("url", output.IdentityProviderDetails.Url) + d.Set(names.AttrURL, output.IdentityProviderDetails.Url) } else { - d.Set("url", "") + d.Set(names.AttrURL, "") } return diags diff --git a/internal/service/transfer/server_data_source_test.go b/internal/service/transfer/server_data_source_test.go index 58c05f64251..12e7bdcb56b 100644 --- a/internal/service/transfer/server_data_source_test.go +++ b/internal/service/transfer/server_data_source_test.go @@ -61,7 +61,7 @@ func testAccServerDataSource_Service_managed(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "logging_role", resourceName, "logging_role"), resource.TestCheckResourceAttrPair(datasourceName, "protocols.#", resourceName, "protocols.#"), resource.TestCheckResourceAttrPair(datasourceName, "security_policy_name", resourceName, "security_policy_name"), - resource.TestCheckResourceAttrPair(datasourceName, "url", resourceName, "url"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrURL, resourceName, names.AttrURL), ), }, }, @@ -87,7 +87,7 @@ func testAccServerDataSource_apigateway(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "identity_provider_type", resourceName, "identity_provider_type"), resource.TestCheckResourceAttrPair(datasourceName, "invocation_role", resourceName, "invocation_role"), resource.TestCheckResourceAttrPair(datasourceName, "logging_role", resourceName, "logging_role"), - resource.TestCheckResourceAttrPair(datasourceName, "url", resourceName, "url"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrURL, resourceName, names.AttrURL), ), }, }, diff --git a/internal/service/transfer/server_test.go b/internal/service/transfer/server_test.go index 0d492be49c1..5b0801ba27a 100644 --- a/internal/service/transfer/server_test.go +++ b/internal/service/transfer/server_test.go @@ -77,7 +77,7 @@ func testAccServer_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "security_policy_name", "TransferSecurityPolicy-2018-11"), resource.TestCheckResourceAttr(resourceName, "structured_log_destinations.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "url", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrURL, ""), resource.TestCheckResourceAttr(resourceName, "workflow_details.#", "0"), ), }, @@ -108,7 +108,7 @@ func testAccServer_basic(t *testing.T) { resource.TestCheckTypeSetElemAttr(resourceName, "protocols.*", "SFTP"), resource.TestCheckResourceAttr(resourceName, "security_policy_name", "TransferSecurityPolicy-2018-11"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "url", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrURL, ""), ), }, }, From 9d4b0daa2e9db608ba62dc08e849402022e777f0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:40 -0400 Subject: [PATCH 1127/1490] ci: Prefer constant for string literal "arns" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index ffc68fb21f4..2c3cb612a89 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1415,3 +1415,13 @@ rules: - pattern: '"url"' severity: ERROR fix: "names.AttrURL" + - id: literal-arns-string-constant + languages: [go] + message: Use the constant `names.AttrARNs` for the string literal "arns" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"arns"' + severity: ERROR + fix: "names.AttrARNs" From 1a13e5d0fb8a0528c27ef46292a0a4deb9ec20c5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:40 -0400 Subject: [PATCH 1128/1490] names: Add constant for string literal "arns" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 477176b8cb9..32ba4c1c8a2 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -5,6 +5,7 @@ package names const ( AttrARN = "arn" + AttrARNs = "arns" AttrAccessKey = "access_key" AttrAccountID = "account_id" AttrAction = "action" From b38c9d3bd4a63c7ea7ef291f9fc2bbf6e1f0d35c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:40 -0400 Subject: [PATCH 1129/1490] amp: Use constant for arns strings --- internal/service/amp/workspaces_data_source.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/amp/workspaces_data_source.go b/internal/service/amp/workspaces_data_source.go index 8acc30f022f..79a7299a28e 100644 --- a/internal/service/amp/workspaces_data_source.go +++ b/internal/service/amp/workspaces_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_prometheus_workspaces", name="Workspaces") @@ -30,7 +31,7 @@ func dataSourceWorkspaces() *schema.Resource { // nosemgrep:ci.caps0-in-func-nam Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "arns": { + names.AttrARNs: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -64,7 +65,7 @@ func dataSourceWorkspacesRead(ctx context.Context, d *schema.ResourceData, meta d.SetId(meta.(*conns.AWSClient).Region) d.Set("aliases", aliases) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("workspace_ids", workspaceIDs) return diags From 96cdf1aa70a7a2895f191448136c30a4cd7bee80 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:41 -0400 Subject: [PATCH 1130/1490] autoscaling: Use constant for arns strings --- internal/service/autoscaling/groups_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/autoscaling/groups_data_source.go b/internal/service/autoscaling/groups_data_source.go index 460a2d9dc6e..d8d6a358b8a 100644 --- a/internal/service/autoscaling/groups_data_source.go +++ b/internal/service/autoscaling/groups_data_source.go @@ -24,7 +24,7 @@ func dataSourceGroups() *schema.Resource { ReadWithoutTimeout: dataSourceGroupsRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -114,7 +114,7 @@ func dataSourceGroupsRead(ctx context.Context, d *schema.ResourceData, meta inte sort.Strings(names) d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("names", names) return diags From 435ded3654cc3dd68e20943fb2256791d0e9faec Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:41 -0400 Subject: [PATCH 1131/1490] cognitoidp: Use constant for arns strings --- internal/service/cognitoidp/user_pools_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/cognitoidp/user_pools_data_source.go b/internal/service/cognitoidp/user_pools_data_source.go index b63bf3c7fc6..378a90598e1 100644 --- a/internal/service/cognitoidp/user_pools_data_source.go +++ b/internal/service/cognitoidp/user_pools_data_source.go @@ -23,7 +23,7 @@ func dataSourceUserPools() *schema.Resource { ReadWithoutTimeout: dataSourceUserPoolsRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -74,7 +74,7 @@ func dataSourceUserPoolsRead(ctx context.Context, d *schema.ResourceData, meta i d.SetId(name) d.Set("ids", userPoolIDs) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) return diags } From 539feb2bcc67dcef7aee13f75b454e6e03485aac Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:41 -0400 Subject: [PATCH 1132/1490] ec2: Use constant for arns strings --- internal/service/ec2/vpc_security_groups_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ec2/vpc_security_groups_data_source.go b/internal/service/ec2/vpc_security_groups_data_source.go index 147ba1e7a81..fc6a0943002 100644 --- a/internal/service/ec2/vpc_security_groups_data_source.go +++ b/internal/service/ec2/vpc_security_groups_data_source.go @@ -29,7 +29,7 @@ func DataSourceSecurityGroups() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -91,7 +91,7 @@ func dataSourceSecurityGroupsRead(ctx context.Context, d *schema.ResourceData, m } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("ids", securityGroupIDs) d.Set("vpc_ids", vpcIDs) From 8e4c99cf6f4b0b3b9d13a192b41b366d6793fc35 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:41 -0400 Subject: [PATCH 1133/1490] efs: Use constant for arns strings --- internal/service/efs/access_points_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/efs/access_points_data_source.go b/internal/service/efs/access_points_data_source.go index 31c267753b7..86204d60528 100644 --- a/internal/service/efs/access_points_data_source.go +++ b/internal/service/efs/access_points_data_source.go @@ -22,7 +22,7 @@ func DataSourceAccessPoints() *schema.Resource { ReadWithoutTimeout: dataSourceAccessPointsRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -64,7 +64,7 @@ func dataSourceAccessPointsRead(ctx context.Context, d *schema.ResourceData, met } d.SetId(fileSystemID) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("ids", accessPointIDs) return diags From 14974eac00a95ba3b6888ae8043b59895afd604a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:41 -0400 Subject: [PATCH 1134/1490] elbv2: Use constant for arns strings --- internal/service/elbv2/load_balancers_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/elbv2/load_balancers_data_source.go b/internal/service/elbv2/load_balancers_data_source.go index d4d0615bc0e..624ff1fd3f4 100644 --- a/internal/service/elbv2/load_balancers_data_source.go +++ b/internal/service/elbv2/load_balancers_data_source.go @@ -22,7 +22,7 @@ func DataSourceLoadBalancers() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceLoadBalancersRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -79,7 +79,7 @@ func dataSourceLoadBalancersRead(ctx context.Context, d *schema.ResourceData, me } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", loadBalancerARNs) + d.Set(names.AttrARNs, loadBalancerARNs) return diags } From 8d694d725976c843b6b512bba6f94f8e6f040eef Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:41 -0400 Subject: [PATCH 1135/1490] iam: Use constant for arns strings --- internal/service/iam/instance_profiles_data_source.go | 5 +++-- internal/service/iam/roles_data_source.go | 5 +++-- internal/service/iam/users_data_source.go | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/internal/service/iam/instance_profiles_data_source.go b/internal/service/iam/instance_profiles_data_source.go index fec6778681e..583ca96579e 100644 --- a/internal/service/iam/instance_profiles_data_source.go +++ b/internal/service/iam/instance_profiles_data_source.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_iam_instance_profiles", name="Instance Profiles") @@ -24,7 +25,7 @@ func dataSourceInstanceProfiles() *schema.Resource { ReadWithoutTimeout: dataSourceInstanceProfilesRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -69,7 +70,7 @@ func dataSourceInstanceProfilesRead(ctx context.Context, d *schema.ResourceData, } d.SetId(roleName) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("names", names) d.Set("paths", paths) diff --git a/internal/service/iam/roles_data_source.go b/internal/service/iam/roles_data_source.go index d45727a370c..9125c4d1b8a 100644 --- a/internal/service/iam/roles_data_source.go +++ b/internal/service/iam/roles_data_source.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_iam_roles", name="Roles") @@ -24,7 +25,7 @@ func dataSourceRoles() *schema.Resource { ReadWithoutTimeout: dataSourceRolesRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -88,7 +89,7 @@ func dataSourceRolesRead(ctx context.Context, d *schema.ResourceData, meta inter names = append(names, aws.ToString(r.RoleName)) } - if err := d.Set("arns", arns); err != nil { + if err := d.Set(names.AttrARNs, arns); err != nil { return sdkdiag.AppendErrorf(diags, "setting arns: %s", err) } diff --git a/internal/service/iam/users_data_source.go b/internal/service/iam/users_data_source.go index aadd74de90c..4b28c381b2f 100644 --- a/internal/service/iam/users_data_source.go +++ b/internal/service/iam/users_data_source.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_iam_users", name="Users") @@ -19,7 +20,7 @@ func dataSourceUsers() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceUsersRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -68,7 +69,7 @@ func dataSourceUsersRead(ctx context.Context, d *schema.ResourceData, meta inter return sdkdiag.AppendErrorf(diags, "setting names: %s", err) } - if err := d.Set("arns", arns); err != nil { + if err := d.Set(names.AttrARNs, arns); err != nil { return sdkdiag.AppendErrorf(diags, "setting arns: %s", err) } From 22647f75f4b0b9cc474c966cceb6d20a14001a9f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:42 -0400 Subject: [PATCH 1136/1490] imagebuilder: Use constant for arns strings --- internal/service/imagebuilder/components_data_source.go | 4 ++-- .../service/imagebuilder/container_recipes_data_source.go | 4 ++-- .../imagebuilder/distribution_configurations_data_source.go | 4 ++-- internal/service/imagebuilder/image_pipelines_data_source.go | 4 ++-- internal/service/imagebuilder/image_recipes_data_source.go | 4 ++-- .../imagebuilder/infrastructure_configurations_data_source.go | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/imagebuilder/components_data_source.go b/internal/service/imagebuilder/components_data_source.go index 615d135c1ee..8b1f422f56b 100644 --- a/internal/service/imagebuilder/components_data_source.go +++ b/internal/service/imagebuilder/components_data_source.go @@ -22,7 +22,7 @@ func DataSourceComponents() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceComponentsRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -86,7 +86,7 @@ func dataSourceComponentsRead(ctx context.Context, d *schema.ResourceData, meta } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("names", names) return diags diff --git a/internal/service/imagebuilder/container_recipes_data_source.go b/internal/service/imagebuilder/container_recipes_data_source.go index 2756b51c5da..e360336156c 100644 --- a/internal/service/imagebuilder/container_recipes_data_source.go +++ b/internal/service/imagebuilder/container_recipes_data_source.go @@ -22,7 +22,7 @@ func DataSourceContainerRecipes() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceContainerRecipesRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -86,7 +86,7 @@ func dataSourceContainerRecipesRead(ctx context.Context, d *schema.ResourceData, } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("names", names) return diags diff --git a/internal/service/imagebuilder/distribution_configurations_data_source.go b/internal/service/imagebuilder/distribution_configurations_data_source.go index 0f41d555b46..bb61b9f0f35 100644 --- a/internal/service/imagebuilder/distribution_configurations_data_source.go +++ b/internal/service/imagebuilder/distribution_configurations_data_source.go @@ -21,7 +21,7 @@ func DataSourceDistributionConfigurations() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceDistributionConfigurationsRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -76,7 +76,7 @@ func dataSourceDistributionConfigurationsRead(ctx context.Context, d *schema.Res } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("names", names) return diags diff --git a/internal/service/imagebuilder/image_pipelines_data_source.go b/internal/service/imagebuilder/image_pipelines_data_source.go index 6be2518c4c4..af7e5a3c0cc 100644 --- a/internal/service/imagebuilder/image_pipelines_data_source.go +++ b/internal/service/imagebuilder/image_pipelines_data_source.go @@ -21,7 +21,7 @@ func DataSourceImagePipelines() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceImagePipelinesRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -76,7 +76,7 @@ func dataSourceImagePipelinesRead(ctx context.Context, d *schema.ResourceData, m } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("names", names) return diags diff --git a/internal/service/imagebuilder/image_recipes_data_source.go b/internal/service/imagebuilder/image_recipes_data_source.go index b2fb4f082c7..633d63e938b 100644 --- a/internal/service/imagebuilder/image_recipes_data_source.go +++ b/internal/service/imagebuilder/image_recipes_data_source.go @@ -22,7 +22,7 @@ func DataSourceImageRecipes() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceImageRecipesRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -86,7 +86,7 @@ func dataSourceImageRecipesRead(ctx context.Context, d *schema.ResourceData, met } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("names", names) return diags diff --git a/internal/service/imagebuilder/infrastructure_configurations_data_source.go b/internal/service/imagebuilder/infrastructure_configurations_data_source.go index f198aea8683..df4a5f52526 100644 --- a/internal/service/imagebuilder/infrastructure_configurations_data_source.go +++ b/internal/service/imagebuilder/infrastructure_configurations_data_source.go @@ -21,7 +21,7 @@ func DataSourceInfrastructureConfigurations() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceInfrastructureConfigurationsRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -76,7 +76,7 @@ func dataSourceInfrastructureConfigurationsRead(ctx context.Context, d *schema.R } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("names", names) return diags From a663bbd2ca53327c97139f1c1462c6cef0c8c5e5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:42 -0400 Subject: [PATCH 1137/1490] inspector: Use constant for arns strings --- internal/service/inspector/rules_packages_data_source.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/inspector/rules_packages_data_source.go b/internal/service/inspector/rules_packages_data_source.go index 0007c58d381..c3546bfb3d0 100644 --- a/internal/service/inspector/rules_packages_data_source.go +++ b/internal/service/inspector/rules_packages_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_inspector_rules_packages") @@ -21,7 +22,7 @@ func DataSourceRulesPackages() *schema.Resource { ReadWithoutTimeout: dataSourceRulesPackagesRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -44,7 +45,7 @@ func dataSourceRulesPackagesRead(ctx context.Context, d *schema.ResourceData, me sort.Strings(arns) d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) return diags } From 0059dfee13c54592bb23a06fabbbf7757b5fcf75 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:42 -0400 Subject: [PATCH 1138/1490] licensemanager: Use constant for arns strings --- internal/service/licensemanager/license_grants_data_source.go | 4 ++-- .../service/licensemanager/received_licenses_data_source.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/licensemanager/license_grants_data_source.go b/internal/service/licensemanager/license_grants_data_source.go index 9397e5afa26..2637b5ebaa5 100644 --- a/internal/service/licensemanager/license_grants_data_source.go +++ b/internal/service/licensemanager/license_grants_data_source.go @@ -23,7 +23,7 @@ func DataSourceDistributedGrants() *schema.Resource { ReadWithoutTimeout: dataSourceDistributedGrantsRead, Schema: map[string]*schema.Schema{ names.AttrFilter: DataSourceFiltersSchema(), - "arns": { + names.AttrARNs: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -59,7 +59,7 @@ func dataSourceDistributedGrantsRead(ctx context.Context, d *schema.ResourceData } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", grantARNs) + d.Set(names.AttrARNs, grantARNs) return diags } diff --git a/internal/service/licensemanager/received_licenses_data_source.go b/internal/service/licensemanager/received_licenses_data_source.go index a443f709a0e..8575fd359b0 100644 --- a/internal/service/licensemanager/received_licenses_data_source.go +++ b/internal/service/licensemanager/received_licenses_data_source.go @@ -22,7 +22,7 @@ func DataSourceReceivedLicenses() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceReceivedLicensesRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -59,7 +59,7 @@ func dataSourceReceivedLicensesRead(ctx context.Context, d *schema.ResourceData, } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", licenseARNs) + d.Set(names.AttrARNs, licenseARNs) return diags } From 8b54a9bb8d90ac3f57004105deb9ce724c7a5d5f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:42 -0400 Subject: [PATCH 1139/1490] logs: Use constant for arns strings --- internal/service/logs/groups_data_source.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/logs/groups_data_source.go b/internal/service/logs/groups_data_source.go index 67d53a4042d..0519d67a72f 100644 --- a/internal/service/logs/groups_data_source.go +++ b/internal/service/logs/groups_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_cloudwatch_log_groups") @@ -21,7 +22,7 @@ func dataSourceGroups() *schema.Resource { ReadWithoutTimeout: dataSourceGroupsRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -72,7 +73,7 @@ func dataSourceGroupsRead(ctx context.Context, d *schema.ResourceData, meta inte logGroupNames = append(logGroupNames, aws.ToString(r.LogGroupName)) } - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("log_group_names", logGroupNames) return diags From 78404b9e79e34c8d5e131b8dfd2d3109292e8ae9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:42 -0400 Subject: [PATCH 1140/1490] oam: Use constant for arns strings --- internal/service/oam/links_data_source.go | 4 ++-- internal/service/oam/sinks_data_source.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/oam/links_data_source.go b/internal/service/oam/links_data_source.go index 57a9e021f5e..0b23185a7d8 100644 --- a/internal/service/oam/links_data_source.go +++ b/internal/service/oam/links_data_source.go @@ -21,7 +21,7 @@ func DataSourceLinks() *schema.Resource { ReadWithoutTimeout: dataSourceLinksRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -54,7 +54,7 @@ func dataSourceLinksRead(ctx context.Context, d *schema.ResourceData, meta inter } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) return nil } diff --git a/internal/service/oam/sinks_data_source.go b/internal/service/oam/sinks_data_source.go index eabb6398777..73111ecb7cd 100644 --- a/internal/service/oam/sinks_data_source.go +++ b/internal/service/oam/sinks_data_source.go @@ -21,7 +21,7 @@ func DataSourceSinks() *schema.Resource { ReadWithoutTimeout: dataSourceSinksRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -54,7 +54,7 @@ func dataSourceSinksRead(ctx context.Context, d *schema.ResourceData, meta inter } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) return nil } From ce2651db2ac6a2db1063b2482195ab40bd32e71c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:43 -0400 Subject: [PATCH 1141/1490] outposts: Use constant for arns strings --- internal/service/outposts/outposts_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/outposts/outposts_data_source.go b/internal/service/outposts/outposts_data_source.go index 5eaf501f265..6bf948d952e 100644 --- a/internal/service/outposts/outposts_data_source.go +++ b/internal/service/outposts/outposts_data_source.go @@ -21,7 +21,7 @@ func DataSourceOutposts() *schema.Resource { // nosemgrep:ci.outposts-in-func-na ReadWithoutTimeout: dataSourceOutpostsRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -100,7 +100,7 @@ func dataSourceOutpostsRead(ctx context.Context, d *schema.ResourceData, meta in return sdkdiag.AppendErrorf(diags, "listing Outposts Outposts: %s", err) } - if err := d.Set("arns", arns); err != nil { + if err := d.Set(names.AttrARNs, arns); err != nil { return sdkdiag.AppendErrorf(diags, "setting arns: %s", err) } From e7d419eb010f3ec7275ef2090b6271296db4ceae Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:43 -0400 Subject: [PATCH 1142/1490] s3: Use constant for arns strings --- internal/service/s3/directory_buckets_data_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/s3/directory_buckets_data_source.go b/internal/service/s3/directory_buckets_data_source.go index 6c7a8aa6879..41207a820bc 100644 --- a/internal/service/s3/directory_buckets_data_source.go +++ b/internal/service/s3/directory_buckets_data_source.go @@ -36,7 +36,7 @@ func (d *directoryBucketsDataSource) Metadata(_ context.Context, request datasou func (d *directoryBucketsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ - "arns": schema.ListAttribute{ + names.AttrARNs: schema.ListAttribute{ ElementType: types.StringType, Computed: true, }, From ca760da0f1909b35d8cb28421e8f8594540589e6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:43 -0400 Subject: [PATCH 1143/1490] secretsmanager: Use constant for arns strings --- internal/service/secretsmanager/secrets_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/secretsmanager/secrets_data_source.go b/internal/service/secretsmanager/secrets_data_source.go index 27aea3b40f0..1ac1c1d43b1 100644 --- a/internal/service/secretsmanager/secrets_data_source.go +++ b/internal/service/secretsmanager/secrets_data_source.go @@ -23,7 +23,7 @@ func dataSourceSecrets() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceSecretsRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeSet, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -64,7 +64,7 @@ func dataSourceSecretsRead(ctx context.Context, d *schema.ResourceData, meta int } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", tfslices.ApplyToAll(results, func(v types.SecretListEntry) string { return aws.ToString(v.ARN) })) + d.Set(names.AttrARNs, tfslices.ApplyToAll(results, func(v types.SecretListEntry) string { return aws.ToString(v.ARN) })) d.Set("names", tfslices.ApplyToAll(results, func(v types.SecretListEntry) string { return aws.ToString(v.Name) })) return diags From 64d6e5f051bf35b05151ddcc0686038111446de8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:43 -0400 Subject: [PATCH 1144/1490] ssm: Use constant for arns strings --- internal/service/ssm/parameters_by_path_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ssm/parameters_by_path_data_source.go b/internal/service/ssm/parameters_by_path_data_source.go index 11f707f759c..ed246f0fc65 100644 --- a/internal/service/ssm/parameters_by_path_data_source.go +++ b/internal/service/ssm/parameters_by_path_data_source.go @@ -21,7 +21,7 @@ func DataSourceParametersByPath() *schema.Resource { ReadWithoutTimeout: dataSourceParametersReadByPath, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -96,7 +96,7 @@ func dataSourceParametersReadByPath(ctx context.Context, d *schema.ResourceData, } d.SetId(path) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("names", n) d.Set("types", types) d.Set(names.AttrValues, values) From d66f3e3fb68e983cf99044d1665a5ac24df26666 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:23:44 -0400 Subject: [PATCH 1145/1490] ssoadmin: Use constant for arns strings --- internal/service/ssoadmin/instances_data_source.go | 5 +++-- internal/service/ssoadmin/sweep.go | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/service/ssoadmin/instances_data_source.go b/internal/service/ssoadmin/instances_data_source.go index a7e163773a1..e1eab45335c 100644 --- a/internal/service/ssoadmin/instances_data_source.go +++ b/internal/service/ssoadmin/instances_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_ssoadmin_instances") @@ -21,7 +22,7 @@ func DataSourceInstances() *schema.Resource { ReadWithoutTimeout: dataSourceInstancesRead, Schema: map[string]*schema.Schema{ - "arns": { + names.AttrARNs: { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -53,7 +54,7 @@ func dataSourceInstancesRead(ctx context.Context, d *schema.ResourceData, meta i } d.SetId(meta.(*conns.AWSClient).Region) - d.Set("arns", arns) + d.Set(names.AttrARNs, arns) d.Set("identity_store_ids", identityStoreIDs) return diags diff --git a/internal/service/ssoadmin/sweep.go b/internal/service/ssoadmin/sweep.go index 52deebb8614..705a7f5c068 100644 --- a/internal/service/ssoadmin/sweep.go +++ b/internal/service/ssoadmin/sweep.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv2" "github.com/hashicorp/terraform-provider-aws/internal/sweep/framework" "github.com/hashicorp/terraform-provider-aws/internal/sweep/sdk" + "github.com/hashicorp/terraform-provider-aws/names" ) func RegisterSweepers() { @@ -63,7 +64,7 @@ func sweepAccountAssignments(region string) error { return err } - if v, ok := dsData.GetOk("arns"); ok && len(v.([]interface{})) > 0 { + if v, ok := dsData.GetOk(names.AttrARNs); ok && len(v.([]interface{})) > 0 { instanceArn := v.([]interface{})[0].(string) // To sweep account assignments, we need to first determine which Permission Sets @@ -156,7 +157,7 @@ func sweepApplications(region string) error { return err } - if v, ok := dsData.GetOk("arns"); ok && len(v.([]interface{})) > 0 { + if v, ok := dsData.GetOk(names.AttrARNs); ok && len(v.([]interface{})) > 0 { instanceArn := v.([]interface{})[0].(string) input := &ssoadmin.ListApplicationsInput{ @@ -216,7 +217,7 @@ func sweepPermissionSets(region string) error { return err } - if v, ok := dsData.GetOk("arns"); ok && len(v.([]interface{})) > 0 { + if v, ok := dsData.GetOk(names.AttrARNs); ok && len(v.([]interface{})) > 0 { instanceArn := v.([]interface{})[0].(string) input := &ssoadmin.ListPermissionSetsInput{ From 34b1075f073a6eca7b97c59f2600356ec8fd2abe Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:26 -0400 Subject: [PATCH 1146/1490] ci: Prefer constant for string literal "username" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 2c3cb612a89..69fc9aa0757 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1425,3 +1425,13 @@ rules: - pattern: '"arns"' severity: ERROR fix: "names.AttrARNs" + - id: literal-username-string-constant + languages: [go] + message: Use the constant `names.AttrUsername` for the string literal "username" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"username"' + severity: ERROR + fix: "names.AttrUsername" From d5b827f85d9feb93b5d92d68af827563c2ad535c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:26 -0400 Subject: [PATCH 1147/1490] names: Add constant for string literal "username" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 32ba4c1c8a2..ea8c228c232 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -78,6 +78,7 @@ const ( AttrTransitGatewayID = "transit_gateway_id" AttrType = "type" AttrURL = "url" + AttrUsername = "username" AttrVPCID = "vpc_id" AttrVPCSecurityGroupIDs = "vpc_security_group_ids" AttrValue = "value" From b6fc90c03a48d22aa88ba646cd98fc8dbb8d7a3a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:27 -0400 Subject: [PATCH 1148/1490] appflow: Use constant for username strings --- internal/service/appflow/connector_profile.go | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/appflow/connector_profile.go b/internal/service/appflow/connector_profile.go index 6efa8458daf..8c85304f145 100644 --- a/internal/service/appflow/connector_profile.go +++ b/internal/service/appflow/connector_profile.go @@ -142,7 +142,7 @@ func resourceConnectorProfile() *schema.Resource { Sensitive: true, ValidateFunc: validation.StringLenBetween(0, 512), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(0, 512), @@ -526,7 +526,7 @@ func resourceConnectorProfile() *schema.Resource { Sensitive: true, ValidateFunc: validation.StringLenBetween(0, 512), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -621,7 +621,7 @@ func resourceConnectorProfile() *schema.Resource { Sensitive: true, ValidateFunc: validation.StringLenBetween(0, 512), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -714,7 +714,7 @@ func resourceConnectorProfile() *schema.Resource { Sensitive: true, ValidateFunc: validation.StringLenBetween(0, 512), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -814,7 +814,7 @@ func resourceConnectorProfile() *schema.Resource { Sensitive: true, ValidateFunc: validation.StringLenBetween(0, 512), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -855,7 +855,7 @@ func resourceConnectorProfile() *schema.Resource { Sensitive: true, ValidateFunc: validation.StringLenBetween(0, 512), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -1758,7 +1758,7 @@ func expandMarketoConnectorProfileCredentials(m map[string]interface{}) *types.M func expandRedshiftConnectorProfileCredentials(m map[string]interface{}) *types.RedshiftConnectorProfileCredentials { credentials := &types.RedshiftConnectorProfileCredentials{ Password: aws.String(m[names.AttrPassword].(string)), - Username: aws.String(m["username"].(string)), + Username: aws.String(m[names.AttrUsername].(string)), } return credentials @@ -1805,7 +1805,7 @@ func expandSAPODataConnectorProfileCredentials(m map[string]interface{}) *types. func expandServiceNowConnectorProfileCredentials(m map[string]interface{}) *types.ServiceNowConnectorProfileCredentials { credentials := &types.ServiceNowConnectorProfileCredentials{ Password: aws.String(m[names.AttrPassword].(string)), - Username: aws.String(m["username"].(string)), + Username: aws.String(m[names.AttrUsername].(string)), } return credentials @@ -1836,7 +1836,7 @@ func expandSlackConnectorProfileCredentials(m map[string]interface{}) *types.Sla func expandSnowflakeConnectorProfileCredentials(m map[string]interface{}) *types.SnowflakeConnectorProfileCredentials { credentials := &types.SnowflakeConnectorProfileCredentials{ Password: aws.String(m[names.AttrPassword].(string)), - Username: aws.String(m["username"].(string)), + Username: aws.String(m[names.AttrUsername].(string)), } return credentials @@ -1853,7 +1853,7 @@ func expandTrendmicroConnectorProfileCredentials(m map[string]interface{}) *type func expandVeevaConnectorProfileCredentials(m map[string]interface{}) *types.VeevaConnectorProfileCredentials { credentials := &types.VeevaConnectorProfileCredentials{ Password: aws.String(m[names.AttrPassword].(string)), - Username: aws.String(m["username"].(string)), + Username: aws.String(m[names.AttrUsername].(string)), } return credentials @@ -1908,7 +1908,7 @@ func expandBasicAuthCredentials(m map[string]interface{}) *types.BasicAuthCreden credentials.Password = aws.String(v) } - if v, ok := m["username"].(string); ok && v != "" { + if v, ok := m[names.AttrUsername].(string); ok && v != "" { credentials.Username = aws.String(v) } From a993e4a944d13e4cb274b60a6b249032f43dbcaa Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:27 -0400 Subject: [PATCH 1149/1490] chime: Use constant for username strings --- .../chime/voice_connector_termination_credentials.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/chime/voice_connector_termination_credentials.go b/internal/service/chime/voice_connector_termination_credentials.go index b7e5955dbf1..8bfbd99e514 100644 --- a/internal/service/chime/voice_connector_termination_credentials.go +++ b/internal/service/chime/voice_connector_termination_credentials.go @@ -41,7 +41,7 @@ func ResourceVoiceConnectorTerminationCredentials() *schema.Resource { MaxItems: 10, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringIsNotEmpty, @@ -162,7 +162,7 @@ func expandCredentialsUsernames(data []interface{}) []string { for _, rData := range data { item := rData.(map[string]interface{}) - rawNames = append(rawNames, item["username"].(string)) + rawNames = append(rawNames, item[names.AttrUsername].(string)) } return rawNames @@ -174,7 +174,7 @@ func expandCredentials(data []interface{}) []awstypes.Credential { for _, rItem := range data { item := rItem.(map[string]interface{}) credentials = append(credentials, awstypes.Credential{ - Username: aws.String(item["username"].(string)), + Username: aws.String(item[names.AttrUsername].(string)), Password: aws.String(item[names.AttrPassword].(string)), }) } From be0fadbb925aae93ce3848a51cd334869892db9d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:27 -0400 Subject: [PATCH 1150/1490] cognitoidp: Use constant for username strings --- internal/service/cognitoidp/user.go | 30 +++++++++---------- internal/service/cognitoidp/user_in_group.go | 9 +++--- .../service/cognitoidp/user_in_group_test.go | 6 ++-- internal/service/cognitoidp/user_test.go | 8 ++--- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/internal/service/cognitoidp/user.go b/internal/service/cognitoidp/user.go index d4336024af0..594cfed162e 100644 --- a/internal/service/cognitoidp/user.go +++ b/internal/service/cognitoidp/user.go @@ -104,7 +104,7 @@ func resourceUser() *schema.Resource { Required: true, ForceNew: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -147,7 +147,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf var diags diag.Diagnostics conn := meta.(*conns.AWSClient).CognitoIDPConn(ctx) - username := d.Get("username").(string) + username := d.Get(names.AttrUsername).(string) userPoolId := d.Get("user_pool_id").(string) params := &cognitoidentityprovider.AdminCreateUserInput{ @@ -200,7 +200,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf if v := d.Get(names.AttrEnabled); !v.(bool) { disableParams := &cognitoidentityprovider.AdminDisableUserInput{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), UserPoolId: aws.String(d.Get("user_pool_id").(string)), } @@ -212,7 +212,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf if v, ok := d.GetOk(names.AttrPassword); ok { setPasswordParams := &cognitoidentityprovider.AdminSetUserPasswordInput{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), UserPoolId: aws.String(d.Get("user_pool_id").(string)), Password: aws.String(v.(string)), Permanent: aws.Bool(true), @@ -231,16 +231,16 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac var diags diag.Diagnostics conn := meta.(*conns.AWSClient).CognitoIDPConn(ctx) - user, err := findUserByTwoPartKey(ctx, conn, d.Get("user_pool_id").(string), d.Get("username").(string)) + user, err := findUserByTwoPartKey(ctx, conn, d.Get("user_pool_id").(string), d.Get(names.AttrUsername).(string)) if !d.IsNewResource() && tfresource.NotFound(err) { - create.LogNotFoundRemoveState(names.CognitoIDP, create.ErrActionReading, ResNameUser, d.Get("username").(string)) + create.LogNotFoundRemoveState(names.CognitoIDP, create.ErrActionReading, ResNameUser, d.Get(names.AttrUsername).(string)) d.SetId("") return diags } if err != nil { - return create.AppendDiagError(diags, names.CognitoIDP, create.ErrActionReading, ResNameUser, d.Get("username").(string), err) + return create.AppendDiagError(diags, names.CognitoIDP, create.ErrActionReading, ResNameUser, d.Get(names.AttrUsername).(string), err) } if err := d.Set("attributes", flattenUserAttributes(user.UserAttributes)); err != nil { @@ -274,7 +274,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf if len(upd) > 0 { params := &cognitoidentityprovider.AdminUpdateUserAttributesInput{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), UserPoolId: aws.String(d.Get("user_pool_id").(string)), UserAttributes: expandAttribute(upd), } @@ -291,7 +291,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf } if len(del) > 0 { params := &cognitoidentityprovider.AdminDeleteUserAttributesInput{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), UserPoolId: aws.String(d.Get("user_pool_id").(string)), UserAttributeNames: expandUserAttributesDelete(del), } @@ -307,7 +307,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf if enabled { enableParams := &cognitoidentityprovider.AdminEnableUserInput{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), UserPoolId: aws.String(d.Get("user_pool_id").(string)), } _, err := conn.AdminEnableUserWithContext(ctx, enableParams) @@ -316,7 +316,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf } } else { disableParams := &cognitoidentityprovider.AdminDisableUserInput{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), UserPoolId: aws.String(d.Get("user_pool_id").(string)), } _, err := conn.AdminDisableUserWithContext(ctx, disableParams) @@ -331,7 +331,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf if password != "" { setPasswordParams := &cognitoidentityprovider.AdminSetUserPasswordInput{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), UserPoolId: aws.String(d.Get("user_pool_id").(string)), Password: aws.String(password), Permanent: aws.Bool(false), @@ -351,7 +351,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf if password != "" { setPasswordParams := &cognitoidentityprovider.AdminSetUserPasswordInput{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), UserPoolId: aws.String(d.Get("user_pool_id").(string)), Password: aws.String(password), Permanent: aws.Bool(true), @@ -375,7 +375,7 @@ func resourceUserDelete(ctx context.Context, d *schema.ResourceData, meta interf log.Printf("[DEBUG] Deleting Cognito User: %s", d.Id()) _, err := conn.AdminDeleteUserWithContext(ctx, &cognitoidentityprovider.AdminDeleteUserInput{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), UserPoolId: aws.String(d.Get("user_pool_id").(string)), }) @@ -398,7 +398,7 @@ func resourceUserImport(ctx context.Context, d *schema.ResourceData, meta interf userPoolId := idSplit[0] name := idSplit[1] d.Set("user_pool_id", userPoolId) - d.Set("username", name) + d.Set(names.AttrUsername, name) return []*schema.ResourceData{d}, nil } diff --git a/internal/service/cognitoidp/user_in_group.go b/internal/service/cognitoidp/user_in_group.go index f46bfe2f838..8c0f4369da2 100644 --- a/internal/service/cognitoidp/user_in_group.go +++ b/internal/service/cognitoidp/user_in_group.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_cognito_user_in_group", name="Group User") @@ -35,7 +36,7 @@ func resourceUserInGroup() *schema.Resource { ForceNew: true, ValidateFunc: validUserPoolID, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -59,7 +60,7 @@ func resourceUserInGroupCreate(ctx context.Context, d *schema.ResourceData, meta input.UserPoolId = aws.String(v.(string)) } - if v, ok := d.GetOk("username"); ok { + if v, ok := d.GetOk(names.AttrUsername); ok { input.Username = aws.String(v.(string)) } @@ -81,7 +82,7 @@ func resourceUserInGroupRead(ctx context.Context, d *schema.ResourceData, meta i groupName := d.Get("group_name").(string) userPoolId := d.Get("user_pool_id").(string) - username := d.Get("username").(string) + username := d.Get(names.AttrUsername).(string) found, err := FindCognitoUserInGroup(ctx, conn, groupName, userPoolId, username) @@ -102,7 +103,7 @@ func resourceUserInGroupDelete(ctx context.Context, d *schema.ResourceData, meta groupName := d.Get("group_name").(string) userPoolID := d.Get("user_pool_id").(string) - username := d.Get("username").(string) + username := d.Get(names.AttrUsername).(string) input := &cognitoidentityprovider.AdminRemoveUserFromGroupInput{ GroupName: aws.String(groupName), diff --git a/internal/service/cognitoidp/user_in_group_test.go b/internal/service/cognitoidp/user_in_group_test.go index fcee7f53730..90881542614 100644 --- a/internal/service/cognitoidp/user_in_group_test.go +++ b/internal/service/cognitoidp/user_in_group_test.go @@ -40,7 +40,7 @@ func TestAccCognitoIDPUserInGroup_basic(t *testing.T) { testAccCheckUserInGroupExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, "user_pool_id", userPoolResourceName, names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "group_name", userGroupResourceName, names.AttrName), - resource.TestCheckResourceAttrPair(resourceName, "username", userResourceName, "username"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrUsername, userResourceName, names.AttrUsername), ), }, }, @@ -112,7 +112,7 @@ func testAccCheckUserInGroupExists(ctx context.Context, resourceName string) res groupName := rs.Primary.Attributes["group_name"] userPoolId := rs.Primary.Attributes["user_pool_id"] - username := rs.Primary.Attributes["username"] + username := rs.Primary.Attributes[names.AttrUsername] found, err := tfcognitoidp.FindCognitoUserInGroup(ctx, conn, groupName, userPoolId, username) @@ -139,7 +139,7 @@ func testAccCheckUserInGroupDestroy(ctx context.Context) resource.TestCheckFunc groupName := rs.Primary.Attributes["group_name"] userPoolId := rs.Primary.Attributes["user_pool_id"] - username := rs.Primary.Attributes["username"] + username := rs.Primary.Attributes[names.AttrUsername] found, err := tfcognitoidp.FindCognitoUserInGroup(ctx, conn, groupName, userPoolId, username) diff --git a/internal/service/cognitoidp/user_test.go b/internal/service/cognitoidp/user_test.go index cf6cfdf0553..2615656b3c0 100644 --- a/internal/service/cognitoidp/user_test.go +++ b/internal/service/cognitoidp/user_test.go @@ -306,7 +306,7 @@ func testAccCheckUserExists(ctx context.Context, n string) resource.TestCheckFun conn := acctest.Provider.Meta().(*conns.AWSClient).CognitoIDPConn(ctx) - _, err := tfcognitoidp.FindUserByTwoPartKey(ctx, conn, rs.Primary.Attributes["user_pool_id"], rs.Primary.Attributes["username"]) + _, err := tfcognitoidp.FindUserByTwoPartKey(ctx, conn, rs.Primary.Attributes["user_pool_id"], rs.Primary.Attributes[names.AttrUsername]) return err } @@ -321,7 +321,7 @@ func testAccCheckUserDestroy(ctx context.Context) resource.TestCheckFunc { continue } - _, err := tfcognitoidp.FindUserByTwoPartKey(ctx, conn, rs.Primary.Attributes["user_pool_id"], rs.Primary.Attributes["username"]) + _, err := tfcognitoidp.FindUserByTwoPartKey(ctx, conn, rs.Primary.Attributes["user_pool_id"], rs.Primary.Attributes[names.AttrUsername]) if tfresource.NotFound(err) { continue @@ -350,7 +350,7 @@ func testAccUserTemporaryPassword(ctx context.Context, userResName string, clien return fmt.Errorf("Not found: %s", clientResName) } - userName := userRs.Primary.Attributes["username"] + userName := userRs.Primary.Attributes[names.AttrUsername] userPassword := userRs.Primary.Attributes["temporary_password"] clientId := clientRs.Primary.Attributes[names.AttrID] @@ -390,7 +390,7 @@ func testAccUserPassword(ctx context.Context, userResName string, clientResName return fmt.Errorf("Not found: %s", clientResName) } - userName := userRs.Primary.Attributes["username"] + userName := userRs.Primary.Attributes[names.AttrUsername] userPassword := userRs.Primary.Attributes[names.AttrPassword] clientId := clientRs.Primary.Attributes[names.AttrID] From 1a626f8f29b5a9ec19e63170f72855a755dd8ae7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:27 -0400 Subject: [PATCH 1151/1490] dms: Use constant for username strings --- internal/service/dms/endpoint.go | 82 ++++++++++---------- internal/service/dms/endpoint_data_source.go | 4 +- internal/service/dms/endpoint_test.go | 40 +++++----- 3 files changed, 63 insertions(+), 63 deletions(-) diff --git a/internal/service/dms/endpoint.go b/internal/service/dms/endpoint.go index 7ac00683db1..50366913ec3 100644 --- a/internal/service/dms/endpoint.go +++ b/internal/service/dms/endpoint.go @@ -731,14 +731,14 @@ func ResourceEndpoint() *schema.Resource { Optional: true, ValidateFunc: verify.ValidARN, RequiredWith: []string{"secrets_manager_arn"}, - ConflictsWith: []string{"username", names.AttrPassword, "server_name", names.AttrPort}, + ConflictsWith: []string{names.AttrUsername, names.AttrPassword, "server_name", names.AttrPort}, }, "secrets_manager_arn": { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, RequiredWith: []string{"secrets_manager_access_role_arn"}, - ConflictsWith: []string{"username", names.AttrPassword, "server_name", names.AttrPort}, + ConflictsWith: []string{names.AttrUsername, names.AttrPassword, "server_name", names.AttrPort}, }, "server_name": { Type: schema.TypeString, @@ -757,7 +757,7 @@ func ResourceEndpoint() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "username": { + names.AttrUsername: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"secrets_manager_access_role_arn", "secrets_manager_arn"}, @@ -813,7 +813,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.MySQLSettings = &dms.MySQLSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -834,7 +834,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in settings.SecretsManagerSecretId = aws.String(d.Get("secrets_manager_arn").(string)) settings.DatabaseName = aws.String(d.Get(names.AttrDatabaseName).(string)) } else { - settings.Username = aws.String(d.Get("username").(string)) + settings.Username = aws.String(d.Get(names.AttrUsername).(string)) settings.Password = aws.String(d.Get(names.AttrPassword).(string)) settings.ServerName = aws.String(d.Get("server_name").(string)) settings.Port = aws.Int64(int64(d.Get(names.AttrPort).(int))) @@ -868,7 +868,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in settings.SecretsManagerAccessRoleArn = aws.String(d.Get("secrets_manager_access_role_arn").(string)) settings.SecretsManagerSecretId = aws.String(d.Get("secrets_manager_arn").(string)) } else { - settings.Username = aws.String(d.Get("username").(string)) + settings.Username = aws.String(d.Get(names.AttrUsername).(string)) settings.Password = aws.String(d.Get(names.AttrPassword).(string)) settings.ServerName = aws.String(d.Get("server_name").(string)) settings.Port = aws.Int64(int64(d.Get(names.AttrPort).(int))) @@ -896,7 +896,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.OracleSettings = &dms.OracleSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -917,7 +917,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in settings.SecretsManagerAccessRoleArn = aws.String(d.Get("secrets_manager_access_role_arn").(string)) settings.SecretsManagerSecretId = aws.String(d.Get("secrets_manager_arn").(string)) } else { - settings.Username = aws.String(d.Get("username").(string)) + settings.Username = aws.String(d.Get(names.AttrUsername).(string)) settings.Password = aws.String(d.Get(names.AttrPassword).(string)) settings.ServerName = aws.String(d.Get("server_name").(string)) settings.Port = aws.Int64(int64(d.Get(names.AttrPort).(int))) @@ -960,7 +960,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.MicrosoftSQLServerSettings = &dms.MicrosoftSQLServerSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -979,7 +979,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.SybaseSettings = &dms.SybaseSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -998,7 +998,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.IBMDb2Settings = &dms.IBMDb2Settings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -1104,7 +1104,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in switch engineName := d.Get("engine_name").(string); engineName { case engineNameAurora, engineNameMariadb, engineNameMySQL: if d.HasChanges( - "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + names.AttrUsername, names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.MySQLSettings = &dms.MySQLSettings{ @@ -1113,7 +1113,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.MySQLSettings = &dms.MySQLSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -1127,7 +1127,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameAuroraPostgresql, engineNamePostgres: if d.HasChanges( - "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + names.AttrUsername, names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.PostgreSQLSettings = &dms.PostgreSQLSettings{ @@ -1137,7 +1137,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.PostgreSQLSettings = &dms.PostgreSQLSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -1183,7 +1183,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameMongodb: if d.HasChanges( - "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "mongodb_settings.0.auth_type", + names.AttrUsername, names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "mongodb_settings.0.auth_type", "mongodb_settings.0.auth_mechanism", "mongodb_settings.0.nesting_level", "mongodb_settings.0.extract_doc_id", "mongodb_settings.0.docs_to_investigate", "mongodb_settings.0.auth_source", "secrets_manager_access_role_arn", "secrets_manager_arn") { @@ -1203,7 +1203,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.MongoDbSettings = &dms.MongoDbSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -1225,7 +1225,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameOracle: if d.HasChanges( - "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + names.AttrUsername, names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.OracleSettings = &dms.OracleSettings{ @@ -1235,7 +1235,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.OracleSettings = &dms.OracleSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -1254,7 +1254,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameRedshift: if d.HasChanges( - "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, + names.AttrUsername, names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "redshift_settings", "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { @@ -1265,7 +1265,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.RedshiftSettings = &dms.RedshiftSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -1303,7 +1303,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameSQLServer, engineNameBabelfish: if d.HasChanges( - "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + names.AttrUsername, names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.MicrosoftSQLServerSettings = &dms.MicrosoftSQLServerSettings{ @@ -1313,7 +1313,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.MicrosoftSQLServerSettings = &dms.MicrosoftSQLServerSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -1327,7 +1327,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameSybase: if d.HasChanges( - "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + names.AttrUsername, names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.SybaseSettings = &dms.SybaseSettings{ @@ -1337,7 +1337,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.SybaseSettings = &dms.SybaseSettings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -1351,7 +1351,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } case engineNameDB2, engineNameDB2zOS: if d.HasChanges( - "username", names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", + names.AttrUsername, names.AttrPassword, "server_name", names.AttrPort, names.AttrDatabaseName, "secrets_manager_access_role_arn", "secrets_manager_arn") { if _, ok := d.GetOk("secrets_manager_arn"); ok { input.IBMDb2Settings = &dms.IBMDb2Settings{ @@ -1361,7 +1361,7 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in } } else { input.IBMDb2Settings = &dms.IBMDb2Settings{ - Username: aws.String(d.Get("username").(string)), + Username: aws.String(d.Get(names.AttrUsername).(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), ServerName: aws.String(d.Get("server_name").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), @@ -1395,8 +1395,8 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in input.ServerName = aws.String(d.Get("server_name").(string)) } - if d.HasChange("username") { - input.Username = aws.String(d.Get("username").(string)) + if d.HasChange(names.AttrUsername) { + input.Username = aws.String(d.Get(names.AttrUsername).(string)) } } @@ -1541,7 +1541,7 @@ func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) er switch aws.StringValue(endpoint.EngineName) { case engineNameAurora, engineNameMariadb, engineNameMySQL: if endpoint.MySQLSettings != nil { - d.Set("username", endpoint.MySQLSettings.Username) + d.Set(names.AttrUsername, endpoint.MySQLSettings.Username) d.Set("server_name", endpoint.MySQLSettings.ServerName) d.Set(names.AttrPort, endpoint.MySQLSettings.Port) d.Set(names.AttrDatabaseName, endpoint.MySQLSettings.DatabaseName) @@ -1552,7 +1552,7 @@ func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) er } case engineNameAuroraPostgresql, engineNamePostgres: if endpoint.PostgreSQLSettings != nil { - d.Set("username", endpoint.PostgreSQLSettings.Username) + d.Set(names.AttrUsername, endpoint.PostgreSQLSettings.Username) d.Set("server_name", endpoint.PostgreSQLSettings.ServerName) d.Set(names.AttrPort, endpoint.PostgreSQLSettings.Port) d.Set(names.AttrDatabaseName, endpoint.PostgreSQLSettings.DatabaseName) @@ -1592,7 +1592,7 @@ func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) er } case engineNameMongodb: if endpoint.MongoDbSettings != nil { - d.Set("username", endpoint.MongoDbSettings.Username) + d.Set(names.AttrUsername, endpoint.MongoDbSettings.Username) d.Set("server_name", endpoint.MongoDbSettings.ServerName) d.Set(names.AttrPort, endpoint.MongoDbSettings.Port) d.Set(names.AttrDatabaseName, endpoint.MongoDbSettings.DatabaseName) @@ -1606,7 +1606,7 @@ func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) er } case engineNameOracle: if endpoint.OracleSettings != nil { - d.Set("username", endpoint.OracleSettings.Username) + d.Set(names.AttrUsername, endpoint.OracleSettings.Username) d.Set("server_name", endpoint.OracleSettings.ServerName) d.Set(names.AttrPort, endpoint.OracleSettings.Port) d.Set(names.AttrDatabaseName, endpoint.OracleSettings.DatabaseName) @@ -1625,7 +1625,7 @@ func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) er } case engineNameRedshift: if endpoint.RedshiftSettings != nil { - d.Set("username", endpoint.RedshiftSettings.Username) + d.Set(names.AttrUsername, endpoint.RedshiftSettings.Username) d.Set("server_name", endpoint.RedshiftSettings.ServerName) d.Set(names.AttrPort, endpoint.RedshiftSettings.Port) d.Set(names.AttrDatabaseName, endpoint.RedshiftSettings.DatabaseName) @@ -1639,7 +1639,7 @@ func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) er } case engineNameSQLServer, engineNameBabelfish: if endpoint.MicrosoftSQLServerSettings != nil { - d.Set("username", endpoint.MicrosoftSQLServerSettings.Username) + d.Set(names.AttrUsername, endpoint.MicrosoftSQLServerSettings.Username) d.Set("server_name", endpoint.MicrosoftSQLServerSettings.ServerName) d.Set(names.AttrPort, endpoint.MicrosoftSQLServerSettings.Port) d.Set(names.AttrDatabaseName, endpoint.MicrosoftSQLServerSettings.DatabaseName) @@ -1650,7 +1650,7 @@ func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) er } case engineNameSybase: if endpoint.SybaseSettings != nil { - d.Set("username", endpoint.SybaseSettings.Username) + d.Set(names.AttrUsername, endpoint.SybaseSettings.Username) d.Set("server_name", endpoint.SybaseSettings.ServerName) d.Set(names.AttrPort, endpoint.SybaseSettings.Port) d.Set(names.AttrDatabaseName, endpoint.SybaseSettings.DatabaseName) @@ -1661,7 +1661,7 @@ func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) er } case engineNameDB2, engineNameDB2zOS: if endpoint.IBMDb2Settings != nil { - d.Set("username", endpoint.IBMDb2Settings.Username) + d.Set(names.AttrUsername, endpoint.IBMDb2Settings.Username) d.Set("server_name", endpoint.IBMDb2Settings.ServerName) d.Set(names.AttrPort, endpoint.IBMDb2Settings.Port) d.Set(names.AttrDatabaseName, endpoint.IBMDb2Settings.DatabaseName) @@ -1678,7 +1678,7 @@ func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) er d.Set(names.AttrDatabaseName, endpoint.DatabaseName) d.Set(names.AttrPort, endpoint.Port) d.Set("server_name", endpoint.ServerName) - d.Set("username", endpoint.Username) + d.Set(names.AttrUsername, endpoint.Username) } d.Set(names.AttrKMSKeyARN, endpoint.KmsKeyId) @@ -2617,7 +2617,7 @@ func engineSettingsToSet(l []interface{}) *schema.Set { } func expandTopLevelConnectionInfo(d *schema.ResourceData, input *dms.CreateEndpointInput) { - input.Username = aws.String(d.Get("username").(string)) + input.Username = aws.String(d.Get(names.AttrUsername).(string)) input.Password = aws.String(d.Get(names.AttrPassword).(string)) input.ServerName = aws.String(d.Get("server_name").(string)) input.Port = aws.Int64(int64(d.Get(names.AttrPort).(int))) @@ -2628,7 +2628,7 @@ func expandTopLevelConnectionInfo(d *schema.ResourceData, input *dms.CreateEndpo } func expandTopLevelConnectionInfoModify(d *schema.ResourceData, input *dms.ModifyEndpointInput) { - input.Username = aws.String(d.Get("username").(string)) + input.Username = aws.String(d.Get(names.AttrUsername).(string)) input.Password = aws.String(d.Get(names.AttrPassword).(string)) input.ServerName = aws.String(d.Get("server_name").(string)) input.Port = aws.Int64(int64(d.Get(names.AttrPort).(int))) @@ -2639,7 +2639,7 @@ func expandTopLevelConnectionInfoModify(d *schema.ResourceData, input *dms.Modif } func flattenTopLevelConnectionInfo(d *schema.ResourceData, endpoint *dms.Endpoint) { - d.Set("username", endpoint.Username) + d.Set(names.AttrUsername, endpoint.Username) d.Set("server_name", endpoint.ServerName) d.Set(names.AttrPort, endpoint.Port) d.Set(names.AttrDatabaseName, endpoint.DatabaseName) diff --git a/internal/service/dms/endpoint_data_source.go b/internal/service/dms/endpoint_data_source.go index 7223cbab59b..b1b51bee40b 100644 --- a/internal/service/dms/endpoint_data_source.go +++ b/internal/service/dms/endpoint_data_source.go @@ -561,7 +561,7 @@ func DataSourceEndpoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Computed: true, }, @@ -593,7 +593,7 @@ func dataSourceEndpointRead(ctx context.Context, d *schema.ResourceData, meta in d.Set(names.AttrPort, out.Port) d.Set("server_name", out.ServerName) d.Set("ssl_mode", out.SslMode) - d.Set("username", out.Username) + d.Set(names.AttrUsername, out.Username) if err := resourceEndpointSetState(d, out); err != nil { return sdkdiag.AppendFromErr(diags, err) diff --git a/internal/service/dms/endpoint_test.go b/internal/service/dms/endpoint_test.go index 75c53b97422..a9ff7c90d66 100644 --- a/internal/service/dms/endpoint_test.go +++ b/internal/service/dms/endpoint_test.go @@ -55,7 +55,7 @@ func TestAccDMSEndpoint_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3303"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"), - resource.TestCheckResourceAttr(resourceName, "username", "tftestupdate"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftestupdate"), ), }, }, @@ -141,7 +141,7 @@ func TestAccDMSEndpoint_Aurora_update(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3307"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), @@ -237,7 +237,7 @@ func TestAccDMSEndpoint_AuroraPostgreSQL_update(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "require"), @@ -931,7 +931,7 @@ func TestAccDMSEndpoint_MongoDB_update(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "endpoint_arn"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27017"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), @@ -943,7 +943,7 @@ func TestAccDMSEndpoint_MongoDB_update(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "require"), @@ -1043,7 +1043,7 @@ func TestAccDMSEndpoint_MariaDB_update(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3307"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), @@ -1139,7 +1139,7 @@ func TestAccDMSEndpoint_MySQL_update(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3307"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), @@ -1230,7 +1230,7 @@ func TestAccDMSEndpoint_Oracle_update(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "endpoint_arn"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27017"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), @@ -1243,7 +1243,7 @@ func TestAccDMSEndpoint_Oracle_update(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), @@ -1339,7 +1339,7 @@ func TestAccDMSEndpoint_PostgreSQL_update(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "require"), @@ -1522,7 +1522,7 @@ func TestAccDMSEndpoint_SQLServer_update(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "require"), @@ -1563,7 +1563,7 @@ func TestAccDMSEndpoint_babelfish(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "require"), @@ -1676,7 +1676,7 @@ func TestAccDMSEndpoint_Sybase_update(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "endpoint_arn"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27017"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), @@ -1689,7 +1689,7 @@ func TestAccDMSEndpoint_Sybase_update(t *testing.T) { testAccCheckEndpointExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "server_name", "tftest-new-server_name"), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), @@ -1764,7 +1764,7 @@ func TestAccDMSEndpoint_docDB(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27019"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"), - resource.TestCheckResourceAttr(resourceName, "username", "tftestupdate"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftestupdate"), ), }, }, @@ -1805,7 +1805,7 @@ func TestAccDMSEndpoint_db2_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27019"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"), - resource.TestCheckResourceAttr(resourceName, "username", "tftestupdate"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftestupdate"), ), }, }, @@ -1846,7 +1846,7 @@ func TestAccDMSEndpoint_db2zOS_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27019"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"), - resource.TestCheckResourceAttr(resourceName, "username", "tftestupdate"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftestupdate"), ), }, }, @@ -1887,7 +1887,7 @@ func TestAccDMSEndpoint_azureSQLManagedInstance(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3342"), resource.TestCheckResourceAttr(resourceName, "ssl_mode", "none"), resource.TestCheckResourceAttr(resourceName, "server_name", "tftestupdate"), - resource.TestCheckResourceAttr(resourceName, "username", "tftestupdate"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftestupdate"), ), }, }, @@ -2080,7 +2080,7 @@ func TestAccDMSEndpoint_Redshift_update(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "endpoint_arn"), resource.TestCheckResourceAttr(resourceName, "extra_connection_attributes", ""), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27017"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest"), resource.TestCheckResourceAttr(resourceName, "redshift_settings.#", "1"), resource.TestCheckResourceAttr(resourceName, "redshift_settings.0.bucket_name", ""), @@ -2097,7 +2097,7 @@ func TestAccDMSEndpoint_Redshift_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, "tftest-new-database_name"), resource.TestMatchResourceAttr(resourceName, "extra_connection_attributes", regexache.MustCompile(`acceptanydate=true`)), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "27018"), - resource.TestCheckResourceAttr(resourceName, "username", "tftest-new-username"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tftest-new-username"), resource.TestCheckResourceAttr(resourceName, names.AttrPassword, "tftest-new-password"), resource.TestCheckResourceAttr(resourceName, "redshift_settings.#", "1"), resource.TestCheckResourceAttr(resourceName, "redshift_settings.0.bucket_name", names.AttrBucketName), From 7663e48573c53ced7bde36e3f849a3bd05974c68 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:27 -0400 Subject: [PATCH 1152/1490] events: Use constant for username strings --- internal/service/events/connection.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/events/connection.go b/internal/service/events/connection.go index bc7d9fd2251..273031cb160 100644 --- a/internal/service/events/connection.go +++ b/internal/service/events/connection.go @@ -149,7 +149,7 @@ func resourceConnection() *schema.Resource { validation.StringLenBetween(1, 512), ), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -521,7 +521,7 @@ func expandCreateConnectionBasicAuthRequestParameters(config []interface{}) *typ basicAuthParameters := &types.CreateConnectionBasicAuthRequestParameters{} for _, c := range config { param := c.(map[string]interface{}) - if val, ok := param["username"].(string); ok && val != "" { + if val, ok := param[names.AttrUsername].(string); ok && val != "" { basicAuthParameters.Username = aws.String(val) } if val, ok := param[names.AttrPassword].(string); ok && val != "" { @@ -705,7 +705,7 @@ func flattenConnectionBasicAuthParameters(basicAuthParameters *types.ConnectionB config := make(map[string]interface{}) if basicAuthParameters.Username != nil { - config["username"] = aws.ToString(basicAuthParameters.Username) + config[names.AttrUsername] = aws.ToString(basicAuthParameters.Username) } if v, ok := d.GetOk("auth_parameters.0.basic.0.password"); ok { @@ -852,7 +852,7 @@ func expandUpdateConnectionBasicAuthRequestParameters(config []interface{}) *typ basicAuthParameters := &types.UpdateConnectionBasicAuthRequestParameters{} for _, c := range config { param := c.(map[string]interface{}) - if val, ok := param["username"].(string); ok && val != "" { + if val, ok := param[names.AttrUsername].(string); ok && val != "" { basicAuthParameters.Username = aws.String(val) } if val, ok := param[names.AttrPassword].(string); ok && val != "" { From a360b3e1257ecedd38f321dc98b6616e3e36f2f0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:27 -0400 Subject: [PATCH 1153/1490] firehose: Use constant for username strings --- internal/service/firehose/delivery_stream.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index 9095e42e826..eb6ed244b5b 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -1222,7 +1222,7 @@ func resourceDeliveryStream() *schema.Resource { ValidateDiagFunc: enum.Validate[types.RedshiftS3BackupMode](), }, "s3_configuration": s3ConfigurationSchema(), - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, }, @@ -2373,7 +2373,7 @@ func expandRedshiftDestinationConfiguration(redshift map[string]interface{}) *ty ClusterJDBCURL: aws.String(redshift["cluster_jdbcurl"].(string)), RetryOptions: expandRedshiftRetryOptions(redshift), Password: aws.String(redshift[names.AttrPassword].(string)), - Username: aws.String(redshift["username"].(string)), + Username: aws.String(redshift[names.AttrUsername].(string)), RoleARN: aws.String(roleARN), CopyCommand: expandCopyCommand(redshift), S3Configuration: expandS3DestinationConfiguration(redshift["s3_configuration"].([]interface{})), @@ -2399,7 +2399,7 @@ func expandRedshiftDestinationUpdate(redshift map[string]interface{}) *types.Red ClusterJDBCURL: aws.String(redshift["cluster_jdbcurl"].(string)), RetryOptions: expandRedshiftRetryOptions(redshift), Password: aws.String(redshift[names.AttrPassword].(string)), - Username: aws.String(redshift["username"].(string)), + Username: aws.String(redshift[names.AttrUsername].(string)), RoleARN: aws.String(roleARN), CopyCommand: expandCopyCommand(redshift), } @@ -3387,7 +3387,7 @@ func flattenRedshiftDestinationDescription(description *types.RedshiftDestinatio "s3_backup_configuration": flattenS3DestinationDescription(description.S3BackupDescription), "s3_backup_mode": description.S3BackupMode, "s3_configuration": flattenS3DestinationDescription(description.S3DestinationDescription), - "username": aws.ToString(description.Username), + names.AttrUsername: aws.ToString(description.Username), } if description.CopyCommand != nil { From 0a460e68f70be6437307574d826a232e848d2452 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:27 -0400 Subject: [PATCH 1154/1490] fsx: Use constant for username strings --- internal/service/fsx/ontap_storage_virtual_machine.go | 8 ++++---- .../fsx/ontap_storage_virtual_machine_data_source.go | 2 +- .../service/fsx/ontap_storage_virtual_machine_migrate.go | 2 +- internal/service/fsx/windows_file_system.go | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/fsx/ontap_storage_virtual_machine.go b/internal/service/fsx/ontap_storage_virtual_machine.go index a28ef8eda0f..77c8add0dcd 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine.go +++ b/internal/service/fsx/ontap_storage_virtual_machine.go @@ -106,7 +106,7 @@ func resourceONTAPStorageVirtualMachine() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 256), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 256), @@ -417,7 +417,7 @@ func expandSelfManagedActiveDirectoryConfiguration(cfg []interface{}) *fsx.SelfM out.Password = aws.String(v) } - if v, ok := conf["username"].(string); ok && len(v) > 0 { + if v, ok := conf[names.AttrUsername].(string); ok && len(v) > 0 { out.UserName = aws.String(v) } @@ -473,7 +473,7 @@ func expandSelfManagedActiveDirectoryConfigurationUpdates(cfg []interface{}) *fs out.Password = aws.String(v) } - if v, ok := conf["username"].(string); ok && len(v) > 0 { + if v, ok := conf[names.AttrUsername].(string); ok && len(v) > 0 { out.UserName = aws.String(v) } @@ -518,7 +518,7 @@ func flattenSelfManagedActiveDirectoryAttributes(d *schema.ResourceData, rs *fsx } if rs.UserName != nil { - m["username"] = aws.StringValue(rs.UserName) + m[names.AttrUsername] = aws.StringValue(rs.UserName) } // Since we are in a configuration block and the FSx API does not return 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 9c06ca80a7e..165bb0bd630 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go @@ -56,7 +56,7 @@ func dataSourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/fsx/ontap_storage_virtual_machine_migrate.go b/internal/service/fsx/ontap_storage_virtual_machine_migrate.go index 22a187b5ce3..86d8ddf4679 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_migrate.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_migrate.go @@ -86,7 +86,7 @@ func resourceONTAPStorageVirtualMachineV0() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 256), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 256), diff --git a/internal/service/fsx/windows_file_system.go b/internal/service/fsx/windows_file_system.go index b370c47571e..75109408540 100644 --- a/internal/service/fsx/windows_file_system.go +++ b/internal/service/fsx/windows_file_system.go @@ -240,7 +240,7 @@ func resourceWindowsFileSystem() *schema.Resource { Sensitive: true, ValidateFunc: validation.StringLenBetween(1, 256), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 256), @@ -650,7 +650,7 @@ func expandSelfManagedActiveDirectoryConfigurationCreate(l []interface{}) *fsx.S DomainName: aws.String(data[names.AttrDomainName].(string)), DnsIps: flex.ExpandStringSet(data["dns_ips"].(*schema.Set)), Password: aws.String(data[names.AttrPassword].(string)), - UserName: aws.String(data["username"].(string)), + UserName: aws.String(data[names.AttrUsername].(string)), } if v, ok := data["file_system_administrators_group"]; ok && v.(string) != "" { @@ -680,7 +680,7 @@ func expandSelfManagedActiveDirectoryConfigurationUpdate(l []interface{}) *fsx.S req.Password = aws.String(v) } - if v, ok := data["username"].(string); ok && v != "" { + if v, ok := data[names.AttrUsername].(string); ok && v != "" { req.UserName = aws.String(v) } @@ -704,7 +704,7 @@ func flattenSelfManagedActiveDirectoryConfiguration(d *schema.ResourceData, adop "file_system_administrators_group": aws.StringValue(adopts.FileSystemAdministratorsGroup), "organizational_unit_distinguished_name": aws.StringValue(adopts.OrganizationalUnitDistinguishedName), names.AttrPassword: d.Get("self_managed_active_directory.0.password").(string), - "username": aws.StringValue(adopts.UserName), + names.AttrUsername: aws.StringValue(adopts.UserName), } return []map[string]interface{}{m} From df88f349947775e71014a07d587f1e21b4a76e41 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:28 -0400 Subject: [PATCH 1155/1490] iam: Use constant for username strings --- internal/service/iam/user_ssh_key.go | 12 ++++++------ internal/service/iam/user_ssh_key_data_source.go | 4 ++-- .../service/iam/user_ssh_key_data_source_test.go | 2 +- internal/service/iam/user_ssh_key_test.go | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/iam/user_ssh_key.go b/internal/service/iam/user_ssh_key.go index 16bd4f51c10..cb755920f3b 100644 --- a/internal/service/iam/user_ssh_key.go +++ b/internal/service/iam/user_ssh_key.go @@ -67,7 +67,7 @@ func resourceUserSSHKey() *schema.Resource { Optional: true, Computed: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -80,7 +80,7 @@ func resourceUserSSHKeyCreate(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).IAMClient(ctx) - username := d.Get("username").(string) + username := d.Get(names.AttrUsername).(string) input := &iam.UploadSSHPublicKeyInput{ SSHPublicKeyBody: aws.String(d.Get("public_key").(string)), UserName: aws.String(username), @@ -124,7 +124,7 @@ func resourceUserSSHKeyRead(ctx context.Context, d *schema.ResourceData, meta in conn := meta.(*conns.AWSClient).IAMClient(ctx) encoding := d.Get("encoding").(string) - key, err := findSSHPublicKeyByThreePartKey(ctx, conn, d.Id(), encoding, d.Get("username").(string)) + key, err := findSSHPublicKeyByThreePartKey(ctx, conn, d.Id(), encoding, d.Get(names.AttrUsername).(string)) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] IAM User SSH Key (%s) not found, removing from state", d.Id()) @@ -155,7 +155,7 @@ func resourceUserSSHKeyUpdate(ctx context.Context, d *schema.ResourceData, meta input := &iam.UpdateSSHPublicKeyInput{ SSHPublicKeyId: aws.String(d.Id()), Status: awstypes.StatusType(d.Get(names.AttrStatus).(string)), - UserName: aws.String(d.Get("username").(string)), + UserName: aws.String(d.Get(names.AttrUsername).(string)), } _, err := conn.UpdateSSHPublicKey(ctx, input) @@ -174,7 +174,7 @@ func resourceUserSSHKeyDelete(ctx context.Context, d *schema.ResourceData, meta log.Printf("[DEBUG] Deleting IAM User SSH Key: %s", d.Id()) _, err := conn.DeleteSSHPublicKey(ctx, &iam.DeleteSSHPublicKeyInput{ SSHPublicKeyId: aws.String(d.Id()), - UserName: aws.String(d.Get("username").(string)), + UserName: aws.String(d.Get(names.AttrUsername).(string)), }) if errs.IsA[*awstypes.NoSuchEntityException](err) { @@ -199,7 +199,7 @@ func resourceUserSSHKeyImport(ctx context.Context, d *schema.ResourceData, meta sshPublicKeyId := idParts[1] encoding := idParts[2] - d.Set("username", username) + d.Set(names.AttrUsername, username) d.Set("ssh_public_key_id", sshPublicKeyId) d.Set("encoding", encoding) d.SetId(sshPublicKeyId) diff --git a/internal/service/iam/user_ssh_key_data_source.go b/internal/service/iam/user_ssh_key_data_source.go index e0646bd9a29..4a1804179a8 100644 --- a/internal/service/iam/user_ssh_key_data_source.go +++ b/internal/service/iam/user_ssh_key_data_source.go @@ -43,7 +43,7 @@ func dataSourceUserSSHKey() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, }, @@ -57,7 +57,7 @@ func dataSourceUserSSHKeyRead(ctx context.Context, d *schema.ResourceData, meta encoding := d.Get("encoding").(string) sshPublicKeyId := d.Get("ssh_public_key_id").(string) - username := d.Get("username").(string) + username := d.Get(names.AttrUsername).(string) request := &iam.GetSSHPublicKeyInput{ Encoding: awstypes.EncodingType(encoding), diff --git a/internal/service/iam/user_ssh_key_data_source_test.go b/internal/service/iam/user_ssh_key_data_source_test.go index 7c86da9dc4c..5b68914045a 100644 --- a/internal/service/iam/user_ssh_key_data_source_test.go +++ b/internal/service/iam/user_ssh_key_data_source_test.go @@ -37,7 +37,7 @@ func TestAccIAMUserSSHKeyDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "public_key", resourceName, "public_key"), resource.TestCheckResourceAttrPair(dataSourceName, "ssh_public_key_id", resourceName, "ssh_public_key_id"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrStatus, resourceName, names.AttrStatus), - resource.TestCheckResourceAttrPair(dataSourceName, "username", resourceName, "username"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUsername, resourceName, names.AttrUsername), ), }, }, diff --git a/internal/service/iam/user_ssh_key_test.go b/internal/service/iam/user_ssh_key_test.go index 8eecf481822..17a5ed5c946 100644 --- a/internal/service/iam/user_ssh_key_test.go +++ b/internal/service/iam/user_ssh_key_test.go @@ -120,7 +120,7 @@ func testAccCheckUserSSHKeyDestroy(ctx context.Context) resource.TestCheckFunc { continue } - _, err := tfiam.FindSSHPublicKeyByThreePartKey(ctx, conn, rs.Primary.ID, rs.Primary.Attributes["encoding"], rs.Primary.Attributes["username"]) + _, err := tfiam.FindSSHPublicKeyByThreePartKey(ctx, conn, rs.Primary.ID, rs.Primary.Attributes["encoding"], rs.Primary.Attributes[names.AttrUsername]) if tfresource.NotFound(err) { continue @@ -150,7 +150,7 @@ func testAccCheckUserSSHKeyExists(ctx context.Context, n string, v *awstypes.SSH conn := acctest.Provider.Meta().(*conns.AWSClient).IAMClient(ctx) - output, err := tfiam.FindSSHPublicKeyByThreePartKey(ctx, conn, rs.Primary.ID, rs.Primary.Attributes["encoding"], rs.Primary.Attributes["username"]) + output, err := tfiam.FindSSHPublicKeyByThreePartKey(ctx, conn, rs.Primary.ID, rs.Primary.Attributes["encoding"], rs.Primary.Attributes[names.AttrUsername]) if err != nil { return err @@ -169,7 +169,7 @@ func testAccUserSSHKeyImportStateIdFunc(resourceName string) resource.ImportStat return "", fmt.Errorf("not found: %s", resourceName) } - username := rs.Primary.Attributes["username"] + username := rs.Primary.Attributes[names.AttrUsername] sshPublicKeyId := rs.Primary.Attributes["ssh_public_key_id"] encoding := rs.Primary.Attributes["encoding"] From ce0ed725d7aaaaa90d708469c949888bcaee6ac7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:28 -0400 Subject: [PATCH 1156/1490] kendra: Use constant for username strings --- internal/service/kendra/index_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/kendra/index_test.go b/internal/service/kendra/index_test.go index 011155f684c..98e3dc49a3f 100644 --- a/internal/service/kendra/index_test.go +++ b/internal/service/kendra/index_test.go @@ -257,7 +257,7 @@ func TestAccKendraIndex_updateUserTokenJSON(t *testing.T) { rName2 := sdkacctest.RandomWithPrefix("resource-test-terraform") rName3 := sdkacctest.RandomWithPrefix("resource-test-terraform") originalGroupAttributeField := "groups" - originalUserNameAttributeField := "username" + originalUserNameAttributeField := names.AttrUsername updatedGroupAttributeField := "groupings" updatedUserNameAttributeField := "usernames" resourceName := "aws_kendra_index.test" @@ -269,13 +269,13 @@ func TestAccKendraIndex_updateUserTokenJSON(t *testing.T) { CheckDestroy: testAccCheckIndexDestroy(ctx), Steps: []resource.TestStep{ { - Config: testAccIndexConfig_userTokenJSON(rName, rName2, rName3, originalGroupAttributeField, originalUserNameAttributeField), + Config: testAccIndexConfig_userTokenJSON(rName, rName2, rName3, originalGroupAttributeField, names.AttrUsername), Check: resource.ComposeTestCheckFunc( testAccCheckIndexExists(ctx, resourceName, &index), resource.TestCheckResourceAttr(resourceName, "user_token_configurations.#", "1"), resource.TestCheckResourceAttr(resourceName, "user_token_configurations.0.json_token_type_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "user_token_configurations.0.json_token_type_configuration.0.group_attribute_field", originalGroupAttributeField), - resource.TestCheckResourceAttr(resourceName, "user_token_configurations.0.json_token_type_configuration.0.user_name_attribute_field", originalUserNameAttributeField), + resource.TestCheckResourceAttr(resourceName, "user_token_configurations.0.json_token_type_configuration.0.user_name_attribute_field", names.AttrUsername), ), }, { @@ -284,13 +284,13 @@ func TestAccKendraIndex_updateUserTokenJSON(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccIndexConfig_userTokenJSON(rName, rName2, rName3, updatedGroupAttributeField, originalUserNameAttributeField), + Config: testAccIndexConfig_userTokenJSON(rName, rName2, rName3, updatedGroupAttributeField, names.AttrUsername), Check: resource.ComposeTestCheckFunc( testAccCheckIndexExists(ctx, resourceName, &index), resource.TestCheckResourceAttr(resourceName, "user_token_configurations.#", "1"), resource.TestCheckResourceAttr(resourceName, "user_token_configurations.0.json_token_type_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "user_token_configurations.0.json_token_type_configuration.0.group_attribute_field", updatedGroupAttributeField), - resource.TestCheckResourceAttr(resourceName, "user_token_configurations.0.json_token_type_configuration.0.user_name_attribute_field", originalUserNameAttributeField), + resource.TestCheckResourceAttr(resourceName, "user_token_configurations.0.json_token_type_configuration.0.user_name_attribute_field", names.AttrUsername), ), }, { From f7647efedc69a84f559ab741381cb4a9624d60bb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:28 -0400 Subject: [PATCH 1157/1490] lightsail: Use constant for username strings --- internal/service/lightsail/instance.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/lightsail/instance.go b/internal/service/lightsail/instance.go index f013a9311f9..90e19433512 100644 --- a/internal/service/lightsail/instance.go +++ b/internal/service/lightsail/instance.go @@ -151,7 +151,7 @@ func ResourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Computed: true, }, @@ -260,7 +260,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte // additional attributes d.Set(names.AttrARN, out.Arn) - d.Set("username", out.Username) + d.Set(names.AttrUsername, out.Username) d.Set(names.AttrCreatedAt, out.CreatedAt.Format(time.RFC3339)) d.Set("cpu_count", out.Hardware.CpuCount) d.Set("ram_size", out.Hardware.RamSizeInGb) From c525e845a390c6ce4ed0eb3386e106f2ca7f17e0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:28 -0400 Subject: [PATCH 1158/1490] medialive: Use constant for username strings --- internal/service/medialive/channel.go | 12 ++++++------ .../medialive/channel_encoder_settings_schema.go | 8 ++++---- internal/service/medialive/input.go | 6 +++--- internal/service/medialive/schemas.go | 3 ++- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/internal/service/medialive/channel.go b/internal/service/medialive/channel.go index e061b9f34d7..e2bc56a8d91 100644 --- a/internal/service/medialive/channel.go +++ b/internal/service/medialive/channel.go @@ -134,7 +134,7 @@ func ResourceChannel() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Optional: true, }, @@ -2262,7 +2262,7 @@ func expandChannelDestinationsSettings(tfList []interface{}) []types.OutputDesti if v, ok := m[names.AttrURL].(string); ok { s.Url = aws.String(v) } - if v, ok := m["username"].(string); ok { + if v, ok := m[names.AttrUsername].(string); ok { s.Username = aws.String(v) } @@ -2330,10 +2330,10 @@ func flattenChannelDestinationsSettings(apiObject []types.OutputDestinationSetti var tfList []interface{} for _, v := range apiObject { m := map[string]interface{}{ - "password_param": aws.ToString(v.PasswordParam), - "stream_name": aws.ToString(v.StreamName), - names.AttrURL: aws.ToString(v.Url), - "username": aws.ToString(v.Username), + "password_param": aws.ToString(v.PasswordParam), + "stream_name": aws.ToString(v.StreamName), + names.AttrURL: aws.ToString(v.Url), + names.AttrUsername: aws.ToString(v.Username), } tfList = append(tfList, m) diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index c2af2bb1603..f93eb02358e 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -4100,7 +4100,7 @@ func expandInputLocation(tfList []interface{}) *types.InputLocation { if v, ok := m["password_param"].(string); ok && v != "" { out.PasswordParam = aws.String(v) } - if v, ok := m["username"].(string); ok && v != "" { + if v, ok := m[names.AttrUsername].(string); ok && v != "" { out.Username = aws.String(v) } @@ -6522,9 +6522,9 @@ func flattenInputLocation(in *types.InputLocation) []interface{} { } m := map[string]interface{}{ - "uri": aws.ToString(in.Uri), - "password_param": aws.ToString(in.PasswordParam), - "username": aws.ToString(in.Username), + "uri": aws.ToString(in.Uri), + "password_param": aws.ToString(in.PasswordParam), + names.AttrUsername: aws.ToString(in.Username), } return []interface{}{m} diff --git a/internal/service/medialive/input.go b/internal/service/medialive/input.go index 04eb22627ca..7ed49161164 100644 --- a/internal/service/medialive/input.go +++ b/internal/service/medialive/input.go @@ -138,7 +138,7 @@ func ResourceInput() *schema.Resource { Type: schema.TypeString, Required: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, }, @@ -547,7 +547,7 @@ func flattenSource(apiObject types.InputSource) map[string]interface{} { m["password_param"] = aws.ToString(v) } if v := apiObject.Username; v != nil { - m["username"] = aws.ToString(v) + m[names.AttrUsername] = aws.ToString(v) } return m } @@ -685,7 +685,7 @@ func expandSources(tfList []interface{}) []types.InputSourceRequest { if val, ok := m[names.AttrURL]; ok { id.Url = aws.String(val.(string)) } - if val, ok := m["username"]; ok { + if val, ok := m[names.AttrUsername]; ok { id.Username = aws.String(val.(string)) } s = append(s, id) diff --git a/internal/service/medialive/schemas.go b/internal/service/medialive/schemas.go index c6d6fc91cf5..08bf3a839ac 100644 --- a/internal/service/medialive/schemas.go +++ b/internal/service/medialive/schemas.go @@ -5,6 +5,7 @@ package medialive import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-aws/names" ) func destinationSchema() *schema.Schema { @@ -67,7 +68,7 @@ func inputLocationSchema() *schema.Schema { Optional: true, Computed: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Optional: true, Computed: true, From 6496dfeda0b3684220d335c3a2f1fa83d44a74ac Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:29 -0400 Subject: [PATCH 1159/1490] mediapackage: Use constant for username strings --- internal/service/mediapackage/channel.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/mediapackage/channel.go b/internal/service/mediapackage/channel.go index 39a050180c9..961d1f04380 100644 --- a/internal/service/mediapackage/channel.go +++ b/internal/service/mediapackage/channel.go @@ -72,7 +72,7 @@ func ResourceChannel() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Computed: true, }, @@ -208,7 +208,7 @@ func flattenHLSIngest(h *types.HlsIngest) []map[string]interface{} { endpoint := map[string]interface{}{ names.AttrPassword: aws.ToString(e.Password), names.AttrURL: aws.ToString(e.Url), - "username": aws.ToString(e.Username), + names.AttrUsername: aws.ToString(e.Username), } ingestEndpoints = append(ingestEndpoints, endpoint) From 0f1b95e36c53ad85ee8d9e0cd3f17e804b8bbbbb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:29 -0400 Subject: [PATCH 1160/1490] mq: Use constant for username strings --- internal/service/mq/broker.go | 14 ++++----- internal/service/mq/broker_data_source.go | 2 +- internal/service/mq/broker_test.go | 36 +++++++++++------------ 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/internal/service/mq/broker.go b/internal/service/mq/broker.go index 20aea32d985..6bc5d983ae2 100644 --- a/internal/service/mq/broker.go +++ b/internal/service/mq/broker.go @@ -363,7 +363,7 @@ func resourceBroker() *schema.Resource { Optional: true, Default: false, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(2, 100), @@ -800,7 +800,7 @@ func resourceUserHash(v interface{}) int { if p, ok := m[names.AttrPassword]; ok { buf.WriteString(fmt.Sprintf("%s-", p.(string))) } - buf.WriteString(fmt.Sprintf("%s-", m["username"].(string))) + buf.WriteString(fmt.Sprintf("%s-", m[names.AttrUsername].(string))) return create.StringHashcode(buf.String()) } @@ -843,7 +843,7 @@ func DiffBrokerUsers(bId string, oldUsers, newUsers []interface{}) (cr []*mq.Cre existingUsers := make(map[string]interface{}) for _, ou := range oldUsers { u := ou.(map[string]interface{}) - username := u["username"].(string) + username := u[names.AttrUsername].(string) // Convert Set to slice to allow easier comparison if g, ok := u["groups"]; ok { groups := g.(*schema.Set).List() @@ -866,7 +866,7 @@ func DiffBrokerUsers(bId string, oldUsers, newUsers []interface{}) (cr []*mq.Cre } newUserMap := newUser.(map[string]interface{}) - username := newUserMap["username"].(string) + username := newUserMap[names.AttrUsername].(string) // Convert Set to slice to allow easier comparison var ng []interface{} @@ -977,7 +977,7 @@ func expandUsers(cfg []interface{}) []types.User { for i, m := range cfg { u := m.(map[string]interface{}) user := types.User{ - Username: aws.String(u["username"].(string)), + Username: aws.String(u[names.AttrUsername].(string)), Password: aws.String(u[names.AttrPassword].(string)), } if v, ok := u["console_access"]; ok { @@ -1025,14 +1025,14 @@ func flattenUsers(users []*types.User, cfgUsers []interface{}) *schema.Set { existingPairs := make(map[string]string) for _, u := range cfgUsers { user := u.(map[string]interface{}) - username := user["username"].(string) + username := user[names.AttrUsername].(string) existingPairs[username] = user[names.AttrPassword].(string) } out := make([]interface{}, 0) for _, u := range users { m := map[string]interface{}{ - "username": aws.ToString(u.Username), + names.AttrUsername: aws.ToString(u.Username), } password := "" if p, ok := existingPairs[aws.ToString(u.Username)]; ok { diff --git a/internal/service/mq/broker_data_source.go b/internal/service/mq/broker_data_source.go index 99c5e2604cf..ff9204ea87a 100644 --- a/internal/service/mq/broker_data_source.go +++ b/internal/service/mq/broker_data_source.go @@ -245,7 +245,7 @@ func dataSourceBroker() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/mq/broker_test.go b/internal/service/mq/broker_test.go index e978628b076..4e3705ecb02 100644 --- a/internal/service/mq/broker_test.go +++ b/internal/service/mq/broker_test.go @@ -126,7 +126,7 @@ func TestDiffUsers(t *testing.T) { NewUsers: []interface{}{ map[string]interface{}{ "console_access": false, - "username": "second", + names.AttrUsername: "second", names.AttrPassword: "TestTest2222", "groups": schema.NewSet(schema.HashString, []interface{}{"admin"}), "replication_user": false, @@ -149,7 +149,7 @@ func TestDiffUsers(t *testing.T) { OldUsers: []interface{}{ map[string]interface{}{ "console_access": true, - "username": "first", + names.AttrUsername: "first", names.AttrPassword: "TestTest1111", "replication_user": false, }, @@ -157,7 +157,7 @@ func TestDiffUsers(t *testing.T) { NewUsers: []interface{}{ map[string]interface{}{ "console_access": false, - "username": "second", + names.AttrUsername: "second", names.AttrPassword: "TestTest2222", "replication_user": false, }, @@ -180,13 +180,13 @@ func TestDiffUsers(t *testing.T) { OldUsers: []interface{}{ map[string]interface{}{ "console_access": true, - "username": "first", + names.AttrUsername: "first", names.AttrPassword: "TestTest1111updated", "replication_user": false, }, map[string]interface{}{ "console_access": false, - "username": "second", + names.AttrUsername: "second", names.AttrPassword: "TestTest2222", "replication_user": false, }, @@ -194,7 +194,7 @@ func TestDiffUsers(t *testing.T) { NewUsers: []interface{}{ map[string]interface{}{ "console_access": false, - "username": "second", + names.AttrUsername: "second", names.AttrPassword: "TestTest2222", "groups": schema.NewSet(schema.HashString, []interface{}{"admin"}), "replication_user": false, @@ -310,7 +310,7 @@ func TestAccMQBroker_basic(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "false", "groups.#": "0", - "username": "Test", + names.AttrUsername: "Test", names.AttrPassword: "TestTest1234", }), ), @@ -462,7 +462,7 @@ func TestAccMQBroker_throughputOptimized(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "false", "groups.#": "0", - "username": "Test", + names.AttrUsername: "Test", names.AttrPassword: "TestTest1234", }), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "mq", regexache.MustCompile(`broker:+.`)), @@ -544,7 +544,7 @@ func TestAccMQBroker_AllFields_defaultVPC(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "true", "groups.#": "3", - "username": "SecondTest", + names.AttrUsername: "SecondTest", names.AttrPassword: "SecondTestTest1234", }), resource.TestCheckTypeSetElemAttr(resourceName, "user.*.groups.*", "first"), @@ -553,7 +553,7 @@ func TestAccMQBroker_AllFields_defaultVPC(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "false", "groups.#": "0", - "username": "Test", + names.AttrUsername: "Test", names.AttrPassword: "TestTest1234", }), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "mq", regexache.MustCompile(`broker:+.`)), @@ -673,7 +673,7 @@ func TestAccMQBroker_AllFields_customVPC(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "true", "groups.#": "3", - "username": "SecondTest", + names.AttrUsername: "SecondTest", names.AttrPassword: "SecondTestTest1234", }), resource.TestCheckTypeSetElemAttr(resourceName, "user.*.groups.*", "first"), @@ -682,7 +682,7 @@ func TestAccMQBroker_AllFields_customVPC(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "false", "groups.#": "0", - "username": "Test", + names.AttrUsername: "Test", names.AttrPassword: "TestTest1234", }), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "mq", regexache.MustCompile(`broker:+.`)), @@ -889,7 +889,7 @@ func TestAccMQBroker_Update_users(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "false", "groups.#": "0", - "username": "first", + names.AttrUsername: "first", names.AttrPassword: "TestTest1111", }), ), @@ -909,13 +909,13 @@ func TestAccMQBroker_Update_users(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "false", "groups.#": "0", - "username": "second", + names.AttrUsername: "second", names.AttrPassword: "TestTest2222", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "true", "groups.#": "0", - "username": "first", + names.AttrUsername: "first", names.AttrPassword: "TestTest1111updated", }), ), @@ -929,7 +929,7 @@ func TestAccMQBroker_Update_users(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "false", "groups.#": "1", - "username": "second", + names.AttrUsername: "second", names.AttrPassword: "TestTest2222", }), resource.TestCheckTypeSetElemAttr(resourceName, "user.*.groups.*", "admin"), @@ -988,7 +988,7 @@ func TestAccMQBroker_Update_securityGroup(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "security_groups.#", "1"), resource.TestCheckResourceAttr(resourceName, "user.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ - "username": "Test", + names.AttrUsername: "Test", names.AttrPassword: "TestTest9999", }), ), @@ -1305,7 +1305,7 @@ func TestAccMQBroker_RabbitMQ_cluster(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "user.*", map[string]string{ "console_access": "false", "groups.#": "0", - "username": "Test", + names.AttrUsername: "Test", names.AttrPassword: "TestTest1234", }), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "mq", regexache.MustCompile(`broker:+.`)), From 0b756090356cb91d8c1216a0efd4405713dcf2c8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:29 -0400 Subject: [PATCH 1161/1490] opsworks: Use constant for username strings --- internal/service/opsworks/application.go | 4 ++-- internal/service/opsworks/ganglia_layer.go | 2 +- internal/service/opsworks/ganglia_layer_test.go | 2 +- internal/service/opsworks/stack.go | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/opsworks/application.go b/internal/service/opsworks/application.go index b761684e15f..cca1cb1f873 100644 --- a/internal/service/opsworks/application.go +++ b/internal/service/opsworks/application.go @@ -91,7 +91,7 @@ func ResourceApplication() *schema.Resource { Optional: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Optional: true, }, @@ -477,7 +477,7 @@ func resourceSetApplicationSource(d *schema.ResourceData, v *opsworks.Source) er m[names.AttrURL] = aws.StringValue(v.Url) } if v.Username != nil { - m["username"] = aws.StringValue(v.Username) + m[names.AttrUsername] = aws.StringValue(v.Username) } if v.Revision != nil { m["revision"] = aws.StringValue(v.Revision) diff --git a/internal/service/opsworks/ganglia_layer.go b/internal/service/opsworks/ganglia_layer.go index 8631f77634e..80b3bf70bde 100644 --- a/internal/service/opsworks/ganglia_layer.go +++ b/internal/service/opsworks/ganglia_layer.go @@ -28,7 +28,7 @@ func ResourceGangliaLayer() *schema.Resource { Type: schema.TypeString, Default: "/ganglia", }, - "username": { + names.AttrUsername: { AttrName: opsworks.LayerAttributesKeysGangliaUser, Type: schema.TypeString, Default: "opsworks", diff --git a/internal/service/opsworks/ganglia_layer_test.go b/internal/service/opsworks/ganglia_layer_test.go index a3552d42fad..4bfa30c8d67 100644 --- a/internal/service/opsworks/ganglia_layer_test.go +++ b/internal/service/opsworks/ganglia_layer_test.go @@ -34,7 +34,7 @@ func TestAccOpsWorksGangliaLayer_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrName, "Ganglia"), resource.TestCheckResourceAttrSet(resourceName, names.AttrPassword), resource.TestCheckResourceAttr(resourceName, names.AttrURL, "/ganglia"), - resource.TestCheckResourceAttr(resourceName, "username", "opsworks"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "opsworks"), ), }, }, diff --git a/internal/service/opsworks/stack.go b/internal/service/opsworks/stack.go index 54f3ff7ee7d..3742316a90a 100644 --- a/internal/service/opsworks/stack.go +++ b/internal/service/opsworks/stack.go @@ -106,7 +106,7 @@ func ResourceStack() *schema.Resource { Type: schema.TypeString, Required: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Optional: true, }, @@ -625,7 +625,7 @@ func expandSource(tfMap map[string]interface{}) *opsworks.Source { apiObject.Url = aws.String(v) } - if v, ok := tfMap["username"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrUsername].(string); ok && v != "" { apiObject.Username = aws.String(v) } @@ -660,7 +660,7 @@ func flattenSource(apiObject *opsworks.Source) map[string]interface{} { } if v := apiObject.Username; v != nil { - tfMap["username"] = aws.StringValue(v) + tfMap[names.AttrUsername] = aws.StringValue(v) } return tfMap From 13f03ba95d47086d8f19c800cefbb1606e314d4d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:30 -0400 Subject: [PATCH 1162/1490] quicksight: Use constant for username strings --- internal/service/quicksight/data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/quicksight/data_source.go b/internal/service/quicksight/data_source.go index 078d34fec47..0119895b9b9 100644 --- a/internal/service/quicksight/data_source.go +++ b/internal/service/quicksight/data_source.go @@ -76,7 +76,7 @@ func ResourceDataSource() *schema.Resource { ), Sensitive: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -864,7 +864,7 @@ func expandDataSourceCredentialPair(tfList []interface{}) *quicksight.Credential return nil } - if v, ok := tfMap["username"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrUsername].(string); ok && v != "" { credentialPair.Username = aws.String(v) } From 0c895f9d02108071afb241275d3ececd4810a75a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:30 -0400 Subject: [PATCH 1163/1490] rds: Use constant for username strings --- internal/service/rds/instance.go | 12 ++++++------ internal/service/rds/instance_data_source_test.go | 6 +++--- internal/service/rds/instance_migrate.go | 4 ++-- internal/service/rds/instance_migrate_test.go | 8 ++++---- internal/service/rds/instance_test.go | 10 +++++----- internal/service/rds/proxy.go | 8 ++++---- internal/service/rds/proxy_data_source.go | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go index e4d124e48e6..045d3ced571 100644 --- a/internal/service/rds/instance.go +++ b/internal/service/rds/instance.go @@ -657,7 +657,7 @@ func ResourceInstance() *schema.Resource { "s3_import", }, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Optional: true, Computed: true, @@ -948,7 +948,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in if _, ok := d.GetOk("engine"); !ok { diags = sdkdiag.AppendErrorf(diags, `"engine": required field is not set`) } - if _, ok := d.GetOk("username"); !ok { + if _, ok := d.GetOk(names.AttrUsername); !ok { diags = sdkdiag.AppendErrorf(diags, `"username": required field is not set`) } if diags.HasError() { @@ -967,7 +967,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), Engine: aws.String(d.Get("engine").(string)), EngineVersion: aws.String(d.Get(names.AttrEngineVersion).(string)), - MasterUsername: aws.String(d.Get("username").(string)), + MasterUsername: aws.String(d.Get(names.AttrUsername).(string)), PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), S3BucketName: aws.String(tfMap[names.AttrBucketName].(string)), S3IngestionRoleArn: aws.String(tfMap["ingestion_role"].(string)), @@ -1554,7 +1554,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in if _, ok := d.GetOk("engine"); !ok { diags = sdkdiag.AppendErrorf(diags, `"engine": required field is not set`) } - if _, ok := d.GetOk("username"); !ok { + if _, ok := d.GetOk(names.AttrUsername); !ok { diags = sdkdiag.AppendErrorf(diags, `"username": required field is not set`) } if diags.HasError() { @@ -1572,7 +1572,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), Engine: aws.String(d.Get("engine").(string)), EngineVersion: aws.String(d.Get(names.AttrEngineVersion).(string)), - MasterUsername: aws.String(d.Get("username").(string)), + MasterUsername: aws.String(d.Get(names.AttrUsername).(string)), PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), StorageEncrypted: aws.Bool(d.Get("storage_encrypted").(bool)), Tags: getTagsIn(ctx), @@ -1927,7 +1927,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("storage_throughput", v.StorageThroughput) d.Set("storage_type", v.StorageType) d.Set("timezone", v.Timezone) - d.Set("username", v.MasterUsername) + d.Set(names.AttrUsername, v.MasterUsername) var vpcSecurityGroupIDs []string for _, v := range v.VpcSecurityGroups { vpcSecurityGroupIDs = append(vpcSecurityGroupIDs, aws.StringValue(v.VpcSecurityGroupId)) diff --git a/internal/service/rds/instance_data_source_test.go b/internal/service/rds/instance_data_source_test.go index 79cae0788ab..69cb0a876ba 100644 --- a/internal/service/rds/instance_data_source_test.go +++ b/internal/service/rds/instance_data_source_test.go @@ -43,7 +43,7 @@ func TestAccRDSInstanceDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, "iops", resourceName, "iops"), - resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, "username"), + resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, names.AttrUsername), resource.TestCheckResourceAttrPair(dataSourceName, "max_allocated_storage", resourceName, "max_allocated_storage"), resource.TestCheckResourceAttrPair(dataSourceName, "multi_az", resourceName, "multi_az"), resource.TestCheckResourceAttrPair(dataSourceName, "network_type", resourceName, "network_type"), @@ -87,7 +87,7 @@ func TestAccRDSInstanceDataSource_ManagedMasterPassword_managed(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, "iops", resourceName, "iops"), - resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, "username"), + resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, names.AttrUsername), resource.TestCheckResourceAttrPair(dataSourceName, "master_user_secret.0.kms_key_id", resourceName, "master_user_secret.0.kms_key_id"), resource.TestCheckResourceAttrPair(dataSourceName, "master_user_secret.0.secret_arn", resourceName, "master_user_secret.0.secret_arn"), resource.TestCheckResourceAttrPair(dataSourceName, "master_user_secret.0.secret_status", resourceName, "master_user_secret.0.secret_status"), @@ -134,7 +134,7 @@ func TestAccRDSInstanceDataSource_tags(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrHostedZoneID, resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttrPair(dataSourceName, "iops", resourceName, "iops"), - resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, "username"), + resource.TestCheckResourceAttrPair(dataSourceName, "master_username", resourceName, names.AttrUsername), resource.TestCheckResourceAttrPair(dataSourceName, "max_allocated_storage", resourceName, "max_allocated_storage"), resource.TestCheckResourceAttrPair(dataSourceName, "multi_az", resourceName, "multi_az"), resource.TestCheckResourceAttrPair(dataSourceName, "network_type", resourceName, "network_type"), diff --git a/internal/service/rds/instance_migrate.go b/internal/service/rds/instance_migrate.go index 66de32a526a..660ba8891f0 100644 --- a/internal/service/rds/instance_migrate.go +++ b/internal/service/rds/instance_migrate.go @@ -33,7 +33,7 @@ func resourceInstanceResourceV0() *schema.Resource { Computed: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Optional: true, Computed: true, @@ -910,7 +910,7 @@ func resourceInstanceResourceV1() *schema.Resource { Computed: true, ForceNew: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/internal/service/rds/instance_migrate_test.go b/internal/service/rds/instance_migrate_test.go index cb5ad1e0cf9..7a519f1dac9 100644 --- a/internal/service/rds/instance_migrate_test.go +++ b/internal/service/rds/instance_migrate_test.go @@ -34,7 +34,7 @@ func TestInstanceStateUpgradeV0(t *testing.T) { "identifier": "my-test-instance", "instance_class": "db.t2.micro", names.AttrPassword: "avoid-plaintext-passwords", - "username": "tfacctest", + names.AttrUsername: "tfacctest", names.AttrTags: map[string]interface{}{"key1": "value1"}, }, ExpectedState: map[string]interface{}{ @@ -44,7 +44,7 @@ func TestInstanceStateUpgradeV0(t *testing.T) { "identifier": "my-test-instance", "instance_class": "db.t2.micro", names.AttrPassword: "avoid-plaintext-passwords", - "username": "tfacctest", + names.AttrUsername: "tfacctest", names.AttrTags: map[string]interface{}{"key1": "value1"}, }, }, @@ -92,7 +92,7 @@ func TestInstanceStateUpgradeV1(t *testing.T) { names.AttrPassword: "avoid-plaintext-passwords", "resource_id": "db-cnuap2ilnbmok4eunzklfvwjca", names.AttrTags: map[string]interface{}{"key1": "value1"}, - "username": "tfacctest", + names.AttrUsername: "tfacctest", }, ExpectedState: map[string]interface{}{ "allocated_storage": 10, @@ -103,7 +103,7 @@ func TestInstanceStateUpgradeV1(t *testing.T) { names.AttrPassword: "avoid-plaintext-passwords", "resource_id": "db-cnuap2ilnbmok4eunzklfvwjca", names.AttrTags: map[string]interface{}{"key1": "value1"}, - "username": "tfacctest", + names.AttrUsername: "tfacctest", }, }, } diff --git a/internal/service/rds/instance_test.go b/internal/service/rds/instance_test.go index 66a4bac8498..e986933aeef 100644 --- a/internal/service/rds/instance_test.go +++ b/internal/service/rds/instance_test.go @@ -93,7 +93,7 @@ func TestAccRDSInstance_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "storage_throughput", "0"), resource.TestCheckResourceAttr(resourceName, "storage_type", "gp2"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "username", "tfacctest"), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, "tfacctest"), ), }, { @@ -1045,7 +1045,7 @@ func TestAccRDSInstance_ReplicateSourceDB_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, "identifier"), resource.TestCheckResourceAttrPair(resourceName, "db_name", sourceResourceName, "db_name"), resource.TestCheckResourceAttr(resourceName, "dedicated_log_volume", "false"), - resource.TestCheckResourceAttrPair(resourceName, "username", sourceResourceName, "username"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrUsername, sourceResourceName, names.AttrUsername), resource.TestCheckResourceAttr(sourceResourceName, "replicas.#", "0"), // Before refreshing source, it will not be aware of replicas ), @@ -1074,7 +1074,7 @@ func TestAccRDSInstance_ReplicateSourceDB_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "identifier", rName), resource.TestCheckResourceAttr(resourceName, "replicate_source_db", ""), resource.TestCheckResourceAttrPair(resourceName, "db_name", sourceResourceName, "db_name"), - resource.TestCheckResourceAttrPair(resourceName, "username", sourceResourceName, "username"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrUsername, sourceResourceName, names.AttrUsername), ), }, { @@ -2382,7 +2382,7 @@ func TestAccRDSInstance_SnapshotIdentifier_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "allocated_storage", sourceDbResourceName, "allocated_storage"), resource.TestCheckResourceAttrPair(resourceName, "engine", sourceDbResourceName, "engine"), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, sourceDbResourceName, names.AttrEngineVersion), - resource.TestCheckResourceAttrPair(resourceName, "username", sourceDbResourceName, "username"), + 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"), @@ -2554,7 +2554,7 @@ func TestAccRDSInstance_SnapshotIdentifier_AssociationRemoved(t *testing.T) { testAccCheckDBInstanceNotRecreated(&dbInstance1, &dbInstance2), resource.TestCheckResourceAttrPair(resourceName, "allocated_storage", sourceDbResourceName, "allocated_storage"), resource.TestCheckResourceAttrPair(resourceName, "engine", sourceDbResourceName, "engine"), - resource.TestCheckResourceAttrPair(resourceName, "username", sourceDbResourceName, "username"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrUsername, sourceDbResourceName, names.AttrUsername), ), }, }, diff --git a/internal/service/rds/proxy.go b/internal/service/rds/proxy.go index 95832131a9a..cccb84529d9 100644 --- a/internal/service/rds/proxy.go +++ b/internal/service/rds/proxy.go @@ -81,13 +81,13 @@ func resourceProxy() *schema.Resource { Optional: true, ValidateFunc: verify.ValidARN, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Optional: true, }, }, }, - Set: sdkv2.SimpleSchemaSetFunc("auth_scheme", names.AttrDescription, "iam_auth", "secret_arn", "username"), + Set: sdkv2.SimpleSchemaSetFunc("auth_scheme", names.AttrDescription, "iam_auth", "secret_arn", names.AttrUsername), }, "debug_logging": { Type: schema.TypeBool, @@ -443,7 +443,7 @@ func expandUserAuthConfigs(tfList []interface{}) []types.UserAuthConfig { apiObject.SecretArn = aws.String(v) } - if v, ok := tfMap["username"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrUsername].(string); ok && v != "" { apiObject.UserName = aws.String(v) } @@ -469,7 +469,7 @@ func flattenUserAuthConfigInfo(apiObject types.UserAuthConfigInfo) map[string]in } if v := apiObject.UserName; v != nil { - tfMap["username"] = aws.ToString(v) + tfMap[names.AttrUsername] = aws.ToString(v) } return tfMap diff --git a/internal/service/rds/proxy_data_source.go b/internal/service/rds/proxy_data_source.go index 4f0dc9cb216..80a414cd8b9 100644 --- a/internal/service/rds/proxy_data_source.go +++ b/internal/service/rds/proxy_data_source.go @@ -48,7 +48,7 @@ func dataSourceProxy() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Computed: true, }, From 9823f90cd9b249e812dc0da6a5e8514f27c0fdb4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:26:30 -0400 Subject: [PATCH 1164/1490] storagegateway: Use constant for username strings --- .../service/storagegateway/file_system_association.go | 6 +++--- .../storagegateway/file_system_association_test.go | 10 +++++----- internal/service/storagegateway/gateway.go | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/storagegateway/file_system_association.go b/internal/service/storagegateway/file_system_association.go index 4f8af433ba4..ca1bada06d4 100644 --- a/internal/service/storagegateway/file_system_association.go +++ b/internal/service/storagegateway/file_system_association.go @@ -88,7 +88,7 @@ func ResourceFileSystemAssociation() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -111,7 +111,7 @@ func resourceFileSystemAssociationCreate(ctx context.Context, d *schema.Resource LocationARN: aws.String(d.Get("location_arn").(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), Tags: getTagsIn(ctx), - UserName: aws.String(d.Get("username").(string)), + UserName: aws.String(d.Get(names.AttrUsername).(string)), } if v, ok := d.GetOk("audit_destination_arn"); ok { @@ -175,7 +175,7 @@ func resourceFileSystemAssociationUpdate(ctx context.Context, d *schema.Resource input := &storagegateway.UpdateFileSystemAssociationInput{ AuditDestinationARN: aws.String(d.Get("audit_destination_arn").(string)), Password: aws.String(d.Get(names.AttrPassword).(string)), - UserName: aws.String(d.Get("username").(string)), + UserName: aws.String(d.Get(names.AttrUsername).(string)), FileSystemAssociationARN: aws.String(d.Id()), } diff --git a/internal/service/storagegateway/file_system_association_test.go b/internal/service/storagegateway/file_system_association_test.go index 1b5016a983d..c83ef34468d 100644 --- a/internal/service/storagegateway/file_system_association_test.go +++ b/internal/service/storagegateway/file_system_association_test.go @@ -44,7 +44,7 @@ func TestAccStorageGatewayFileSystemAssociation_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "storagegateway", regexache.MustCompile(`fs-association/fsa-.+`)), resource.TestCheckResourceAttrPair(resourceName, "gateway_arn", gatewayResourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "location_arn", fsxResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "username", username), + resource.TestCheckResourceAttr(resourceName, names.AttrUsername, username), resource.TestCheckResourceAttr(resourceName, "cache_attributes.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), @@ -53,7 +53,7 @@ func TestAccStorageGatewayFileSystemAssociation_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"username", names.AttrPassword}, + ImportStateVerifyIgnore: []string{names.AttrUsername, names.AttrPassword}, }, }, }) @@ -86,7 +86,7 @@ func TestAccStorageGatewayFileSystemAssociation_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"username", names.AttrPassword}, + ImportStateVerifyIgnore: []string{names.AttrUsername, names.AttrPassword}, }, { Config: testAccFileSystemAssociationConfig_tags2(rName, domainName, username, "key1", "value1updated", "key2", "value2"), @@ -137,7 +137,7 @@ func TestAccStorageGatewayFileSystemAssociation_cacheAttributes(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"username", names.AttrPassword}, + ImportStateVerifyIgnore: []string{names.AttrUsername, names.AttrPassword}, }, { Config: testAccFileSystemAssociationConfig_cache(rName, domainName, username, 0), @@ -175,7 +175,7 @@ func TestAccStorageGatewayFileSystemAssociation_auditDestination(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"username", names.AttrPassword}, + ImportStateVerifyIgnore: []string{names.AttrUsername, names.AttrPassword}, }, { Config: testAccFileSystemAssociationConfig_auditDisabled(rName, domainName, username), diff --git a/internal/service/storagegateway/gateway.go b/internal/service/storagegateway/gateway.go index 7b1f677adde..5d8b6bba904 100644 --- a/internal/service/storagegateway/gateway.go +++ b/internal/service/storagegateway/gateway.go @@ -225,7 +225,7 @@ func ResourceGateway() *schema.Resource { Default: 20, ValidateFunc: validation.IntBetween(0, 3600), }, - "username": { + names.AttrUsername: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -560,7 +560,7 @@ func resourceGatewayRead(ctx context.Context, d *schema.ResourceData, meta inter if v, ok := d.GetOk("smb_active_directory_settings"); ok && len(v.([]interface{})) > 0 { configM := v.([]interface{})[0].(map[string]interface{}) m[names.AttrPassword] = configM[names.AttrPassword] - m["username"] = configM["username"] + m[names.AttrUsername] = configM[names.AttrUsername] m["timeout_in_seconds"] = configM["timeout_in_seconds"] if v, ok := configM["organizational_unit"]; ok { @@ -820,7 +820,7 @@ func expandGatewayDomain(l []interface{}, gatewayArn string) *storagegateway.Joi DomainName: aws.String(tfMap[names.AttrDomainName].(string)), GatewayARN: aws.String(gatewayArn), Password: aws.String(tfMap[names.AttrPassword].(string)), - UserName: aws.String(tfMap["username"].(string)), + UserName: aws.String(tfMap[names.AttrUsername].(string)), TimeoutInSeconds: aws.Int64(int64(tfMap["timeout_in_seconds"].(int))), } From 056bebd33229f6536e90fb2eb4c483833f62a65d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:05 -0400 Subject: [PATCH 1165/1490] ci: Prefer constant for string literal "configuration" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 69fc9aa0757..11faacbc399 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1435,3 +1435,13 @@ rules: - pattern: '"username"' severity: ERROR fix: "names.AttrUsername" + - id: literal-configuration-string-constant + languages: [go] + message: Use the constant `names.AttrConfiguration` for the string literal "configuration" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"configuration"' + severity: ERROR + fix: "names.AttrConfiguration" From 1e96f40391a08f32f1fbf7c0207164bde5049720 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:05 -0400 Subject: [PATCH 1166/1490] names: Add constant for string literal "configuration" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index ea8c228c232..97a8566e520 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -17,6 +17,7 @@ const ( AttrBucketPrefix = "bucket_prefix" AttrCatalogID = "catalog_id" AttrClusterIdentifier = "cluster_identifier" + AttrConfiguration = "configuration" AttrCreatedAt = "created_at" AttrCreatedDate = "created_date" AttrDatabaseName = "database_name" From 9c3589031281adb397400127d792e621a15cc9cf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:05 -0400 Subject: [PATCH 1167/1490] accessanalyzer: Use constant for configuration strings --- internal/service/accessanalyzer/accessanalyzer_test.go | 10 +++++----- internal/service/accessanalyzer/analyzer.go | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/accessanalyzer/accessanalyzer_test.go b/internal/service/accessanalyzer/accessanalyzer_test.go index 8b67ddb8275..81349acf45c 100644 --- a/internal/service/accessanalyzer/accessanalyzer_test.go +++ b/internal/service/accessanalyzer/accessanalyzer_test.go @@ -19,11 +19,11 @@ func TestAccAccessAnalyzer_serial(t *testing.T) { testCases := map[string]map[string]func(t *testing.T){ "Analyzer": { - "basic": testAccAnalyzer_basic, - "configuration": testAccAnalyzer_configuration, - "disappears": testAccAnalyzer_disappears, - names.AttrTags: testAccAccessAnalyzerAnalyzer_tagsSerial, - "Type_Organization": testAccAnalyzer_Type_Organization, + "basic": testAccAnalyzer_basic, + names.AttrConfiguration: testAccAnalyzer_configuration, + "disappears": testAccAnalyzer_disappears, + names.AttrTags: testAccAccessAnalyzerAnalyzer_tagsSerial, + "Type_Organization": testAccAnalyzer_Type_Organization, }, "ArchiveRule": { "basic": testAccAnalyzerArchiveRule_basic, diff --git a/internal/service/accessanalyzer/analyzer.go b/internal/service/accessanalyzer/analyzer.go index b680ee65298..9b6107059dd 100644 --- a/internal/service/accessanalyzer/analyzer.go +++ b/internal/service/accessanalyzer/analyzer.go @@ -63,7 +63,7 @@ func resourceAnalyzer() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Optional: true, ForceNew: true, @@ -115,7 +115,7 @@ func resourceAnalyzerCreate(ctx context.Context, d *schema.ResourceData, meta in Type: types.Type(d.Get(names.AttrType).(string)), } - if v, ok := d.GetOk("configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.Configuration = expandAnalyzerConfiguration(v.([]interface{})[0].(map[string]interface{})) } @@ -155,11 +155,11 @@ func resourceAnalyzerRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("analyzer_name", analyzer.Name) d.Set(names.AttrARN, analyzer.Arn) if analyzer.Configuration != nil { - if err := d.Set("configuration", []interface{}{flattenConfiguration(analyzer.Configuration)}); err != nil { + if err := d.Set(names.AttrConfiguration, []interface{}{flattenConfiguration(analyzer.Configuration)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting configuration: %s", err) } } else { - d.Set("configuration", nil) + d.Set(names.AttrConfiguration, nil) } d.Set(names.AttrType, analyzer.Type) From 6f9d5148d7b24005cd50ce9b582a130389c02853 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:05 -0400 Subject: [PATCH 1168/1490] athena: Use constant for configuration strings --- internal/service/athena/workgroup.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/athena/workgroup.go b/internal/service/athena/workgroup.go index 9c593b265a9..a2896fbad5e 100644 --- a/internal/service/athena/workgroup.go +++ b/internal/service/athena/workgroup.go @@ -45,7 +45,7 @@ func resourceWorkGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -190,7 +190,7 @@ func resourceWorkGroupCreate(ctx context.Context, d *schema.ResourceData, meta i name := d.Get(names.AttrName).(string) input := &athena.CreateWorkGroupInput{ - Configuration: expandWorkGroupConfiguration(d.Get("configuration").([]interface{})), + Configuration: expandWorkGroupConfiguration(d.Get(names.AttrConfiguration).([]interface{})), Name: aws.String(name), Tags: getTagsIn(ctx), } @@ -247,7 +247,7 @@ func resourceWorkGroupRead(ctx context.Context, d *schema.ResourceData, meta int Resource: fmt.Sprintf("workgroup/%s", d.Id()), } d.Set(names.AttrARN, arn.String()) - if err := d.Set("configuration", flattenWorkGroupConfiguration(wg.Configuration)); err != nil { + if err := d.Set(names.AttrConfiguration, flattenWorkGroupConfiguration(wg.Configuration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting configuration: %s", err) } d.Set(names.AttrDescription, wg.Description) @@ -267,8 +267,8 @@ func resourceWorkGroupUpdate(ctx context.Context, d *schema.ResourceData, meta i WorkGroup: aws.String(d.Get(names.AttrName).(string)), } - if d.HasChange("configuration") { - input.ConfigurationUpdates = expandWorkGroupConfigurationUpdates(d.Get("configuration").([]interface{})) + if d.HasChange(names.AttrConfiguration) { + input.ConfigurationUpdates = expandWorkGroupConfigurationUpdates(d.Get(names.AttrConfiguration).([]interface{})) } if d.HasChange(names.AttrDescription) { From 1fa02f9fa17d1d71b33827a2d6dfb3b62d861e61 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:06 -0400 Subject: [PATCH 1169/1490] codepipeline: Use constant for configuration strings --- internal/service/codepipeline/codepipeline.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/codepipeline/codepipeline.go b/internal/service/codepipeline/codepipeline.go index b6ac95e5939..a2eb8b51d04 100644 --- a/internal/service/codepipeline/codepipeline.go +++ b/internal/service/codepipeline/codepipeline.go @@ -136,7 +136,7 @@ func resourcePipeline() *schema.Resource { Required: true, ValidateDiagFunc: enum.Validate[types.ActionCategory](), }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeMap, Optional: true, ValidateDiagFunc: validation.AllDiag( @@ -835,7 +835,7 @@ func expandActionDeclaration(tfMap map[string]interface{}) *types.ActionDeclarat apiObject.ActionTypeId.Category = types.ActionCategory(v) } - if v, ok := tfMap["configuration"].(map[string]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrConfiguration].(map[string]interface{}); ok && len(v) > 0 { apiObject.Configuration = flex.ExpandStringValueMap(v) } @@ -1324,7 +1324,7 @@ func flattenActionDeclaration(d *schema.ResourceData, i, j int, apiObject types. } } - tfMap["configuration"] = v + tfMap[names.AttrConfiguration] = v } if v := apiObject.InputArtifacts; len(v) > 0 { From 91ea965307b96819e9292f8145e437d468f544b0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:06 -0400 Subject: [PATCH 1170/1490] ecs: Use constant for configuration strings --- internal/service/ecs/cluster.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/ecs/cluster.go b/internal/service/ecs/cluster.go index 637c12a1453..9f997ff116e 100644 --- a/internal/service/ecs/cluster.go +++ b/internal/service/ecs/cluster.go @@ -45,7 +45,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -168,7 +168,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("configuration"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrConfiguration); ok && len(v.([]interface{})) > 0 { input.Configuration = expandClusterConfiguration(v.([]interface{})) } @@ -239,7 +239,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter cluster := outputRaw.(*ecs.Cluster) d.Set(names.AttrARN, cluster.ClusterArn) if cluster.Configuration != nil { - if err := d.Set("configuration", flattenClusterConfiguration(cluster.Configuration)); err != nil { + if err := d.Set(names.AttrConfiguration, flattenClusterConfiguration(cluster.Configuration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting configuration: %s", err) } } @@ -265,12 +265,12 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int conn := meta.(*conns.AWSClient).ECSConn(ctx) - if d.HasChanges("configuration", "service_connect_defaults", "setting") { + if d.HasChanges(names.AttrConfiguration, "service_connect_defaults", "setting") { input := &ecs.UpdateClusterInput{ Cluster: aws.String(d.Id()), } - if v, ok := d.GetOk("configuration"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrConfiguration); ok && len(v.([]interface{})) > 0 { input.Configuration = expandClusterConfiguration(v.([]interface{})) } From ba92f1843186e45bf42c6069989aab7c9b328ee1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:06 -0400 Subject: [PATCH 1171/1490] emr: Use constant for configuration strings --- internal/service/emr/security_configuration.go | 6 +++--- internal/service/emr/security_configuration_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/emr/security_configuration.go b/internal/service/emr/security_configuration.go index a12380c3f75..4d57e373be9 100644 --- a/internal/service/emr/security_configuration.go +++ b/internal/service/emr/security_configuration.go @@ -35,7 +35,7 @@ func resourceSecurityConfiguration() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "configuration": { + names.AttrConfiguration: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -76,7 +76,7 @@ func resourceSecurityConfigurationCreate(ctx context.Context, d *schema.Resource ).Generate() input := &emr.CreateSecurityConfigurationInput{ Name: aws.String(name), - SecurityConfiguration: aws.String(d.Get("configuration").(string)), + SecurityConfiguration: aws.String(d.Get(names.AttrConfiguration).(string)), } output, err := conn.CreateSecurityConfigurationWithContext(ctx, input) @@ -106,7 +106,7 @@ func resourceSecurityConfigurationRead(ctx context.Context, d *schema.ResourceDa return sdkdiag.AppendErrorf(diags, "reading EMR Security Configuration (%s): %s", d.Id(), err) } - d.Set("configuration", output.SecurityConfiguration) + d.Set(names.AttrConfiguration, output.SecurityConfiguration) d.Set("creation_date", aws.TimeValue(output.CreationDateTime).Format(time.RFC3339)) d.Set(names.AttrName, output.Name) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.StringValue(output.Name))) diff --git a/internal/service/emr/security_configuration_test.go b/internal/service/emr/security_configuration_test.go index 1b36c7d8929..b92ff16a48e 100644 --- a/internal/service/emr/security_configuration_test.go +++ b/internal/service/emr/security_configuration_test.go @@ -33,7 +33,7 @@ func TestAccEMRSecurityConfiguration_basic(t *testing.T) { Config: testAccSecurityConfigurationConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckSecurityConfigurationExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "configuration"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrConfiguration), acctest.CheckResourceAttrRFC3339(resourceName, "creation_date"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, ""), From 64f7526ac1831e03c44c058bbcf3ea3f100b740c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:06 -0400 Subject: [PATCH 1172/1490] glue: Use constant for configuration strings --- internal/service/glue/crawler.go | 10 +++++----- internal/service/glue/crawler_test.go | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/service/glue/crawler.go b/internal/service/glue/crawler.go index 7af9e81bdee..e2494367ed5 100644 --- a/internal/service/glue/crawler.go +++ b/internal/service/glue/crawler.go @@ -90,7 +90,7 @@ func ResourceCrawler() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeString, Optional: true, DiffSuppressFunc: verify.SuppressEquivalentJSONDiffs, @@ -506,7 +506,7 @@ func resourceCrawlerRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set(names.AttrName, crawler.Name) d.Set(names.AttrDatabaseName, crawler.DatabaseName) d.Set("role", crawler.Role) - d.Set("configuration", crawler.Configuration) + d.Set(names.AttrConfiguration, crawler.Configuration) d.Set(names.AttrDescription, crawler.Description) d.Set("security_configuration", crawler.CrawlerSecurityConfiguration) d.Set("schedule", "") @@ -672,11 +672,11 @@ func createCrawlerInput(ctx context.Context, d *schema.ResourceData, crawlerName if tablePrefix, ok := d.GetOk("table_prefix"); ok { crawlerInput.TablePrefix = aws.String(tablePrefix.(string)) } - if configuration, ok := d.GetOk("configuration"); ok { + if configuration, ok := d.GetOk(names.AttrConfiguration); ok { crawlerInput.Configuration = aws.String(configuration.(string)) } - if v, ok := d.GetOk("configuration"); ok { + if v, ok := d.GetOk(names.AttrConfiguration); ok { configuration, err := structure.NormalizeJsonString(v) if err != nil { return nil, fmt.Errorf("configuration contains an invalid JSON: %v", err) @@ -728,7 +728,7 @@ func updateCrawlerInput(d *schema.ResourceData, crawlerName string) (*glue.Updat crawlerInput.TablePrefix = aws.String(d.Get("table_prefix").(string)) - if v, ok := d.GetOk("configuration"); ok { + if v, ok := d.GetOk(names.AttrConfiguration); ok { configuration, err := structure.NormalizeJsonString(v) if err != nil { return nil, fmt.Errorf("Configuration contains an invalid JSON: %v", err) diff --git a/internal/service/glue/crawler_test.go b/internal/service/glue/crawler_test.go index e30d5105722..fa1e35f6f46 100644 --- a/internal/service/glue/crawler_test.go +++ b/internal/service/glue/crawler_test.go @@ -43,7 +43,7 @@ func TestAccGlueCrawler_dynamoDBTarget(t *testing.T) { testAccCheckCrawlerExists(ctx, resourceName, &crawler), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "glue", fmt.Sprintf("crawler/%s", rName)), resource.TestCheckResourceAttr(resourceName, "classifiers.#", "0"), - resource.TestCheckResourceAttr(resourceName, "configuration", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, ""), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "dynamodb_target.#", "1"), @@ -67,7 +67,7 @@ func TestAccGlueCrawler_dynamoDBTarget(t *testing.T) { testAccCheckCrawlerExists(ctx, resourceName, &crawler), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "glue", fmt.Sprintf("crawler/%s", rName)), resource.TestCheckResourceAttr(resourceName, "classifiers.#", "0"), - resource.TestCheckResourceAttr(resourceName, "configuration", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, ""), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "dynamodb_target.#", "1"), @@ -204,7 +204,7 @@ func TestAccGlueCrawler_jdbcTarget(t *testing.T) { testAccCheckCrawlerExists(ctx, resourceName, &crawler), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "glue", fmt.Sprintf("crawler/%s", rName)), resource.TestCheckResourceAttr(resourceName, "classifiers.#", "0"), - resource.TestCheckResourceAttr(resourceName, "configuration", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, ""), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "dynamodb_target.#", "0"), @@ -230,7 +230,7 @@ func TestAccGlueCrawler_jdbcTarget(t *testing.T) { testAccCheckCrawlerExists(ctx, resourceName, &crawler), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "glue", fmt.Sprintf("crawler/%s", rName)), resource.TestCheckResourceAttr(resourceName, "classifiers.#", "0"), - resource.TestCheckResourceAttr(resourceName, "configuration", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, ""), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "dynamodb_target.#", "0"), @@ -261,7 +261,7 @@ func TestAccGlueCrawler_jdbcTarget(t *testing.T) { testAccCheckCrawlerExists(ctx, resourceName, &crawler), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "glue", fmt.Sprintf("crawler/%s", rName)), resource.TestCheckResourceAttr(resourceName, "classifiers.#", "0"), - resource.TestCheckResourceAttr(resourceName, "configuration", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, ""), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "dynamodb_target.#", "0"), @@ -694,7 +694,7 @@ func TestAccGlueCrawler_s3Target(t *testing.T) { testAccCheckCrawlerExists(ctx, resourceName, &crawler), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "glue", fmt.Sprintf("crawler/%s", rName)), resource.TestCheckResourceAttr(resourceName, "classifiers.#", "0"), - resource.TestCheckResourceAttr(resourceName, "configuration", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, ""), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "dynamodb_target.#", "0"), @@ -718,7 +718,7 @@ func TestAccGlueCrawler_s3Target(t *testing.T) { testAccCheckCrawlerExists(ctx, resourceName, &crawler), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "glue", fmt.Sprintf("crawler/%s", rName)), resource.TestCheckResourceAttr(resourceName, "classifiers.#", "0"), - resource.TestCheckResourceAttr(resourceName, "configuration", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, ""), resource.TestCheckResourceAttr(resourceName, names.AttrDatabaseName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "dynamodb_target.#", "0"), @@ -1039,7 +1039,7 @@ func TestAccGlueCrawler_catalogTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "schema_change_policy.0.update_behavior", "UPDATE_IN_DATABASE"), resource.TestCheckResourceAttr(resourceName, "table_prefix", ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "configuration", "{\"Version\":1.0,\"Grouping\":{\"TableGroupingPolicy\":\"CombineCompatibleSchemas\"}}"), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, "{\"Version\":1.0,\"Grouping\":{\"TableGroupingPolicy\":\"CombineCompatibleSchemas\"}}"), ), }, { @@ -1066,7 +1066,7 @@ func TestAccGlueCrawler_catalogTarget(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "schema_change_policy.0.update_behavior", "UPDATE_IN_DATABASE"), resource.TestCheckResourceAttr(resourceName, "table_prefix", ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - resource.TestCheckResourceAttr(resourceName, "configuration", "{\"Version\":1.0,\"Grouping\":{\"TableGroupingPolicy\":\"CombineCompatibleSchemas\"}}"), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, "{\"Version\":1.0,\"Grouping\":{\"TableGroupingPolicy\":\"CombineCompatibleSchemas\"}}"), ), }, { @@ -1242,7 +1242,7 @@ func TestAccGlueCrawler_Configuration(t *testing.T) { Config: testAccCrawlerConfig_configuration(rName, ""), Check: resource.ComposeTestCheckFunc( testAccCheckCrawlerExists(ctx, resourceName, &crawler), - resource.TestCheckResourceAttr(resourceName, "configuration", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, ""), ), }, }, From f355736bd1a477705b48975a0ee35c48f8e7bb53 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:06 -0400 Subject: [PATCH 1173/1490] grafana: Use constant for configuration strings --- internal/service/grafana/grafana_test.go | 2 +- internal/service/grafana/workspace.go | 12 ++++++------ internal/service/grafana/workspace_test.go | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/grafana/grafana_test.go b/internal/service/grafana/grafana_test.go index 937ad802f36..f8528d054e2 100644 --- a/internal/service/grafana/grafana_test.go +++ b/internal/service/grafana/grafana_test.go @@ -35,7 +35,7 @@ func TestAccGrafana_serial(t *testing.T) { "notificationDestinations": testAccWorkspace_notificationDestinations, names.AttrTags: testAccWorkspace_tags, "vpc": testAccWorkspace_vpc, - "configuration": testAccWorkspace_configuration, + names.AttrConfiguration: testAccWorkspace_configuration, "networkAccess": testAccWorkspace_networkAccess, names.AttrVersion: testAccWorkspace_version, }, diff --git a/internal/service/grafana/workspace.go b/internal/service/grafana/workspace.go index 85e8f3947cd..da9f9e8ec0b 100644 --- a/internal/service/grafana/workspace.go +++ b/internal/service/grafana/workspace.go @@ -64,7 +64,7 @@ func ResourceWorkspace() *schema.Resource { ValidateFunc: validation.StringInSlice(managedgrafana.AuthenticationProviderTypes_Values(), false), }, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeString, Optional: true, Computed: true, @@ -200,7 +200,7 @@ func resourceWorkspaceCreate(ctx context.Context, d *schema.ResourceData, meta i Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("configuration"); ok { + if v, ok := d.GetOk(names.AttrConfiguration); ok { input.Configuration = aws.String(v.(string)) } @@ -321,7 +321,7 @@ func resourceWorkspaceRead(ctx context.Context, d *schema.ResourceData, meta int return sdkdiag.AppendErrorf(diags, "reading Grafana Workspace (%s) configuration: %s", d.Id(), err) } - d.Set("configuration", output.Configuration) + d.Set(names.AttrConfiguration, output.Configuration) return diags } @@ -330,7 +330,7 @@ func resourceWorkspaceUpdate(ctx context.Context, d *schema.ResourceData, meta i var diags diag.Diagnostics conn := meta.(*conns.AWSClient).GrafanaConn(ctx) - if d.HasChangesExcept("configuration", "grafana_version", names.AttrTags, names.AttrTagsAll) { + if d.HasChangesExcept(names.AttrConfiguration, "grafana_version", names.AttrTags, names.AttrTagsAll) { input := &managedgrafana.UpdateWorkspaceInput{ WorkspaceId: aws.String(d.Id()), } @@ -406,9 +406,9 @@ func resourceWorkspaceUpdate(ctx context.Context, d *schema.ResourceData, meta i } } - if d.HasChanges("configuration", "grafana_version") { + if d.HasChanges(names.AttrConfiguration, "grafana_version") { input := &managedgrafana.UpdateWorkspaceConfigurationInput{ - Configuration: aws.String(d.Get("configuration").(string)), + Configuration: aws.String(d.Get(names.AttrConfiguration).(string)), WorkspaceId: aws.String(d.Id()), } diff --git a/internal/service/grafana/workspace_test.go b/internal/service/grafana/workspace_test.go index 3822ff1e13d..c6aabda02eb 100644 --- a/internal/service/grafana/workspace_test.go +++ b/internal/service/grafana/workspace_test.go @@ -409,7 +409,7 @@ func testAccWorkspace_configuration(t *testing.T) { Config: testAccWorkspaceConfig_configuration(rName, `{"unifiedAlerting": { "enabled": true }, "plugins": {"pluginAdminEnabled": false}}`), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckWorkspaceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "configuration", `{"unifiedAlerting":{"enabled":true},"plugins":{"pluginAdminEnabled":false}}`), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, `{"unifiedAlerting":{"enabled":true},"plugins":{"pluginAdminEnabled":false}}`), ), }, { @@ -421,7 +421,7 @@ func testAccWorkspace_configuration(t *testing.T) { Config: testAccWorkspaceConfig_configuration(rName, `{"unifiedAlerting": { "enabled": false }, "plugins": {"pluginAdminEnabled": true}}`), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckWorkspaceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "configuration", `{"unifiedAlerting":{"enabled":false},"plugins":{"pluginAdminEnabled":true}}`), + resource.TestCheckResourceAttr(resourceName, names.AttrConfiguration, `{"unifiedAlerting":{"enabled":false},"plugins":{"pluginAdminEnabled":true}}`), ), }, }, From c8e44942992acef59a27594c97fc7075c19a5785 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:06 -0400 Subject: [PATCH 1174/1490] kendra: Use constant for configuration strings --- internal/service/kendra/data_source.go | 14 +++++++------- internal/service/kendra/experience.go | 10 +++++----- internal/service/kendra/experience_data_source.go | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/kendra/data_source.go b/internal/service/kendra/data_source.go index 0d871c7357d..099f8d5c620 100644 --- a/internal/service/kendra/data_source.go +++ b/internal/service/kendra/data_source.go @@ -57,7 +57,7 @@ func ResourceDataSource() *schema.Resource { }, CustomizeDiff: customdiff.All( func(_ context.Context, diff *schema.ResourceDiff, v interface{}) error { - if configuration, dataSourcetype := diff.Get("configuration").([]interface{}), diff.Get(names.AttrType).(string); len(configuration) > 0 && dataSourcetype == string(types.DataSourceTypeCustom) { + if configuration, dataSourcetype := diff.Get(names.AttrConfiguration).([]interface{}), diff.Get(names.AttrType).(string); len(configuration) > 0 && dataSourcetype == string(types.DataSourceTypeCustom) { return fmt.Errorf("configuration must not be set when type is %s", string(types.DataSourceTypeCustom)) } @@ -78,7 +78,7 @@ func ResourceDataSource() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -605,7 +605,7 @@ func resourceDataSourceCreate(ctx context.Context, d *schema.ResourceData, meta Type: types.DataSourceType(d.Get(names.AttrType).(string)), } - if v, ok := d.GetOk("configuration"); ok { + if v, ok := d.GetOk(names.AttrConfiguration); ok { input.Configuration = expandDataSourceConfiguration(v.([]interface{})) } @@ -710,7 +710,7 @@ func resourceDataSourceRead(ctx context.Context, d *schema.ResourceData, meta in d.Set(names.AttrType, resp.Type) d.Set("updated_at", aws.ToTime(resp.UpdatedAt).Format(time.RFC3339)) - if err := d.Set("configuration", flattenDataSourceConfiguration(resp.Configuration)); err != nil { + if err := d.Set(names.AttrConfiguration, flattenDataSourceConfiguration(resp.Configuration)); err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -726,7 +726,7 @@ func resourceDataSourceUpdate(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).KendraClient(ctx) - if d.HasChanges("configuration", "custom_document_enrichment_configuration", names.AttrDescription, "language_code", names.AttrName, names.AttrRoleARN, "schedule") { + if d.HasChanges(names.AttrConfiguration, "custom_document_enrichment_configuration", names.AttrDescription, "language_code", names.AttrName, names.AttrRoleARN, "schedule") { id, indexId, err := DataSourceParseResourceID(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) @@ -737,8 +737,8 @@ func resourceDataSourceUpdate(ctx context.Context, d *schema.ResourceData, meta IndexId: aws.String(indexId), } - if d.HasChange("configuration") { - input.Configuration = expandDataSourceConfiguration(d.Get("configuration").([]interface{})) + if d.HasChange(names.AttrConfiguration) { + input.Configuration = expandDataSourceConfiguration(d.Get(names.AttrConfiguration).([]interface{})) } if d.HasChange("custom_document_enrichment_configuration") { diff --git a/internal/service/kendra/experience.go b/internal/service/kendra/experience.go index 92005c31207..b1b7570dbc7 100644 --- a/internal/service/kendra/experience.go +++ b/internal/service/kendra/experience.go @@ -52,7 +52,7 @@ func ResourceExperience() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Optional: true, Computed: true, @@ -194,7 +194,7 @@ func resourceExperienceCreate(ctx context.Context, d *schema.ResourceData, meta in.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { in.Configuration = expandConfiguration(v.([]interface{})) } @@ -261,7 +261,7 @@ func resourceExperienceRead(ctx context.Context, d *schema.ResourceData, meta in return sdkdiag.AppendErrorf(diags, "setting endpoints argument: %s", err) } - if err := d.Set("configuration", flattenConfiguration(out.Configuration)); err != nil { + if err := d.Set(names.AttrConfiguration, flattenConfiguration(out.Configuration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting configuration argument: %s", err) } @@ -283,8 +283,8 @@ func resourceExperienceUpdate(ctx context.Context, d *schema.ResourceData, meta IndexId: aws.String(indexId), } - if d.HasChange("configuration") { - in.Configuration = expandConfiguration(d.Get("configuration").([]interface{})) + if d.HasChange(names.AttrConfiguration) { + in.Configuration = expandConfiguration(d.Get(names.AttrConfiguration).([]interface{})) } if d.HasChange(names.AttrDescription) { diff --git a/internal/service/kendra/experience_data_source.go b/internal/service/kendra/experience_data_source.go index 56047ca126c..fa2176913cd 100644 --- a/internal/service/kendra/experience_data_source.go +++ b/internal/service/kendra/experience_data_source.go @@ -28,7 +28,7 @@ func DataSourceExperience() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -173,7 +173,7 @@ func dataSourceExperienceRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrStatus, resp.Status) d.Set("updated_at", aws.ToTime(resp.UpdatedAt).Format(time.RFC3339)) - if err := d.Set("configuration", flattenConfiguration(resp.Configuration)); err != nil { + if err := d.Set(names.AttrConfiguration, flattenConfiguration(resp.Configuration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting configuration argument: %s", err) } From 09ffe541ead408c5233ae45d36598cffeb4bc5be Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:07 -0400 Subject: [PATCH 1175/1490] location: Use constant for configuration strings --- internal/service/location/map.go | 8 ++++---- internal/service/location/map_data_source.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/location/map.go b/internal/service/location/map.go index ff29b3f8404..3ae0323b0e3 100644 --- a/internal/service/location/map.go +++ b/internal/service/location/map.go @@ -33,7 +33,7 @@ func ResourceMap() *schema.Resource { StateContext: schema.ImportStatePassthroughContext, }, Schema: map[string]*schema.Schema{ - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Required: true, ForceNew: true, @@ -87,7 +87,7 @@ func resourceMapCreate(ctx context.Context, d *schema.ResourceData, meta interfa Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.Configuration = expandConfiguration(v.([]interface{})[0].(map[string]interface{})) } @@ -139,9 +139,9 @@ func resourceMapRead(ctx context.Context, d *schema.ResourceData, meta interface } if output.Configuration != nil { - d.Set("configuration", []interface{}{flattenConfiguration(output.Configuration)}) + d.Set(names.AttrConfiguration, []interface{}{flattenConfiguration(output.Configuration)}) } else { - d.Set("configuration", nil) + d.Set(names.AttrConfiguration, nil) } d.Set("create_time", aws.TimeValue(output.CreateTime).Format(time.RFC3339)) diff --git a/internal/service/location/map_data_source.go b/internal/service/location/map_data_source.go index c52565927c5..ae7580e9217 100644 --- a/internal/service/location/map_data_source.go +++ b/internal/service/location/map_data_source.go @@ -23,7 +23,7 @@ func DataSourceMap() *schema.Resource { return &schema.Resource{ ReadWithoutTimeout: dataSourceMapRead, Schema: map[string]*schema.Schema{ - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -84,9 +84,9 @@ func dataSourceMapRead(ctx context.Context, d *schema.ResourceData, meta interfa d.SetId(aws.StringValue(output.MapName)) if output.Configuration != nil { - d.Set("configuration", []interface{}{flattenConfiguration(output.Configuration)}) + d.Set(names.AttrConfiguration, []interface{}{flattenConfiguration(output.Configuration)}) } else { - d.Set("configuration", nil) + d.Set(names.AttrConfiguration, nil) } d.Set("create_time", aws.TimeValue(output.CreateTime).Format(time.RFC3339)) From 395be674a230a11352ccf8595d7419109c6e544f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:07 -0400 Subject: [PATCH 1176/1490] mq: Use constant for configuration strings --- internal/service/mq/broker.go | 10 +++++----- internal/service/mq/broker_data_source.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/mq/broker.go b/internal/service/mq/broker.go index 6bc5d983ae2..ca000d9854d 100644 --- a/internal/service/mq/broker.go +++ b/internal/service/mq/broker.go @@ -84,7 +84,7 @@ func resourceBroker() *schema.Resource { ForceNew: true, ValidateFunc: ValidateBrokerName, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Optional: true, Computed: true, @@ -412,7 +412,7 @@ func resourceBrokerCreate(ctx context.Context, d *schema.ResourceData, meta inte if v, ok := d.GetOk("authentication_strategy"); ok { input.AuthenticationStrategy = types.AuthenticationStrategy(v.(string)) } - if v, ok := d.GetOk("configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.Configuration = expandConfigurationId(v.([]interface{})) } if v, ok := d.GetOk("deployment_mode"); ok { @@ -495,7 +495,7 @@ func resourceBrokerRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("storage_type", output.StorageType) d.Set(names.AttrSubnetIDs, output.SubnetIds) - if err := d.Set("configuration", flattenConfiguration(output.Configurations)); err != nil { + if err := d.Set(names.AttrConfiguration, flattenConfiguration(output.Configurations)); err != nil { return sdkdiag.AppendErrorf(diags, "setting configuration: %s", err) } @@ -555,10 +555,10 @@ func resourceBrokerUpdate(ctx context.Context, d *schema.ResourceData, meta inte } } - if d.HasChanges("configuration", "logs", names.AttrEngineVersion) { + if d.HasChanges(names.AttrConfiguration, "logs", names.AttrEngineVersion) { input := &mq.UpdateBrokerInput{ BrokerId: aws.String(d.Id()), - Configuration: expandConfigurationId(d.Get("configuration").([]interface{})), + Configuration: expandConfigurationId(d.Get(names.AttrConfiguration).([]interface{})), EngineVersion: aws.String(d.Get(names.AttrEngineVersion).(string)), Logs: expandLogs(d.Get("engine_type").(string), d.Get("logs").([]interface{})), } diff --git a/internal/service/mq/broker_data_source.go b/internal/service/mq/broker_data_source.go index ff9204ea87a..6ed39208f7b 100644 --- a/internal/service/mq/broker_data_source.go +++ b/internal/service/mq/broker_data_source.go @@ -50,7 +50,7 @@ func dataSourceBroker() *schema.Resource { Computed: true, ConflictsWith: []string{"broker_id"}, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -302,7 +302,7 @@ func dataSourceBrokerRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("storage_type", output.StorageType) d.Set(names.AttrSubnetIDs, output.SubnetIds) - if err := d.Set("configuration", flattenConfiguration(output.Configurations)); err != nil { + if err := d.Set(names.AttrConfiguration, flattenConfiguration(output.Configurations)); err != nil { return sdkdiag.AppendErrorf(diags, "setting configuration: %s", err) } From 91a0876e8a8a17624b7ca60c0174e110124b5529 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:07 -0400 Subject: [PATCH 1177/1490] networkmanager: Use constant for configuration strings --- internal/service/networkmanager/connect_peer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/networkmanager/connect_peer.go b/internal/service/networkmanager/connect_peer.go index 89f63c3d3b2..84c058cccde 100644 --- a/internal/service/networkmanager/connect_peer.go +++ b/internal/service/networkmanager/connect_peer.go @@ -69,7 +69,7 @@ func ResourceConnectPeer() *schema.Resource { }, }, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -287,7 +287,7 @@ func resourceConnectPeerRead(ctx context.Context, d *schema.ResourceData, meta i bgpOptions := map[string]interface{}{} bgpOptions["peer_asn"] = connectPeer.Configuration.BgpConfigurations[0].PeerAsn d.Set("bgp_options", []interface{}{bgpOptions}) - d.Set("configuration", []interface{}{flattenPeerConfiguration(connectPeer.Configuration)}) + d.Set(names.AttrConfiguration, []interface{}{flattenPeerConfiguration(connectPeer.Configuration)}) d.Set("connect_peer_id", connectPeer.ConnectPeerId) d.Set("core_network_id", connectPeer.CoreNetworkId) if connectPeer.CreatedAt != nil { From a39f5277758f99072fefc870f2d9e58451237678 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:07 -0400 Subject: [PATCH 1178/1490] schema: Use constant for configuration strings --- .../service/quicksight/schema/template_filter.go | 6 +++--- internal/service/quicksight/schema/template_sheet.go | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/quicksight/schema/template_filter.go b/internal/service/quicksight/schema/template_filter.go index 3f46b789409..c6b7d220c94 100644 --- a/internal/service/quicksight/schema/template_filter.go +++ b/internal/service/quicksight/schema/template_filter.go @@ -45,7 +45,7 @@ func categoryFilterSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "column": columnSchema(true), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_ColumnIdentifier.html - "configuration": { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_CategoryFilterConfiguration.html + names.AttrConfiguration: { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_CategoryFilterConfiguration.html Type: schema.TypeList, Required: true, MinItems: 1, @@ -572,7 +572,7 @@ func expandCategoryFilter(tfList []interface{}) *quicksight.CategoryFilter { if v, ok := tfMap["column"].([]interface{}); ok && len(v) > 0 { filter.Column = expandColumnIdentifier(v) } - if v, ok := tfMap["configuration"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrConfiguration].([]interface{}); ok && len(v) > 0 { filter.Configuration = expandCategoryFilterConfiguration(v) } @@ -1311,7 +1311,7 @@ func flattenCategoryFilter(apiObject *quicksight.CategoryFilter) []interface{} { tfMap["column"] = flattenColumnIdentifier(apiObject.Column) } if apiObject.Configuration != nil { - tfMap["configuration"] = flattenCategoryFilterConfiguration(apiObject.Configuration) + tfMap[names.AttrConfiguration] = flattenCategoryFilterConfiguration(apiObject.Configuration) } if apiObject.FilterId != nil { tfMap["filter_id"] = aws.StringValue(apiObject.FilterId) diff --git a/internal/service/quicksight/schema/template_sheet.go b/internal/service/quicksight/schema/template_sheet.go index 9eabfc754cb..8f492e80d75 100644 --- a/internal/service/quicksight/schema/template_sheet.go +++ b/internal/service/quicksight/schema/template_sheet.go @@ -180,7 +180,7 @@ func sheetControlLayoutsSchema() *schema.Schema { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "configuration": { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_SheetControlLayoutConfiguration.html + names.AttrConfiguration: { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_SheetControlLayoutConfiguration.html Type: schema.TypeList, MinItems: 1, MaxItems: 1, @@ -205,7 +205,7 @@ func layoutSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "configuration": { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_LayoutConfiguration.html + names.AttrConfiguration: { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_LayoutConfiguration.html Type: schema.TypeList, Required: true, MinItems: 1, @@ -979,7 +979,7 @@ func expandLayout(tfMap map[string]interface{}) *quicksight.Layout { layout := &quicksight.Layout{} - if v, ok := tfMap["configuration"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrConfiguration].([]interface{}); ok && len(v) > 0 { layout.Configuration = expandLayoutConfiguration(v) } @@ -1587,7 +1587,7 @@ func expandSheetControlLayout(tfMap map[string]interface{}) *quicksight.SheetCon layout := &quicksight.SheetControlLayout{} - if v, ok := tfMap["configuration"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrConfiguration].([]interface{}); ok && len(v) > 0 { layout.Configuration = expandSheetControlLayoutConfiguration(v) } @@ -1897,7 +1897,7 @@ func flattenLayouts(apiObject []*quicksight.Layout) []interface{} { } tfMap := map[string]interface{}{ - "configuration": flattenLayoutConfiguration(config.Configuration), + names.AttrConfiguration: flattenLayoutConfiguration(config.Configuration), } tfList = append(tfList, tfMap) @@ -2283,7 +2283,7 @@ func flattenSheetControlLayouts(apiObject []*quicksight.SheetControlLayout) []in } tfMap := map[string]interface{}{ - "configuration": flattenSheetControlLayoutConfiguration(config.Configuration), + names.AttrConfiguration: flattenSheetControlLayoutConfiguration(config.Configuration), } tfList = append(tfList, tfMap) } From 852c3140773cd02fcac3e54cd70ca9648aeea60f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:07 -0400 Subject: [PATCH 1179/1490] quicksight: Use constant for configuration strings --- internal/service/quicksight/theme.go | 8 ++++---- internal/service/quicksight/theme_data_source.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/quicksight/theme.go b/internal/service/quicksight/theme.go index e63331729c3..780eefdc8ec 100644 --- a/internal/service/quicksight/theme.go +++ b/internal/service/quicksight/theme.go @@ -63,7 +63,7 @@ func ResourceTheme() *schema.Resource { Type: schema.TypeString, Required: true, }, - "configuration": { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_ThemeConfiguration.html + names.AttrConfiguration: { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_ThemeConfiguration.html Type: schema.TypeList, MaxItems: 1, Optional: true, @@ -372,7 +372,7 @@ func resourceThemeCreate(ctx context.Context, d *schema.ResourceData, meta inter input.VersionDescription = aws.String(v.(string)) } - if v, ok := d.GetOk("configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.Configuration = expandThemeConfiguration(v.([]interface{})) } @@ -423,7 +423,7 @@ func resourceThemeRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set("version_description", out.Version.Description) d.Set("version_number", out.Version.VersionNumber) - if err := d.Set("configuration", flattenThemeConfiguration(out.Version.Configuration)); err != nil { + if err := d.Set(names.AttrConfiguration, flattenThemeConfiguration(out.Version.Configuration)); err != nil { return diag.Errorf("setting configuration: %s", err) } @@ -459,7 +459,7 @@ func resourceThemeUpdate(ctx context.Context, d *schema.ResourceData, meta inter Name: aws.String(d.Get(names.AttrName).(string)), } - if v, ok := d.GetOk("configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { in.Configuration = expandThemeConfiguration(v.([]interface{})) } diff --git a/internal/service/quicksight/theme_data_source.go b/internal/service/quicksight/theme_data_source.go index 0b3b6bd4806..25831db8595 100644 --- a/internal/service/quicksight/theme_data_source.go +++ b/internal/service/quicksight/theme_data_source.go @@ -39,7 +39,7 @@ func DataSourceTheme() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "configuration": { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_ThemeConfiguration.html + names.AttrConfiguration: { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_ThemeConfiguration.html Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -309,7 +309,7 @@ func dataSourceThemeRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("version_description", out.Version.Description) d.Set("version_number", out.Version.VersionNumber) - if err := d.Set("configuration", flattenThemeConfiguration(out.Version.Configuration)); err != nil { + if err := d.Set(names.AttrConfiguration, flattenThemeConfiguration(out.Version.Configuration)); err != nil { return diag.Errorf("setting configuration: %s", err) } From 8c74dba69a1d4a2537b43dfc2fd656b522d04248 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:08 -0400 Subject: [PATCH 1180/1490] redshift: Use constant for configuration strings --- internal/service/redshift/event_subscription.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/redshift/event_subscription.go b/internal/service/redshift/event_subscription.go index 0492f75f4e8..944067db484 100644 --- a/internal/service/redshift/event_subscription.go +++ b/internal/service/redshift/event_subscription.go @@ -64,7 +64,7 @@ func resourceEventSubscription() *schema.Resource { Elem: &schema.Schema{ Type: schema.TypeString, ValidateFunc: validation.StringInSlice([]string{ - "configuration", + names.AttrConfiguration, "management", "monitoring", "security", From 2dc6526a633b5f5eaf733a5ce6adf221ab2d3a9d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:08 -0400 Subject: [PATCH 1181/1490] resourcegroups: Use constant for configuration strings --- internal/service/resourcegroups/group.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/resourcegroups/group.go b/internal/service/resourcegroups/group.go index dac0c20315f..44ec3624798 100644 --- a/internal/service/resourcegroups/group.go +++ b/internal/service/resourcegroups/group.go @@ -48,7 +48,7 @@ func resourceGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -127,7 +127,7 @@ func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta inter } waitForConfigurationAttached := false - if groupCfg, set := d.GetOk("configuration"); set { + if groupCfg, set := d.GetOk(names.AttrConfiguration); set { // Only expand and add configuration if its set input.Configuration = expandGroupConfigurationItems(groupCfg.(*schema.Set).List()) waitForConfigurationAttached = true @@ -210,7 +210,7 @@ func resourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interfa } } if hasConfiguration { - if err := d.Set("configuration", flattenGroupConfigurationItems(groupCfg.Configuration)); err != nil { + if err := d.Set(names.AttrConfiguration, flattenGroupConfigurationItems(groupCfg.Configuration)); err != nil { return diag.Errorf("setting configuration: %s", err) } } @@ -222,7 +222,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter conn := meta.(*conns.AWSClient).ResourceGroupsClient(ctx) // Conversion between a resource-query and configuration group is not possible and vice-versa - if d.HasChange("configuration") && d.HasChange("resource_query") { + if d.HasChange(names.AttrConfiguration) && d.HasChange("resource_query") { return diag.Errorf("conversion between resource-query and configuration group types is not possible") } @@ -252,9 +252,9 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter } } - if d.HasChange("configuration") { + if d.HasChange(names.AttrConfiguration) { input := &resourcegroups.PutGroupConfigurationInput{ - Configuration: expandGroupConfigurationItems(d.Get("configuration").(*schema.Set).List()), + Configuration: expandGroupConfigurationItems(d.Get(names.AttrConfiguration).(*schema.Set).List()), Group: aws.String(d.Id()), } From 1e603ffd9e4adf014e71011f6255574a4cf48d45 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:08 -0400 Subject: [PATCH 1182/1490] s3control: Use constant for configuration strings --- internal/service/s3control/object_lambda_access_point.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/s3control/object_lambda_access_point.go b/internal/service/s3control/object_lambda_access_point.go index 930a8bd9ba9..5c3676c9550 100644 --- a/internal/service/s3control/object_lambda_access_point.go +++ b/internal/service/s3control/object_lambda_access_point.go @@ -53,7 +53,7 @@ func resourceObjectLambdaAccessPoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeList, Required: true, MaxItems: 1, @@ -146,7 +146,7 @@ func resourceObjectLambdaAccessPointCreate(ctx context.Context, d *schema.Resour Name: aws.String(name), } - if v, ok := d.GetOk("configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.Configuration = expandObjectLambdaConfiguration(v.([]interface{})[0].(map[string]interface{})) } @@ -191,7 +191,7 @@ func resourceObjectLambdaAccessPointRead(ctx context.Context, d *schema.Resource Resource: fmt.Sprintf("accesspoint/%s", name), }.String() d.Set(names.AttrARN, arn) - if err := d.Set("configuration", []interface{}{flattenObjectLambdaConfiguration(outputConfiguration)}); err != nil { + if err := d.Set(names.AttrConfiguration, []interface{}{flattenObjectLambdaConfiguration(outputConfiguration)}); err != nil { return diag.Errorf("setting configuration: %s", err) } d.Set(names.AttrName, name) @@ -220,7 +220,7 @@ func resourceObjectLambdaAccessPointUpdate(ctx context.Context, d *schema.Resour Name: aws.String(name), } - if v, ok := d.GetOk("configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.Configuration = expandObjectLambdaConfiguration(v.([]interface{})[0].(map[string]interface{})) } From 955455756500f0715dd61c14b53798fdac2a9a4a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:08 -0400 Subject: [PATCH 1183/1490] securitylake: Use constant for configuration strings --- internal/service/securitylake/custom_log_source.go | 2 +- .../service/securitylake/custom_log_source_test.go | 14 +++++++------- internal/service/securitylake/data_lake.go | 2 +- .../securitylake/subscriber_notification.go | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/securitylake/custom_log_source.go b/internal/service/securitylake/custom_log_source.go index be2e933f30d..91aa84e6e81 100644 --- a/internal/service/securitylake/custom_log_source.go +++ b/internal/service/securitylake/custom_log_source.go @@ -105,7 +105,7 @@ func (r *customLogSourceResource) Schema(ctx context.Context, request resource.S }, }, Blocks: map[string]schema.Block{ - "configuration": schema.ListNestedBlock{ + names.AttrConfiguration: schema.ListNestedBlock{ CustomType: fwtypes.NewListNestedObjectTypeOf[customLogSourceConfigurationModel](ctx), PlanModifiers: []planmodifier.List{ listplanmodifier.RequiresReplace(), diff --git a/internal/service/securitylake/custom_log_source_test.go b/internal/service/securitylake/custom_log_source_test.go index add1bd2736c..9fc30ef0db9 100644 --- a/internal/service/securitylake/custom_log_source_test.go +++ b/internal/service/securitylake/custom_log_source_test.go @@ -63,7 +63,7 @@ func testAccCustomLogSource_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"configuration"}, + ImportStateVerifyIgnore: []string{names.AttrConfiguration}, }, }, }) @@ -96,7 +96,7 @@ func testAccCustomLogSource_sourceVersion(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"configuration"}, + ImportStateVerifyIgnore: []string{names.AttrConfiguration}, }, { Config: testAccCustomLogSourceConfig_sourceVersion(rName, "2.5"), @@ -109,7 +109,7 @@ func testAccCustomLogSource_sourceVersion(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"configuration"}, + ImportStateVerifyIgnore: []string{names.AttrConfiguration}, }, }, }) @@ -148,7 +148,7 @@ func testAccCustomLogSource_multiple(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"configuration"}, + ImportStateVerifyIgnore: []string{names.AttrConfiguration}, }, }, }) @@ -182,7 +182,7 @@ func testAccCustomLogSource_eventClasses(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"configuration", "event_classes"}, + ImportStateVerifyIgnore: []string{names.AttrConfiguration, "event_classes"}, }, { Config: testAccCustomLogSourceConfig_eventClasses(rName, "MEMORY_ACTIVITY", "FILE_ACTIVITY"), @@ -197,7 +197,7 @@ func testAccCustomLogSource_eventClasses(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"configuration", "event_classes"}, + ImportStateVerifyIgnore: []string{names.AttrConfiguration, "event_classes"}, }, { Config: testAccCustomLogSourceConfig_eventClasses(rName, "MEMORY_ACTIVITY"), @@ -211,7 +211,7 @@ func testAccCustomLogSource_eventClasses(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"configuration", "event_classes"}, + ImportStateVerifyIgnore: []string{names.AttrConfiguration, "event_classes"}, }, }, }) diff --git a/internal/service/securitylake/data_lake.go b/internal/service/securitylake/data_lake.go index d1e5ca71a24..a98ac4c9a82 100644 --- a/internal/service/securitylake/data_lake.go +++ b/internal/service/securitylake/data_lake.go @@ -78,7 +78,7 @@ func (r *dataLakeResource) Schema(ctx context.Context, request resource.SchemaRe names.AttrTagsAll: tftags.TagsAttributeComputedOnly(), }, Blocks: map[string]schema.Block{ - "configuration": schema.ListNestedBlock{ + names.AttrConfiguration: schema.ListNestedBlock{ CustomType: fwtypes.NewListNestedObjectTypeOf[dataLakeConfigurationModel](ctx), Validators: []validator.List{ listvalidator.IsRequired(), diff --git a/internal/service/securitylake/subscriber_notification.go b/internal/service/securitylake/subscriber_notification.go index d0efe03809d..baccf539e54 100644 --- a/internal/service/securitylake/subscriber_notification.go +++ b/internal/service/securitylake/subscriber_notification.go @@ -70,7 +70,7 @@ func (r *subscriberNotificationResource) Schema(ctx context.Context, req resourc }, }, Blocks: map[string]schema.Block{ - "configuration": schema.ListNestedBlock{ + names.AttrConfiguration: schema.ListNestedBlock{ CustomType: fwtypes.NewListNestedObjectTypeOf[subscriberNotificationResourceConfigurationModel](ctx), Validators: []validator.List{ listvalidator.IsRequired(), From 0831fa5fa14e64bf7f4e3e5a1377155fb78cd64b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:29:09 -0400 Subject: [PATCH 1184/1490] ssm: Use constant for configuration strings --- internal/service/ssm/patch_baseline.go | 6 +++--- internal/service/ssm/patch_baseline_data_source.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/ssm/patch_baseline.go b/internal/service/ssm/patch_baseline.go index c74006e7cb4..61d89fcc60a 100644 --- a/internal/service/ssm/patch_baseline.go +++ b/internal/service/ssm/patch_baseline.go @@ -190,7 +190,7 @@ func resourcePatchBaseline() *schema.Resource { MaxItems: 20, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "configuration": { + names.AttrConfiguration: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 1024), @@ -567,7 +567,7 @@ func expandPatchSource(d *schema.ResourceData) []*ssm.PatchSource { source := &ssm.PatchSource{ Name: aws.String(config[names.AttrName].(string)), - Configuration: aws.String(config["configuration"].(string)), + Configuration: aws.String(config[names.AttrConfiguration].(string)), Products: flex.ExpandStringList(config["products"].([]interface{})), } @@ -587,7 +587,7 @@ func flattenPatchSource(sources []*ssm.PatchSource) []map[string]interface{} { for _, source := range sources { s := make(map[string]interface{}) s[names.AttrName] = aws.StringValue(source.Name) - s["configuration"] = aws.StringValue(source.Configuration) + s[names.AttrConfiguration] = aws.StringValue(source.Configuration) s["products"] = flex.FlattenStringList(source.Products) result = append(result, s) } diff --git a/internal/service/ssm/patch_baseline_data_source.go b/internal/service/ssm/patch_baseline_data_source.go index b0953e13106..9958ab94182 100644 --- a/internal/service/ssm/patch_baseline_data_source.go +++ b/internal/service/ssm/patch_baseline_data_source.go @@ -143,7 +143,7 @@ func DataSourcePatchBaseline() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "configuration": { + names.AttrConfiguration: { Type: schema.TypeString, Computed: true, }, From 7002d73bf82e61c5636e985fdc256773823eae23 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:41 -0400 Subject: [PATCH 1185/1490] ci: Prefer constant for string literal "parameter" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 11faacbc399..e5faa7f29d4 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1445,3 +1445,13 @@ rules: - pattern: '"configuration"' severity: ERROR fix: "names.AttrConfiguration" + - id: literal-parameter-string-constant + languages: [go] + message: Use the constant `names.AttrParameter` for the string literal "parameter" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"parameter"' + severity: ERROR + fix: "names.AttrParameter" From 701753e78e195974294fa3ffb61ffec17fb48944 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:41 -0400 Subject: [PATCH 1186/1490] names: Add constant for string literal "parameter" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 97a8566e520..490019ca50b 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -46,6 +46,7 @@ const ( AttrNamePrefix = "name_prefix" AttrNetworkInterfaceID = "network_interface_id" AttrOwnerID = "owner_id" + AttrParameter = "parameter" AttrParameters = "parameters" AttrPassword = "password" AttrPath = "path" From 3c3376be7ebdb452771fd3d98af0188170d8d8c1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:42 -0400 Subject: [PATCH 1187/1490] appconfig: Use constant for parameter strings --- internal/service/appconfig/extension.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/appconfig/extension.go b/internal/service/appconfig/extension.go index 8c3994d1e0d..70465216af4 100644 --- a/internal/service/appconfig/extension.go +++ b/internal/service/appconfig/extension.go @@ -88,7 +88,7 @@ func ResourceExtension() *schema.Resource { Optional: true, Computed: true, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Computed: true, @@ -140,7 +140,7 @@ func resourceExtensionCreate(ctx context.Context, d *schema.ResourceData, meta i in.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("parameter"); ok && v.(*schema.Set).Len() > 0 { + if v, ok := d.GetOk(names.AttrParameter); ok && v.(*schema.Set).Len() > 0 { in.Parameters = expandExtensionParameters(v.(*schema.Set).List()) } @@ -179,7 +179,7 @@ func resourceExtensionRead(ctx context.Context, d *schema.ResourceData, meta int d.Set(names.AttrARN, out.Arn) d.Set("action_point", flattenExtensionActionPoints(out.Actions)) d.Set(names.AttrDescription, out.Description) - d.Set("parameter", flattenExtensionParameters(out.Parameters)) + d.Set(names.AttrParameter, flattenExtensionParameters(out.Parameters)) d.Set(names.AttrName, out.Name) d.Set(names.AttrVersion, out.VersionNumber) @@ -206,8 +206,8 @@ func resourceExtensionUpdate(ctx context.Context, d *schema.ResourceData, meta i requestUpdate = true } - if d.HasChange("parameter") { - in.Parameters = expandExtensionParameters(d.Get("parameter").(*schema.Set).List()) + if d.HasChange(names.AttrParameter) { + in.Parameters = expandExtensionParameters(d.Get(names.AttrParameter).(*schema.Set).List()) requestUpdate = true } From aa916d96d15c5e3f10ce1e1d00a83ed089e8a0c7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:42 -0400 Subject: [PATCH 1188/1490] ce: Use constant for parameter strings --- internal/service/ce/cost_category.go | 6 +++--- internal/service/ce/cost_category_data_source.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/ce/cost_category.go b/internal/service/ce/cost_category.go index 5b361a7628e..1aec6bd90df 100644 --- a/internal/service/ce/cost_category.go +++ b/internal/service/ce/cost_category.go @@ -130,7 +130,7 @@ func resourceCostCategory() *schema.Resource { Required: true, ValidateDiagFunc: enum.Validate[awstypes.CostCategorySplitChargeMethod](), }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -640,7 +640,7 @@ func expandCostCategorySplitChargeRule(tfMap map[string]interface{}) *awstypes.C Source: aws.String(tfMap[names.AttrSource].(string)), Targets: flex.ExpandStringValueSet(tfMap["targets"].(*schema.Set)), } - if v, ok := tfMap["parameter"]; ok { + if v, ok := tfMap[names.AttrParameter]; ok { apiObject.Parameters = expandCostCategorySplitChargeRuleParameters(v.(*schema.Set).List()) } @@ -847,7 +847,7 @@ func flattenCostCategorySplitChargeRule(apiObject *awstypes.CostCategorySplitCha tfMap := map[string]interface{}{} tfMap["method"] = string(apiObject.Method) - tfMap["parameter"] = flattenCostCategorySplitChargeRuleParameters(apiObject.Parameters) + tfMap[names.AttrParameter] = flattenCostCategorySplitChargeRuleParameters(apiObject.Parameters) tfMap[names.AttrSource] = aws.ToString(apiObject.Source) tfMap["targets"] = apiObject.Targets diff --git a/internal/service/ce/cost_category_data_source.go b/internal/service/ce/cost_category_data_source.go index 3d32843d43f..594d9f32c5c 100644 --- a/internal/service/ce/cost_category_data_source.go +++ b/internal/service/ce/cost_category_data_source.go @@ -94,7 +94,7 @@ func dataSourceCostCategory() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ From 255de3846ca7d2ce0df8e5bb3eef81e9c7674b5e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:42 -0400 Subject: [PATCH 1189/1490] configservice: Use constant for parameter strings --- internal/service/configservice/remediation_configuration.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/configservice/remediation_configuration.go b/internal/service/configservice/remediation_configuration.go index 21dab3a326e..9800aa0cea6 100644 --- a/internal/service/configservice/remediation_configuration.go +++ b/internal/service/configservice/remediation_configuration.go @@ -85,7 +85,7 @@ func resourceRemediationConfiguration() *schema.Resource { Optional: true, ValidateFunc: validation.IntBetween(1, 25), }, - "parameter": { + names.AttrParameter: { Type: schema.TypeList, MaxItems: 25, Optional: true, @@ -161,7 +161,7 @@ func resourceRemediationConfigurationPut(ctx context.Context, d *schema.Resource remediationConfiguration.MaximumAutomaticAttempts = aws.Int32(int32(v.(int))) } - if v, ok := d.GetOk("parameter"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrParameter); ok && len(v.([]interface{})) > 0 { remediationConfiguration.Parameters = expandRemediationParameterValues(v.([]interface{})) } @@ -223,7 +223,7 @@ func resourceRemediationConfigurationRead(ctx context.Context, d *schema.Resourc return sdkdiag.AppendErrorf(diags, "setting execution_controls: %s", err) } d.Set("maximum_automatic_attempts", remediationConfiguration.MaximumAutomaticAttempts) - if err := d.Set("parameter", flattenRemediationParameterValues(remediationConfiguration.Parameters)); err != nil { + if err := d.Set(names.AttrParameter, flattenRemediationParameterValues(remediationConfiguration.Parameters)); err != nil { return sdkdiag.AppendErrorf(diags, "setting parameter: %s", err) } d.Set("resource_type", remediationConfiguration.ResourceType) From 85b8822989b780d2e34dc5e57c997700219c1b9e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:42 -0400 Subject: [PATCH 1190/1490] docdb: Use constant for parameter strings --- internal/service/docdb/cluster_parameter_group.go | 10 +++++----- internal/service/docdb/cluster_parameter_group_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/docdb/cluster_parameter_group.go b/internal/service/docdb/cluster_parameter_group.go index 959a97abd7c..025a7beae34 100644 --- a/internal/service/docdb/cluster_parameter_group.go +++ b/internal/service/docdb/cluster_parameter_group.go @@ -71,7 +71,7 @@ func ResourceClusterParameterGroup() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validParamGroupNamePrefix, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -121,7 +121,7 @@ func resourceClusterParameterGroupCreate(ctx context.Context, d *schema.Resource d.SetId(name) - if v, ok := d.GetOk("parameter"); ok && v.(*schema.Set).Len() > 0 { + if v, ok := d.GetOk(names.AttrParameter); ok && v.(*schema.Set).Len() > 0 { err := modifyClusterParameterGroupParameters(ctx, conn, d.Id(), expandParameters(v.(*schema.Set).List())) if err != nil { @@ -164,7 +164,7 @@ func resourceClusterParameterGroupRead(ctx context.Context, d *schema.ResourceDa return sdkdiag.AppendErrorf(diags, "reading DocumentDB Cluster Parameter Group (%s) parameters: %s", d.Id(), err) } - if err := d.Set("parameter", flattenParameters(parameters, d.Get("parameter").(*schema.Set).List())); err != nil { + if err := d.Set(names.AttrParameter, flattenParameters(parameters, d.Get(names.AttrParameter).(*schema.Set).List())); err != nil { return sdkdiag.AppendErrorf(diags, "setting parameter: %s", err) } @@ -175,8 +175,8 @@ func resourceClusterParameterGroupUpdate(ctx context.Context, d *schema.Resource var diags diag.Diagnostics conn := meta.(*conns.AWSClient).DocDBConn(ctx) - if d.HasChange("parameter") { - o, n := d.GetChange("parameter") + if d.HasChange(names.AttrParameter) { + o, n := d.GetChange(names.AttrParameter) os, ns := o.(*schema.Set), n.(*schema.Set) if parameters := expandParameters(ns.Difference(os).List()); len(parameters) > 0 { diff --git a/internal/service/docdb/cluster_parameter_group_test.go b/internal/service/docdb/cluster_parameter_group_test.go index 2330fc320c0..84f403bedc3 100644 --- a/internal/service/docdb/cluster_parameter_group_test.go +++ b/internal/service/docdb/cluster_parameter_group_test.go @@ -185,7 +185,7 @@ func TestAccDocDBClusterParameterGroup_systemParameter(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"parameter"}, + ImportStateVerifyIgnore: []string{names.AttrParameter}, }, }, }) From 7c3dc40319ee7b37b2dda54afd3b06bc611a0fa6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:42 -0400 Subject: [PATCH 1191/1490] elasticache: Use constant for parameter strings --- internal/service/elasticache/parameter_group.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/elasticache/parameter_group.go b/internal/service/elasticache/parameter_group.go index efd59ed47e8..1c0aa970752 100644 --- a/internal/service/elasticache/parameter_group.go +++ b/internal/service/elasticache/parameter_group.go @@ -64,7 +64,7 @@ func resourceParameterGroup() *schema.Resource { return strings.ToLower(val.(string)) }, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -153,7 +153,7 @@ func resourceParameterGroupRead(ctx context.Context, d *schema.ResourceData, met return sdkdiag.AppendErrorf(diags, "reading ElastiCache Parameter Group (%s) parameters: %s", d.Id(), err) } - d.Set("parameter", flattenParameters(output.Parameters)) + d.Set(names.AttrParameter, flattenParameters(output.Parameters)) return diags } @@ -162,8 +162,8 @@ func resourceParameterGroupUpdate(ctx context.Context, d *schema.ResourceData, m var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ElastiCacheConn(ctx) - if d.HasChange("parameter") { - o, n := d.GetChange("parameter") + if d.HasChange(names.AttrParameter) { + o, n := d.GetChange(names.AttrParameter) toRemove, toAdd := parameterChanges(o, n) // We can only modify 20 parameters at a time, so walk them until From 5a556b1f6133e6e61f66b939b32ac2c50c2c16f1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:42 -0400 Subject: [PATCH 1192/1490] fis: Use constant for parameter strings --- internal/service/fis/experiment_template.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/fis/experiment_template.go b/internal/service/fis/experiment_template.go index ca736f72613..65c3d792540 100644 --- a/internal/service/fis/experiment_template.go +++ b/internal/service/fis/experiment_template.go @@ -75,7 +75,7 @@ func ResourceExperimentTemplate() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(0, 64), }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -460,7 +460,7 @@ func expandExperimentTemplateActions(l *schema.Set) map[string]types.CreateExper config.Description = aws.String(v) } - if v, ok := raw["parameter"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := raw[names.AttrParameter].(*schema.Set); ok && v.Len() > 0 { config.Parameters = expandExperimentTemplateActionParameteres(v) } @@ -499,7 +499,7 @@ func expandExperimentTemplateActionsForUpdate(l *schema.Set) map[string]types.Up config.Description = aws.String(v) } - if v, ok := raw["parameter"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := raw[names.AttrParameter].(*schema.Set); ok && v.Len() > 0 { config.Parameters = expandExperimentTemplateActionParameteres(v) } @@ -825,7 +825,7 @@ func flattenExperimentTemplateActions(configured map[string]types.ExperimentTemp item := make(map[string]interface{}) item["action_id"] = aws.ToString(v.ActionId) item[names.AttrDescription] = aws.ToString(v.Description) - item["parameter"] = flattenExperimentTemplateActionParameters(v.Parameters) + item[names.AttrParameter] = flattenExperimentTemplateActionParameters(v.Parameters) item["start_after"] = v.StartAfter item[names.AttrTarget] = flattenExperimentTemplateActionTargets(v.Targets) From 529f5fba97b0bd1f263e9a5a85f60ce15f572900 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:43 -0400 Subject: [PATCH 1193/1490] imagebuilder: Use constant for parameter strings --- internal/service/imagebuilder/container_recipe.go | 2 +- .../service/imagebuilder/container_recipe_data_source.go | 2 +- internal/service/imagebuilder/flex.go | 4 ++-- internal/service/imagebuilder/image.go | 2 +- internal/service/imagebuilder/image_recipe.go | 6 +++--- internal/service/imagebuilder/image_recipe_data_source.go | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/imagebuilder/container_recipe.go b/internal/service/imagebuilder/container_recipe.go index a28a940961d..e534839bd34 100644 --- a/internal/service/imagebuilder/container_recipe.go +++ b/internal/service/imagebuilder/container_recipe.go @@ -52,7 +52,7 @@ func ResourceContainerRecipe() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, 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 a317e0a632b..2a2b1f0d88b 100644 --- a/internal/service/imagebuilder/container_recipe_data_source.go +++ b/internal/service/imagebuilder/container_recipe_data_source.go @@ -36,7 +36,7 @@ func DataSourceContainerRecipe() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ diff --git a/internal/service/imagebuilder/flex.go b/internal/service/imagebuilder/flex.go index d03314d863d..572f2c7bf26 100644 --- a/internal/service/imagebuilder/flex.go +++ b/internal/service/imagebuilder/flex.go @@ -64,7 +64,7 @@ func flattenWorkflowConfiguration(apiObject *imagebuilder.WorkflowConfiguration) } if v := apiObject.Parameters; v != nil { - tfMap["parameter"] = flattenWorkflowParameters(v) + tfMap[names.AttrParameter] = flattenWorkflowParameters(v) } if v := apiObject.WorkflowArn; v != nil { @@ -153,7 +153,7 @@ func expandWorkflowConfiguration(tfMap map[string]interface{}) *imagebuilder.Wor apiObject.ParallelGroup = aws.String(v) } - if v, ok := tfMap["parameter"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := tfMap[names.AttrParameter].(*schema.Set); ok && v.Len() > 0 { apiObject.Parameters = expandWorkflowParameters(v.List()) } diff --git a/internal/service/imagebuilder/image.go b/internal/service/imagebuilder/image.go index 30f16cdeec1..8339e5c34cc 100644 --- a/internal/service/imagebuilder/image.go +++ b/internal/service/imagebuilder/image.go @@ -237,7 +237,7 @@ func ResourceImage() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^[A-Za-z0-9][A-Za-z0-9-_+#]{0,99}$`), "valid parallel group string must be provider"), }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, ForceNew: true, diff --git a/internal/service/imagebuilder/image_recipe.go b/internal/service/imagebuilder/image_recipe.go index 60222643247..b47ed16ba1e 100644 --- a/internal/service/imagebuilder/image_recipe.go +++ b/internal/service/imagebuilder/image_recipe.go @@ -142,7 +142,7 @@ func ResourceImageRecipe() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -393,7 +393,7 @@ func expandComponentConfiguration(tfMap map[string]interface{}) *imagebuilder.Co apiObject.ComponentArn = aws.String(v) } - if v, ok := tfMap["parameter"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := tfMap[names.AttrParameter].(*schema.Set); ok && v.Len() > 0 { apiObject.Parameters = expandComponentParameters(v.List()) } @@ -592,7 +592,7 @@ func flattenComponentConfiguration(apiObject *imagebuilder.ComponentConfiguratio } if v := apiObject.Parameters; v != nil { - tfMap["parameter"] = flattenComponentParameters(v) + tfMap[names.AttrParameter] = flattenComponentParameters(v) } return tfMap diff --git a/internal/service/imagebuilder/image_recipe_data_source.go b/internal/service/imagebuilder/image_recipe_data_source.go index 61c27fbc9ec..20df98a6c93 100644 --- a/internal/service/imagebuilder/image_recipe_data_source.go +++ b/internal/service/imagebuilder/image_recipe_data_source.go @@ -97,7 +97,7 @@ func DataSourceImageRecipe() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ From 10108472ebe2cb0d75bc9b13cf061308f30d99c4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:43 -0400 Subject: [PATCH 1194/1490] memorydb: Use constant for parameter strings --- internal/service/memorydb/parameter_group.go | 10 +++++----- .../service/memorydb/parameter_group_data_source.go | 4 ++-- internal/service/memorydb/parameter_group_test.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/memorydb/parameter_group.go b/internal/service/memorydb/parameter_group.go index 877c845404b..369d2a5d39c 100644 --- a/internal/service/memorydb/parameter_group.go +++ b/internal/service/memorydb/parameter_group.go @@ -74,7 +74,7 @@ func ResourceParameterGroup() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validateResourceNamePrefix(parameterGroupNameMaxLength - id.UniqueIDSuffixLength), }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -131,8 +131,8 @@ func resourceParameterGroupUpdate(ctx context.Context, d *schema.ResourceData, m conn := meta.(*conns.AWSClient).MemoryDBConn(ctx) - if d.HasChange("parameter") { - o, n := d.GetChange("parameter") + if d.HasChange(names.AttrParameter) { + o, n := d.GetChange(names.AttrParameter) toRemove, toAdd := ParameterChanges(o, n) log.Printf("[DEBUG] Updating MemoryDB Parameter Group (%s)", d.Id()) @@ -209,7 +209,7 @@ func resourceParameterGroupRead(ctx context.Context, d *schema.ResourceData, met return sdkdiag.AppendErrorf(diags, "listing parameters for MemoryDB Parameter Group (%s): %s", d.Id(), err) } - if err := d.Set("parameter", flattenParameters(parameters)); err != nil { + if err := d.Set(names.AttrParameter, flattenParameters(parameters)); err != nil { return sdkdiag.AppendErrorf(diags, "failed to set parameter: %s", err) } @@ -402,7 +402,7 @@ func expandParameterNameValue(param map[string]interface{}) *memorydb.ParameterN func createUserDefinedParameterMap(d *schema.ResourceData) map[string]string { result := map[string]string{} - for _, param := range d.Get("parameter").(*schema.Set).List() { + for _, param := range d.Get(names.AttrParameter).(*schema.Set).List() { m, ok := param.(map[string]interface{}) if !ok { continue diff --git a/internal/service/memorydb/parameter_group_data_source.go b/internal/service/memorydb/parameter_group_data_source.go index e560843f404..ad0442fb02c 100644 --- a/internal/service/memorydb/parameter_group_data_source.go +++ b/internal/service/memorydb/parameter_group_data_source.go @@ -38,7 +38,7 @@ func DataSourceParameterGroup() *schema.Resource { Type: schema.TypeString, Required: true, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ @@ -88,7 +88,7 @@ func dataSourceParameterGroupRead(ctx context.Context, d *schema.ResourceData, m return sdkdiag.AppendErrorf(diags, "listing parameters for MemoryDB Parameter Group (%s): %s", d.Id(), err) } - if err := d.Set("parameter", flattenParameters(parameters)); err != nil { + if err := d.Set(names.AttrParameter, flattenParameters(parameters)); err != nil { return sdkdiag.AppendErrorf(diags, "failed to set parameter: %s", err) } diff --git a/internal/service/memorydb/parameter_group_test.go b/internal/service/memorydb/parameter_group_test.go index 44dc2f45617..aa06cffd1e2 100644 --- a/internal/service/memorydb/parameter_group_test.go +++ b/internal/service/memorydb/parameter_group_test.go @@ -127,7 +127,7 @@ func TestAccMemoryDBParameterGroup_update_parameters(t *testing.T) { ImportStateVerify: true, // Setting timeout to its default value will cause // the import to diverge on the initial read. - ImportStateVerifyIgnore: []string{"parameter"}, + ImportStateVerifyIgnore: []string{names.AttrParameter}, }, { Config: testAccParameterGroupConfig_one(rName, "timeout", "20"), From c5ed85fca52476dbedc5068632586123a0e6467c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:43 -0400 Subject: [PATCH 1195/1490] neptune: Use constant for parameter strings --- internal/service/neptune/cluster_parameter_group.go | 12 ++++++------ internal/service/neptune/parameter_group.go | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/neptune/cluster_parameter_group.go b/internal/service/neptune/cluster_parameter_group.go index 2807e14fea2..fdc70d5ffb6 100644 --- a/internal/service/neptune/cluster_parameter_group.go +++ b/internal/service/neptune/cluster_parameter_group.go @@ -71,7 +71,7 @@ func ResourceClusterParameterGroup() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validParamGroupNamePrefix, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -121,7 +121,7 @@ func resourceClusterParameterGroupCreate(ctx context.Context, d *schema.Resource d.SetId(name) - if v, ok := d.GetOk("parameter"); ok && v.(*schema.Set).Len() > 0 { + if v, ok := d.GetOk(names.AttrParameter); ok && v.(*schema.Set).Len() > 0 { if err := modifyClusterParameterGroupParameters(ctx, conn, d.Id(), expandParameters(v.(*schema.Set).List())); err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -166,7 +166,7 @@ func resourceClusterParameterGroupRead(ctx context.Context, d *schema.ResourceDa } // Add only system parameters that are set in the config. - p := d.Get("parameter") + p := d.Get(names.AttrParameter) if p == nil { p = new(schema.Set) } @@ -189,7 +189,7 @@ func resourceClusterParameterGroupRead(ctx context.Context, d *schema.ResourceDa parameters = append(parameters, systemParameters...) - if err := d.Set("parameter", flattenParameters(parameters)); err != nil { + if err := d.Set(names.AttrParameter, flattenParameters(parameters)); err != nil { return sdkdiag.AppendErrorf(diags, "setting parameter: %s", err) } @@ -200,8 +200,8 @@ func resourceClusterParameterGroupUpdate(ctx context.Context, d *schema.Resource var diags diag.Diagnostics conn := meta.(*conns.AWSClient).NeptuneConn(ctx) - if d.HasChange("parameter") { - o, n := d.GetChange("parameter") + if d.HasChange(names.AttrParameter) { + o, n := d.GetChange(names.AttrParameter) os, ns := o.(*schema.Set), n.(*schema.Set) if parameters := expandParameters(ns.Difference(os).List()); len(parameters) > 0 { diff --git a/internal/service/neptune/parameter_group.go b/internal/service/neptune/parameter_group.go index e438ed4cb66..d12bb7e9f8b 100644 --- a/internal/service/neptune/parameter_group.go +++ b/internal/service/neptune/parameter_group.go @@ -75,7 +75,7 @@ func ResourceParameterGroup() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validParamGroupNamePrefix, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -125,7 +125,7 @@ func resourceParameterGroupCreate(ctx context.Context, d *schema.ResourceData, m d.SetId(aws.StringValue(output.DBParameterGroup.DBParameterGroupName)) - if v, ok := d.GetOk("parameter"); ok && v.(*schema.Set).Len() > 0 { + if v, ok := d.GetOk(names.AttrParameter); ok && v.(*schema.Set).Len() > 0 { if err := addDBParameterGroupParameters(ctx, conn, d.Id(), expandParameters(v.(*schema.Set).List())); err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -168,7 +168,7 @@ func resourceParameterGroupRead(ctx context.Context, d *schema.ResourceData, met return sdkdiag.AppendErrorf(diags, "reading Neptune Parameter Group (%s) parameters: %s", d.Id(), err) } - if err := d.Set("parameter", flattenParameters(parameters)); err != nil { + if err := d.Set(names.AttrParameter, flattenParameters(parameters)); err != nil { return sdkdiag.AppendErrorf(diags, "setting parameter: %s", err) } @@ -179,8 +179,8 @@ func resourceParameterGroupUpdate(ctx context.Context, d *schema.ResourceData, m var diags diag.Diagnostics conn := meta.(*conns.AWSClient).NeptuneConn(ctx) - if d.HasChange("parameter") { - o, n := d.GetChange("parameter") + if d.HasChange(names.AttrParameter) { + o, n := d.GetChange(names.AttrParameter) os, ns := o.(*schema.Set), n.(*schema.Set) add, del := ns.Difference(os).List(), os.Difference(ns).List() From 4577f9d58c31605fbff78fa7b273f405a53135f2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:43 -0400 Subject: [PATCH 1196/1490] schema: Use constant for parameter strings --- .../service/quicksight/schema/template_filter.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/quicksight/schema/template_filter.go b/internal/service/quicksight/schema/template_filter.go index c6b7d220c94..1a69e039b7d 100644 --- a/internal/service/quicksight/schema/template_filter.go +++ b/internal/service/quicksight/schema/template_filter.go @@ -332,7 +332,7 @@ func numericRangeFilterValueSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "parameter": { + names.AttrParameter: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.All( @@ -357,7 +357,7 @@ func timeRangeFilterValueSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "parameter": { + names.AttrParameter: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.All( @@ -864,7 +864,7 @@ func expandNumericRangeFilterValue(tfList []interface{}) *quicksight.NumericRang filter := &quicksight.NumericRangeFilterValue{} - if v, ok := tfMap["parameter"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrParameter].(string); ok && v != "" { filter.Parameter = aws.String(v) } if v, ok := tfMap["static_value"].(float64); ok { @@ -1054,7 +1054,7 @@ func expandTimeRangeFilterValue(tfList []interface{}) *quicksight.TimeRangeFilte filter := &quicksight.TimeRangeFilterValue{} - if v, ok := tfMap["parameter"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrParameter].(string); ok && v != "" { filter.Parameter = aws.String(v) } if v, ok := tfMap["static_value"].(string); ok && v != "" { @@ -1483,7 +1483,7 @@ func flattenNumericRangeFilterValue(apiObject *quicksight.NumericRangeFilterValu tfMap := map[string]interface{}{} if apiObject.Parameter != nil { - tfMap["parameter"] = aws.StringValue(apiObject.Parameter) + tfMap[names.AttrParameter] = aws.StringValue(apiObject.Parameter) } if apiObject.StaticValue != nil { tfMap["static_value"] = aws.Float64Value(apiObject.StaticValue) @@ -1636,7 +1636,7 @@ func flattenTimeRangeFilterValue(apiObject *quicksight.TimeRangeFilterValue) []i tfMap := map[string]interface{}{} if apiObject.Parameter != nil { - tfMap["parameter"] = aws.StringValue(apiObject.Parameter) + tfMap[names.AttrParameter] = aws.StringValue(apiObject.Parameter) } if apiObject.RollingDate != nil { tfMap["rolling_date"] = flattenRollingDateConfiguration(apiObject.RollingDate) From 01e5fd8f048e919760263fed00bb5a7120439a4f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:43 -0400 Subject: [PATCH 1197/1490] rds: Use constant for parameter strings --- internal/service/rds/cluster_parameter_group.go | 10 +++++----- internal/service/rds/parameter_group.go | 10 +++++----- internal/service/rds/parameter_group_test.go | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/rds/cluster_parameter_group.go b/internal/service/rds/cluster_parameter_group.go index f116ad37e42..50199867fc8 100644 --- a/internal/service/rds/cluster_parameter_group.go +++ b/internal/service/rds/cluster_parameter_group.go @@ -73,7 +73,7 @@ func ResourceClusterParameterGroup() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validParamGroupNamePrefix, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -177,7 +177,7 @@ func resourceClusterParameterGroupRead(ctx context.Context, d *schema.ResourceDa } // add only system parameters that are set in the config - p := d.Get("parameter") + p := d.Get(names.AttrParameter) if p == nil { p = new(schema.Set) } @@ -209,7 +209,7 @@ func resourceClusterParameterGroupRead(ctx context.Context, d *schema.ResourceDa return sdkdiag.AppendErrorf(diags, "reading RDS Cluster Parameter Group (%s) parameters: %s", d.Id(), err) } - if err := d.Set("parameter", flattenParameters(parameters)); err != nil { + if err := d.Set(names.AttrParameter, flattenParameters(parameters)); err != nil { return sdkdiag.AppendErrorf(diags, "setting parameter: %s", err) } @@ -223,8 +223,8 @@ func resourceClusterParameterGroupUpdate(ctx context.Context, d *schema.Resource var diags diag.Diagnostics conn := meta.(*conns.AWSClient).RDSConn(ctx) - if d.HasChange("parameter") { - o, n := d.GetChange("parameter") + if d.HasChange(names.AttrParameter) { + o, n := d.GetChange(names.AttrParameter) if o == nil { o = new(schema.Set) } diff --git a/internal/service/rds/parameter_group.go b/internal/service/rds/parameter_group.go index 546903e074d..6b1dfe22d9b 100644 --- a/internal/service/rds/parameter_group.go +++ b/internal/service/rds/parameter_group.go @@ -74,7 +74,7 @@ func ResourceParameterGroup() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validParamGroupNamePrefix, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -155,7 +155,7 @@ func resourceParameterGroupRead(ctx context.Context, d *schema.ResourceData, met DBParameterGroupName: aws.String(d.Id()), } - configParams := d.Get("parameter").(*schema.Set) + configParams := d.Get(names.AttrParameter).(*schema.Set) if configParams.Len() < 1 { // if we don't have any params in the ResourceData already, two possibilities // first, we don't have a config available to us. Second, we do, but it has @@ -219,7 +219,7 @@ func resourceParameterGroupRead(ctx context.Context, d *schema.ResourceData, met } } - if err := d.Set("parameter", flattenParameters(userParams)); err != nil { + if err := d.Set(names.AttrParameter, flattenParameters(userParams)); err != nil { return sdkdiag.AppendErrorf(diags, "setting parameter: %s", err) } @@ -233,8 +233,8 @@ func resourceParameterGroupUpdate(ctx context.Context, d *schema.ResourceData, m var diags diag.Diagnostics conn := meta.(*conns.AWSClient).RDSConn(ctx) - if d.HasChange("parameter") { - o, n := d.GetChange("parameter") + if d.HasChange(names.AttrParameter) { + o, n := d.GetChange(names.AttrParameter) if o == nil { o = new(schema.Set) } diff --git a/internal/service/rds/parameter_group_test.go b/internal/service/rds/parameter_group_test.go index 44db48ebfa8..ed8748f9b27 100644 --- a/internal/service/rds/parameter_group_test.go +++ b/internal/service/rds/parameter_group_test.go @@ -710,7 +710,7 @@ func TestAccRDSParameterGroup_matchDefault(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"parameter"}, + ImportStateVerifyIgnore: []string{names.AttrParameter}, }, }, }) From dca3d67fa522751c82039b5aedbe9576031d5466 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:44 -0400 Subject: [PATCH 1198/1490] redshift: Use constant for parameter strings --- internal/service/redshift/parameter_group.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/redshift/parameter_group.go b/internal/service/redshift/parameter_group.go index 32c6f92b44d..d534482ff6a 100644 --- a/internal/service/redshift/parameter_group.go +++ b/internal/service/redshift/parameter_group.go @@ -69,7 +69,7 @@ func resourceParameterGroup() *schema.Resource { validation.StringDoesNotMatch(regexache.MustCompile(`-$`), "cannot end with a hyphen"), ), }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -114,7 +114,7 @@ func resourceParameterGroupCreate(ctx context.Context, d *schema.ResourceData, m d.SetId(name) - if v := d.Get("parameter").(*schema.Set); v.Len() > 0 { + if v := d.Get(names.AttrParameter).(*schema.Set); v.Len() > 0 { input := &redshift.ModifyClusterParameterGroupInput{ ParameterGroupName: aws.String(d.Id()), Parameters: expandParameters(v.List()), @@ -171,7 +171,7 @@ func resourceParameterGroupRead(ctx context.Context, d *schema.ResourceData, met return sdkdiag.AppendErrorf(diags, "reading Redshift Parameter Group (%s) parameters: %s", d.Id(), err) } - d.Set("parameter", flattenParameters(output.Parameters)) + d.Set(names.AttrParameter, flattenParameters(output.Parameters)) return diags } @@ -180,8 +180,8 @@ func resourceParameterGroupUpdate(ctx context.Context, d *schema.ResourceData, m var diags diag.Diagnostics conn := meta.(*conns.AWSClient).RedshiftConn(ctx) - if d.HasChange("parameter") { - o, n := d.GetChange("parameter") + if d.HasChange(names.AttrParameter) { + o, n := d.GetChange(names.AttrParameter) if o == nil { o = new(schema.Set) } From 0a545e4a3771225701f1bf8b28945017cb8e99c3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:44 -0400 Subject: [PATCH 1199/1490] securityhub: Use constant for parameter strings --- internal/service/securityhub/configuration_policy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/securityhub/configuration_policy.go b/internal/service/securityhub/configuration_policy.go index 2308d49994b..03cdaedb4bf 100644 --- a/internal/service/securityhub/configuration_policy.go +++ b/internal/service/securityhub/configuration_policy.go @@ -224,7 +224,7 @@ func resourceConfigurationPolicy() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Required: true, MinItems: 1, @@ -489,7 +489,7 @@ func expandSecurityControlCustomParameter(tfMap map[string]interface{}) types.Se apiObject.SecurityControlId = aws.String(v) } - if v, ok := tfMap["parameter"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := tfMap[names.AttrParameter].(*schema.Set); ok && v.Len() > 0 { for _, tfMapRaw := range v.List() { tfMap, ok := tfMapRaw.(map[string]interface{}) if !ok { @@ -693,7 +693,7 @@ func flattenSecurityControlCustomParameter(apiObject types.SecurityControlCustom tfList = append(tfList, tfMap) } - tfMap["parameter"] = tfList + tfMap[names.AttrParameter] = tfList return tfMap } From 4ffcf8c43fd6b96f235ff2cc01bc631eb3c69c82 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:44 -0400 Subject: [PATCH 1200/1490] ssm: Use constant for parameter strings --- internal/service/ssm/document.go | 6 +++--- internal/service/ssm/maintenance_window_task.go | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/ssm/document.go b/internal/service/ssm/document.go index 9b98c1b45dd..c55e31ced19 100644 --- a/internal/service/ssm/document.go +++ b/internal/service/ssm/document.go @@ -141,7 +141,7 @@ func ResourceDocument() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -239,7 +239,7 @@ func ResourceDocument() *schema.Resource { if err := d.SetNewComputed("latest_version"); err != nil { return err } - if err := d.SetNewComputed("parameter"); err != nil { + if err := d.SetNewComputed(names.AttrParameter); err != nil { return err } } @@ -347,7 +347,7 @@ func resourceDocumentRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("latest_version", doc.LatestVersion) d.Set(names.AttrName, doc.Name) d.Set("owner", doc.Owner) - if err := d.Set("parameter", flattenDocumentParameters(doc.Parameters)); err != nil { + if err := d.Set(names.AttrParameter, flattenDocumentParameters(doc.Parameters)); err != nil { return sdkdiag.AppendErrorf(diags, "setting parameter: %s", err) } d.Set("platform_types", aws.StringValueSlice(doc.PlatformTypes)) diff --git a/internal/service/ssm/maintenance_window_task.go b/internal/service/ssm/maintenance_window_task.go index a35e3d1ab96..d4186836de3 100644 --- a/internal/service/ssm/maintenance_window_task.go +++ b/internal/service/ssm/maintenance_window_task.go @@ -146,7 +146,7 @@ func ResourceMaintenanceWindowTask() *schema.Resource { Optional: true, ValidateFunc: validation.StringMatch(regexache.MustCompile("([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)"), "see https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_MaintenanceWindowAutomationParameters.html"), }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -265,7 +265,7 @@ func ResourceMaintenanceWindowTask() *schema.Resource { Optional: true, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -400,7 +400,7 @@ func expandTaskInvocationAutomationParameters(config []interface{}) *ssm.Mainten if attr, ok := configParam["document_version"]; ok && len(attr.(string)) != 0 { params.DocumentVersion = aws.String(attr.(string)) } - if attr, ok := configParam["parameter"]; ok && len(attr.(*schema.Set).List()) > 0 { + if attr, ok := configParam[names.AttrParameter]; ok && len(attr.(*schema.Set).List()) > 0 { params.Parameters = expandTaskInvocationCommonParameters(attr.(*schema.Set).List()) } @@ -414,7 +414,7 @@ func flattenTaskInvocationAutomationParameters(parameters *ssm.MaintenanceWindow result["document_version"] = aws.StringValue(parameters.DocumentVersion) } if parameters.Parameters != nil { - result["parameter"] = flattenTaskInvocationCommonParameters(parameters.Parameters) + result[names.AttrParameter] = flattenTaskInvocationCommonParameters(parameters.Parameters) } return []interface{}{result} @@ -482,7 +482,7 @@ func expandTaskInvocationRunCommandParameters(config []interface{}) *ssm.Mainten if attr, ok := configParam["output_s3_key_prefix"]; ok && len(attr.(string)) != 0 { params.OutputS3KeyPrefix = aws.String(attr.(string)) } - if attr, ok := configParam["parameter"]; ok && len(attr.(*schema.Set).List()) > 0 { + if attr, ok := configParam[names.AttrParameter]; ok && len(attr.(*schema.Set).List()) > 0 { params.Parameters = expandTaskInvocationCommonParameters(attr.(*schema.Set).List()) } if attr, ok := configParam["service_role_arn"]; ok && len(attr.(string)) != 0 { @@ -523,7 +523,7 @@ func flattenTaskInvocationRunCommandParameters(parameters *ssm.MaintenanceWindow result["output_s3_key_prefix"] = aws.StringValue(parameters.OutputS3KeyPrefix) } if parameters.Parameters != nil { - result["parameter"] = flattenTaskInvocationCommonParameters(parameters.Parameters) + result[names.AttrParameter] = flattenTaskInvocationCommonParameters(parameters.Parameters) } if parameters.ServiceRoleArn != nil { result["service_role_arn"] = aws.StringValue(parameters.ServiceRoleArn) From ae34f77b58b0d1ed65128673699d96c8b42a3c72 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:31:44 -0400 Subject: [PATCH 1201/1490] ssmincidents: Use constant for parameter strings --- internal/service/ssmincidents/flex.go | 4 ++-- internal/service/ssmincidents/response_plan.go | 2 +- internal/service/ssmincidents/response_plan_data_source.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/ssmincidents/flex.go b/internal/service/ssmincidents/flex.go index f36744c8f0e..b5efc8a8764 100644 --- a/internal/service/ssmincidents/flex.go +++ b/internal/service/ssmincidents/flex.go @@ -231,7 +231,7 @@ func expandSSMAutomations(automations []interface{}) []types.Action { ssmAutomation.TargetAccount = types.SsmTargetAccount(v) } - if v, ok := automationData["parameter"].(*schema.Set); ok { + if v, ok := automationData[names.AttrParameter].(*schema.Set); ok { ssmAutomation.Parameters = expandParameters(v) } @@ -273,7 +273,7 @@ func flattenSSMAutomations(actions []types.Action) []interface{} { } if v := ssmAutomation.Parameters; v != nil { - a["parameter"] = flattenParameters(v) + a[names.AttrParameter] = flattenParameters(v) } if v := ssmAutomation.DynamicParameters; v != nil { diff --git a/internal/service/ssmincidents/response_plan.go b/internal/service/ssmincidents/response_plan.go index abd70719c0a..a1a2d5e17c2 100644 --- a/internal/service/ssmincidents/response_plan.go +++ b/internal/service/ssmincidents/response_plan.go @@ -63,7 +63,7 @@ func ResourceResponsePlan() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ diff --git a/internal/service/ssmincidents/response_plan_data_source.go b/internal/service/ssmincidents/response_plan_data_source.go index a5c3553b5f2..eec06d1a0ec 100644 --- a/internal/service/ssmincidents/response_plan_data_source.go +++ b/internal/service/ssmincidents/response_plan_data_source.go @@ -46,7 +46,7 @@ func DataSourceResponsePlan() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "parameter": { + names.AttrParameter: { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ From 7a2ed89db8bb9fa3da50672d04d6bd0e0cd0423b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:23 -0400 Subject: [PATCH 1202/1490] ci: Prefer constant for string literal "format" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index e5faa7f29d4..9ecd3abd241 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1455,3 +1455,13 @@ rules: - pattern: '"parameter"' severity: ERROR fix: "names.AttrParameter" + - id: literal-format-string-constant + languages: [go] + message: Use the constant `names.AttrFormat` for the string literal "format" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"format"' + severity: ERROR + fix: "names.AttrFormat" From a9cdb3475e842c65feea69b95efa3a65008dfa83 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:23 -0400 Subject: [PATCH 1203/1490] names: Add constant for string literal "format" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 490019ca50b..eee46b1f468 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -32,6 +32,7 @@ const ( AttrEngineVersion = "engine_version" AttrFileSystemID = "file_system_id" AttrFilter = "filter" + AttrFormat = "format" AttrHostedZoneID = "hosted_zone_id" AttrID = "id" // Should be explicitly declared only for Framework resources AttrInstanceID = "instance_id" From 18bec007616594a8b509d9a84a04660ef991cef0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:23 -0400 Subject: [PATCH 1204/1490] apigateway: Use constant for format strings --- internal/service/apigateway/stage.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/apigateway/stage.go b/internal/service/apigateway/stage.go index 2457a9ca463..be610862f76 100644 --- a/internal/service/apigateway/stage.go +++ b/internal/service/apigateway/stage.go @@ -64,7 +64,7 @@ func resourceStage() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, }, @@ -554,7 +554,7 @@ func flattenAccessLogSettings(accessLogSettings *types.AccessLogSettings) []map[ if accessLogSettings != nil { result = append(result, map[string]interface{}{ "destination_arn": aws.ToString(accessLogSettings.DestinationArn), - "format": aws.ToString(accessLogSettings.Format), + names.AttrFormat: aws.ToString(accessLogSettings.Format), }) } return result From 043063799994ae6ee1804fb95d124a864a960d8a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:23 -0400 Subject: [PATCH 1205/1490] apigatewayv2: Use constant for format strings --- internal/service/apigatewayv2/stage.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/apigatewayv2/stage.go b/internal/service/apigatewayv2/stage.go index 0b18ca800e1..8d6857d323d 100644 --- a/internal/service/apigatewayv2/stage.go +++ b/internal/service/apigatewayv2/stage.go @@ -54,7 +54,7 @@ func resourceStage() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, }, @@ -480,7 +480,7 @@ func expandAccessLogSettings(vSettings []interface{}) *awstypes.AccessLogSetting if vDestinationArn, ok := mSettings["destination_arn"].(string); ok && vDestinationArn != "" { settings.DestinationArn = aws.String(vDestinationArn) } - if vFormat, ok := mSettings["format"].(string); ok && vFormat != "" { + if vFormat, ok := mSettings[names.AttrFormat].(string); ok && vFormat != "" { settings.Format = aws.String(vFormat) } @@ -494,7 +494,7 @@ func flattenAccessLogSettings(settings *awstypes.AccessLogSettings) []interface{ return []interface{}{map[string]interface{}{ "destination_arn": aws.ToString(settings.DestinationArn), - "format": aws.ToString(settings.Format), + names.AttrFormat: aws.ToString(settings.Format), }} } From d47586e5ec7342ea384c567c389f5877e7a6d8a9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:24 -0400 Subject: [PATCH 1206/1490] appmesh: Use constant for format strings --- internal/service/appmesh/flex.go | 4 ++-- internal/service/appmesh/virtual_gateway.go | 6 +++--- internal/service/appmesh/virtual_node.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/appmesh/flex.go b/internal/service/appmesh/flex.go index d26054eaef5..d04946cbfd1 100644 --- a/internal/service/appmesh/flex.go +++ b/internal/service/appmesh/flex.go @@ -1033,7 +1033,7 @@ func expandVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec { mFile := vFile[0].(map[string]interface{}) - if vFormat, ok := mFile["format"].([]interface{}); ok && len(vFormat) > 0 && vFormat[0] != nil { + if vFormat, ok := mFile[names.AttrFormat].([]interface{}); ok && len(vFormat) > 0 && vFormat[0] != nil { format := &appmesh.LoggingFormat{} mFormat := vFormat[0].(map[string]interface{}) @@ -1871,7 +1871,7 @@ func flattenVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} { mFormat["text"] = aws.StringValue(text) } - mFile["format"] = []interface{}{mFormat} + mFile[names.AttrFormat] = []interface{}{mFormat} } mFile[names.AttrPath] = aws.StringValue(file.Path) diff --git a/internal/service/appmesh/virtual_gateway.go b/internal/service/appmesh/virtual_gateway.go index 0f49aae6528..4e8dce314cd 100644 --- a/internal/service/appmesh/virtual_gateway.go +++ b/internal/service/appmesh/virtual_gateway.go @@ -601,7 +601,7 @@ func resourceVirtualGatewaySpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "format": { + names.AttrFormat: { Type: schema.TypeList, Optional: true, MinItems: 0, @@ -1098,7 +1098,7 @@ func expandVirtualGatewaySpec(vSpec []interface{}) *appmesh.VirtualGatewaySpec { mFile := vFile[0].(map[string]interface{}) - if vFormat, ok := mFile["format"].([]interface{}); ok && len(vFormat) > 0 && vFormat[0] != nil { + if vFormat, ok := mFile[names.AttrFormat].([]interface{}); ok && len(vFormat) > 0 && vFormat[0] != nil { format := &appmesh.LoggingFormat{} mFormat := vFormat[0].(map[string]interface{}) @@ -1458,7 +1458,7 @@ func flattenVirtualGatewaySpec(spec *appmesh.VirtualGatewaySpec) []interface{} { mFormat["text"] = aws.StringValue(text) } - mFile["format"] = []interface{}{mFormat} + mFile[names.AttrFormat] = []interface{}{mFormat} } mFile[names.AttrPath] = aws.StringValue(file.Path) diff --git a/internal/service/appmesh/virtual_node.go b/internal/service/appmesh/virtual_node.go index 0bfe4dd0c8b..9d9a19e7b91 100644 --- a/internal/service/appmesh/virtual_node.go +++ b/internal/service/appmesh/virtual_node.go @@ -856,7 +856,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "format": { + names.AttrFormat: { Type: schema.TypeList, Optional: true, MinItems: 0, From e9034dfa485d44aca931d36ce1a5766daf279d17 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:24 -0400 Subject: [PATCH 1207/1490] appsync: Use constant for format strings --- internal/service/appsync/type.go | 8 ++++---- internal/service/appsync/type_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/appsync/type.go b/internal/service/appsync/type.go index b1141586ab2..06009b9e942 100644 --- a/internal/service/appsync/type.go +++ b/internal/service/appsync/type.go @@ -50,7 +50,7 @@ func ResourceType() *schema.Resource { Type: schema.TypeString, Required: true, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appsync.TypeDefinitionFormat_Values(), false), @@ -72,7 +72,7 @@ func resourceTypeCreate(ctx context.Context, d *schema.ResourceData, meta interf params := &appsync.CreateTypeInput{ ApiId: aws.String(apiID), Definition: aws.String(d.Get("definition").(string)), - Format: aws.String(d.Get("format").(string)), + Format: aws.String(d.Get(names.AttrFormat).(string)), } out, err := conn.CreateTypeWithContext(ctx, params) @@ -108,7 +108,7 @@ func resourceTypeRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set("api_id", apiID) d.Set(names.AttrARN, resp.Arn) d.Set(names.AttrName, resp.Name) - d.Set("format", resp.Format) + d.Set(names.AttrFormat, resp.Format) d.Set("definition", resp.Definition) d.Set(names.AttrDescription, resp.Description) @@ -121,7 +121,7 @@ func resourceTypeUpdate(ctx context.Context, d *schema.ResourceData, meta interf params := &appsync.UpdateTypeInput{ ApiId: aws.String(d.Get("api_id").(string)), - Format: aws.String(d.Get("format").(string)), + Format: aws.String(d.Get(names.AttrFormat).(string)), TypeName: aws.String(d.Get(names.AttrName).(string)), Definition: aws.String(d.Get("definition").(string)), } diff --git a/internal/service/appsync/type_test.go b/internal/service/appsync/type_test.go index c87dcd5820e..e4cf8ab4ab6 100644 --- a/internal/service/appsync/type_test.go +++ b/internal/service/appsync/type_test.go @@ -38,7 +38,7 @@ func testAccType_basic(t *testing.T) { testAccCheckTypeExists(ctx, resourceName, &typ), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "appsync", regexache.MustCompile("apis/.+/types/.+")), resource.TestCheckResourceAttrPair(resourceName, "api_id", "aws_appsync_graphql_api.test", names.AttrID), - resource.TestCheckResourceAttr(resourceName, "format", "SDL"), + resource.TestCheckResourceAttr(resourceName, names.AttrFormat, "SDL"), resource.TestCheckResourceAttr(resourceName, names.AttrName, "Mutation"), ), }, From 212db96e692f208e13f8364dd6098e2c3125fec1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:24 -0400 Subject: [PATCH 1208/1490] bcmdataexports: Use constant for format strings --- internal/service/bcmdataexports/export.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/bcmdataexports/export.go b/internal/service/bcmdataexports/export.go index 0055c1bb191..e3233c693f0 100644 --- a/internal/service/bcmdataexports/export.go +++ b/internal/service/bcmdataexports/export.go @@ -89,7 +89,7 @@ func (r *resourceExport) Schema(ctx context.Context, req resource.SchemaRequest, stringplanmodifier.RequiresReplace(), }, }, - "format": schema.StringAttribute{ + names.AttrFormat: schema.StringAttribute{ Required: true, CustomType: fwtypes.StringEnumType[awstypes.FormatOption](), PlanModifiers: []planmodifier.String{ From 91797c14a30add73a91f1c8f3c11c4fe00351527 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:24 -0400 Subject: [PATCH 1209/1490] cloudfront: Use constant for format strings --- .../service/cloudfront/field_level_encryption_config.go | 7 ++++--- .../cloudfront/field_level_encryption_config_test.go | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/service/cloudfront/field_level_encryption_config.go b/internal/service/cloudfront/field_level_encryption_config.go index f4b454ecc49..73d32754525 100644 --- a/internal/service/cloudfront/field_level_encryption_config.go +++ b/internal/service/cloudfront/field_level_encryption_config.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_cloudfront_field_level_encryption_config", name="Field-level Encryption Config") @@ -63,7 +64,7 @@ func resourceFieldLevelEncryptionConfig() *schema.Resource { Type: schema.TypeString, Required: true, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[awstypes.Format](), @@ -330,7 +331,7 @@ func expandContentTypeProfile(tfMap map[string]interface{}) *awstypes.ContentTyp apiObject.ContentType = aws.String(v) } - if v, ok := tfMap["format"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrFormat].(string); ok && v != "" { apiObject.Format = awstypes.Format(v) } @@ -483,7 +484,7 @@ func flattenContentTypeProfile(apiObject *awstypes.ContentTypeProfile) map[strin } tfMap := map[string]interface{}{ - "format": apiObject.Format, + names.AttrFormat: apiObject.Format, } if v := apiObject.ContentType; v != nil { diff --git a/internal/service/cloudfront/field_level_encryption_config_test.go b/internal/service/cloudfront/field_level_encryption_config_test.go index 67a897f52a6..00c98d70f27 100644 --- a/internal/service/cloudfront/field_level_encryption_config_test.go +++ b/internal/service/cloudfront/field_level_encryption_config_test.go @@ -40,8 +40,8 @@ func TestAccCloudFrontFieldLevelEncryptionConfig_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_type_profile_config.0.content_type_profiles.#", "1"), resource.TestCheckResourceAttr(resourceName, "content_type_profile_config.0.content_type_profiles.0.items.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "content_type_profile_config.0.content_type_profiles.0.items.*", map[string]string{ - "content_type": "application/x-www-form-urlencoded", - "format": "URLEncoded", + "content_type": "application/x-www-form-urlencoded", + names.AttrFormat: "URLEncoded", }), resource.TestCheckResourceAttr(resourceName, "content_type_profile_config.0.forward_when_content_type_is_unknown", "true"), resource.TestCheckResourceAttr(resourceName, "query_arg_profile_config.#", "1"), @@ -64,8 +64,8 @@ func TestAccCloudFrontFieldLevelEncryptionConfig_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_type_profile_config.0.content_type_profiles.#", "1"), resource.TestCheckResourceAttr(resourceName, "content_type_profile_config.0.content_type_profiles.0.items.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "content_type_profile_config.0.content_type_profiles.0.items.*", map[string]string{ - "content_type": "application/x-www-form-urlencoded", - "format": "URLEncoded", + "content_type": "application/x-www-form-urlencoded", + names.AttrFormat: "URLEncoded", }), resource.TestCheckResourceAttr(resourceName, "query_arg_profile_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "query_arg_profile_config.0.forward_when_query_arg_profile_is_unknown", "false"), From 608a387e6b63a333dca85fc91599a1c5d529ef38 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:24 -0400 Subject: [PATCH 1210/1490] codeartifact: Use constant for format strings --- .../service/codeartifact/repository_endpoint_data_source.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/codeartifact/repository_endpoint_data_source.go b/internal/service/codeartifact/repository_endpoint_data_source.go index 8a4dc5c78cf..e5a8c726607 100644 --- a/internal/service/codeartifact/repository_endpoint_data_source.go +++ b/internal/service/codeartifact/repository_endpoint_data_source.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/enum" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_codeartifact_repository_endpoint", name="Repository Endpoint") @@ -34,7 +35,7 @@ func dataSourceRepositoryEndpoint() *schema.Resource { Computed: true, ValidateFunc: verify.ValidAccountID, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[types.PackageFormat](), @@ -62,7 +63,7 @@ func dataSourceRepositoryEndpointRead(ctx context.Context, d *schema.ResourceDat } else { domainOwner = meta.(*conns.AWSClient).AccountID } - format := types.PackageFormat(d.Get("format").(string)) + format := types.PackageFormat(d.Get(names.AttrFormat).(string)) repositoryName := d.Get("repository").(string) input := &codeartifact.GetRepositoryEndpointInput{ Domain: aws.String(domainName), From 906e13d335f7bf0acd0fb4bfb9cb370cd0b3d4c4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:25 -0400 Subject: [PATCH 1211/1490] cur: Use constant for format strings --- internal/service/cur/report_definition.go | 8 ++++---- internal/service/cur/report_definition_data_source.go | 5 +++-- internal/service/cur/report_definition_test.go | 10 +++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/internal/service/cur/report_definition.go b/internal/service/cur/report_definition.go index 70a790dd951..b643b134286 100644 --- a/internal/service/cur/report_definition.go +++ b/internal/service/cur/report_definition.go @@ -65,7 +65,7 @@ func resourceReportDefinition() *schema.Resource { Required: true, ValidateDiagFunc: enum.Validate[types.CompressionFormat](), }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[types.ReportFormat](), @@ -122,7 +122,7 @@ func resourceReportDefinitionCreate(ctx context.Context, d *schema.ResourceData, reportName := d.Get("report_name").(string) additionalArtifacts := flex.ExpandStringyValueSet[types.AdditionalArtifact](d.Get("additional_artifacts").(*schema.Set)) compression := types.CompressionFormat(d.Get("compression").(string)) - format := types.ReportFormat(d.Get("format").(string)) + format := types.ReportFormat(d.Get(names.AttrFormat).(string)) prefix := d.Get("s3_prefix").(string) reportVersioning := types.ReportVersioning(d.Get("report_versioning").(string)) @@ -192,7 +192,7 @@ func resourceReportDefinitionRead(ctx context.Context, d *schema.ResourceData, m }.String() d.Set(names.AttrARN, arn) d.Set("compression", reportDefinition.Compression) - d.Set("format", reportDefinition.Format) + d.Set(names.AttrFormat, reportDefinition.Format) d.Set("refresh_closed_reports", reportDefinition.RefreshClosedReports) d.Set("report_name", reportName) d.Set("report_versioning", reportDefinition.ReportVersioning) @@ -210,7 +210,7 @@ func resourceReportDefinitionUpdate(ctx context.Context, d *schema.ResourceData, additionalArtifacts := flex.ExpandStringyValueSet[types.AdditionalArtifact](d.Get("additional_artifacts").(*schema.Set)) compression := types.CompressionFormat(d.Get("compression").(string)) - format := types.ReportFormat(d.Get("format").(string)) + format := types.ReportFormat(d.Get(names.AttrFormat).(string)) prefix := d.Get("s3_prefix").(string) reportVersioning := types.ReportVersioning(d.Get("report_versioning").(string)) diff --git a/internal/service/cur/report_definition_data_source.go b/internal/service/cur/report_definition_data_source.go index 239fca572e9..2a1c2f14c9b 100644 --- a/internal/service/cur/report_definition_data_source.go +++ b/internal/service/cur/report_definition_data_source.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_cur_report_definition", name="Report Definition") @@ -33,7 +34,7 @@ func dataSourceReportDefinition() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Computed: true, }, @@ -84,7 +85,7 @@ func dataSourceReportDefinitionRead(ctx context.Context, d *schema.ResourceData, d.Set("additional_artifacts", reportDefinition.AdditionalArtifacts) d.Set("additional_schema_elements", reportDefinition.AdditionalSchemaElements) d.Set("compression", reportDefinition.Compression) - d.Set("format", reportDefinition.Format) + d.Set(names.AttrFormat, reportDefinition.Format) d.Set("refresh_closed_reports", reportDefinition.RefreshClosedReports) d.Set("report_name", reportDefinition.ReportName) d.Set("report_versioning", reportDefinition.ReportVersioning) diff --git a/internal/service/cur/report_definition_test.go b/internal/service/cur/report_definition_test.go index ee681acd42e..3e49a616913 100644 --- a/internal/service/cur/report_definition_test.go +++ b/internal/service/cur/report_definition_test.go @@ -99,7 +99,7 @@ func testAccReportDefinition_textOrCSV(t *testing.T) { testAccCheckReportDefinitionExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "report_name", reportName), resource.TestCheckResourceAttr(resourceName, "time_unit", "DAILY"), - resource.TestCheckResourceAttr(resourceName, "format", format), + resource.TestCheckResourceAttr(resourceName, names.AttrFormat, format), resource.TestCheckResourceAttr(resourceName, "compression", compression), resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), @@ -144,7 +144,7 @@ func testAccReportDefinition_parquet(t *testing.T) { testAccCheckReportDefinitionExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "report_name", reportName), resource.TestCheckResourceAttr(resourceName, "time_unit", "DAILY"), - resource.TestCheckResourceAttr(resourceName, "format", format), + resource.TestCheckResourceAttr(resourceName, names.AttrFormat, format), resource.TestCheckResourceAttr(resourceName, "compression", compression), resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), @@ -188,7 +188,7 @@ func testAccReportDefinition_athena(t *testing.T) { testAccCheckReportDefinitionExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "report_name", reportName), resource.TestCheckResourceAttr(resourceName, "time_unit", "DAILY"), - resource.TestCheckResourceAttr(resourceName, "format", format), + resource.TestCheckResourceAttr(resourceName, names.AttrFormat, format), resource.TestCheckResourceAttr(resourceName, "compression", compression), resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), @@ -233,7 +233,7 @@ func testAccReportDefinition_refresh(t *testing.T) { testAccCheckReportDefinitionExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "report_name", reportName), resource.TestCheckResourceAttr(resourceName, "time_unit", "DAILY"), - resource.TestCheckResourceAttr(resourceName, "format", format), + resource.TestCheckResourceAttr(resourceName, names.AttrFormat, format), resource.TestCheckResourceAttr(resourceName, "compression", compression), resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), @@ -278,7 +278,7 @@ func testAccReportDefinition_overwrite(t *testing.T) { testAccCheckReportDefinitionExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "report_name", reportName), resource.TestCheckResourceAttr(resourceName, "time_unit", "DAILY"), - resource.TestCheckResourceAttr(resourceName, "format", format), + resource.TestCheckResourceAttr(resourceName, names.AttrFormat, format), resource.TestCheckResourceAttr(resourceName, "compression", compression), resource.TestCheckResourceAttr(resourceName, "additional_schema_elements.#", "2"), resource.TestCheckResourceAttr(resourceName, "s3_bucket", bucketName), From 4fa9c3a25c3a14087af55253d6c7096badd4f00f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:25 -0400 Subject: [PATCH 1212/1490] ec2: Use constant for format strings --- internal/service/ec2/ebs_snapshot_import.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/ec2/ebs_snapshot_import.go b/internal/service/ec2/ebs_snapshot_import.go index f0f8ead29d2..cce3184b1f6 100644 --- a/internal/service/ec2/ebs_snapshot_import.go +++ b/internal/service/ec2/ebs_snapshot_import.go @@ -101,7 +101,7 @@ func ResourceEBSSnapshotImport() *schema.Resource { Optional: true, ForceNew: true, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -347,7 +347,7 @@ func expandSnapshotDiskContainer(tfMap map[string]interface{}) *awstypes.Snapsho apiObject.Description = aws.String(v) } - if v, ok := tfMap["format"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrFormat].(string); ok && v != "" { apiObject.Format = aws.String(v) } From dc66c8caaa47c9b903d0b3556e5a556316eef674 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:25 -0400 Subject: [PATCH 1213/1490] elastictranscoder: Use constant for format strings --- internal/service/elastictranscoder/preset.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/elastictranscoder/preset.go b/internal/service/elastictranscoder/preset.go index 021016d478c..31bdfb88f3b 100644 --- a/internal/service/elastictranscoder/preset.go +++ b/internal/service/elastictranscoder/preset.go @@ -210,7 +210,7 @@ func ResourcePreset() *schema.Resource { "16:9", }, false), }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -563,7 +563,7 @@ func expandETThumbnails(d *schema.ResourceData) *elastictranscoder.Thumbnails { thumbnails.Interval = aws.String(v.(string)) } - if v, ok := t["format"]; ok && v.(string) != "" { + if v, ok := t[names.AttrFormat]; ok && v.(string) != "" { thumbnails.Format = aws.String(v.(string)) } @@ -861,7 +861,7 @@ func flattenETThumbnails(thumbs *elastictranscoder.Thumbnails) []map[string]inte result := map[string]interface{}{ "aspect_ratio": aws.StringValue(thumbs.AspectRatio), - "format": aws.StringValue(thumbs.Format), + names.AttrFormat: aws.StringValue(thumbs.Format), "interval": aws.StringValue(thumbs.Interval), "max_height": aws.StringValue(thumbs.MaxHeight), "max_width": aws.StringValue(thumbs.MaxWidth), From 9ae15a8606cf6e0514c288befb53b0349f7c633b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:25 -0400 Subject: [PATCH 1214/1490] guardduty: Use constant for format strings --- internal/service/guardduty/ipset.go | 6 +++--- internal/service/guardduty/threatintelset.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/guardduty/ipset.go b/internal/service/guardduty/ipset.go index 14acedfef11..e060ed19f42 100644 --- a/internal/service/guardduty/ipset.go +++ b/internal/service/guardduty/ipset.go @@ -52,7 +52,7 @@ func ResourceIPSet() *schema.Resource { Type: schema.TypeString, Required: true, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -82,7 +82,7 @@ func resourceIPSetCreate(ctx context.Context, d *schema.ResourceData, meta inter input := &guardduty.CreateIPSetInput{ DetectorId: aws.String(detectorID), Name: aws.String(d.Get(names.AttrName).(string)), - Format: aws.String(d.Get("format").(string)), + Format: aws.String(d.Get(names.AttrFormat).(string)), Location: aws.String(d.Get("location").(string)), Activate: aws.Bool(d.Get("activate").(bool)), Tags: getTagsIn(ctx), @@ -144,7 +144,7 @@ func resourceIPSetRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set(names.AttrARN, arn) d.Set("detector_id", detectorId) - d.Set("format", resp.Format) + d.Set(names.AttrFormat, resp.Format) d.Set("location", resp.Location) d.Set(names.AttrName, resp.Name) d.Set("activate", aws.StringValue(resp.Status) == guardduty.IpSetStatusActive) diff --git a/internal/service/guardduty/threatintelset.go b/internal/service/guardduty/threatintelset.go index ea73dbbbff5..92f874a5894 100644 --- a/internal/service/guardduty/threatintelset.go +++ b/internal/service/guardduty/threatintelset.go @@ -52,7 +52,7 @@ func ResourceThreatIntelSet() *schema.Resource { Type: schema.TypeString, Required: true, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -83,7 +83,7 @@ func resourceThreatIntelSetCreate(ctx context.Context, d *schema.ResourceData, m input := &guardduty.CreateThreatIntelSetInput{ DetectorId: aws.String(detectorID), Name: aws.String(name), - Format: aws.String(d.Get("format").(string)), + Format: aws.String(d.Get(names.AttrFormat).(string)), Location: aws.String(d.Get("location").(string)), Activate: aws.Bool(d.Get("activate").(bool)), Tags: getTagsIn(ctx), @@ -144,7 +144,7 @@ func resourceThreatIntelSetRead(ctx context.Context, d *schema.ResourceData, met d.Set(names.AttrARN, arn) d.Set("detector_id", detectorId) - d.Set("format", resp.Format) + d.Set(names.AttrFormat, resp.Format) d.Set("location", resp.Location) d.Set(names.AttrName, resp.Name) d.Set("activate", aws.StringValue(resp.Status) == guardduty.ThreatIntelSetStatusActive) From 279502b430e58324e72fa8290f16ba9a7a28d2c1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:25 -0400 Subject: [PATCH 1215/1490] quicksight: Use constant for format strings --- internal/service/quicksight/data_set.go | 12 ++++++------ internal/service/quicksight/data_set_data_source.go | 4 ++-- .../service/quicksight/schema/visual_filled_map.go | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/quicksight/data_set.go b/internal/service/quicksight/data_set.go index 6ab41f20059..1d559902a1d 100644 --- a/internal/service/quicksight/data_set.go +++ b/internal/service/quicksight/data_set.go @@ -399,7 +399,7 @@ func logicalTableMapSchema() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 128), }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Computed: true, Optional: true, @@ -809,7 +809,7 @@ func physicalTableMapSchema() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(1, 1), }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Computed: true, Optional: true, @@ -1437,7 +1437,7 @@ func expandDataSetCastColumnTypeOperation(tfList []interface{}) *quicksight.Cast if v, ok := tfMap["new_column_type"].(string); ok { castColumnTypeOperation.NewColumnType = aws.String(v) } - if v, ok := tfMap["format"].(string); ok { + if v, ok := tfMap[names.AttrFormat].(string); ok { castColumnTypeOperation.Format = aws.String(v) } @@ -1798,7 +1798,7 @@ func expandDataSetUploadSettings(tfMap map[string]interface{}) *quicksight.Uploa if v, ok := tfMap["delimiter"].(string); ok { uploadSettings.Delimiter = aws.String(v) } - if v, ok := tfMap["format"].(string); ok { + if v, ok := tfMap[names.AttrFormat].(string); ok { uploadSettings.Format = aws.String(v) } if v, ok := tfMap["start_from_row"].(int); ok { @@ -2205,7 +2205,7 @@ func flattenCastColumnTypeOperation(apiObject *quicksight.CastColumnTypeOperatio tfMap["column_name"] = aws.StringValue(apiObject.ColumnName) } if apiObject.Format != nil { - tfMap["format"] = aws.StringValue(apiObject.Format) + tfMap[names.AttrFormat] = aws.StringValue(apiObject.Format) } if apiObject.NewColumnType != nil { tfMap["new_column_type"] = aws.StringValue(apiObject.NewColumnType) @@ -2556,7 +2556,7 @@ func flattenUploadSettings(apiObject *quicksight.UploadSettings) []interface{} { tfMap["delimiter"] = aws.StringValue(apiObject.Delimiter) } if apiObject.Format != nil { - tfMap["format"] = aws.StringValue(apiObject.Format) + tfMap[names.AttrFormat] = aws.StringValue(apiObject.Format) } if apiObject.StartFromRow != nil { tfMap["start_from_row"] = int(aws.Int64Value(apiObject.StartFromRow)) diff --git a/internal/service/quicksight/data_set_data_source.go b/internal/service/quicksight/data_set_data_source.go index 926c4863a66..6efc06e63f6 100644 --- a/internal/service/quicksight/data_set_data_source.go +++ b/internal/service/quicksight/data_set_data_source.go @@ -257,7 +257,7 @@ func logicalTableMapDataSourceSchema() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Computed: true, }, @@ -588,7 +588,7 @@ func physicalTableMapDataSourceSchema() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/quicksight/schema/visual_filled_map.go b/internal/service/quicksight/schema/visual_filled_map.go index 330303aecfb..abe9800aecb 100644 --- a/internal/service/quicksight/schema/visual_filled_map.go +++ b/internal/service/quicksight/schema/visual_filled_map.go @@ -93,7 +93,7 @@ func filledMapVisualSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "field_id": stringSchema(true, validation.StringLenBetween(1, 512)), - "format": { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_ShapeConditionalFormat.html + names.AttrFormat: { // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_ShapeConditionalFormat.html Type: schema.TypeList, Optional: true, MinItems: 1, @@ -322,7 +322,7 @@ func expandFilledMapShapeConditionalFormatting(tfList []interface{}) *quicksight if v, ok := tfMap["field_id"].(string); ok && v != "" { options.FieldId = aws.String(v) } - if v, ok := tfMap["format"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrFormat].([]interface{}); ok && len(v) > 0 { options.Format = expandShapeConditionalFormat(v) } @@ -493,7 +493,7 @@ func flattenFilledMapShapeConditionalFormatting(apiObject *quicksight.FilledMapS tfMap["field_id"] = aws.StringValue(apiObject.FieldId) } if apiObject.Format != nil { - tfMap["format"] = flattenShapeConditionalFormat(apiObject.Format) + tfMap[names.AttrFormat] = flattenShapeConditionalFormat(apiObject.Format) } return []interface{}{tfMap} From 8b81eab22a7a9971d15a39f8978d94fcb5893482 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:26 -0400 Subject: [PATCH 1216/1490] s3: Use constant for format strings --- internal/service/s3/bucket_analytics_configuration.go | 8 ++++---- internal/service/s3/bucket_inventory.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/s3/bucket_analytics_configuration.go b/internal/service/s3/bucket_analytics_configuration.go index ddb3cb34ff2..38262a7fbe7 100644 --- a/internal/service/s3/bucket_analytics_configuration.go +++ b/internal/service/s3/bucket_analytics_configuration.go @@ -108,7 +108,7 @@ func resourceBucketAnalyticsConfiguration() *schema.Resource { Optional: true, ValidateFunc: verify.ValidAccountID, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Optional: true, Default: types.AnalyticsS3ExportFileFormatCsv, @@ -343,7 +343,7 @@ func expandAnalyticsS3BucketDestination(bdl []interface{}) *types.AnalyticsS3Buc if len(bdl) != 0 && bdl[0] != nil { bdm := bdl[0].(map[string]interface{}) result.Bucket = aws.String(bdm["bucket_arn"].(string)) - result.Format = types.AnalyticsS3ExportFileFormat(bdm["format"].(string)) + result.Format = types.AnalyticsS3ExportFileFormat(bdm[names.AttrFormat].(string)) if v, ok := bdm["bucket_account_id"]; ok && v != "" { result.BucketAccountId = aws.String(v.(string)) @@ -419,8 +419,8 @@ func flattenAnalyticsS3BucketDestination(bucketDestination *types.AnalyticsS3Buc } result := map[string]interface{}{ - "bucket_arn": aws.ToString(bucketDestination.Bucket), - "format": bucketDestination.Format, + "bucket_arn": aws.ToString(bucketDestination.Bucket), + names.AttrFormat: bucketDestination.Format, } if bucketDestination.BucketAccountId != nil { result["bucket_account_id"] = aws.ToString(bucketDestination.BucketAccountId) diff --git a/internal/service/s3/bucket_inventory.go b/internal/service/s3/bucket_inventory.go index e4eb5701a40..a4cace0f3a5 100644 --- a/internal/service/s3/bucket_inventory.go +++ b/internal/service/s3/bucket_inventory.go @@ -102,7 +102,7 @@ func resourceBucketInventory() *schema.Resource { }, }, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[types.InventoryFormat](), @@ -362,7 +362,7 @@ func flattenInventorySchedule(schedule *types.InventorySchedule) []map[string]in func expandInventoryBucketDestination(m map[string]interface{}) *types.InventoryS3BucketDestination { destination := &types.InventoryS3BucketDestination{ - Format: types.InventoryFormat(m["format"].(string)), + Format: types.InventoryFormat(m[names.AttrFormat].(string)), Bucket: aws.String(m["bucket_arn"].(string)), } @@ -407,8 +407,8 @@ func flattenInventoryBucketDestination(destination *types.InventoryS3BucketDesti result := make([]map[string]interface{}, 0, 1) m := map[string]interface{}{ - "format": destination.Format, - "bucket_arn": aws.ToString(destination.Bucket), + names.AttrFormat: destination.Format, + "bucket_arn": aws.ToString(destination.Bucket), } if destination.AccountId != nil { From 1deec3152a83d330a41f6696f81b981bf6f277ef Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:34:26 -0400 Subject: [PATCH 1217/1490] s3control: Use constant for format strings --- internal/service/s3control/storage_lens_configuration.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/s3control/storage_lens_configuration.go b/internal/service/s3control/storage_lens_configuration.go index 266b7e0316b..abcc37bc9a6 100644 --- a/internal/service/s3control/storage_lens_configuration.go +++ b/internal/service/s3control/storage_lens_configuration.go @@ -308,7 +308,7 @@ func resourceStorageLensConfiguration() *schema.Resource { }, }, }, - "format": { + names.AttrFormat: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[types.Format](), @@ -921,7 +921,7 @@ func expandS3BucketDestination(tfMap map[string]interface{}) *types.S3BucketDest apiObject.Encryption = expandStorageLensDataExportEncryption(v[0].(map[string]interface{})) } - if v, ok := tfMap["format"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrFormat].(string); ok && v != "" { apiObject.Format = types.Format(v) } @@ -1254,7 +1254,7 @@ func flattenS3BucketDestination(apiObject *types.S3BucketDestination) map[string tfMap["encryption"] = []interface{}{flattenStorageLensDataExportEncryption(v)} } - tfMap["format"] = apiObject.Format + tfMap[names.AttrFormat] = apiObject.Format tfMap["output_schema_version"] = apiObject.OutputSchemaVersion if v := apiObject.Prefix; v != nil { From 75cf1eb4505574722825ea899815e72277287d94 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:37 -0400 Subject: [PATCH 1218/1490] ci: Prefer constant for string literal "mode" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 9ecd3abd241..8f0e5ffc681 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1465,3 +1465,13 @@ rules: - pattern: '"format"' severity: ERROR fix: "names.AttrFormat" + - id: literal-mode-string-constant + languages: [go] + message: Use the constant `names.AttrMode` for the string literal "mode" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"mode"' + severity: ERROR + fix: "names.AttrMode" From c664b933bb2a2f3fcbcc461f0451f43fdd503708 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:37 -0400 Subject: [PATCH 1219/1490] names: Add constant for string literal "mode" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index eee46b1f468..526dc588d5e 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -43,6 +43,7 @@ const ( AttrLastUpdatedDate = "last_updated_date" AttrMax = "max" AttrMin = "min" + AttrMode = "mode" AttrName = "name" AttrNamePrefix = "name_prefix" AttrNetworkInterfaceID = "network_interface_id" From bdef0f48170fbc9282c25b1c5269cf65301787e9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:37 -0400 Subject: [PATCH 1220/1490] appmesh: Use constant for mode strings --- internal/service/appmesh/flex.go | 4 ++-- internal/service/appmesh/virtual_gateway.go | 6 +++--- internal/service/appmesh/virtual_node.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/appmesh/flex.go b/internal/service/appmesh/flex.go index d04946cbfd1..b241e39039b 100644 --- a/internal/service/appmesh/flex.go +++ b/internal/service/appmesh/flex.go @@ -898,7 +898,7 @@ func expandVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec { mTls := vTls[0].(map[string]interface{}) - if vMode, ok := mTls["mode"].(string); ok && vMode != "" { + if vMode, ok := mTls[names.AttrMode].(string); ok && vMode != "" { tls.Mode = aws.String(vMode) } @@ -1757,7 +1757,7 @@ func flattenVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} { if tls := listener.Tls; tls != nil { mTls := map[string]interface{}{ - "mode": aws.StringValue(tls.Mode), + names.AttrMode: aws.StringValue(tls.Mode), } if certificate := tls.Certificate; certificate != nil { diff --git a/internal/service/appmesh/virtual_gateway.go b/internal/service/appmesh/virtual_gateway.go index 4e8dce314cd..ed38811b3b4 100644 --- a/internal/service/appmesh/virtual_gateway.go +++ b/internal/service/appmesh/virtual_gateway.go @@ -494,7 +494,7 @@ func resourceVirtualGatewaySpecSchema() *schema.Schema { }, }, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.VirtualGatewayListenerTlsMode_Values(), false), @@ -963,7 +963,7 @@ func expandVirtualGatewaySpec(vSpec []interface{}) *appmesh.VirtualGatewaySpec { mTls := vTls[0].(map[string]interface{}) - if vMode, ok := mTls["mode"].(string); ok && vMode != "" { + if vMode, ok := mTls[names.AttrMode].(string); ok && vMode != "" { tls.Mode = aws.String(vMode) } @@ -1344,7 +1344,7 @@ func flattenVirtualGatewaySpec(spec *appmesh.VirtualGatewaySpec) []interface{} { if tls := listener.Tls; tls != nil { mTls := map[string]interface{}{ - "mode": aws.StringValue(tls.Mode), + names.AttrMode: aws.StringValue(tls.Mode), } if certificate := tls.Certificate; certificate != nil { diff --git a/internal/service/appmesh/virtual_node.go b/internal/service/appmesh/virtual_node.go index 9d9a19e7b91..c73e7fd53a6 100644 --- a/internal/service/appmesh/virtual_node.go +++ b/internal/service/appmesh/virtual_node.go @@ -749,7 +749,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { }, }, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.ListenerTlsMode_Values(), false), From acb0e2e8fbd7bbf46864eea2f5186346ea16cb38 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:38 -0400 Subject: [PATCH 1221/1490] autoscaling: Use constant for mode strings --- internal/service/autoscaling/policy.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/autoscaling/policy.go b/internal/service/autoscaling/policy.go index a741e19c76f..5db2847398f 100644 --- a/internal/service/autoscaling/policy.go +++ b/internal/service/autoscaling/policy.go @@ -293,7 +293,7 @@ func resourcePolicy() *schema.Resource { }, }, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, Default: awstypes.PredictiveScalingModeForecastOnly, @@ -888,7 +888,7 @@ func expandPredictiveScalingConfig(predictiveScalingConfigSlice []interface{}) * predictiveScalingConfig := &awstypes.PredictiveScalingConfiguration{ MetricSpecifications: expandPredictiveScalingMetricSpecifications(predictiveScalingConfigFlat["metric_specification"].([]interface{})), MaxCapacityBreachBehavior: awstypes.PredictiveScalingMaxCapacityBreachBehavior(predictiveScalingConfigFlat["max_capacity_breach_behavior"].(string)), - Mode: awstypes.PredictiveScalingMode(predictiveScalingConfigFlat["mode"].(string)), + Mode: awstypes.PredictiveScalingMode(predictiveScalingConfigFlat[names.AttrMode].(string)), } if v, null, _ := nullable.Int(predictiveScalingConfigFlat["max_capacity_buffer"].(string)).ValueInt32(); !null { predictiveScalingConfig.MaxCapacityBuffer = aws.Int32(v) @@ -1142,7 +1142,7 @@ func flattenPredictiveScalingConfig(predictiveScalingConfig *awstypes.Predictive if predictiveScalingConfig.MetricSpecifications != nil && len(predictiveScalingConfig.MetricSpecifications) > 0 { predictiveScalingConfigFlat["metric_specification"] = flattenPredictiveScalingMetricSpecifications(predictiveScalingConfig.MetricSpecifications) } - predictiveScalingConfigFlat["mode"] = string(predictiveScalingConfig.Mode) + predictiveScalingConfigFlat[names.AttrMode] = string(predictiveScalingConfig.Mode) if predictiveScalingConfig.SchedulingBufferTime != nil { predictiveScalingConfigFlat["scheduling_buffer_time"] = strconv.FormatInt(int64(aws.ToInt32(predictiveScalingConfig.SchedulingBufferTime)), 10) } From 0f47acf4a922a5a1c6ff8441059ea56102345858 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:38 -0400 Subject: [PATCH 1222/1490] comprehend: Use constant for mode strings --- internal/service/comprehend/document_classifier.go | 8 ++++---- internal/service/comprehend/document_classifier_test.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/comprehend/document_classifier.go b/internal/service/comprehend/document_classifier.go index ff8422f488a..921231a4daa 100644 --- a/internal/service/comprehend/document_classifier.go +++ b/internal/service/comprehend/document_classifier.go @@ -144,7 +144,7 @@ func ResourceDocumentClassifier() *schema.Resource { Required: true, ValidateDiagFunc: enum.Validate[types.SyntaxLanguageCode](), }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, ValidateDiagFunc: enum.Validate[types.DocumentClassifierMode](), @@ -255,7 +255,7 @@ func ResourceDocumentClassifier() *schema.Resource { return nil }, func(_ context.Context, diff *schema.ResourceDiff, _ interface{}) error { - mode := types.DocumentClassifierMode(diff.Get("mode").(string)) + mode := types.DocumentClassifierMode(diff.Get(names.AttrMode).(string)) if mode == types.DocumentClassifierModeMultiClass { config := diff.GetRawConfig() @@ -312,7 +312,7 @@ func resourceDocumentClassifierRead(ctx context.Context, d *schema.ResourceData, d.Set(names.AttrARN, out.DocumentClassifierArn) d.Set("data_access_role_arn", out.DataAccessRoleArn) d.Set("language_code", out.LanguageCode) - d.Set("mode", out.Mode) + d.Set(names.AttrMode, out.Mode) d.Set("model_kms_key_id", out.ModelKmsKeyId) d.Set("version_name", out.VersionName) d.Set("version_name_prefix", create.NamePrefixFromName(aws.ToString(out.VersionName))) @@ -472,7 +472,7 @@ func documentClassifierPublishVersion(ctx context.Context, conn *comprehend.Clie InputDataConfig: expandDocumentClassifierInputDataConfig(d), LanguageCode: types.LanguageCode(d.Get("language_code").(string)), DocumentClassifierName: aws.String(d.Get(names.AttrName).(string)), - Mode: types.DocumentClassifierMode(d.Get("mode").(string)), + Mode: types.DocumentClassifierMode(d.Get(names.AttrMode).(string)), OutputDataConfig: expandDocumentClassifierOutputDataConfig(d.Get("output_data_config").([]interface{})), VersionName: versionName, VpcConfig: expandVPCConfig(d.Get("vpc_config").([]interface{})), diff --git a/internal/service/comprehend/document_classifier_test.go b/internal/service/comprehend/document_classifier_test.go index cc3b3101ac1..4fc74921740 100644 --- a/internal/service/comprehend/document_classifier_test.go +++ b/internal/service/comprehend/document_classifier_test.go @@ -57,7 +57,7 @@ func TestAccComprehendDocumentClassifier_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "input_data_config.0.s3_uri"), resource.TestCheckResourceAttr(resourceName, "input_data_config.0.test_s3_uri", ""), resource.TestCheckResourceAttr(resourceName, "language_code", "en"), - resource.TestCheckResourceAttr(resourceName, "mode", string(types.DocumentClassifierModeMultiClass)), + resource.TestCheckResourceAttr(resourceName, names.AttrMode, string(types.DocumentClassifierModeMultiClass)), resource.TestCheckResourceAttr(resourceName, "model_kms_key_id", ""), resource.TestCheckResourceAttr(resourceName, "output_data_config.#", "0"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -414,7 +414,7 @@ func TestAccComprehendDocumentClassifier_multiLabel_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "input_data_config.0.data_format", string(types.DocumentClassifierDataFormatComprehendCsv)), resource.TestCheckResourceAttr(resourceName, "input_data_config.0.label_delimiter", tfcomprehend.DocumentClassifierLabelSeparatorDefault), resource.TestCheckResourceAttr(resourceName, "language_code", "en"), - resource.TestCheckResourceAttr(resourceName, "mode", string(types.DocumentClassifierModeMultiLabel)), + resource.TestCheckResourceAttr(resourceName, names.AttrMode, string(types.DocumentClassifierModeMultiLabel)), resource.TestCheckResourceAttr(resourceName, "model_kms_key_id", ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), @@ -824,7 +824,7 @@ func TestAccComprehendDocumentClassifier_multiLabel_labelDelimiter(t *testing.T) resource.TestCheckResourceAttr(resourceName, "input_data_config.0.data_format", string(types.DocumentClassifierDataFormatComprehendCsv)), resource.TestCheckResourceAttr(resourceName, "input_data_config.0.label_delimiter", delimiter), resource.TestCheckResourceAttr(resourceName, "language_code", "en"), - resource.TestCheckResourceAttr(resourceName, "mode", string(types.DocumentClassifierModeMultiLabel)), + resource.TestCheckResourceAttr(resourceName, names.AttrMode, string(types.DocumentClassifierModeMultiLabel)), resource.TestCheckResourceAttr(resourceName, "model_kms_key_id", ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "tags_all.%", "0"), From 9559c357341e4b8da6975fc580534338afb70fbd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:38 -0400 Subject: [PATCH 1223/1490] configservice: Use constant for mode strings --- internal/service/configservice/config_rule.go | 6 +++--- internal/service/configservice/config_rule_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/configservice/config_rule.go b/internal/service/configservice/config_rule.go index 9ce761f3714..ad32f66fd5a 100644 --- a/internal/service/configservice/config_rule.go +++ b/internal/service/configservice/config_rule.go @@ -57,7 +57,7 @@ func resourceConfigRule() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, Computed: true, @@ -425,7 +425,7 @@ func expandEvaluationModeConfigurations(tfList []interface{}) []types.Evaluation apiObject := types.EvaluationModeConfiguration{} - if v, ok := tfMap["mode"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrMode].(string); ok && v != "" { apiObject.Mode = types.EvaluationMode(v) } @@ -541,7 +541,7 @@ func flattenEvaluationModeConfigurations(apiObjects []types.EvaluationModeConfig for _, apiObject := range apiObjects { tfMap := map[string]interface{}{ - "mode": apiObject.Mode, + names.AttrMode: apiObject.Mode, } tfList = append(tfList, tfMap) diff --git a/internal/service/configservice/config_rule_test.go b/internal/service/configservice/config_rule_test.go index b1708c7448a..040ac98d4da 100644 --- a/internal/service/configservice/config_rule_test.go +++ b/internal/service/configservice/config_rule_test.go @@ -41,7 +41,7 @@ func testAccConfigRule_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "source.0.owner", "AWS"), resource.TestCheckResourceAttr(resourceName, "source.0.source_identifier", "S3_BUCKET_VERSIONING_ENABLED"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "evaluation_mode.*", map[string]string{ - "mode": "DETECTIVE", + names.AttrMode: "DETECTIVE", }), ), }, @@ -82,7 +82,7 @@ func testAccConfigRule_evaluationMode(t *testing.T) { testAccCheckConfigRuleExists(ctx, resourceName, &cr), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "evaluation_mode.*", map[string]string{ - "mode": "DETECTIVE", + names.AttrMode: "DETECTIVE", }), ), }, @@ -92,10 +92,10 @@ func testAccConfigRule_evaluationMode(t *testing.T) { testAccCheckConfigRuleExists(ctx, resourceName, &cr), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "evaluation_mode.*", map[string]string{ - "mode": "DETECTIVE", + names.AttrMode: "DETECTIVE", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "evaluation_mode.*", map[string]string{ - "mode": "PROACTIVE", + names.AttrMode: "PROACTIVE", }), ), }, From d92eb9a6b6ff3435c165e60ea9c1259cfc62ce20 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:38 -0400 Subject: [PATCH 1224/1490] elbv2: Use constant for mode strings --- internal/service/elbv2/listener.go | 8 ++++---- internal/service/elbv2/listener_data_source.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/elbv2/listener.go b/internal/service/elbv2/listener.go index 4a3befee1fb..86447a9bd1f 100644 --- a/internal/service/elbv2/listener.go +++ b/internal/service/elbv2/listener.go @@ -353,7 +353,7 @@ func ResourceListener() *schema.Resource { Optional: true, Default: false, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(mutualAuthenticationModeEnum_Values(), true), @@ -896,7 +896,7 @@ func expandMutualAuthenticationAttributes(l []interface{}) *awstypes.MutualAuthe return nil } - switch mode := tfMap["mode"].(string); mode { + switch mode := tfMap[names.AttrMode].(string); mode { case mutualAuthenticationOff: return &awstypes.MutualAuthenticationAttributes{ Mode: aws.String(mode), @@ -1057,13 +1057,13 @@ func flattenMutualAuthenticationAttributes(description *awstypes.MutualAuthentic if mode == mutualAuthenticationOff { return []interface{}{ map[string]interface{}{ - "mode": mode, + names.AttrMode: mode, }, } } m := map[string]interface{}{ - "mode": aws.ToString(description.Mode), + names.AttrMode: aws.ToString(description.Mode), "trust_store_arn": aws.ToString(description.TrustStoreArn), "ignore_client_certificate_expiry": aws.ToBool(description.IgnoreClientCertificateExpiry), } diff --git a/internal/service/elbv2/listener_data_source.go b/internal/service/elbv2/listener_data_source.go index 7e3d4e93408..0345fe57f93 100644 --- a/internal/service/elbv2/listener_data_source.go +++ b/internal/service/elbv2/listener_data_source.go @@ -267,7 +267,7 @@ func DataSourceListener() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "mode": { + names.AttrMode: { Type: schema.TypeString, Computed: true, }, From 8c27f4101454753d31dd7b2486ff5e2a84eda708 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:38 -0400 Subject: [PATCH 1225/1490] fsx: Use constant for mode strings --- internal/service/fsx/ontap_file_system.go | 6 +++--- internal/service/fsx/ontap_file_system_data_source.go | 2 +- internal/service/fsx/openzfs_file_system.go | 6 +++--- internal/service/fsx/windows_file_system.go | 6 +++--- internal/service/fsx/windows_file_system_data_source.go | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/fsx/ontap_file_system.go b/internal/service/fsx/ontap_file_system.go index 1e9aab43999..06cc41380f1 100644 --- a/internal/service/fsx/ontap_file_system.go +++ b/internal/service/fsx/ontap_file_system.go @@ -84,7 +84,7 @@ func resourceONTAPFileSystem() *schema.Resource { Computed: true, ValidateFunc: validation.IntBetween(0, 2400000), }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, Default: fsx.DiskIopsConfigurationModeAutomatic, @@ -501,7 +501,7 @@ func expandOntapFileDiskIopsConfiguration(cfg []interface{}) *fsx.DiskIopsConfig out := fsx.DiskIopsConfiguration{} - if v, ok := conf["mode"].(string); ok && len(v) > 0 { + if v, ok := conf[names.AttrMode].(string); ok && len(v) > 0 { out.Mode = aws.String(v) } if v, ok := conf["iops"].(int); ok { @@ -518,7 +518,7 @@ func flattenOntapFileDiskIopsConfiguration(rs *fsx.DiskIopsConfiguration) []inte m := make(map[string]interface{}) if rs.Mode != nil { - m["mode"] = aws.StringValue(rs.Mode) + m[names.AttrMode] = aws.StringValue(rs.Mode) } if rs.Iops != nil { m["iops"] = aws.Int64Value(rs.Iops) diff --git a/internal/service/fsx/ontap_file_system_data_source.go b/internal/service/fsx/ontap_file_system_data_source.go index 9e479b150f8..1fa075902f8 100644 --- a/internal/service/fsx/ontap_file_system_data_source.go +++ b/internal/service/fsx/ontap_file_system_data_source.go @@ -48,7 +48,7 @@ func dataSourceONTAPFileSystem() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/fsx/openzfs_file_system.go b/internal/service/fsx/openzfs_file_system.go index ad6dc0fc86d..f7f3c701405 100644 --- a/internal/service/fsx/openzfs_file_system.go +++ b/internal/service/fsx/openzfs_file_system.go @@ -104,7 +104,7 @@ func resourceOpenZFSFileSystem() *schema.Resource { Optional: true, Computed: true, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, Default: fsx.DiskIopsConfigurationModeAutomatic, @@ -665,7 +665,7 @@ func expandDiskIopsConfiguration(cfg []interface{}) *fsx.DiskIopsConfiguration { out := fsx.DiskIopsConfiguration{} - if v, ok := conf["mode"].(string); ok && len(v) > 0 { + if v, ok := conf[names.AttrMode].(string); ok && len(v) > 0 { out.Mode = aws.String(v) } @@ -751,7 +751,7 @@ func flattenDiskIopsConfiguration(rs *fsx.DiskIopsConfiguration) []interface{} { m := make(map[string]interface{}) if rs.Mode != nil { - m["mode"] = aws.StringValue(rs.Mode) + m[names.AttrMode] = aws.StringValue(rs.Mode) } if rs.Iops != nil { m["iops"] = aws.Int64Value(rs.Iops) diff --git a/internal/service/fsx/windows_file_system.go b/internal/service/fsx/windows_file_system.go index 75109408540..5a2ab5cddc4 100644 --- a/internal/service/fsx/windows_file_system.go +++ b/internal/service/fsx/windows_file_system.go @@ -152,7 +152,7 @@ func resourceWindowsFileSystem() *schema.Resource { Computed: true, ValidateFunc: validation.IntBetween(0, 350000), }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, Default: fsx.DiskIopsConfigurationModeAutomatic, @@ -769,7 +769,7 @@ func expandWindowsDiskIopsConfiguration(l []interface{}) *fsx.DiskIopsConfigurat req.Iops = aws.Int64(int64(v)) } - if v, ok := data["mode"].(string); ok && v != "" { + if v, ok := data[names.AttrMode].(string); ok && v != "" { req.Mode = aws.String(v) } @@ -787,7 +787,7 @@ func flattenWindowsDiskIopsConfiguration(rs *fsx.DiskIopsConfiguration) []interf m["iops"] = aws.Int64Value(rs.Iops) } if rs.Mode != nil { - m["mode"] = aws.StringValue(rs.Mode) + m[names.AttrMode] = aws.StringValue(rs.Mode) } return []interface{}{m} diff --git a/internal/service/fsx/windows_file_system_data_source.go b/internal/service/fsx/windows_file_system_data_source.go index 41cf0be0b91..08d8474cde5 100644 --- a/internal/service/fsx/windows_file_system_data_source.go +++ b/internal/service/fsx/windows_file_system_data_source.go @@ -85,7 +85,7 @@ func dataSourceWindowsFileSystem() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Computed: true, }, From 515315a65385ba5ec87d5e6fc77150b4384d1ebe Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:39 -0400 Subject: [PATCH 1226/1490] lambda: Use constant for mode strings --- internal/service/lambda/function.go | 8 ++++---- internal/service/lambda/function_data_source.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/lambda/function.go b/internal/service/lambda/function.go index dae874f691c..182c9df541f 100644 --- a/internal/service/lambda/function.go +++ b/internal/service/lambda/function.go @@ -393,7 +393,7 @@ func resourceFunction() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "mode": { + names.AttrMode: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[awstypes.TracingMode](), @@ -566,7 +566,7 @@ func resourceFunctionCreate(ctx context.Context, d *schema.ResourceData, meta in if v, ok := d.GetOk("tracing_config"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.TracingConfig = &awstypes.TracingConfig{ - Mode: awstypes.TracingMode(v.([]interface{})[0].(map[string]interface{})["mode"].(string)), + Mode: awstypes.TracingMode(v.([]interface{})[0].(map[string]interface{})[names.AttrMode].(string)), } } @@ -707,7 +707,7 @@ func resourceFunctionRead(ctx context.Context, d *schema.ResourceData, meta inte } if err := d.Set("tracing_config", []interface{}{ map[string]interface{}{ - "mode": string(tracingConfigMode), + names.AttrMode: string(tracingConfigMode), }, }); err != nil { return sdkdiag.AppendErrorf(diags, "setting tracing_config: %s", err) @@ -894,7 +894,7 @@ func resourceFunctionUpdate(ctx context.Context, d *schema.ResourceData, meta in if d.HasChange("tracing_config") { if v, ok := d.GetOk("tracing_config"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.TracingConfig = &awstypes.TracingConfig{ - Mode: awstypes.TracingMode(v.([]interface{})[0].(map[string]interface{})["mode"].(string)), + Mode: awstypes.TracingMode(v.([]interface{})[0].(map[string]interface{})[names.AttrMode].(string)), } } } diff --git a/internal/service/lambda/function_data_source.go b/internal/service/lambda/function_data_source.go index b7dcd09963c..8b28ef798f2 100644 --- a/internal/service/lambda/function_data_source.go +++ b/internal/service/lambda/function_data_source.go @@ -203,7 +203,7 @@ func dataSourceFunction() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "mode": { + names.AttrMode: { Type: schema.TypeString, Computed: true, }, @@ -343,7 +343,7 @@ func dataSourceFunctionRead(ctx context.Context, d *schema.ResourceData, meta in } if err := d.Set("tracing_config", []interface{}{ map[string]interface{}{ - "mode": string(tracingConfigMode), + names.AttrMode: string(tracingConfigMode), }, }); err != nil { return sdkdiag.AppendErrorf(diags, "setting tracing_config: %s", err) From 385f9e672f0b1253bcd3e788f3492b07a92b6fbb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:39 -0400 Subject: [PATCH 1227/1490] medialive: Use constant for mode strings --- .../service/medialive/channel_encoder_settings_schema.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index f93eb02358e..2f7bf2e25b5 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -972,7 +972,7 @@ func channelEncoderSettingsSchema() *schema.Schema { Optional: true, Computed: true, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, Computed: true, @@ -3761,7 +3761,7 @@ func expandHLSGroupSettings(tfList []interface{}) *types.HlsGroupSettings { if v, ok := m["min_segment_length"].(int); ok && v != 0 { out.MinSegmentLength = aws.Int32(int32(v)) } - if v, ok := m["mode"].(string); ok && v != "" { + if v, ok := m[names.AttrMode].(string); ok && v != "" { out.Mode = types.HlsMode(v) } if v, ok := m["output_selection"].(string); ok && v != "" { @@ -6306,7 +6306,7 @@ func flattenOutputGroupSettingsHLSGroupSettings(in *types.HlsGroupSettings) []in "manifest_compression": string(in.ManifestCompression), "manifest_duration_format": string(in.ManifestDurationFormat), "min_segment_length": int(aws.ToInt32(in.MinSegmentLength)), - "mode": string(in.Mode), + names.AttrMode: string(in.Mode), "output_selection": string(in.OutputSelection), "program_date_time": string(in.ProgramDateTime), "program_date_time_clock": string(in.ProgramDateTimeClock), From 6726fa7f6f4784d1a0b041e85cddc356da101c56 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:39 -0400 Subject: [PATCH 1228/1490] networkmanager: Use constant for mode strings --- .../core_network_policy_document_data_source.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/networkmanager/core_network_policy_document_data_source.go b/internal/service/networkmanager/core_network_policy_document_data_source.go index 99ba3825ba6..1de817975fd 100644 --- a/internal/service/networkmanager/core_network_policy_document_data_source.go +++ b/internal/service/networkmanager/core_network_policy_document_data_source.go @@ -284,7 +284,7 @@ func DataSourceCoreNetworkPolicyDocument() *schema.Resource { ), }, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ @@ -371,7 +371,7 @@ func expandDataCoreNetworkPolicySegmentActions(cfgSegmentActionsIntf []interface var shareWith, shareWithExcept interface{} if action == "share" { - if mode, ok := cfgSA["mode"]; ok { + if mode, ok := cfgSA[names.AttrMode]; ok { sgmtAction.Mode = mode.(string) } @@ -395,7 +395,7 @@ func expandDataCoreNetworkPolicySegmentActions(cfgSegmentActionsIntf []interface } if action == "create-route" { - if mode := cfgSA["mode"]; mode != "" { + if mode := cfgSA[names.AttrMode]; mode != "" { return nil, fmt.Errorf("Cannot specify \"mode\" if action = \"create-route\". See segment_actions[%s].", strconv.Itoa(i)) } From 7a63aee7732f7aba5fd43e0a8f77502442f2a891 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:39 -0400 Subject: [PATCH 1229/1490] pinpoint: Use constant for mode strings --- internal/service/pinpoint/app.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/pinpoint/app.go b/internal/service/pinpoint/app.go index f00ec7edf66..082609c0cae 100644 --- a/internal/service/pinpoint/app.go +++ b/internal/service/pinpoint/app.go @@ -55,7 +55,7 @@ func ResourceApp() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice(pinpoint.Mode_Values(), false), @@ -325,7 +325,7 @@ func expandCampaignHook(configs []interface{}) *pinpoint.CampaignHook { ch.LambdaFunctionName = aws.String(v.(string)) } - if v, ok := m["mode"]; ok { + if v, ok := m[names.AttrMode]; ok { ch.Mode = aws.String(v.(string)) } @@ -342,7 +342,7 @@ func flattenCampaignHook(ch *pinpoint.CampaignHook) []interface{} { m := map[string]interface{}{} m["lambda_function_name"] = aws.StringValue(ch.LambdaFunctionName) - m["mode"] = aws.StringValue(ch.Mode) + m[names.AttrMode] = aws.StringValue(ch.Mode) m["web_url"] = aws.StringValue(ch.WebUrl) l = append(l, m) From d43d86777532ddb18eb927533c9ac4d0651415f4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:40 -0400 Subject: [PATCH 1230/1490] rds: Use constant for mode strings --- internal/service/rds/cluster_activity_stream.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/rds/cluster_activity_stream.go b/internal/service/rds/cluster_activity_stream.go index 24cf7cccafc..05f2af56853 100644 --- a/internal/service/rds/cluster_activity_stream.go +++ b/internal/service/rds/cluster_activity_stream.go @@ -47,7 +47,7 @@ func ResourceClusterActivityStream() *schema.Resource { Required: true, ForceNew: true, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -71,7 +71,7 @@ func resourceClusterActivityStreamCreate(ctx context.Context, d *schema.Resource ApplyImmediately: aws.Bool(true), EngineNativeAuditFieldsIncluded: aws.Bool(d.Get("engine_native_audit_fields_included").(bool)), KmsKeyId: aws.String(d.Get(names.AttrKMSKeyID).(string)), - Mode: aws.String(d.Get("mode").(string)), + Mode: aws.String(d.Get(names.AttrMode).(string)), ResourceArn: aws.String(arn), } @@ -106,7 +106,7 @@ func resourceClusterActivityStreamRead(ctx context.Context, d *schema.ResourceDa d.Set("kinesis_stream_name", output.ActivityStreamKinesisStreamName) d.Set(names.AttrKMSKeyID, output.ActivityStreamKmsKeyId) - d.Set("mode", output.ActivityStreamMode) + d.Set(names.AttrMode, output.ActivityStreamMode) d.Set(names.AttrResourceARN, output.DBClusterArn) return nil From b761060e378249a2e6fbd2446d65a20a2111f5c9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:40 -0400 Subject: [PATCH 1231/1490] s3: Use constant for mode strings --- internal/service/s3/bucket.go | 10 +++++----- .../service/s3/bucket_object_lock_configuration.go | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index 9837b288ffa..a67a99d5cf5 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -357,7 +357,7 @@ func resourceBucket() *schema.Resource { Optional: true, ValidateFunc: validation.IntAtLeast(1), }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[types.ObjectLockRetentionMode](), @@ -2905,7 +2905,7 @@ func expandBucketObjectLockConfiguration(l []interface{}) *types.ObjectLockConfi if v, ok := tfMap["days"].(int); ok && v > 0 { apiObject.Rule.DefaultRetention.Days = aws.Int32(int32(v)) } - if v, ok := tfMap["mode"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrMode].(string); ok && v != "" { apiObject.Rule.DefaultRetention.Mode = types.ObjectLockRetentionMode(v) } if v, ok := tfMap["years"].(int); ok && v > 0 { @@ -2931,9 +2931,9 @@ func flattenObjectLockConfiguration(apiObject *types.ObjectLockConfiguration) [] tfMap := map[string]interface{}{ "default_retention": []interface{}{ map[string]interface{}{ - "days": aws.ToInt32(apiObject.Days), - "mode": apiObject.Mode, - "years": aws.ToInt32(apiObject.Years), + "days": aws.ToInt32(apiObject.Days), + names.AttrMode: apiObject.Mode, + "years": aws.ToInt32(apiObject.Years), }, }, } diff --git a/internal/service/s3/bucket_object_lock_configuration.go b/internal/service/s3/bucket_object_lock_configuration.go index bc9be8b3d4c..95723494625 100644 --- a/internal/service/s3/bucket_object_lock_configuration.go +++ b/internal/service/s3/bucket_object_lock_configuration.go @@ -72,7 +72,7 @@ func resourceBucketObjectLockConfiguration() *schema.Resource { Optional: true, ConflictsWith: []string{"rule.0.default_retention.0.years"}, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, ValidateDiagFunc: enum.Validate[types.ObjectLockRetentionMode](), @@ -318,7 +318,7 @@ func expandDefaultRetention(l []interface{}) *types.DefaultRetention { dr.Days = aws.Int32(int32(v)) } - if v, ok := tfMap["mode"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrMode].(string); ok && v != "" { dr.Mode = types.ObjectLockRetentionMode(v) } @@ -349,9 +349,9 @@ func flattenDefaultRetention(dr *types.DefaultRetention) []interface{} { } m := map[string]interface{}{ - "days": dr.Days, - "mode": dr.Mode, - "years": dr.Years, + "days": dr.Days, + names.AttrMode: dr.Mode, + "years": dr.Years, } return []interface{}{m} From 6264ae1fd33079059aebae42a569f95e7f1414ac Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:40 -0400 Subject: [PATCH 1232/1490] sagemaker: Use constant for mode strings --- internal/service/sagemaker/model.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/sagemaker/model.go b/internal/service/sagemaker/model.go index 7067b3c39fe..84e369ffee0 100644 --- a/internal/service/sagemaker/model.go +++ b/internal/service/sagemaker/model.go @@ -96,7 +96,7 @@ func ResourceModel() *schema.Resource { }, }, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -173,7 +173,7 @@ func ResourceModel() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "mode": { + names.AttrMode: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(sagemaker.InferenceExecutionMode_Values(), false), @@ -243,7 +243,7 @@ func ResourceModel() *schema.Resource { }, }, }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -497,7 +497,7 @@ func expandContainer(m map[string]interface{}) *sagemaker.ContainerDefinition { container.Image = aws.String(v.(string)) } - if v, ok := m["mode"]; ok && v.(string) != "" { + if v, ok := m[names.AttrMode]; ok && v.(string) != "" { container.Mode = aws.String(v.(string)) } @@ -616,7 +616,7 @@ func flattenContainer(container *sagemaker.ContainerDefinition) []interface{} { } if container.Mode != nil { - cfg["mode"] = aws.StringValue(container.Mode) + cfg[names.AttrMode] = aws.StringValue(container.Mode) } if container.ContainerHostname != nil { @@ -722,7 +722,7 @@ func expandModelInferenceExecutionConfig(l []interface{}) *sagemaker.InferenceEx m := l[0].(map[string]interface{}) config := &sagemaker.InferenceExecutionConfig{ - Mode: aws.String(m["mode"].(string)), + Mode: aws.String(m[names.AttrMode].(string)), } return config @@ -735,7 +735,7 @@ func flattenModelInferenceExecutionConfig(config *sagemaker.InferenceExecutionCo cfg := make(map[string]interface{}) - cfg["mode"] = aws.StringValue(config.Mode) + cfg[names.AttrMode] = aws.StringValue(config.Mode) return []interface{}{cfg} } From b14b6882a2194e2cf2091f854a68e70140595429 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:40 -0400 Subject: [PATCH 1233/1490] scheduler: Use constant for mode strings --- internal/service/scheduler/flex.go | 4 ++-- internal/service/scheduler/schedule.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/scheduler/flex.go b/internal/service/scheduler/flex.go index 179dbaab194..641c5b0d7e0 100644 --- a/internal/service/scheduler/flex.go +++ b/internal/service/scheduler/flex.go @@ -302,7 +302,7 @@ func expandFlexibleTimeWindow(tfMap map[string]interface{}) *types.FlexibleTimeW a.MaximumWindowInMinutes = aws.Int32(int32(v)) } - if v, ok := tfMap["mode"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrMode].(string); ok && v != "" { a.Mode = types.FlexibleTimeWindowMode(v) } @@ -321,7 +321,7 @@ func flattenFlexibleTimeWindow(apiObject *types.FlexibleTimeWindow) map[string]i } if v := string(apiObject.Mode); v != "" { - m["mode"] = v + m[names.AttrMode] = v } return m diff --git a/internal/service/scheduler/schedule.go b/internal/service/scheduler/schedule.go index 5d37a664a0d..0e43c177bb8 100644 --- a/internal/service/scheduler/schedule.go +++ b/internal/service/scheduler/schedule.go @@ -70,7 +70,7 @@ func resourceSchedule() *schema.Resource { Optional: true, ValidateDiagFunc: validation.ToDiagFunc(validation.IntBetween(1, 1440)), }, - "mode": { + names.AttrMode: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[types.FlexibleTimeWindowMode](), From dc2ec0c9fc4c492ea5970b40b5e46dc53e268d75 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:37:41 -0400 Subject: [PATCH 1234/1490] verifiedpermissions: Use constant for mode strings --- internal/service/verifiedpermissions/policy_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/verifiedpermissions/policy_store.go b/internal/service/verifiedpermissions/policy_store.go index 2590e9fbb6d..c5a92328fbc 100644 --- a/internal/service/verifiedpermissions/policy_store.go +++ b/internal/service/verifiedpermissions/policy_store.go @@ -72,7 +72,7 @@ func (r *resourcePolicyStore) Schema(ctx context.Context, request resource.Schem }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "mode": schema.StringAttribute{ + names.AttrMode: schema.StringAttribute{ CustomType: fwtypes.StringEnumType[awstypes.ValidationMode](), Required: true, }, From fe265d0ef951418734995f051d2f89ad72b3383b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:20 -0400 Subject: [PATCH 1235/1490] ci: Prefer constant for string literal "unit" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 8f0e5ffc681..95cbd342432 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1475,3 +1475,13 @@ rules: - pattern: '"mode"' severity: ERROR fix: "names.AttrMode" + - id: literal-unit-string-constant + languages: [go] + message: Use the constant `names.AttrUnit` for the string literal "unit" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"unit"' + severity: ERROR + fix: "names.AttrUnit" From b9b45986052a20c6f55aa877391268fbeb4c0385 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:20 -0400 Subject: [PATCH 1236/1490] names: Add constant for string literal "unit" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 526dc588d5e..6b5c651ef33 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -82,6 +82,7 @@ const ( AttrTransitGatewayID = "transit_gateway_id" AttrType = "type" AttrURL = "url" + AttrUnit = "unit" AttrUsername = "username" AttrVPCID = "vpc_id" AttrVPCSecurityGroupIDs = "vpc_security_group_ids" From 4aed0b178c9b6055a7ca54952ea101f48f87c247 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:21 -0400 Subject: [PATCH 1237/1490] appautoscaling: Use constant for unit strings --- internal/service/appautoscaling/policy.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/appautoscaling/policy.go b/internal/service/appautoscaling/policy.go index ababaadefe5..ea3394f3b47 100644 --- a/internal/service/appautoscaling/policy.go +++ b/internal/service/appautoscaling/policy.go @@ -221,7 +221,7 @@ func resourcePolicy() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 100), }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, }, @@ -247,7 +247,7 @@ func resourcePolicy() *schema.Resource { ConflictsWith: []string{"target_tracking_scaling_policy_configuration.0.customized_metric_specification.0.metrics"}, ValidateFunc: validation.StringInSlice(applicationautoscaling.MetricStatistic_Values(), false), }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"target_tracking_scaling_policy_configuration.0.customized_metric_specification.0.metrics"}, @@ -556,7 +556,7 @@ func expandCustomizedMetricSpecification(configured []interface{}) *applicationa spec.Namespace = aws.String(v.(string)) } - if v, ok := data["unit"].(string); ok && v != "" { + if v, ok := data[names.AttrUnit].(string); ok && v != "" { spec.Unit = aws.String(v) } @@ -615,7 +615,7 @@ func expandTargetTrackingMetricDataQueries(metricDataQuerySlices []interface{}) Metric: metric, Stat: aws.String(metricStatSpec["stat"].(string)), } - if v, ok := metricStatSpec["unit"]; ok && len(v.(string)) > 0 { + if v, ok := metricStatSpec[names.AttrUnit]; ok && len(v.(string)) > 0 { metricStat.Unit = aws.String(v.(string)) } metricDataQuery.MetricStat = metricStat @@ -859,7 +859,7 @@ func flattenCustomizedMetricSpecification(cfg *applicationautoscaling.Customized } if v := cfg.Unit; v != nil { - m["unit"] = aws.StringValue(v) + m[names.AttrUnit] = aws.StringValue(v) } } @@ -899,7 +899,7 @@ func flattenTargetTrackingMetricDataQueries(metricDataQueries []*applicationauto metricStatSpec["metric"] = []map[string]interface{}{metricSpec} metricStatSpec["stat"] = aws.StringValue(rawMetricStat.Stat) if rawMetricStat.Unit != nil { - metricStatSpec["unit"] = aws.StringValue(rawMetricStat.Unit) + metricStatSpec[names.AttrUnit] = aws.StringValue(rawMetricStat.Unit) } metricDataQuery["metric_stat"] = []map[string]interface{}{metricStatSpec} } From c54676301840c52269864278bbd1e91d728aadb9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:21 -0400 Subject: [PATCH 1238/1490] appmesh: Use constant for unit strings --- internal/service/appmesh/flex.go | 4 ++-- internal/service/appmesh/route.go | 14 +++++++------- internal/service/appmesh/virtual_node.go | 18 +++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/appmesh/flex.go b/internal/service/appmesh/flex.go index b241e39039b..eedb55f8c69 100644 --- a/internal/service/appmesh/flex.go +++ b/internal/service/appmesh/flex.go @@ -155,7 +155,7 @@ func expandDuration(vDuration []interface{}) *appmesh.Duration { mDuration := vDuration[0].(map[string]interface{}) - if vUnit, ok := mDuration["unit"].(string); ok && vUnit != "" { + if vUnit, ok := mDuration[names.AttrUnit].(string); ok && vUnit != "" { duration.Unit = aws.String(vUnit) } if vValue, ok := mDuration[names.AttrValue].(int); ok && vValue > 0 { @@ -1301,7 +1301,7 @@ func flattenDuration(duration *appmesh.Duration) []interface{} { } mDuration := map[string]interface{}{ - "unit": aws.StringValue(duration.Unit), + names.AttrUnit: aws.StringValue(duration.Unit), names.AttrValue: int(aws.Int64Value(duration.Value)), } diff --git a/internal/service/appmesh/route.go b/internal/service/appmesh/route.go index f5408cd1e6f..bfa706eb65d 100644 --- a/internal/service/appmesh/route.go +++ b/internal/service/appmesh/route.go @@ -307,7 +307,7 @@ func resourceRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -342,7 +342,7 @@ func resourceRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -361,7 +361,7 @@ func resourceRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -558,7 +558,7 @@ func resourceRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -593,7 +593,7 @@ func resourceRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -612,7 +612,7 @@ func resourceRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -717,7 +717,7 @@ func resourceRouteSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), diff --git a/internal/service/appmesh/virtual_node.go b/internal/service/appmesh/virtual_node.go index c73e7fd53a6..3993099907d 100644 --- a/internal/service/appmesh/virtual_node.go +++ b/internal/service/appmesh/virtual_node.go @@ -436,7 +436,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -455,7 +455,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -521,7 +521,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -540,7 +540,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -569,7 +569,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -588,7 +588,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -617,7 +617,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -636,7 +636,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), @@ -665,7 +665,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appmesh.DurationUnit_Values(), false), From 55e5e7dfddc8a0430bebfd3a896a908e609ab2b8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:21 -0400 Subject: [PATCH 1239/1490] autoscaling: Use constant for unit strings --- internal/service/autoscaling/policy.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/autoscaling/policy.go b/internal/service/autoscaling/policy.go index 5db2847398f..babfadf18cc 100644 --- a/internal/service/autoscaling/policy.go +++ b/internal/service/autoscaling/policy.go @@ -109,7 +109,7 @@ func resourcePolicy() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 100), }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, }, @@ -436,7 +436,7 @@ func resourcePolicy() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 100), }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, }, @@ -461,7 +461,7 @@ func resourcePolicy() *schema.Resource { Optional: true, ConflictsWith: []string{"target_tracking_configuration.0.customized_metric_specification.0.metrics"}, }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"target_tracking_configuration.0.customized_metric_specification.0.metrics"}, @@ -804,7 +804,7 @@ func expandTargetTrackingConfiguration(configs []interface{}) *awstypes.TargetTr customSpec.Namespace = aws.String(spec["namespace"].(string)) customSpec.MetricName = aws.String(spec["metric_name"].(string)) customSpec.Statistic = awstypes.MetricStatistic(spec["statistic"].(string)) - if val, ok := spec["unit"]; ok && len(val.(string)) > 0 { + if val, ok := spec[names.AttrUnit]; ok && len(val.(string)) > 0 { customSpec.Unit = aws.String(val.(string)) } if val, ok := spec["metric_dimension"]; ok { @@ -861,7 +861,7 @@ func expandTargetTrackingMetricDataQueries(metricDataQuerySlices []interface{}) Metric: metric, Stat: aws.String(metricStatSpec["stat"].(string)), } - if v, ok := metricStatSpec["unit"]; ok && len(v.(string)) > 0 { + if v, ok := metricStatSpec[names.AttrUnit]; ok && len(v.(string)) > 0 { metricStat.Unit = aws.String(v.(string)) } metricDataQuery.MetricStat = metricStat @@ -1026,7 +1026,7 @@ func expandMetricDataQueries(metricDataQuerySlices []interface{}) []awstypes.Met Metric: metric, Stat: aws.String(metricStatSpec["stat"].(string)), } - if v, ok := metricStatSpec["unit"]; ok && len(v.(string)) > 0 { + if v, ok := metricStatSpec[names.AttrUnit]; ok && len(v.(string)) > 0 { metricStat.Unit = aws.String(v.(string)) } metricDataQuery.MetricStat = metricStat @@ -1070,7 +1070,7 @@ func flattenTargetTrackingConfiguration(config *awstypes.TargetTrackingConfigura spec["namespace"] = aws.ToString(config.CustomizedMetricSpecification.Namespace) spec["statistic"] = string(config.CustomizedMetricSpecification.Statistic) if config.CustomizedMetricSpecification.Unit != nil { - spec["unit"] = aws.ToString(config.CustomizedMetricSpecification.Unit) + spec[names.AttrUnit] = aws.ToString(config.CustomizedMetricSpecification.Unit) } if config.CustomizedMetricSpecification.Dimensions != nil { dimSpec := make([]interface{}, len(config.CustomizedMetricSpecification.Dimensions)) @@ -1122,7 +1122,7 @@ func flattenTargetTrackingMetricDataQueries(metricDataQueries []awstypes.TargetT metricStatSpec["metric"] = []map[string]interface{}{metricSpec} metricStatSpec["stat"] = aws.ToString(rawMetricStat.Stat) if rawMetricStat.Unit != nil { - metricStatSpec["unit"] = aws.ToString(rawMetricStat.Unit) + metricStatSpec[names.AttrUnit] = aws.ToString(rawMetricStat.Unit) } metricDataQuery["metric_stat"] = []map[string]interface{}{metricStatSpec} } @@ -1273,7 +1273,7 @@ func flattenMetricDataQueries(metricDataQueries []awstypes.MetricDataQuery) []in metricStatSpec["metric"] = []map[string]interface{}{metricSpec} metricStatSpec["stat"] = aws.ToString(rawMetricStat.Stat) if rawMetricStat.Unit != nil { - metricStatSpec["unit"] = aws.ToString(rawMetricStat.Unit) + metricStatSpec[names.AttrUnit] = aws.ToString(rawMetricStat.Unit) } metricDataQuery["metric_stat"] = []map[string]interface{}{metricStatSpec} } From 9d1cf5b068daae2e1dec7c0801ec7b2a2b0eae8d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:21 -0400 Subject: [PATCH 1240/1490] autoscalingplans: Use constant for unit strings --- .../service/autoscalingplans/scaling_plan.go | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/autoscalingplans/scaling_plan.go b/internal/service/autoscalingplans/scaling_plan.go index 742564a3a0a..1e74a497f41 100644 --- a/internal/service/autoscalingplans/scaling_plan.go +++ b/internal/service/autoscalingplans/scaling_plan.go @@ -123,7 +123,7 @@ func ResourceScalingPlan() *schema.Resource { ValidateFunc: validation.StringInSlice(enum.Slice(awstypes.MetricStatisticSum), false), }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, }, @@ -255,7 +255,7 @@ func ResourceScalingPlan() *schema.Resource { ValidateDiagFunc: enum.Validate[awstypes.MetricStatistic](), }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, }, @@ -617,7 +617,7 @@ func expandScalingInstructions(vScalingInstructions *schema.Set) []awstypes.Scal if v, ok := mCustomizedLoadMetricSpecification["statistic"].(string); ok && v != "" { customizedLoadMetricSpecification.Statistic = awstypes.MetricStatistic(v) } - if v, ok := mCustomizedLoadMetricSpecification["unit"].(string); ok && v != "" { + if v, ok := mCustomizedLoadMetricSpecification[names.AttrUnit].(string); ok && v != "" { customizedLoadMetricSpecification.Unit = aws.String(v) } @@ -691,7 +691,7 @@ func expandScalingInstructions(vScalingInstructions *schema.Set) []awstypes.Scal if v, ok := mCustomizedScalingMetricSpecification["statistic"].(string); ok && v != "" { customizedScalingMetricSpecification.Statistic = awstypes.MetricStatistic(v) } - if v, ok := mCustomizedScalingMetricSpecification["unit"].(string); ok && v != "" { + if v, ok := mCustomizedScalingMetricSpecification[names.AttrUnit].(string); ok && v != "" { customizedScalingMetricSpecification.Unit = aws.String(v) } @@ -751,11 +751,11 @@ func flattenScalingInstructions(scalingInstructions []awstypes.ScalingInstructio mScalingInstruction["customized_load_metric_specification"] = []interface{}{ map[string]interface{}{ - "dimensions": mDimensions, - "metric_name": aws.ToString(customizedLoadMetricSpecification.MetricName), - "namespace": aws.ToString(customizedLoadMetricSpecification.Namespace), - "statistic": string(customizedLoadMetricSpecification.Statistic), - "unit": aws.ToString(customizedLoadMetricSpecification.Unit), + "dimensions": mDimensions, + "metric_name": aws.ToString(customizedLoadMetricSpecification.MetricName), + "namespace": aws.ToString(customizedLoadMetricSpecification.Namespace), + "statistic": string(customizedLoadMetricSpecification.Statistic), + names.AttrUnit: aws.ToString(customizedLoadMetricSpecification.Unit), }, } } @@ -789,11 +789,11 @@ func flattenScalingInstructions(scalingInstructions []awstypes.ScalingInstructio mTargetTrackingConfiguration["customized_scaling_metric_specification"] = []interface{}{ map[string]interface{}{ - "dimensions": mDimensions, - "metric_name": aws.ToString(customizedScalingMetricSpecification.MetricName), - "namespace": aws.ToString(customizedScalingMetricSpecification.Namespace), - "statistic": string(customizedScalingMetricSpecification.Statistic), - "unit": aws.ToString(customizedScalingMetricSpecification.Unit), + "dimensions": mDimensions, + "metric_name": aws.ToString(customizedScalingMetricSpecification.MetricName), + "namespace": aws.ToString(customizedScalingMetricSpecification.Namespace), + "statistic": string(customizedScalingMetricSpecification.Statistic), + names.AttrUnit: aws.ToString(customizedScalingMetricSpecification.Unit), }, } } From 9a91d87b458c696aac48555318c8d704991d9f78 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:21 -0400 Subject: [PATCH 1241/1490] budgets: Use constant for unit strings --- internal/service/budgets/budget.go | 6 +++--- internal/service/budgets/budget_data_source.go | 10 +++++----- internal/service/budgets/budget_test.go | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/budgets/budget.go b/internal/service/budgets/budget.go index f11e6a90b27..7b140d59d02 100644 --- a/internal/service/budgets/budget.go +++ b/internal/service/budgets/budget.go @@ -264,7 +264,7 @@ func ResourceBudget() *schema.Resource { Required: true, ValidateFunc: validTimePeriodTimestamp, }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, }, @@ -797,7 +797,7 @@ func convertPlannedBudgetLimitsToSet(plannedBudgetLimits map[string]awstypes.Spe convertedPlannedBudgetLimit := make(map[string]string) convertedPlannedBudgetLimit["amount"] = aws.ToString(v.Amount) convertedPlannedBudgetLimit["start_time"] = startTime - convertedPlannedBudgetLimit["unit"] = aws.ToString(v.Unit) + convertedPlannedBudgetLimit[names.AttrUnit] = aws.ToString(v.Unit) convertedPlannedBudgetLimits[i] = convertedPlannedBudgetLimit i++ @@ -967,7 +967,7 @@ func expandPlannedBudgetLimitsUnmarshal(plannedBudgetLimitsRaw []interface{}) (m } amount := plannedBudgetLimit["amount"].(string) - unit := plannedBudgetLimit["unit"].(string) + unit := plannedBudgetLimit[names.AttrUnit].(string) plannedBudgetLimits[key] = awstypes.Spend{ Amount: aws.String(amount), diff --git a/internal/service/budgets/budget_data_source.go b/internal/service/budgets/budget_data_source.go index bd30716c3f0..b1d1cde9a84 100644 --- a/internal/service/budgets/budget_data_source.go +++ b/internal/service/budgets/budget_data_source.go @@ -79,7 +79,7 @@ func DataSourceBudget() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Computed: true, }, @@ -100,7 +100,7 @@ func DataSourceBudget() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Computed: true, }, @@ -238,7 +238,7 @@ func DataSourceBudget() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Computed: true, }, @@ -350,8 +350,8 @@ func flattenSpend(apiObject *awstypes.Spend) []interface{} { } attrs := map[string]interface{}{ - "amount": aws.ToString(apiObject.Amount), - "unit": aws.ToString(apiObject.Unit), + "amount": aws.ToString(apiObject.Amount), + names.AttrUnit: aws.ToString(apiObject.Unit), } return []interface{}{attrs} diff --git a/internal/service/budgets/budget_test.go b/internal/service/budgets/budget_test.go index dfce17e41ab..675f1c79c67 100644 --- a/internal/service/budgets/budget_test.go +++ b/internal/service/budgets/budget_test.go @@ -822,9 +822,9 @@ planned_limit { testCheckFuncs := make([]resource.TestCheckFunc, len(startTimes)) for i := 0; i < len(startTimes); i++ { testCheckFuncs[i] = resource.TestCheckTypeSetElemNestedAttrs(resourceName, "planned_limit.*", map[string]string{ - "start_time": tfbudgets.TimePeriodTimestampToString(&startTimes[i]), - "amount": amount, - "unit": "USD", + "start_time": tfbudgets.TimePeriodTimestampToString(&startTimes[i]), + "amount": amount, + names.AttrUnit: "USD", }) } From 9ff991e5e769acddb99451c32688a0efc6cd5a8b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:21 -0400 Subject: [PATCH 1242/1490] cloudwatch: Use constant for unit strings --- internal/service/cloudwatch/metric_alarm.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/cloudwatch/metric_alarm.go b/internal/service/cloudwatch/metric_alarm.go index 71f45516d98..155fd5f3ca9 100644 --- a/internal/service/cloudwatch/metric_alarm.go +++ b/internal/service/cloudwatch/metric_alarm.go @@ -198,7 +198,7 @@ func resourceMetricAlarm() *schema.Resource { ), ), }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, ValidateDiagFunc: enum.Validate[types.StandardUnit](), @@ -281,7 +281,7 @@ func resourceMetricAlarm() *schema.Resource { Default: missingDataMissing, ValidateFunc: validation.StringInSlice(missingData_Values(), true), }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, ValidateDiagFunc: enum.Validate[types.StandardUnit](), @@ -410,7 +410,7 @@ func resourceMetricAlarmRead(ctx context.Context, d *schema.ResourceData, meta i } else { d.Set("treat_missing_data", missingDataMissing) } - d.Set("unit", alarm.Unit) + d.Set(names.AttrUnit, alarm.Unit) return diags } @@ -542,7 +542,7 @@ func expandPutMetricAlarmInput(ctx context.Context, d *schema.ResourceData) *clo apiObject.Threshold = aws.Float64(d.Get("threshold").(float64)) } - if v, ok := d.GetOk("unit"); ok { + if v, ok := d.GetOk(names.AttrUnit); ok { apiObject.Unit = types.StandardUnit(v.(string)) } @@ -595,9 +595,9 @@ func flattenMetricAlarmMetricsMetricStat(apiObject *types.MetricStat) map[string } tfMap := map[string]interface{}{ - "period": aws.ToInt32(apiObject.Period), - "stat": aws.ToString(apiObject.Stat), - "unit": apiObject.Unit, + "period": aws.ToInt32(apiObject.Period), + "stat": aws.ToString(apiObject.Stat), + names.AttrUnit: apiObject.Unit, } if v := apiObject.Metric; v != nil { @@ -685,7 +685,7 @@ func expandMetricAlarmMetricsMetric(tfMap map[string]interface{}) *types.MetricS apiObject.Period = aws.Int32(int32(v.(int))) } - if v, ok := tfMap["unit"]; ok && v.(string) != "" { + if v, ok := tfMap[names.AttrUnit]; ok && v.(string) != "" { apiObject.Unit = types.StandardUnit(v.(string)) } From 8faa615121887584ef9e8b7e91e65d47006f47ff Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:22 -0400 Subject: [PATCH 1243/1490] ecs: Use constant for unit strings --- internal/service/ecs/flex.go | 4 ++-- internal/service/ecs/task_set.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/ecs/flex.go b/internal/service/ecs/flex.go index 970a55df079..5ea3d0b34ea 100644 --- a/internal/service/ecs/flex.go +++ b/internal/service/ecs/flex.go @@ -198,7 +198,7 @@ func expandScale(l []interface{}) *ecs.Scale { result := &ecs.Scale{} - if v, ok := tfMap["unit"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrUnit].(string); ok && v != "" { result.Unit = aws.String(v) } @@ -216,7 +216,7 @@ func flattenScale(scale *ecs.Scale) []map[string]interface{} { } m := make(map[string]interface{}) - m["unit"] = aws.StringValue(scale.Unit) + m[names.AttrUnit] = aws.StringValue(scale.Unit) m[names.AttrValue] = aws.Float64Value(scale.Value) return []map[string]interface{}{m} diff --git a/internal/service/ecs/task_set.go b/internal/service/ecs/task_set.go index eea3c660b4d..c26b4728a7d 100644 --- a/internal/service/ecs/task_set.go +++ b/internal/service/ecs/task_set.go @@ -171,7 +171,7 @@ func ResourceTaskSet() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, Default: ecs.ScaleUnitPercent, From 7ee9a48152acf6cba1bea1844f17dea5b1ea3df7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:22 -0400 Subject: [PATCH 1244/1490] elasticache: Use constant for unit strings --- internal/service/elasticache/serverless_cache.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/elasticache/serverless_cache.go b/internal/service/elasticache/serverless_cache.go index d5433bb59f5..80efe84acdb 100644 --- a/internal/service/elasticache/serverless_cache.go +++ b/internal/service/elasticache/serverless_cache.go @@ -205,7 +205,7 @@ func (r *serverlessCacheResource) Schema(ctx context.Context, request resource.S int64planmodifier.RequiresReplace(), }, }, - "unit": schema.StringAttribute{ + names.AttrUnit: schema.StringAttribute{ CustomType: fwtypes.StringEnumType[awstypes.DataStorageUnit](), Required: true, }, From 0c2bc39f6a91e4dfbb92def00bffcc77bac6d55b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:22 -0400 Subject: [PATCH 1245/1490] elasticsearch: Use constant for unit strings --- internal/service/elasticsearch/domain.go | 2 +- internal/service/elasticsearch/domain_data_source.go | 2 +- internal/service/elasticsearch/domain_structure.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/elasticsearch/domain.go b/internal/service/elasticsearch/domain.go index 1ff7ba021b9..5bde0cd631e 100644 --- a/internal/service/elasticsearch/domain.go +++ b/internal/service/elasticsearch/domain.go @@ -186,7 +186,7 @@ func ResourceDomain() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(elasticsearch.TimeUnit_Values(), false), diff --git a/internal/service/elasticsearch/domain_data_source.go b/internal/service/elasticsearch/domain_data_source.go index a00581d8a31..c5459d3470a 100644 --- a/internal/service/elasticsearch/domain_data_source.go +++ b/internal/service/elasticsearch/domain_data_source.go @@ -76,7 +76,7 @@ func DataSourceDomain() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/elasticsearch/domain_structure.go b/internal/service/elasticsearch/domain_structure.go index ca2093953cc..a29026149e7 100644 --- a/internal/service/elasticsearch/domain_structure.go +++ b/internal/service/elasticsearch/domain_structure.go @@ -111,7 +111,7 @@ func expandAutoTuneMaintenanceSchedules(tfList []interface{}) []*elasticsearch.A func expandAutoTuneMaintenanceScheduleDuration(tfMap map[string]interface{}) *elasticsearch.Duration { autoTuneMaintenanceScheduleDuration := &elasticsearch.Duration{ Value: aws.Int64(int64(tfMap[names.AttrValue].(int))), - Unit: aws.String(tfMap["unit"].(string)), + Unit: aws.String(tfMap[names.AttrUnit].(string)), } return autoTuneMaintenanceScheduleDuration @@ -230,7 +230,7 @@ func flattenAutoTuneMaintenanceScheduleDuration(autoTuneMaintenanceScheduleDurat m := map[string]interface{}{} m[names.AttrValue] = aws.Int64Value(autoTuneMaintenanceScheduleDuration.Value) - m["unit"] = aws.StringValue(autoTuneMaintenanceScheduleDuration.Unit) + m[names.AttrUnit] = aws.StringValue(autoTuneMaintenanceScheduleDuration.Unit) return m } From 0d1af1506d9e266a18fd3c8e864b317802381519 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:22 -0400 Subject: [PATCH 1246/1490] iot: Use constant for unit strings --- internal/service/iot/topic_rule.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/iot/topic_rule.go b/internal/service/iot/topic_rule.go index 80ef1dc612d..40d845d984e 100644 --- a/internal/service/iot/topic_rule.go +++ b/internal/service/iot/topic_rule.go @@ -797,7 +797,7 @@ func ResourceTopicRule() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ @@ -1169,7 +1169,7 @@ func ResourceTopicRule() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ @@ -1988,7 +1988,7 @@ func expandTimestreamTimestamp(tfList []interface{}) *iot.TimestreamTimestamp { apiObject := &iot.TimestreamTimestamp{} tfMap := tfList[0].(map[string]interface{}) - if v, ok := tfMap["unit"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrUnit].(string); ok && v != "" { apiObject.Unit = aws.String(v) } @@ -3313,7 +3313,7 @@ func flattenTimestreamTimestamp(apiObject *iot.TimestreamTimestamp) []interface{ tfMap := make(map[string]interface{}) if v := apiObject.Unit; v != nil { - tfMap["unit"] = aws.StringValue(v) + tfMap[names.AttrUnit] = aws.StringValue(v) } if v := apiObject.Value; v != nil { From 21dcdf437fa3788f45e9f43834561711033d86be Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:22 -0400 Subject: [PATCH 1247/1490] licensemanager: Use constant for unit strings --- .../service/licensemanager/received_license_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/licensemanager/received_license_data_source.go b/internal/service/licensemanager/received_license_data_source.go index 5dbbdbe1e25..b29e821a4ed 100644 --- a/internal/service/licensemanager/received_license_data_source.go +++ b/internal/service/licensemanager/received_license_data_source.go @@ -97,7 +97,7 @@ func DataSourceReceivedLicense() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Computed: true, }, @@ -357,7 +357,7 @@ func flattenEntitlement(apiObject *licensemanager.Entitlement) map[string]interf } if v := apiObject.Unit; v != nil { - tfMap["unit"] = v + tfMap[names.AttrUnit] = v } if v := apiObject.Value; v != nil { From 65eac20b4c4f09652dd2e9879347a182d02fa4e5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:23 -0400 Subject: [PATCH 1248/1490] logs: Use constant for unit strings --- internal/service/logs/metric_filter.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/logs/metric_filter.go b/internal/service/logs/metric_filter.go index ed7b73e311f..ffe697ec90f 100644 --- a/internal/service/logs/metric_filter.go +++ b/internal/service/logs/metric_filter.go @@ -72,7 +72,7 @@ func resourceMetricFilter() *schema.Resource { Required: true, ValidateFunc: validLogMetricFilterTransformationName, }, - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, Default: types.StandardUnitNone, @@ -267,7 +267,7 @@ func expandMetricTransformation(tfMap map[string]interface{}) *types.MetricTrans apiObject.MetricNamespace = aws.String(v) } - if v, ok := tfMap["unit"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrUnit].(string); ok && v != "" { apiObject.Unit = types.StandardUnit(v) } @@ -306,7 +306,7 @@ func expandMetricTransformations(tfList []interface{}) []types.MetricTransformat func flattenMetricTransformation(apiObject types.MetricTransformation) map[string]interface{} { tfMap := map[string]interface{}{ - "unit": apiObject.Unit, + names.AttrUnit: apiObject.Unit, } if v := apiObject.DefaultValue; v != nil { From ad20c005e95c38bd259b732d0642dd6d229c9477 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:23 -0400 Subject: [PATCH 1249/1490] opensearch: Use constant for unit strings --- internal/service/opensearch/domain.go | 2 +- internal/service/opensearch/domain_data_source.go | 2 +- internal/service/opensearch/domain_structure.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/opensearch/domain.go b/internal/service/opensearch/domain.go index 173128a54f1..ceb96499bf4 100644 --- a/internal/service/opensearch/domain.go +++ b/internal/service/opensearch/domain.go @@ -195,7 +195,7 @@ func ResourceDomain() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(opensearchservice.TimeUnit_Values(), false), diff --git a/internal/service/opensearch/domain_data_source.go b/internal/service/opensearch/domain_data_source.go index ae22a123c14..069f1348b8a 100644 --- a/internal/service/opensearch/domain_data_source.go +++ b/internal/service/opensearch/domain_data_source.go @@ -80,7 +80,7 @@ func DataSourceDomain() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/opensearch/domain_structure.go b/internal/service/opensearch/domain_structure.go index 9087b0a20f5..d7630622bf5 100644 --- a/internal/service/opensearch/domain_structure.go +++ b/internal/service/opensearch/domain_structure.go @@ -118,7 +118,7 @@ func expandAutoTuneMaintenanceSchedules(tfList []interface{}) []*opensearchservi func expandAutoTuneMaintenanceScheduleDuration(tfMap map[string]interface{}) *opensearchservice.Duration { autoTuneMaintenanceScheduleDuration := &opensearchservice.Duration{ Value: aws.Int64(int64(tfMap[names.AttrValue].(int))), - Unit: aws.String(tfMap["unit"].(string)), + Unit: aws.String(tfMap[names.AttrUnit].(string)), } return autoTuneMaintenanceScheduleDuration @@ -294,7 +294,7 @@ func flattenAutoTuneMaintenanceScheduleDuration(autoTuneMaintenanceScheduleDurat m := map[string]interface{}{} m[names.AttrValue] = aws.Int64Value(autoTuneMaintenanceScheduleDuration.Value) - m["unit"] = aws.StringValue(autoTuneMaintenanceScheduleDuration.Unit) + m[names.AttrUnit] = aws.StringValue(autoTuneMaintenanceScheduleDuration.Unit) return m } From 5a062e7cf3e8293927b69b47e0d4051958025d27 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:23 -0400 Subject: [PATCH 1250/1490] sagemaker: Use constant for unit strings --- internal/service/sagemaker/feature_group.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/sagemaker/feature_group.go b/internal/service/sagemaker/feature_group.go index e09dfbe654a..164d195c3ed 100644 --- a/internal/service/sagemaker/feature_group.go +++ b/internal/service/sagemaker/feature_group.go @@ -215,7 +215,7 @@ func ResourceFeatureGroup() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice(sagemaker.TtlDurationUnit_Values(), false), @@ -514,7 +514,7 @@ func expandFeatureGroupOnlineStoreConfigTTLDuration(l []interface{}) *sagemaker. m := l[0].(map[string]interface{}) config := &sagemaker.TtlDuration{ - Unit: aws.String(m["unit"].(string)), + Unit: aws.String(m[names.AttrUnit].(string)), Value: aws.Int64(int64(m[names.AttrValue].(int))), } @@ -527,7 +527,7 @@ func flattenFeatureGroupOnlineStoreConfigTTLDuration(config *sagemaker.TtlDurati } m := map[string]interface{}{ - "unit": aws.StringValue(config.Unit), + names.AttrUnit: aws.StringValue(config.Unit), names.AttrValue: aws.Int64Value(config.Value), } From f1f9ebad7ff13ec87e75efaad56ad4f13f97b36c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:24 -0400 Subject: [PATCH 1251/1490] securityhub: Use constant for unit strings --- internal/service/securityhub/automation_rule.go | 2 +- internal/service/securityhub/insight.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/securityhub/automation_rule.go b/internal/service/securityhub/automation_rule.go index 55e3862237c..d4ea4a919a7 100644 --- a/internal/service/securityhub/automation_rule.go +++ b/internal/service/securityhub/automation_rule.go @@ -268,7 +268,7 @@ func dateFilterSchemaFramework(ctx context.Context) schema.SetNestedBlock { }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "unit": schema.StringAttribute{ + names.AttrUnit: schema.StringAttribute{ CustomType: fwtypes.StringEnumType[awstypes.DateRangeUnit](), Required: true, }, diff --git a/internal/service/securityhub/insight.go b/internal/service/securityhub/insight.go index d469dc08f0d..e86d640ac99 100644 --- a/internal/service/securityhub/insight.go +++ b/internal/service/securityhub/insight.go @@ -299,7 +299,7 @@ func dateFilterSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "unit": { + names.AttrUnit: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[types.DateRangeUnit](), @@ -450,7 +450,7 @@ func expandDateFilterDateRange(l []interface{}) *types.DateRange { dr := &types.DateRange{} - if v, ok := tfMap["unit"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrUnit].(string); ok && v != "" { dr.Unit = types.DateRangeUnit(v) } @@ -1021,7 +1021,7 @@ func flattenDateFilterDateRange(dateRange *types.DateRange) []interface{} { } m := map[string]interface{}{ - "unit": string(dateRange.Unit), + names.AttrUnit: string(dateRange.Unit), names.AttrValue: aws.ToInt32((dateRange.Value)), } From fb6dd6a85581b145e5e1ba8fd4ed34186daa3af1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:40:24 -0400 Subject: [PATCH 1252/1490] servicequotas: Use constant for unit strings --- internal/service/servicequotas/template.go | 2 +- internal/service/servicequotas/templates_data_source.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/servicequotas/template.go b/internal/service/servicequotas/template.go index 6fd074a0250..1628fbe6c59 100644 --- a/internal/service/servicequotas/template.go +++ b/internal/service/servicequotas/template.go @@ -85,7 +85,7 @@ func (r *resourceTemplate) Schema(ctx context.Context, req resource.SchemaReques stringplanmodifier.UseStateForUnknown(), }, }, - "unit": schema.StringAttribute{ + names.AttrUnit: schema.StringAttribute{ Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), diff --git a/internal/service/servicequotas/templates_data_source.go b/internal/service/servicequotas/templates_data_source.go index 9da29543e8b..e112831df3d 100644 --- a/internal/service/servicequotas/templates_data_source.go +++ b/internal/service/servicequotas/templates_data_source.go @@ -67,7 +67,7 @@ func (d *dataSourceTemplates) Schema(ctx context.Context, req datasource.SchemaR "service_name": schema.StringAttribute{ Computed: true, }, - "unit": schema.StringAttribute{ + names.AttrUnit: schema.StringAttribute{ Computed: true, }, names.AttrValue: schema.Float64Attribute{ @@ -117,7 +117,7 @@ var templatesSourceAttrTypes = map[string]attr.Type{ names.AttrRegion: types.StringType, "service_code": types.StringType, "service_name": types.StringType, - "unit": types.StringType, + names.AttrUnit: types.StringType, names.AttrValue: types.Float64Type, } @@ -140,7 +140,7 @@ func flattenTemplates(ctx context.Context, apiObject []awstypes.ServiceQuotaIncr names.AttrRegion: flex.StringToFramework(ctx, t.AwsRegion), "service_code": flex.StringToFramework(ctx, t.ServiceCode), "service_name": flex.StringToFramework(ctx, t.ServiceName), - "unit": flex.StringToFramework(ctx, t.Unit), + names.AttrUnit: flex.StringToFramework(ctx, t.Unit), names.AttrValue: flex.Float64ToFramework(ctx, t.DesiredValue), } objVal, d := types.ObjectValue(templatesSourceAttrTypes, obj) From 66ebe67596f4fd0a62d31a1ef8df7de119e1c4bd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:09 -0400 Subject: [PATCH 1253/1490] ci: Prefer constant for string literal "address" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 95cbd342432..c46ca3f5f04 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1485,3 +1485,13 @@ rules: - pattern: '"unit"' severity: ERROR fix: "names.AttrUnit" + - id: literal-address-string-constant + languages: [go] + message: Use the constant `names.AttrAddress` for the string literal "address" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"address"' + severity: ERROR + fix: "names.AttrAddress" From 9d32b2931bfcf84bd6c3cb3b52fe402569ffa53b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:09 -0400 Subject: [PATCH 1254/1490] names: Add constant for string literal "address" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 6b5c651ef33..4ca47d715e6 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -9,6 +9,7 @@ const ( AttrAccessKey = "access_key" AttrAccountID = "account_id" AttrAction = "action" + AttrAddress = "address" AttrAutoMinorVersionUpgrade = "auto_minor_version_upgrade" AttrAvailabilityZone = "availability_zone" AttrAvailabilityZones = "availability_zones" From c8c5d8a96d71b1dd61da4f44caed08fe57ef4325 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:09 -0400 Subject: [PATCH 1255/1490] budgets: Use constant for address strings --- internal/service/budgets/budget_action.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/budgets/budget_action.go b/internal/service/budgets/budget_action.go index 8957f71378f..2afa489a1f4 100644 --- a/internal/service/budgets/budget_action.go +++ b/internal/service/budgets/budget_action.go @@ -206,7 +206,7 @@ func ResourceBudgetAction() *schema.Resource { MaxItems: 11, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -474,7 +474,7 @@ func expandBudgetActionSubscriber(l *schema.Set) []awstypes.Subscriber { config := awstypes.Subscriber{} raw := m.(map[string]interface{}) - if v, ok := raw["address"].(string); ok && v != "" { + if v, ok := raw[names.AttrAddress].(string); ok && v != "" { config.Address = aws.String(v) } @@ -589,7 +589,7 @@ func flattenBudgetActionSubscriber(configured []awstypes.Subscriber) []map[strin for _, raw := range configured { item := make(map[string]interface{}) - item["address"] = aws.ToString(raw.Address) + item[names.AttrAddress] = aws.ToString(raw.Address) item["subscription_type"] = string(raw.SubscriptionType) dataResources = append(dataResources, item) From ae0d9396f834d74f34a30895c5c1729191bfdbe4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:09 -0400 Subject: [PATCH 1256/1490] ce: Use constant for address strings --- internal/service/ce/anomaly_subscription.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/ce/anomaly_subscription.go b/internal/service/ce/anomaly_subscription.go index 92f864175f5..02778f2c13d 100644 --- a/internal/service/ce/anomaly_subscription.go +++ b/internal/service/ce/anomaly_subscription.go @@ -81,7 +81,7 @@ func resourceAnomalySubscription() *schema.Resource { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Required: true, }, @@ -267,7 +267,7 @@ func expandSubscribers(tfList []interface{}) []awstypes.Subscriber { } apiObjects = append(apiObjects, awstypes.Subscriber{ - Address: aws.String(tfMap["address"].(string)), + Address: aws.String(tfMap[names.AttrAddress].(string)), Type: awstypes.SubscriberType(tfMap[names.AttrType].(string)), }) } @@ -284,8 +284,8 @@ func flattenSubscribers(apiObjects []awstypes.Subscriber) []interface{} { for _, apiObject := range apiObjects { tfList = append(tfList, map[string]interface{}{ - "address": aws.ToString(apiObject.Address), - names.AttrType: apiObject.Type, + names.AttrAddress: aws.ToString(apiObject.Address), + names.AttrType: apiObject.Type, }) } From e20bcb9614d8eb4d6c8126194c9c54f41081bc32 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:09 -0400 Subject: [PATCH 1257/1490] codestarnotifications: Use constant for address strings --- .../codestarnotifications/notification_rule.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/codestarnotifications/notification_rule.go b/internal/service/codestarnotifications/notification_rule.go index dcee2ae0bf6..e43a4c9ce54 100644 --- a/internal/service/codestarnotifications/notification_rule.go +++ b/internal/service/codestarnotifications/notification_rule.go @@ -87,7 +87,7 @@ func resourceNotificationRule() *schema.Resource { MaxItems: 10, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -165,9 +165,9 @@ func resourceNotificationRuleRead(ctx context.Context, d *schema.ResourceData, m targets := make([]map[string]interface{}, 0, len(rule.Targets)) for _, t := range rule.Targets { targets = append(targets, map[string]interface{}{ - "address": aws.ToString(t.TargetAddress), - names.AttrType: aws.ToString(t.TargetType), - names.AttrStatus: t.TargetStatus, + names.AttrAddress: aws.ToString(t.TargetAddress), + names.AttrType: aws.ToString(t.TargetType), + names.AttrStatus: t.TargetStatus, }) } if err := d.Set(names.AttrTarget, targets); err != nil { @@ -273,7 +273,7 @@ func cleanupNotificationRuleTargets(ctx context.Context, conn *codestarnotificat input := &codestarnotifications.DeleteTargetInput{ ForceUnsubscribeAll: false, - TargetAddress: aws.String(target["address"].(string)), + TargetAddress: aws.String(target[names.AttrAddress].(string)), } _, err := tfresource.RetryWhenAWSErrMessageContains(ctx, targetSubscriptionTimeout, func() (interface{}, error) { @@ -298,7 +298,7 @@ func expandNotificationRuleTargets(targetsData []interface{}) []types.Target { for _, t := range targetsData { target := t.(map[string]interface{}) targets = append(targets, types.Target{ - TargetAddress: aws.String(target["address"].(string)), + TargetAddress: aws.String(target[names.AttrAddress].(string)), TargetType: aws.String(target[names.AttrType].(string)), }) } From 9034b2b54f948ceba38ec9d2d7543c34aa37db91 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:09 -0400 Subject: [PATCH 1258/1490] cognitoidp: Use constant for address strings --- internal/service/cognitoidp/user.go | 2 +- internal/service/cognitoidp/user_pool.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/cognitoidp/user.go b/internal/service/cognitoidp/user.go index 594cfed162e..6521b752011 100644 --- a/internal/service/cognitoidp/user.go +++ b/internal/service/cognitoidp/user.go @@ -544,7 +544,7 @@ func UserAttributeKeyMatchesStandardAttribute(input string) bool { } var standardAttributeKeys = []string{ - "address", + names.AttrAddress, "birthdate", "email", "email_verified", diff --git a/internal/service/cognitoidp/user_pool.go b/internal/service/cognitoidp/user_pool.go index c34d6079a7a..862e172fe56 100644 --- a/internal/service/cognitoidp/user_pool.go +++ b/internal/service/cognitoidp/user_pool.go @@ -1966,7 +1966,7 @@ func UserPoolSchemaAttributeMatchesStandardAttribute(input *cognitoidentityprovi AttributeDataType: aws.String(cognitoidentityprovider.AttributeDataTypeString), DeveloperOnlyAttribute: aws.Bool(false), Mutable: aws.Bool(true), - Name: aws.String("address"), + Name: aws.String(names.AttrAddress), Required: aws.Bool(false), StringAttributeConstraints: &cognitoidentityprovider.StringAttributeConstraintsType{ MaxLength: aws.String("2048"), From 9a5bdc5e79a4cc4daffbd83ef99649ac82f46427 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:10 -0400 Subject: [PATCH 1259/1490] customerprofiles: Use constant for address strings --- internal/service/customerprofiles/domain.go | 6 +++--- internal/service/customerprofiles/profile.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/customerprofiles/domain.go b/internal/service/customerprofiles/domain.go index 993e0909938..d18ccbcffa4 100644 --- a/internal/service/customerprofiles/domain.go +++ b/internal/service/customerprofiles/domain.go @@ -139,7 +139,7 @@ func ResourceDomain() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeList, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, @@ -638,7 +638,7 @@ func expandAttributesTypesSelector(tfMap []interface{}) *types.AttributeTypesSel apiObject.AttributeMatchingModel = types.AttributeMatchingModel(v.(string)) } - if v, ok := tfList["address"]; ok { + if v, ok := tfList[names.AttrAddress]; ok { apiObject.Address = flex.ExpandStringValueList(v.([]interface{})) } @@ -874,7 +874,7 @@ func flattenAttributeTypesSelector(apiObject *types.AttributeTypesSelector) []in tfMap := map[string]interface{}{} if v := apiObject.Address; v != nil { - tfMap["address"] = flex.FlattenStringValueList(v) + tfMap[names.AttrAddress] = flex.FlattenStringValueList(v) } tfMap["attribute_matching_model"] = apiObject.AttributeMatchingModel diff --git a/internal/service/customerprofiles/profile.go b/internal/service/customerprofiles/profile.go index a61852bd290..087e77f7429 100644 --- a/internal/service/customerprofiles/profile.go +++ b/internal/service/customerprofiles/profile.go @@ -44,7 +44,7 @@ func ResourceProfile() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "address": customerProfileAddressSchema(), + names.AttrAddress: customerProfileAddressSchema(), "attributes": { Type: schema.TypeMap, Optional: true, @@ -187,7 +187,7 @@ func resourceProfileCreate(ctx context.Context, d *schema.ResourceData, meta int input.AdditionalInformation = aws.String(v.(string)) } - if v, ok := d.GetOk("address"); ok { + if v, ok := d.GetOk(names.AttrAddress); ok { input.Address = expandAddress(v.([]interface{})) } @@ -301,7 +301,7 @@ func resourceProfileRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("account_number", output.AccountNumber) d.Set("additional_information", output.AdditionalInformation) - d.Set("address", flattenAddress(output.Address)) + d.Set(names.AttrAddress, flattenAddress(output.Address)) d.Set("account_number", output.AccountNumber) d.Set("attributes", output.Attributes) d.Set("billing_address", flattenAddress(output.BillingAddress)) @@ -342,8 +342,8 @@ func resourceProfileUpdate(ctx context.Context, d *schema.ResourceData, meta int input.AdditionalInformation = aws.String(d.Get("additional_information").(string)) } - if d.HasChange("address") { - input.Address = expandUpdateAddress(d.Get("address").([]interface{})) + if d.HasChange(names.AttrAddress) { + input.Address = expandUpdateAddress(d.Get(names.AttrAddress).([]interface{})) } if d.HasChange("attributes") { From f6c8a57bd6f9b9263d6b39dde8f10bb39fb1a064 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:10 -0400 Subject: [PATCH 1260/1490] dax: Use constant for address strings --- internal/service/dax/cluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/dax/cluster.go b/internal/service/dax/cluster.go index aff4ee3aacb..dcc15f38d7c 100644 --- a/internal/service/dax/cluster.go +++ b/internal/service/dax/cluster.go @@ -184,7 +184,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -481,7 +481,7 @@ func setClusterNodeData(d *schema.ResourceData, c awstypes.Cluster) error { for _, node := range sortedNodes { nodeData = append(nodeData, map[string]interface{}{ names.AttrID: aws.ToString(node.NodeId), - "address": aws.ToString(node.Endpoint.Address), + names.AttrAddress: aws.ToString(node.Endpoint.Address), names.AttrPort: node.Endpoint.Port, names.AttrAvailabilityZone: aws.ToString(node.AvailabilityZone), }) From facc969a912bd5df1b2df7ce6bb0515e78296ea4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:10 -0400 Subject: [PATCH 1261/1490] ec2: Use constant for address strings --- internal/service/ec2/ec2_eip.go | 4 ++-- internal/service/ec2/vpc_network_insights_analysis.go | 6 +++--- internal/service/ec2/vpnsite_connection.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/ec2/ec2_eip.go b/internal/service/ec2/ec2_eip.go index 994c8dfb907..3974258e54a 100644 --- a/internal/service/ec2/ec2_eip.go +++ b/internal/service/ec2/ec2_eip.go @@ -49,7 +49,7 @@ func resourceEIP() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -154,7 +154,7 @@ func resourceEIPCreate(ctx context.Context, d *schema.ResourceData, meta interfa TagSpecifications: getTagSpecificationsInV2(ctx, types.ResourceTypeElasticIp), } - if v, ok := d.GetOk("address"); ok { + if v, ok := d.GetOk(names.AttrAddress); ok { input.Address = aws.String(v.(string)) } diff --git a/internal/service/ec2/vpc_network_insights_analysis.go b/internal/service/ec2/vpc_network_insights_analysis.go index fefeef30c1b..8e10789516f 100644 --- a/internal/service/ec2/vpc_network_insights_analysis.go +++ b/internal/service/ec2/vpc_network_insights_analysis.go @@ -640,7 +640,7 @@ var networkInsightsAnalysisExplanationsSchema = &schema.Schema{ }, }, }, - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -1677,7 +1677,7 @@ func flattenAnalysisLoadBalancerTarget(apiObject *ec2.AnalysisLoadBalancerTarget tfMap := map[string]interface{}{} if v := apiObject.Address; v != nil { - tfMap["address"] = aws.StringValue(v) + tfMap[names.AttrAddress] = aws.StringValue(v) } if v := apiObject.AvailabilityZone; v != nil { @@ -1821,7 +1821,7 @@ func flattenExplanation(apiObject *ec2.Explanation) map[string]interface{} { } if v := apiObject.Address; v != nil { - tfMap["address"] = aws.StringValue(v) + tfMap[names.AttrAddress] = aws.StringValue(v) } if v := apiObject.Addresses; v != nil { diff --git a/internal/service/ec2/vpnsite_connection.go b/internal/service/ec2/vpnsite_connection.go index c24e8c14f15..3ab5d7a33b7 100644 --- a/internal/service/ec2/vpnsite_connection.go +++ b/internal/service/ec2/vpnsite_connection.go @@ -911,7 +911,7 @@ func resourceVPNConnectionUpdate(ctx context.Context, d *schema.ResourceData, me } for i, prefix := range []string{"tunnel1_", "tunnel2_"} { - if options, address := expandModifyVPNTunnelOptionsSpecification(d, prefix), d.Get(prefix+"address").(string); options != nil && address != "" { + if options, address := expandModifyVPNTunnelOptionsSpecification(d, prefix), d.Get(prefix+names.AttrAddress).(string); options != nil && address != "" { input := &ec2.ModifyVpnTunnelOptionsInput{ TunnelOptions: options, VpnConnectionId: aws.String(d.Id()), From 6ea0200833021976b79ebd0f3f72f9bcd9e22c9e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:10 -0400 Subject: [PATCH 1262/1490] elasticache: Use constant for address strings --- internal/service/elasticache/cluster.go | 4 ++-- internal/service/elasticache/cluster_data_source.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/elasticache/cluster.go b/internal/service/elasticache/cluster.go index 0b518eb5917..b210267063b 100644 --- a/internal/service/elasticache/cluster.go +++ b/internal/service/elasticache/cluster.go @@ -85,7 +85,7 @@ func resourceCluster() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -949,7 +949,7 @@ func setCacheNodeData(d *schema.ResourceData, c *elasticache.CacheCluster) error } cacheNodeData = append(cacheNodeData, map[string]interface{}{ names.AttrID: aws.StringValue(node.CacheNodeId), - "address": aws.StringValue(node.Endpoint.Address), + names.AttrAddress: aws.StringValue(node.Endpoint.Address), names.AttrPort: aws.Int64Value(node.Endpoint.Port), names.AttrAvailabilityZone: aws.StringValue(node.CustomerAvailabilityZone), "outpost_arn": aws.StringValue(node.CustomerOutpostArn), diff --git a/internal/service/elasticache/cluster_data_source.go b/internal/service/elasticache/cluster_data_source.go index 5c4a46525e8..b1d9ddc6a11 100644 --- a/internal/service/elasticache/cluster_data_source.go +++ b/internal/service/elasticache/cluster_data_source.go @@ -39,7 +39,7 @@ func dataSourceCluster() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, From b5e76b39e74b9d59bab2ad25e2d5a987d791e94f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:10 -0400 Subject: [PATCH 1263/1490] memorydb: Use constant for address strings --- internal/service/memorydb/cluster.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/memorydb/cluster.go b/internal/service/memorydb/cluster.go index 55d3637a4e8..431078c0f9b 100644 --- a/internal/service/memorydb/cluster.go +++ b/internal/service/memorydb/cluster.go @@ -258,7 +258,7 @@ func endpointSchema() *schema.Schema { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -600,7 +600,7 @@ func flattenEndpoint(endpoint *memorydb.Endpoint) []interface{} { m := map[string]interface{}{} if v := aws.StringValue(endpoint.Address); v != "" { - m["address"] = v + m[names.AttrAddress] = v } if v := aws.Int64Value(endpoint.Port); v != 0 { From adc1d909b109ad81fd8efe1d55c22c344af3cc2c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:10 -0400 Subject: [PATCH 1264/1490] neptune: Use constant for address strings --- internal/service/neptune/cluster_instance.go | 4 ++-- internal/service/neptune/cluster_instance_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/neptune/cluster_instance.go b/internal/service/neptune/cluster_instance.go index 68efb73da2c..7ade25f143f 100644 --- a/internal/service/neptune/cluster_instance.go +++ b/internal/service/neptune/cluster_instance.go @@ -47,7 +47,7 @@ func ResourceClusterInstance() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -296,7 +296,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me address := aws.StringValue(db.Endpoint.Address) port := int(aws.Int64Value(db.Endpoint.Port)) - d.Set("address", address) + d.Set(names.AttrAddress, address) d.Set(names.AttrEndpoint, fmt.Sprintf("%s:%d", address, port)) d.Set(names.AttrPort, port) } diff --git a/internal/service/neptune/cluster_instance_test.go b/internal/service/neptune/cluster_instance_test.go index d00228c10e7..a7fe3dc282f 100644 --- a/internal/service/neptune/cluster_instance_test.go +++ b/internal/service/neptune/cluster_instance_test.go @@ -39,13 +39,13 @@ func TestAccNeptuneClusterInstance_basic(t *testing.T) { Config: testAccClusterInstanceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "address"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrAddress), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "rds", fmt.Sprintf("db:%s", rName)), resource.TestCheckResourceAttr(resourceName, names.AttrAutoMinorVersionUpgrade, "true"), resource.TestMatchResourceAttr(resourceName, names.AttrAvailabilityZone, regexache.MustCompile(fmt.Sprintf("^%s[a-z]{1}$", acctest.Region()))), resource.TestCheckResourceAttrPair(resourceName, names.AttrClusterIdentifier, clusterResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "dbi_resource_id"), - resource.TestCheckResourceAttrSet(resourceName, "address"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrAddress), resource.TestCheckResourceAttr(resourceName, "engine", "neptune"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), resource.TestCheckResourceAttr(resourceName, "identifier", rName), From 33cb5b89e8d49515fb4584a8109eb863f0c859bc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:11 -0400 Subject: [PATCH 1265/1490] networkmanager: Use constant for address strings --- internal/service/networkmanager/device.go | 2 +- internal/service/networkmanager/device_data_source.go | 2 +- internal/service/networkmanager/site.go | 6 +++--- internal/service/networkmanager/site_data_source.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/networkmanager/device.go b/internal/service/networkmanager/device.go index c2f61fcf20f..6ff1a3773d7 100644 --- a/internal/service/networkmanager/device.go +++ b/internal/service/networkmanager/device.go @@ -106,7 +106,7 @@ func ResourceDevice() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 256), diff --git a/internal/service/networkmanager/device_data_source.go b/internal/service/networkmanager/device_data_source.go index 018afe89e6a..f0e89daebf8 100644 --- a/internal/service/networkmanager/device_data_source.go +++ b/internal/service/networkmanager/device_data_source.go @@ -57,7 +57,7 @@ func DataSourceDevice() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/networkmanager/site.go b/internal/service/networkmanager/site.go index f3d102870f8..e3ddcfd3739 100644 --- a/internal/service/networkmanager/site.go +++ b/internal/service/networkmanager/site.go @@ -86,7 +86,7 @@ func ResourceSite() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 256), @@ -401,7 +401,7 @@ func expandLocation(tfMap map[string]interface{}) *networkmanager.Location { apiObject := &networkmanager.Location{} - if v, ok := tfMap["address"].(string); ok { + if v, ok := tfMap[names.AttrAddress].(string); ok { apiObject.Address = aws.String(v) } @@ -424,7 +424,7 @@ func flattenLocation(apiObject *networkmanager.Location) map[string]interface{} tfMap := map[string]interface{}{} if v := apiObject.Address; v != nil { - tfMap["address"] = aws.StringValue(v) + tfMap[names.AttrAddress] = aws.StringValue(v) } if v := apiObject.Latitude; v != nil { diff --git a/internal/service/networkmanager/site_data_source.go b/internal/service/networkmanager/site_data_source.go index fa4d0620d8f..157e6c8ab99 100644 --- a/internal/service/networkmanager/site_data_source.go +++ b/internal/service/networkmanager/site_data_source.go @@ -37,7 +37,7 @@ func DataSourceSite() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, From 45b626d68c2e0bb34b75ef846a443fbcc6507044 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:11 -0400 Subject: [PATCH 1266/1490] rds: Use constant for address strings --- internal/service/rds/instance.go | 8 ++++---- internal/service/rds/instance_data_source.go | 6 +++--- internal/service/rds/instance_data_source_test.go | 6 +++--- internal/service/rds/instance_migrate.go | 6 +++--- internal/service/rds/proxy_target_test.go | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go index 045d3ced571..f64a1437dfe 100644 --- a/internal/service/rds/instance.go +++ b/internal/service/rds/instance.go @@ -84,7 +84,7 @@ func ResourceInstance() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -377,7 +377,7 @@ func ResourceInstance() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -1935,7 +1935,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrVPCSecurityGroupIDs, vpcSecurityGroupIDs) if v.Endpoint != nil { - d.Set("address", v.Endpoint.Address) + d.Set(names.AttrAddress, v.Endpoint.Address) if v.Endpoint.Address != nil && v.Endpoint.Port != nil { d.Set(names.AttrEndpoint, fmt.Sprintf("%s:%d", aws.StringValue(v.Endpoint.Address), aws.Int64Value(v.Endpoint.Port))) } @@ -3018,7 +3018,7 @@ func flattenEndpoint(apiObject *rds.Endpoint) map[string]interface{} { tfMap := map[string]interface{}{} if v := apiObject.Address; v != nil { - tfMap["address"] = aws.StringValue(v) + tfMap[names.AttrAddress] = aws.StringValue(v) } if v := apiObject.HostedZoneId; v != nil { diff --git a/internal/service/rds/instance_data_source.go b/internal/service/rds/instance_data_source.go index beea5284efe..3eebbd68d8c 100644 --- a/internal/service/rds/instance_data_source.go +++ b/internal/service/rds/instance_data_source.go @@ -25,7 +25,7 @@ func DataSourceInstance() *schema.Resource { ReadWithoutTimeout: dataSourceInstanceRead, Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -310,12 +310,12 @@ func dataSourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta in // Per AWS SDK Go docs: // The endpoint might not be shown for instances whose status is creating. if dbEndpoint := instance.Endpoint; dbEndpoint != nil { - d.Set("address", dbEndpoint.Address) + d.Set(names.AttrAddress, dbEndpoint.Address) d.Set(names.AttrEndpoint, fmt.Sprintf("%s:%d", aws.StringValue(dbEndpoint.Address), aws.Int64Value(dbEndpoint.Port))) d.Set(names.AttrHostedZoneID, dbEndpoint.HostedZoneId) d.Set(names.AttrPort, dbEndpoint.Port) } else { - d.Set("address", nil) + d.Set(names.AttrAddress, nil) d.Set(names.AttrEndpoint, nil) d.Set(names.AttrHostedZoneID, nil) d.Set(names.AttrPort, nil) diff --git a/internal/service/rds/instance_data_source_test.go b/internal/service/rds/instance_data_source_test.go index 69cb0a876ba..66a849b8f95 100644 --- a/internal/service/rds/instance_data_source_test.go +++ b/internal/service/rds/instance_data_source_test.go @@ -31,7 +31,7 @@ func TestAccRDSInstanceDataSource_basic(t *testing.T) { { Config: testAccInstanceDataSourceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrPair(dataSourceName, "address", resourceName, "address"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrAddress, resourceName, names.AttrAddress), resource.TestCheckResourceAttrPair(dataSourceName, "allocated_storage", resourceName, "allocated_storage"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrAutoMinorVersionUpgrade, resourceName, names.AttrAutoMinorVersionUpgrade), resource.TestCheckResourceAttrPair(dataSourceName, "db_instance_arn", resourceName, names.AttrARN), @@ -76,7 +76,7 @@ func TestAccRDSInstanceDataSource_ManagedMasterPassword_managed(t *testing.T) { { Config: testAccInstanceDataSourceConfig_managedMasterPassword(rName), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrPair(dataSourceName, "address", resourceName, "address"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrAddress, resourceName, names.AttrAddress), resource.TestCheckResourceAttrPair(dataSourceName, "allocated_storage", resourceName, "allocated_storage"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrAutoMinorVersionUpgrade, resourceName, names.AttrAutoMinorVersionUpgrade), resource.TestCheckResourceAttrPair(dataSourceName, "db_instance_arn", resourceName, names.AttrARN), @@ -122,7 +122,7 @@ func TestAccRDSInstanceDataSource_tags(t *testing.T) { { Config: testAccInstanceDataSourceConfig_tags(rName), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrPair(dataSourceName, "address", resourceName, "address"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrAddress, resourceName, names.AttrAddress), resource.TestCheckResourceAttrPair(dataSourceName, "allocated_storage", resourceName, "allocated_storage"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrAutoMinorVersionUpgrade, resourceName, names.AttrAutoMinorVersionUpgrade), resource.TestCheckResourceAttrPair(dataSourceName, "db_instance_arn", resourceName, names.AttrARN), diff --git a/internal/service/rds/instance_migrate.go b/internal/service/rds/instance_migrate.go index 660ba8891f0..4d806f7e1e4 100644 --- a/internal/service/rds/instance_migrate.go +++ b/internal/service/rds/instance_migrate.go @@ -256,7 +256,7 @@ func resourceInstanceResourceV0() *schema.Resource { Computed: true, }, - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -404,7 +404,7 @@ func InstanceStateUpgradeV0(_ context.Context, rawState map[string]interface{}, func resourceInstanceResourceV1() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -636,7 +636,7 @@ func resourceInstanceResourceV1() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/rds/proxy_target_test.go b/internal/service/rds/proxy_target_test.go index 062b8ce73ce..7332527225f 100644 --- a/internal/service/rds/proxy_target_test.go +++ b/internal/service/rds/proxy_target_test.go @@ -39,7 +39,7 @@ func TestAccRDSProxyTarget_instance(t *testing.T) { Config: testAccProxyTargetConfig_instance(rName), Check: resource.ComposeTestCheckFunc( testAccCheckProxyTargetExists(ctx, resourceName, &dbProxyTarget), - resource.TestCheckResourceAttrPair(resourceName, names.AttrEndpoint, "aws_db_instance.test", "address"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrEndpoint, "aws_db_instance.test", names.AttrAddress), resource.TestCheckResourceAttrPair(resourceName, names.AttrPort, "aws_db_instance.test", names.AttrPort), resource.TestCheckResourceAttr(resourceName, "rds_resource_id", rName), resource.TestCheckResourceAttr(resourceName, "target_arn", ""), From 4f6bb239cf2d17a6bc5ceb3027e0f9864ed7f983 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:11 -0400 Subject: [PATCH 1267/1490] redshift: Use constant for address strings --- internal/service/redshift/endpoint_access.go | 4 ++-- internal/service/redshift/endpoint_access_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/redshift/endpoint_access.go b/internal/service/redshift/endpoint_access.go index c5b9510c95a..21b008cfa09 100644 --- a/internal/service/redshift/endpoint_access.go +++ b/internal/service/redshift/endpoint_access.go @@ -34,7 +34,7 @@ func resourceEndpointAccess() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -175,7 +175,7 @@ func resourceEndpointAccessRead(ctx context.Context, d *schema.ResourceData, met d.Set("resource_owner", endpoint.ResourceOwner) d.Set(names.AttrClusterIdentifier, endpoint.ClusterIdentifier) d.Set(names.AttrPort, endpoint.Port) - d.Set("address", endpoint.Address) + d.Set(names.AttrAddress, endpoint.Address) if err := d.Set("vpc_endpoint", flattenVPCEndpoint(endpoint.VpcEndpoint)); err != nil { return sdkdiag.AppendErrorf(diags, "setting vpc_endpoint: %s", err) diff --git a/internal/service/redshift/endpoint_access_test.go b/internal/service/redshift/endpoint_access_test.go index 8bf3fde7cfa..6145abd3470 100644 --- a/internal/service/redshift/endpoint_access_test.go +++ b/internal/service/redshift/endpoint_access_test.go @@ -42,7 +42,7 @@ func TestAccRedshiftEndpointAccess_basic(t *testing.T) { acctest.CheckResourceAttrAccountID(resourceName, "resource_owner"), resource.TestCheckResourceAttrPair(resourceName, "subnet_group_name", "aws_redshift_subnet_group.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, names.AttrClusterIdentifier, "aws_redshift_cluster.test", names.AttrClusterIdentifier), - resource.TestCheckResourceAttrSet(resourceName, "address"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrAddress), ), }, { From fca93eb085e4ce728c8cdc56dd23e74d6c03ac6a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:43:12 -0400 Subject: [PATCH 1268/1490] redshiftserverless: Use constant for address strings --- internal/service/redshiftserverless/endpoint_access.go | 4 ++-- internal/service/redshiftserverless/workgroup.go | 4 ++-- internal/service/redshiftserverless/workgroup_data_source.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/redshiftserverless/endpoint_access.go b/internal/service/redshiftserverless/endpoint_access.go index 4e2616a57cf..452b9446986 100644 --- a/internal/service/redshiftserverless/endpoint_access.go +++ b/internal/service/redshiftserverless/endpoint_access.go @@ -35,7 +35,7 @@ func resourceEndpointAccess() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -177,7 +177,7 @@ func resourceEndpointAccessRead(ctx context.Context, d *schema.ResourceData, met return sdkdiag.AppendErrorf(diags, "reading Redshift Serverless Endpoint Access (%s): %s", d.Id(), err) } - d.Set("address", endpointAccess.Address) + d.Set(names.AttrAddress, endpointAccess.Address) d.Set(names.AttrARN, endpointAccess.EndpointArn) d.Set("endpoint_name", endpointAccess.EndpointName) d.Set("owner_account", d.Get("owner_account")) diff --git a/internal/service/redshiftserverless/workgroup.go b/internal/service/redshiftserverless/workgroup.go index 8aba7672eae..4cbc280a9c1 100644 --- a/internal/service/redshiftserverless/workgroup.go +++ b/internal/service/redshiftserverless/workgroup.go @@ -99,7 +99,7 @@ func resourceWorkgroup() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, @@ -649,7 +649,7 @@ func flattenEndpoint(apiObject *redshiftserverless.Endpoint) map[string]interfac tfMap := map[string]interface{}{} if v := apiObject.Address; v != nil { - tfMap["address"] = aws.StringValue(v) + tfMap[names.AttrAddress] = aws.StringValue(v) } if v := apiObject.Port; v != nil { diff --git a/internal/service/redshiftserverless/workgroup_data_source.go b/internal/service/redshiftserverless/workgroup_data_source.go index 5182b1eb828..553efab0bb9 100644 --- a/internal/service/redshiftserverless/workgroup_data_source.go +++ b/internal/service/redshiftserverless/workgroup_data_source.go @@ -28,7 +28,7 @@ func dataSourceWorkgroup() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "address": { + names.AttrAddress: { Type: schema.TypeString, Computed: true, }, From 47e6db1c2213c72ecf4087df48bfae2cea612a5b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:11 -0400 Subject: [PATCH 1269/1490] ci: Prefer constant for string literal "destination" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index c46ca3f5f04..dbc8a11680f 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1495,3 +1495,13 @@ rules: - pattern: '"address"' severity: ERROR fix: "names.AttrAddress" + - id: literal-destination-string-constant + languages: [go] + message: Use the constant `names.AttrDestination` for the string literal "destination" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"destination"' + severity: ERROR + fix: "names.AttrDestination" From f9e326262dc4d83efe9f0d29d3e5cfae7b86c830 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:11 -0400 Subject: [PATCH 1270/1490] names: Add constant for string literal "destination" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 4ca47d715e6..1023311ba0f 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -24,6 +24,7 @@ const ( AttrDatabaseName = "database_name" AttrDeleteOnTermination = "delete_on_termination" AttrDescription = "description" + AttrDestination = "destination" AttrDeviceName = "device_name" AttrDomainName = "domain_name" AttrEnabled = "enabled" From 178d0fe62588ccf68aa88bd2fef067566353448d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:11 -0400 Subject: [PATCH 1271/1490] amp: Use constant for destination strings --- internal/service/amp/scraper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/amp/scraper.go b/internal/service/amp/scraper.go index ad68dfe711f..94f04e0ea64 100644 --- a/internal/service/amp/scraper.go +++ b/internal/service/amp/scraper.go @@ -86,7 +86,7 @@ func (r *scraperResource) Schema(ctx context.Context, req resource.SchemaRequest names.AttrTagsAll: tftags.TagsAttributeComputedOnly(), }, Blocks: map[string]schema.Block{ - "destination": schema.ListNestedBlock{ + names.AttrDestination: schema.ListNestedBlock{ CustomType: fwtypes.NewListNestedObjectTypeOf[scraperDestinationModel](ctx), Validators: []validator.List{ listvalidator.SizeAtLeast(1), From 103e709d5b904bc1abddfc0c7b1898809e498291 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:12 -0400 Subject: [PATCH 1272/1490] auditmanager: Use constant for destination strings --- internal/service/auditmanager/assessment.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/auditmanager/assessment.go b/internal/service/auditmanager/assessment.go index 075d3b1d926..dcb9282324d 100644 --- a/internal/service/auditmanager/assessment.go +++ b/internal/service/auditmanager/assessment.go @@ -105,7 +105,7 @@ func (r *resourceAssessment) Schema(ctx context.Context, req resource.SchemaRequ }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "destination": schema.StringAttribute{ + names.AttrDestination: schema.StringAttribute{ Required: true, }, "destination_type": schema.StringAttribute{ @@ -399,8 +399,8 @@ func FindAssessmentByID(ctx context.Context, conn *auditmanager.Client, id strin var ( assessmentReportsDestinationAttrTypes = map[string]attr.Type{ - "destination": types.StringType, - "destination_type": types.StringType, + names.AttrDestination: types.StringType, + "destination_type": types.StringType, } assessmentRolesAttrTypes = map[string]attr.Type{ @@ -566,8 +566,8 @@ func flattenAssessmentReportsDestination(ctx context.Context, apiObject *awstype } obj := map[string]attr.Value{ - "destination": flex.StringToFramework(ctx, apiObject.Destination), - "destination_type": flex.StringValueToFramework(ctx, apiObject.DestinationType), + names.AttrDestination: flex.StringToFramework(ctx, apiObject.Destination), + "destination_type": flex.StringValueToFramework(ctx, apiObject.DestinationType), } objVal, d := types.ObjectValue(assessmentReportsDestinationAttrTypes, obj) diags.Append(d...) From 290f273c34857aeeba3e3511d2a9eedee0defc95 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:12 -0400 Subject: [PATCH 1273/1490] chimesdkmediapipelines: Use constant for destination strings --- .../media_insights_pipeline_configuration.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/chimesdkmediapipelines/media_insights_pipeline_configuration.go b/internal/service/chimesdkmediapipelines/media_insights_pipeline_configuration.go index 4222facdfc8..e0dc8c4e971 100644 --- a/internal/service/chimesdkmediapipelines/media_insights_pipeline_configuration.go +++ b/internal/service/chimesdkmediapipelines/media_insights_pipeline_configuration.go @@ -340,7 +340,7 @@ func S3RecordingSinkConfigurationSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, @@ -855,7 +855,7 @@ func expandElement(inputElement interface{}) (awstypes.MediaInsightsPipelineConf rawConfiguration := configuration[0].(map[string]interface{}) element.S3RecordingSinkConfiguration = &awstypes.S3RecordingSinkConfiguration{ - Destination: aws.String(rawConfiguration["destination"].(string)), + Destination: aws.String(rawConfiguration[names.AttrDestination].(string)), } case element.Type == awstypes.MediaInsightsPipelineConfigurationElementTypeVoiceAnalyticsProcessor: var configuration []interface{} @@ -1030,7 +1030,7 @@ func flattenElement(apiElement awstypes.MediaInsightsPipelineConfigurationElemen tfMap["sqs_queue_sink_configuration"] = []interface{}{configuration} case apiElement.Type == awstypes.MediaInsightsPipelineConfigurationElementTypeS3RecordingSink: processorConfiguration := apiElement.S3RecordingSinkConfiguration - configuration["destination"] = processorConfiguration.Destination + configuration[names.AttrDestination] = processorConfiguration.Destination tfMap["s3_recording_sink_configuration"] = []interface{}{configuration} case apiElement.Type == awstypes.MediaInsightsPipelineConfigurationElementTypeVoiceAnalyticsProcessor: processorConfiguration := apiElement.VoiceAnalyticsProcessorConfiguration From 5871109438171fc3916298eb96061001aca12482 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:12 -0400 Subject: [PATCH 1274/1490] ec2: Use constant for destination strings --- internal/service/ec2/vpc_network_insights_analysis.go | 4 ++-- internal/service/ec2/vpc_network_insights_path.go | 6 +++--- .../service/ec2/vpc_network_insights_path_data_source.go | 4 ++-- .../ec2/vpc_network_insights_path_data_source_test.go | 2 +- internal/service/ec2/vpc_network_insights_path_test.go | 4 ++-- .../ec2/vpc_network_performance_metric_subscription.go | 6 +++--- .../ec2/vpc_network_performance_metric_subscription_test.go | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/ec2/vpc_network_insights_analysis.go b/internal/service/ec2/vpc_network_insights_analysis.go index 8e10789516f..d2ed5c08c1a 100644 --- a/internal/service/ec2/vpc_network_insights_analysis.go +++ b/internal/service/ec2/vpc_network_insights_analysis.go @@ -735,7 +735,7 @@ var networkInsightsAnalysisExplanationsSchema = &schema.Schema{ }, }, }, - "destination": { + names.AttrDestination: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -1853,7 +1853,7 @@ func flattenExplanation(apiObject *ec2.Explanation) map[string]interface{} { } if v := apiObject.Destination; v != nil { - tfMap["destination"] = []interface{}{flattenAnalysisComponent(v)} + tfMap[names.AttrDestination] = []interface{}{flattenAnalysisComponent(v)} } if v := apiObject.DestinationVpc; v != nil { diff --git a/internal/service/ec2/vpc_network_insights_path.go b/internal/service/ec2/vpc_network_insights_path.go index 4c6a1ecb7d8..f0a0c9d927a 100644 --- a/internal/service/ec2/vpc_network_insights_path.go +++ b/internal/service/ec2/vpc_network_insights_path.go @@ -45,7 +45,7 @@ func ResourceNetworkInsightsPath() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -97,7 +97,7 @@ func resourceNetworkInsightsPathCreate(ctx context.Context, d *schema.ResourceDa input := &ec2.CreateNetworkInsightsPathInput{ ClientToken: aws.String(id.UniqueId()), - Destination: aws.String(d.Get("destination").(string)), + Destination: aws.String(d.Get(names.AttrDestination).(string)), Protocol: aws.String(d.Get(names.AttrProtocol).(string)), Source: aws.String(d.Get(names.AttrSource).(string)), TagSpecifications: getTagSpecificationsIn(ctx, ec2.ResourceTypeNetworkInsightsPath), @@ -144,7 +144,7 @@ func resourceNetworkInsightsPathRead(ctx context.Context, d *schema.ResourceData } d.Set(names.AttrARN, nip.NetworkInsightsPathArn) - d.Set("destination", nip.Destination) + d.Set(names.AttrDestination, nip.Destination) d.Set("destination_arn", nip.DestinationArn) d.Set("destination_ip", nip.DestinationIp) d.Set("destination_port", nip.DestinationPort) diff --git a/internal/service/ec2/vpc_network_insights_path_data_source.go b/internal/service/ec2/vpc_network_insights_path_data_source.go index 7fad1bbb3b6..b24b52fd497 100644 --- a/internal/service/ec2/vpc_network_insights_path_data_source.go +++ b/internal/service/ec2/vpc_network_insights_path_data_source.go @@ -27,7 +27,7 @@ func DataSourceNetworkInsightsPath() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "destination": { + names.AttrDestination: { Type: schema.TypeString, Computed: true, }, @@ -100,7 +100,7 @@ func dataSourceNetworkInsightsPathRead(ctx context.Context, d *schema.ResourceDa networkInsightsPathID := aws.StringValue(nip.NetworkInsightsPathId) d.SetId(networkInsightsPathID) d.Set(names.AttrARN, nip.NetworkInsightsPathArn) - d.Set("destination", nip.Destination) + d.Set(names.AttrDestination, nip.Destination) d.Set("destination_arn", nip.DestinationArn) d.Set("destination_ip", nip.DestinationIp) d.Set("destination_port", nip.DestinationPort) diff --git a/internal/service/ec2/vpc_network_insights_path_data_source_test.go b/internal/service/ec2/vpc_network_insights_path_data_source_test.go index 702da9cb6e5..8af9a2ca9ce 100644 --- a/internal/service/ec2/vpc_network_insights_path_data_source_test.go +++ b/internal/service/ec2/vpc_network_insights_path_data_source_test.go @@ -28,7 +28,7 @@ func TestAccVPCNetworkInsightsPathDataSource_basic(t *testing.T) { Config: testAccVPCNetworkInsightsPathDataSourceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(datasourceName, "destination", resourceName, "destination"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrDestination, resourceName, names.AttrDestination), resource.TestCheckResourceAttrPair(datasourceName, "destination_arn", resourceName, "destination_arn"), resource.TestCheckResourceAttrPair(datasourceName, "destination_ip", resourceName, "destination_ip"), resource.TestCheckResourceAttrPair(datasourceName, "destination_port", resourceName, "destination_port"), diff --git a/internal/service/ec2/vpc_network_insights_path_test.go b/internal/service/ec2/vpc_network_insights_path_test.go index fb0e780babc..ccda5a52312 100644 --- a/internal/service/ec2/vpc_network_insights_path_test.go +++ b/internal/service/ec2/vpc_network_insights_path_test.go @@ -35,7 +35,7 @@ func TestAccVPCNetworkInsightsPath_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckNetworkInsightsPathExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`network-insights-path/.+$`)), - resource.TestCheckResourceAttrPair(resourceName, "destination", "aws_network_interface.test.1", names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestination, "aws_network_interface.test.1", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "destination_arn", "aws_network_interface.test.1", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "destination_ip", ""), resource.TestCheckResourceAttr(resourceName, "destination_port", "0"), @@ -138,7 +138,7 @@ func TestAccVPCNetworkInsightsPath_sourceAndDestinationARN(t *testing.T) { Config: testAccVPCNetworkInsightsPathConfig_sourceAndDestinationARN(rName, "tcp"), Check: resource.ComposeTestCheckFunc( testAccCheckNetworkInsightsPathExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "destination", "aws_network_interface.test.1", names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestination, "aws_network_interface.test.1", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "destination_arn", "aws_network_interface.test.1", names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_network_interface.test.0", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "source_arn", "aws_network_interface.test.0", names.AttrARN), diff --git a/internal/service/ec2/vpc_network_performance_metric_subscription.go b/internal/service/ec2/vpc_network_performance_metric_subscription.go index 0c8fefdb2c2..b87272b586f 100644 --- a/internal/service/ec2/vpc_network_performance_metric_subscription.go +++ b/internal/service/ec2/vpc_network_performance_metric_subscription.go @@ -29,7 +29,7 @@ func ResourceNetworkPerformanceMetricSubscription() *schema.Resource { DeleteWithoutTimeout: resourceNetworkPerformanceMetricSubscriptionDelete, Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -67,7 +67,7 @@ func resourceNetworkPerformanceMetricSubscriptionCreate(ctx context.Context, d * conn := meta.(*conns.AWSClient).EC2Client(ctx) source := d.Get(names.AttrSource).(string) - destination := d.Get("destination").(string) + destination := d.Get(names.AttrDestination).(string) metric := d.Get("metric").(string) statistic := d.Get("statistic").(string) id := NetworkPerformanceMetricSubscriptionCreateResourceID(source, destination, metric, statistic) @@ -112,7 +112,7 @@ func resourceNetworkPerformanceMetricSubscriptionRead(ctx context.Context, d *sc return sdkdiag.AppendErrorf(diags, "reading EC2 AWS Network Performance Metric Subscription (%s): %s", d.Id(), err) } - d.Set("destination", subscription.Destination) + d.Set(names.AttrDestination, subscription.Destination) d.Set("metric", subscription.Metric) d.Set("period", subscription.Period) d.Set(names.AttrSource, subscription.Source) diff --git a/internal/service/ec2/vpc_network_performance_metric_subscription_test.go b/internal/service/ec2/vpc_network_performance_metric_subscription_test.go index 90b44322cf4..b49d160af6c 100644 --- a/internal/service/ec2/vpc_network_performance_metric_subscription_test.go +++ b/internal/service/ec2/vpc_network_performance_metric_subscription_test.go @@ -44,7 +44,7 @@ func testAccNetworkPerformanceMetricSubscription_basic(t *testing.T) { Config: testAccVPCNetworkPerformanceMetricSubscription_basic(src, dst), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckNetworkPerformanceMetricSubscriptionExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "destination", dst), + resource.TestCheckResourceAttr(resourceName, names.AttrDestination, dst), resource.TestCheckResourceAttr(resourceName, "metric", "aggregate-latency"), resource.TestCheckResourceAttr(resourceName, "period", "five-minutes"), resource.TestCheckResourceAttr(resourceName, names.AttrSource, src), From 9c6ca358f434b6fbae84fce443bbedada3454aec Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:13 -0400 Subject: [PATCH 1275/1490] ecr: Use constant for destination strings --- internal/service/ecr/replication_configuration.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/ecr/replication_configuration.go b/internal/service/ecr/replication_configuration.go index 270951f7441..4019d961799 100644 --- a/internal/service/ecr/replication_configuration.go +++ b/internal/service/ecr/replication_configuration.go @@ -49,7 +49,7 @@ func resourceReplicationConfiguration() *schema.Resource { MaxItems: 10, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeList, Required: true, MaxItems: 25, @@ -212,7 +212,7 @@ func expandReplicationConfigurationReplicationConfigurationRules(data []interfac for _, rule := range data { ec := rule.(map[string]interface{}) config := types.ReplicationRule{ - Destinations: expandReplicationConfigurationReplicationConfigurationRulesDestinations(ec["destination"].([]interface{})), + Destinations: expandReplicationConfigurationReplicationConfigurationRulesDestinations(ec[names.AttrDestination].([]interface{})), RepositoryFilters: expandReplicationConfigurationReplicationConfigurationRulesRepositoryFilters(ec["repository_filter"].([]interface{})), } @@ -230,8 +230,8 @@ func flattenReplicationConfigurationReplicationConfigurationRules(ec []types.Rep for _, apiObject := range ec { tfMap := map[string]interface{}{ - "destination": flattenReplicationConfigurationReplicationConfigurationRulesDestinations(apiObject.Destinations), - "repository_filter": flattenReplicationConfigurationReplicationConfigurationRulesRepositoryFilters(apiObject.RepositoryFilters), + names.AttrDestination: flattenReplicationConfigurationReplicationConfigurationRulesDestinations(apiObject.Destinations), + "repository_filter": flattenReplicationConfigurationReplicationConfigurationRulesRepositoryFilters(apiObject.RepositoryFilters), } tfList = append(tfList, tfMap) From 13448a9f56472fd49825f887acba13d591bc23d7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:13 -0400 Subject: [PATCH 1276/1490] efs: Use constant for destination strings --- internal/service/efs/replication_configuration.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/efs/replication_configuration.go b/internal/service/efs/replication_configuration.go index 0211eec725c..124f98f7caa 100644 --- a/internal/service/efs/replication_configuration.go +++ b/internal/service/efs/replication_configuration.go @@ -43,7 +43,7 @@ func ResourceReplicationConfiguration() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "destination": { + names.AttrDestination: { Type: schema.TypeList, Required: true, ForceNew: true, @@ -112,7 +112,7 @@ func resourceReplicationConfigurationCreate(ctx context.Context, d *schema.Resou SourceFileSystemId: aws.String(fsID), } - if v, ok := d.GetOk("destination"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrDestination); ok && len(v.([]interface{})) > 0 { input.Destinations = expandDestinationsToCreate(v.([]interface{})) } @@ -150,7 +150,7 @@ func resourceReplicationConfigurationRead(ctx context.Context, d *schema.Resourc destinations := flattenDestinations(replication.Destinations) // availability_zone_name and kms_key_id aren't returned from the AWS Read API. - if v, ok := d.GetOk("destination"); ok && len(v.([]interface{})) > 0 { + if v, ok := d.GetOk(names.AttrDestination); ok && len(v.([]interface{})) > 0 { copy := func(i int, k string) { destinations[i].(map[string]interface{})[k] = v.([]interface{})[i].(map[string]interface{})[k] } @@ -160,7 +160,7 @@ func resourceReplicationConfigurationRead(ctx context.Context, d *schema.Resourc } d.Set("creation_time", aws.TimeValue(replication.CreationTime).String()) - if err := d.Set("destination", destinations); err != nil { + if err := d.Set(names.AttrDestination, destinations); err != nil { return sdkdiag.AppendErrorf(diags, "setting destination: %s", err) } d.Set("original_source_file_system_arn", replication.OriginalSourceFileSystemArn) @@ -176,7 +176,7 @@ func resourceReplicationConfigurationDelete(ctx context.Context, d *schema.Resou conn := meta.(*conns.AWSClient).EFSConn(ctx) // Deletion of the replication configuration must be done from the Region in which the destination file system is located. - destination := expandDestinationsToCreate(d.Get("destination").([]interface{}))[0] + destination := expandDestinationsToCreate(d.Get(names.AttrDestination).([]interface{}))[0] regionConn := meta.(*conns.AWSClient).EFSConnForRegion(ctx, aws.StringValue(destination.Region)) log.Printf("[DEBUG] Deleting EFS Replication Configuration: %s", d.Id()) From 3d39441590af2b76bfefea39d71475afe763b129 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:13 -0400 Subject: [PATCH 1277/1490] elasticache: Use constant for destination strings --- internal/service/elasticache/cluster.go | 2 +- internal/service/elasticache/cluster_data_source.go | 2 +- internal/service/elasticache/flex.go | 9 +++++---- internal/service/elasticache/replication_group.go | 2 +- .../service/elasticache/replication_group_data_source.go | 2 +- .../service/elasticache/replication_group_migrate.go | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/internal/service/elasticache/cluster.go b/internal/service/elasticache/cluster.go index b210267063b..5cc117e45f1 100644 --- a/internal/service/elasticache/cluster.go +++ b/internal/service/elasticache/cluster.go @@ -167,7 +167,7 @@ func resourceCluster() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, }, diff --git a/internal/service/elasticache/cluster_data_source.go b/internal/service/elasticache/cluster_data_source.go index b1d9ddc6a11..cad284acbfe 100644 --- a/internal/service/elasticache/cluster_data_source.go +++ b/internal/service/elasticache/cluster_data_source.go @@ -95,7 +95,7 @@ func dataSourceCluster() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/elasticache/flex.go b/internal/service/elasticache/flex.go index 10419cd1d2d..2fb70a3936d 100644 --- a/internal/service/elasticache/flex.go +++ b/internal/service/elasticache/flex.go @@ -6,6 +6,7 @@ package elasticache import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/elasticache" + "github.com/hashicorp/terraform-provider-aws/names" ) func flattenSecurityGroupIDs(securityGroups []*elasticache.SecurityGroupMembership) []string { @@ -29,9 +30,9 @@ func flattenLogDeliveryConfigurations(logDeliveryConfiguration []*elasticache.Lo switch aws.StringValue(v.DestinationType) { case elasticache.DestinationTypeKinesisFirehose: - logDeliveryConfig["destination"] = aws.StringValue(v.DestinationDetails.KinesisFirehoseDetails.DeliveryStream) + logDeliveryConfig[names.AttrDestination] = aws.StringValue(v.DestinationDetails.KinesisFirehoseDetails.DeliveryStream) case elasticache.DestinationTypeCloudwatchLogs: - logDeliveryConfig["destination"] = aws.StringValue(v.DestinationDetails.CloudWatchLogsDetails.LogGroup) + logDeliveryConfig[names.AttrDestination] = aws.StringValue(v.DestinationDetails.CloudWatchLogsDetails.LogGroup) } logDeliveryConfig["destination_type"] = aws.StringValue(v.DestinationType) @@ -62,11 +63,11 @@ func expandLogDeliveryConfigurations(v map[string]interface{}) elasticache.LogDe switch v["destination_type"].(string) { case elasticache.DestinationTypeCloudwatchLogs: destinationDetails.CloudWatchLogsDetails = &elasticache.CloudWatchLogsDestinationDetails{ - LogGroup: aws.String(v["destination"].(string)), + LogGroup: aws.String(v[names.AttrDestination].(string)), } case elasticache.DestinationTypeKinesisFirehose: destinationDetails.KinesisFirehoseDetails = &elasticache.KinesisFirehoseDestinationDetails{ - DeliveryStream: aws.String(v["destination"].(string)), + DeliveryStream: aws.String(v[names.AttrDestination].(string)), } } diff --git a/internal/service/elasticache/replication_group.go b/internal/service/elasticache/replication_group.go index fc446b337de..8e9fb44b4fe 100644 --- a/internal/service/elasticache/replication_group.go +++ b/internal/service/elasticache/replication_group.go @@ -170,7 +170,7 @@ func resourceReplicationGroup() *schema.Resource { Required: true, ValidateFunc: validation.StringInSlice(elasticache.DestinationType_Values(), false), }, - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, }, diff --git a/internal/service/elasticache/replication_group_data_source.go b/internal/service/elasticache/replication_group_data_source.go index 2c0f9cfe432..0c03edb9c24 100644 --- a/internal/service/elasticache/replication_group_data_source.go +++ b/internal/service/elasticache/replication_group_data_source.go @@ -49,7 +49,7 @@ func dataSourceReplicationGroup() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/elasticache/replication_group_migrate.go b/internal/service/elasticache/replication_group_migrate.go index b2867419257..9aab5e124a5 100644 --- a/internal/service/elasticache/replication_group_migrate.go +++ b/internal/service/elasticache/replication_group_migrate.go @@ -136,7 +136,7 @@ func resourceReplicationGroupConfigV1() *schema.Resource { Required: true, ValidateFunc: validation.StringInSlice(elasticache.DestinationType_Values(), false), }, - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, }, From 22fae5bd533b8ae202e88472d31ab980c1fd7f05 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:14 -0400 Subject: [PATCH 1278/1490] firehose: Use constant for destination strings --- internal/service/firehose/delivery_stream.go | 24 +++++++++---------- .../service/firehose/delivery_stream_test.go | 10 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index eb6ed244b5b..3f95d087369 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -297,7 +297,7 @@ func resourceDeliveryStream() *schema.Resource { Optional: true, Computed: true, }, - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -1327,7 +1327,7 @@ func resourceDeliveryStream() *schema.Resource { CustomizeDiff: customdiff.All( verify.SetTagsDiff, func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) error { - destination := destinationType(d.Get("destination").(string)) + destination := destinationType(d.Get(names.AttrDestination).(string)) requiredAttribute := map[destinationType]string{ destinationTypeElasticsearch: "elasticsearch_configuration", destinationTypeExtendedS3: "extended_s3_configuration", @@ -1368,7 +1368,7 @@ func resourceDeliveryStreamCreate(ctx context.Context, d *schema.ResourceData, m input.MSKSourceConfiguration = expandMSKSourceConfiguration(v.([]interface{})[0].(map[string]interface{})) } - switch v := destinationType(d.Get("destination").(string)); v { + switch v := destinationType(d.Get(names.AttrDestination).(string)); v { case destinationTypeElasticsearch: if v, ok := d.GetOk("elasticsearch_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.ElasticsearchDestinationConfiguration = expandElasticsearchDestinationConfiguration(v.([]interface{})[0].(map[string]interface{})) @@ -1492,46 +1492,46 @@ func resourceDeliveryStreamRead(ctx context.Context, d *schema.ResourceData, met destination := s.Destinations[0] switch { case destination.ElasticsearchDestinationDescription != nil: - d.Set("destination", destinationTypeElasticsearch) + d.Set(names.AttrDestination, destinationTypeElasticsearch) if err := d.Set("elasticsearch_configuration", flattenElasticsearchDestinationDescription(destination.ElasticsearchDestinationDescription)); err != nil { return sdkdiag.AppendErrorf(diags, "setting elasticsearch_configuration: %s", err) } case destination.HttpEndpointDestinationDescription != nil: - d.Set("destination", destinationTypeHTTPEndpoint) + d.Set(names.AttrDestination, destinationTypeHTTPEndpoint) configuredAccessKey := d.Get("http_endpoint_configuration.0.access_key").(string) if err := d.Set("http_endpoint_configuration", flattenHTTPEndpointDestinationDescription(destination.HttpEndpointDestinationDescription, configuredAccessKey)); err != nil { return sdkdiag.AppendErrorf(diags, "setting http_endpoint_configuration: %s", err) } case destination.AmazonopensearchserviceDestinationDescription != nil: - d.Set("destination", destinationTypeOpenSearch) + d.Set(names.AttrDestination, destinationTypeOpenSearch) if err := d.Set("opensearch_configuration", flattenAmazonopensearchserviceDestinationDescription(destination.AmazonopensearchserviceDestinationDescription)); err != nil { return sdkdiag.AppendErrorf(diags, "setting opensearch_configuration: %s", err) } case destination.AmazonOpenSearchServerlessDestinationDescription != nil: - d.Set("destination", destinationTypeOpenSearchServerless) + d.Set(names.AttrDestination, destinationTypeOpenSearchServerless) if err := d.Set("opensearchserverless_configuration", flattenAmazonOpenSearchServerlessDestinationDescription(destination.AmazonOpenSearchServerlessDestinationDescription)); err != nil { return sdkdiag.AppendErrorf(diags, "setting opensearchserverless_configuration: %s", err) } case destination.RedshiftDestinationDescription != nil: - d.Set("destination", destinationTypeRedshift) + d.Set(names.AttrDestination, destinationTypeRedshift) configuredPassword := d.Get("redshift_configuration.0.password").(string) if err := d.Set("redshift_configuration", flattenRedshiftDestinationDescription(destination.RedshiftDestinationDescription, configuredPassword)); err != nil { return sdkdiag.AppendErrorf(diags, "setting redshift_configuration: %s", err) } case destination.SnowflakeDestinationDescription != nil: - d.Set("destination", destinationTypeSnowflake) + d.Set(names.AttrDestination, destinationTypeSnowflake) configuredKeyPassphrase := d.Get("snowflake_configuration.0.key_passphrase").(string) configuredPrivateKey := d.Get("snowflake_configuration.0.private_key").(string) if err := d.Set("snowflake_configuration", flattenSnowflakeDestinationDescription(destination.SnowflakeDestinationDescription, configuredKeyPassphrase, configuredPrivateKey)); err != nil { return sdkdiag.AppendErrorf(diags, "setting snowflake_configuration: %s", err) } case destination.SplunkDestinationDescription != nil: - d.Set("destination", destinationTypeSplunk) + d.Set(names.AttrDestination, destinationTypeSplunk) if err := d.Set("splunk_configuration", flattenSplunkDestinationDescription(destination.SplunkDestinationDescription)); err != nil { return sdkdiag.AppendErrorf(diags, "setting splunk_configuration: %s", err) } default: - d.Set("destination", destinationTypeExtendedS3) + d.Set(names.AttrDestination, destinationTypeExtendedS3) if err := d.Set("extended_s3_configuration", flattenExtendedS3DestinationDescription(destination.ExtendedS3DestinationDescription)); err != nil { return sdkdiag.AppendErrorf(diags, "setting extended_s3_configuration: %s", err) } @@ -1555,7 +1555,7 @@ func resourceDeliveryStreamUpdate(ctx context.Context, d *schema.ResourceData, m DestinationId: aws.String(d.Get("destination_id").(string)), } - switch v := destinationType(d.Get("destination").(string)); v { + switch v := destinationType(d.Get(names.AttrDestination).(string)); v { case destinationTypeElasticsearch: if v, ok := d.GetOk("elasticsearch_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.ElasticsearchDestinationUpdate = expandElasticsearchDestinationUpdate(v.([]interface{})[0].(map[string]interface{})) diff --git a/internal/service/firehose/delivery_stream_test.go b/internal/service/firehose/delivery_stream_test.go index beddc077f4d..5096c2faacb 100644 --- a/internal/service/firehose/delivery_stream_test.go +++ b/internal/service/firehose/delivery_stream_test.go @@ -41,7 +41,7 @@ func TestAccFirehoseDeliveryStream_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckDeliveryStreamExists(ctx, resourceName, &stream), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "destination", "extended_s3"), + resource.TestCheckResourceAttr(resourceName, names.AttrDestination, "extended_s3"), resource.TestCheckResourceAttrSet(resourceName, "destination_id"), resource.TestCheckResourceAttr(resourceName, "elasticsearch_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "extended_s3_configuration.#", "1"), @@ -1080,7 +1080,7 @@ func TestAccFirehoseDeliveryStream_snowflakeUpdates(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckDeliveryStreamExists(ctx, resourceName, &stream), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "destination", "snowflake"), + resource.TestCheckResourceAttr(resourceName, names.AttrDestination, "snowflake"), resource.TestCheckResourceAttrSet(resourceName, "destination_id"), resource.TestCheckResourceAttr(resourceName, "elasticsearch_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "extended_s3_configuration.#", "0"), @@ -1147,7 +1147,7 @@ func TestAccFirehoseDeliveryStream_snowflakeUpdates(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckDeliveryStreamExists(ctx, resourceName, &stream), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "destination", "snowflake"), + resource.TestCheckResourceAttr(resourceName, names.AttrDestination, "snowflake"), resource.TestCheckResourceAttrSet(resourceName, "destination_id"), resource.TestCheckResourceAttr(resourceName, "elasticsearch_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "extended_s3_configuration.#", "0"), @@ -1953,7 +1953,7 @@ func TestAccFirehoseDeliveryStream_openSearchServerlessUpdates(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckDeliveryStreamExists(ctx, resourceName, &stream), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "destination", "opensearchserverless"), + resource.TestCheckResourceAttr(resourceName, names.AttrDestination, "opensearchserverless"), resource.TestCheckResourceAttrSet(resourceName, "destination_id"), resource.TestCheckResourceAttr(resourceName, "elasticsearch_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "extended_s3_configuration.#", "0"), @@ -2011,7 +2011,7 @@ func TestAccFirehoseDeliveryStream_openSearchServerlessUpdates(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckDeliveryStreamExists(ctx, resourceName, &stream), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "destination", "opensearchserverless"), + resource.TestCheckResourceAttr(resourceName, names.AttrDestination, "opensearchserverless"), resource.TestCheckResourceAttrSet(resourceName, "destination_id"), resource.TestCheckResourceAttr(resourceName, "elasticsearch_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "extended_s3_configuration.#", "0"), From bc062bc9d0eac5101fe91894f83272c885a5226b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:14 -0400 Subject: [PATCH 1279/1490] fsx: Use constant for destination strings --- internal/service/fsx/file_cache.go | 2 +- internal/service/fsx/lustre_file_system.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/fsx/file_cache.go b/internal/service/fsx/file_cache.go index c9cb2d38a4c..ff41bf696cc 100644 --- a/internal/service/fsx/file_cache.go +++ b/internal/service/fsx/file_cache.go @@ -201,7 +201,7 @@ func resourceFileCache() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/fsx/lustre_file_system.go b/internal/service/fsx/lustre_file_system.go index 3c88cda4feb..55e9738a990 100644 --- a/internal/service/fsx/lustre_file_system.go +++ b/internal/service/fsx/lustre_file_system.go @@ -161,7 +161,7 @@ func resourceLustreFileSystem() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Optional: true, Computed: true, @@ -624,7 +624,7 @@ func expandLustreLogCreateConfiguration(l []interface{}) *fsx.LustreLogCreateCon Level: aws.String(data["level"].(string)), } - if v, ok := data["destination"].(string); ok && v != "" { + if v, ok := data[names.AttrDestination].(string); ok && v != "" { req.Destination = aws.String(logStateFunc(v)) } @@ -641,7 +641,7 @@ func flattenLustreLogConfiguration(adopts *fsx.LustreLogConfiguration) []map[str } if adopts.Destination != nil { - m["destination"] = aws.StringValue(adopts.Destination) + m[names.AttrDestination] = aws.StringValue(adopts.Destination) } return []map[string]interface{}{m} From 13457ae0f6025723e5b67286947fd68f97866b6a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:14 -0400 Subject: [PATCH 1280/1490] lambda: Use constant for destination strings --- .../service/lambda/function_event_invoke_config.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/service/lambda/function_event_invoke_config.go b/internal/service/lambda/function_event_invoke_config.go index 800d5d595bc..775884ed486 100644 --- a/internal/service/lambda/function_event_invoke_config.go +++ b/internal/service/lambda/function_event_invoke_config.go @@ -22,6 +22,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_lambda_function_event_invoke_config", name="Function Event Invoke Config") @@ -49,7 +50,7 @@ func resourceFunctionEventInvokeConfig() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -63,7 +64,7 @@ func resourceFunctionEventInvokeConfig() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -369,7 +370,7 @@ func expandFunctionEventInvokeConfigDestinationConfigOnFailure(tfList []interfac onFailure := &awstypes.OnFailure{} - if v, ok := tfMap["destination"].(string); ok { + if v, ok := tfMap[names.AttrDestination].(string); ok { onFailure.Destination = aws.String(v) } @@ -385,7 +386,7 @@ func expandFunctionEventInvokeConfigDestinationConfigOnSuccess(tfList []interfac onSuccess := &awstypes.OnSuccess{} - if v, ok := tfMap["destination"].(string); ok { + if v, ok := tfMap[names.AttrDestination].(string); ok { onSuccess.Destination = aws.String(v) } @@ -427,7 +428,7 @@ func flattenFunctionEventInvokeConfigDestinationConfigOnFailure(apiObject *awsty } tfMap := map[string]interface{}{ - "destination": aws.ToString(apiObject.Destination), + names.AttrDestination: aws.ToString(apiObject.Destination), } return []interface{}{tfMap} @@ -443,7 +444,7 @@ func flattenFunctionEventInvokeConfigDestinationConfigOnSuccess(apiObject *awsty } m := map[string]interface{}{ - "destination": aws.ToString(apiObject.Destination), + names.AttrDestination: aws.ToString(apiObject.Destination), } return []interface{}{m} From 92ec6870d31123706bd7988adcd957c8c9390515 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:14 -0400 Subject: [PATCH 1281/1490] lexmodels: Use constant for destination strings --- internal/service/lexmodels/bot_alias.go | 6 +++--- internal/service/lexmodels/bot_alias_test.go | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/lexmodels/bot_alias.go b/internal/service/lexmodels/bot_alias.go index 3f197626f0d..8ad225d9209 100644 --- a/internal/service/lexmodels/bot_alias.go +++ b/internal/service/lexmodels/bot_alias.go @@ -321,7 +321,7 @@ func resourceBotAliasImport(ctx context.Context, d *schema.ResourceData, _ inter var logSettings = &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(lexmodelbuildingservice.Destination_Values(), false), @@ -379,7 +379,7 @@ func expandConversationLogs(rawObject interface{}) (*lexmodelbuildingservice.Con func flattenLogSettings(responses []*lexmodelbuildingservice.LogSettingsResponse) (flattened []map[string]interface{}) { for _, response := range responses { flattened = append(flattened, map[string]interface{}{ - "destination": response.Destination, + names.AttrDestination: response.Destination, names.AttrKMSKeyARN: response.KmsKeyArn, "log_type": response.LogType, names.AttrResourceARN: response.ResourceArn, @@ -397,7 +397,7 @@ func expandLogSettings(rawValues []interface{}) ([]*lexmodelbuildingservice.LogS if !ok { continue } - destination := value["destination"].(string) + destination := value[names.AttrDestination].(string) request := &lexmodelbuildingservice.LogSettingsRequest{ Destination: aws.String(destination), LogType: aws.String(value["log_type"].(string)), diff --git a/internal/service/lexmodels/bot_alias_test.go b/internal/service/lexmodels/bot_alias_test.go index 121408481d8..7180c03a11a 100644 --- a/internal/service/lexmodels/bot_alias_test.go +++ b/internal/service/lexmodels/bot_alias_test.go @@ -151,9 +151,9 @@ func TestAccLexModelsBotAlias_conversationLogsText(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "conversation_logs.0.iam_role_arn", iamRoleResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "conversation_logs.0.log_settings.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "conversation_logs.0.log_settings.*", map[string]string{ - "destination": "CLOUDWATCH_LOGS", - "log_type": "TEXT", - names.AttrKMSKeyARN: "", + names.AttrDestination: "CLOUDWATCH_LOGS", + "log_type": "TEXT", + names.AttrKMSKeyARN: "", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "conversation_logs.0.log_settings.*.resource_arn", cloudwatchLogGroupResourceName, names.AttrARN), resource.TestMatchTypeSetElemNestedAttrs(resourceName, "conversation_logs.0.log_settings.*", map[string]*regexp.Regexp{ @@ -202,8 +202,8 @@ func TestAccLexModelsBotAlias_conversationLogsAudio(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "conversation_logs.0.iam_role_arn", iamRoleResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "conversation_logs.0.log_settings.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "conversation_logs.0.log_settings.*", map[string]string{ - "destination": "S3", - "log_type": "AUDIO", + names.AttrDestination: "S3", + "log_type": "AUDIO", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "conversation_logs.0.log_settings.*.resource_arn", s3BucketResourceName, names.AttrARN), resource.TestCheckTypeSetElemAttrPair(resourceName, "conversation_logs.0.log_settings.*.kms_key_arn", kmsKeyResourceName, names.AttrARN), @@ -255,15 +255,15 @@ func TestAccLexModelsBotAlias_conversationLogsBoth(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "conversation_logs.0.log_settings.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "conversation_logs.0.log_settings.*", map[string]string{ - "destination": "CLOUDWATCH_LOGS", - "log_type": "TEXT", - names.AttrKMSKeyARN: "", + names.AttrDestination: "CLOUDWATCH_LOGS", + "log_type": "TEXT", + names.AttrKMSKeyARN: "", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "conversation_logs.0.log_settings.*.resource_arn", cloudwatchLogGroupResourceName, names.AttrARN), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "conversation_logs.0.log_settings.*", map[string]string{ - "destination": "S3", - "log_type": "AUDIO", + names.AttrDestination: "S3", + "log_type": "AUDIO", }), resource.TestCheckTypeSetElemAttrPair(resourceName, "conversation_logs.0.log_settings.*.resource_arn", s3BucketResourceName, names.AttrARN), resource.TestCheckTypeSetElemAttrPair(resourceName, "conversation_logs.0.log_settings.*.kms_key_arn", kmsKeyResourceName, names.AttrARN), From 558a41e2090f089c48356a170d1ad0151aeacffb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:15 -0400 Subject: [PATCH 1282/1490] medialive: Use constant for destination strings --- .../channel_encoder_settings_schema.go | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index 2f7bf2e25b5..9fe0215d125 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -567,7 +567,7 @@ func channelEncoderSettingsSchema() *schema.Schema { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": func() *schema.Schema { + names.AttrDestination: func() *schema.Schema { return destinationSchema() }(), "archive_cdn_settings": { @@ -606,7 +606,7 @@ func channelEncoderSettingsSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": func() *schema.Schema { + names.AttrDestination: func() *schema.Schema { return destinationSchema() }(), "frame_capture_cdn_settings": { @@ -643,7 +643,7 @@ func channelEncoderSettingsSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": func() *schema.Schema { + names.AttrDestination: func() *schema.Schema { return destinationSchema() }(), "ad_markers": { @@ -1054,7 +1054,7 @@ func channelEncoderSettingsSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": func() *schema.Schema { + names.AttrDestination: func() *schema.Schema { return destinationSchema() }(), }, @@ -1074,7 +1074,7 @@ func channelEncoderSettingsSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": func() *schema.Schema { + names.AttrDestination: func() *schema.Schema { return destinationSchema() }(), "acquisition_point_id": { @@ -2501,7 +2501,7 @@ func outputSettingsSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": destinationSchema(), + names.AttrDestination: destinationSchema(), }, }, }, @@ -2511,7 +2511,7 @@ func outputSettingsSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": destinationSchema(), + names.AttrDestination: destinationSchema(), "certificate_mode": { Type: schema.TypeString, Optional: true, @@ -2548,7 +2548,7 @@ func outputSettingsSchema() *schema.Schema { }(), }}, }, - "destination": destinationSchema(), + names.AttrDestination: destinationSchema(), "buffer_msec": { Type: schema.TypeInt, Optional: true, @@ -3590,7 +3590,7 @@ func expandMediaPackageGroupSettings(tfList []interface{}) *types.MediaPackageGr var o types.MediaPackageGroupSettings - if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + if v, ok := m[names.AttrDestination].([]interface{}); ok && len(v) > 0 { o.Destination = expandDestination(v) } @@ -3606,7 +3606,7 @@ func expandArchiveGroupSettings(tfList []interface{}) *types.ArchiveGroupSetting var o types.ArchiveGroupSettings - if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + if v, ok := m[names.AttrDestination].([]interface{}); ok && len(v) > 0 { o.Destination = expandDestination(v) } if v, ok := m["archive_cdn_settings"].([]interface{}); ok && len(v) > 0 { @@ -3627,7 +3627,7 @@ func expandFrameCaptureGroupSettings(tfList []interface{}) *types.FrameCaptureGr m := tfList[0].(map[string]interface{}) var out types.FrameCaptureGroupSettings - if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + if v, ok := m[names.AttrDestination].([]interface{}); ok && len(v) > 0 { out.Destination = expandDestination(v) } if v, ok := m["frame_capture_cdn_settings"].([]interface{}); ok && len(v) > 0 { @@ -3674,7 +3674,7 @@ func expandHLSGroupSettings(tfList []interface{}) *types.HlsGroupSettings { m := tfList[0].(map[string]interface{}) var out types.HlsGroupSettings - if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + if v, ok := m[names.AttrDestination].([]interface{}); ok && len(v) > 0 { out.Destination = expandDestination(v) } if v, ok := m["ad_markers"].([]interface{}); ok && len(v) > 0 { @@ -3812,7 +3812,7 @@ func expandMsSmoothGroupSettings(tfList []interface{}) *types.MsSmoothGroupSetti m := tfList[0].(map[string]interface{}) var out types.MsSmoothGroupSettings - if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + if v, ok := m[names.AttrDestination].([]interface{}); ok && len(v) > 0 { out.Destination = expandDestination(v) } if v, ok := m["acquisition_point_id"].(string); ok && v != "" { @@ -4314,7 +4314,7 @@ func expandOutputsOutputSettings(tfList []interface{}) *types.OutputSettings { data := inner[0].(map[string]interface{}) var mos types.MultiplexOutputSettings - if v, ok := data["destination"].([]interface{}); ok && len(v) > 0 { + if v, ok := data[names.AttrDestination].([]interface{}); ok && len(v) > 0 { mos.Destination = expandDestination(v) } return &mos @@ -4566,7 +4566,7 @@ func expandOutputsOutputSettingsRtmpOutputSettings(tfList []interface{}) *types. m := tfList[0].(map[string]interface{}) var settings types.RtmpOutputSettings - if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + if v, ok := m[names.AttrDestination].([]interface{}); ok && len(v) > 0 { settings.Destination = expandDestination(v) } if v, ok := m["certificate_mode"].(string); ok && v != "" { @@ -4593,7 +4593,7 @@ func expandOutputsOutputSettingsUdpOutputSettings(tfList []interface{}) *types.U if v, ok := m["container_settings"].([]interface{}); ok && len(v) > 0 { settings.ContainerSettings = expandOutputsOutputSettingsUdpSettingsContainerSettings(v) } - if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + if v, ok := m[names.AttrDestination].([]interface{}); ok && len(v) > 0 { settings.Destination = expandDestination(v) } if v, ok := m["buffer_msec"].(int); ok && v != 0 { @@ -5920,7 +5920,7 @@ func flattenOutputsOutputSettings(in *types.OutputSettings) []interface{} { return nil } data := map[string]interface{}{ - "destination": flattenDestination(inner.Destination), + names.AttrDestination: flattenDestination(inner.Destination), } return []interface{}{data} @@ -6082,7 +6082,7 @@ func flattenOutputsOutputSettingsRtmpOutputSettings(in *types.RtmpOutputSettings } m := map[string]interface{}{ - "destination": flattenDestination(in.Destination), + names.AttrDestination: flattenDestination(in.Destination), "certificate_mode": string(in.CertificateMode), "connection_retry_interval": int(aws.ToInt32(in.ConnectionRetryInterval)), "num_retries": int(aws.ToInt32(in.NumRetries)), @@ -6098,7 +6098,7 @@ func flattenOutputsOutputSettingsUdpOutputSettings(in *types.UdpOutputSettings) m := map[string]interface{}{ "container_settings": flattenOutputsOutputSettingsUdpOutputSettingsContainerSettings(in.ContainerSettings), - "destination": flattenDestination(in.Destination), + names.AttrDestination: flattenDestination(in.Destination), "buffer_msec": int(aws.ToInt32(in.BufferMsec)), "fec_output_settings": flattenFecOutputSettings(in.FecOutputSettings), } @@ -6250,7 +6250,7 @@ func flattenOutputGroupSettingsArchiveGroupSettings(in *types.ArchiveGroupSettin } m := map[string]interface{}{ - "destination": flattenDestination(in.Destination), + names.AttrDestination: flattenDestination(in.Destination), "archive_cdn_settings": flattenOutputGroupSettingsArchiveCDNSettings(in.ArchiveCdnSettings), "rollover_interval": int(aws.ToInt32(in.RolloverInterval)), } @@ -6264,7 +6264,7 @@ func flattenOutputGroupSettingsFrameCaptureGroupSettings(in *types.FrameCaptureG } m := map[string]interface{}{ - "destination": flattenDestination(in.Destination), + names.AttrDestination: flattenDestination(in.Destination), "frame_capture_cdn_settings": flattenFrameCaptureCDNSettings(in.FrameCaptureCdnSettings), } @@ -6277,7 +6277,7 @@ func flattenOutputGroupSettingsHLSGroupSettings(in *types.HlsGroupSettings) []in } m := map[string]interface{}{ - "destination": flattenDestination(in.Destination), + names.AttrDestination: flattenDestination(in.Destination), "ad_markers": flattenHLSAdMarkers(in.AdMarkers), "base_url_content": aws.ToString(in.BaseUrlContent), "base_url_content1": aws.ToString(in.BaseUrlContent1), @@ -6330,7 +6330,7 @@ func flattenOutputGroupSettingsMsSmoothGroupSettings(in *types.MsSmoothGroupSett } m := map[string]interface{}{ - "destination": flattenDestination(in.Destination), + names.AttrDestination: flattenDestination(in.Destination), "acquisition_point_id": aws.ToString(in.AcquisitionPointId), "audio_only_timecode_control": string(in.AudioOnlyTimecodeControl), "certificate_mode": string(in.CertificateMode), @@ -6548,7 +6548,7 @@ func flattenOutputGroupSettingsMediaPackageGroupSettings(mp *types.MediaPackageG } m := map[string]interface{}{ - "destination": flattenDestination(mp.Destination), + names.AttrDestination: flattenDestination(mp.Destination), } return []interface{}{m} From b87e12a999ddc5a24062eda0014ebafb03275b5b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:15 -0400 Subject: [PATCH 1283/1490] networkfirewall: Use constant for destination strings --- .../service/networkfirewall/rule_group.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/networkfirewall/rule_group.go b/internal/service/networkfirewall/rule_group.go index 899f739b54a..cd5df9cedc1 100644 --- a/internal/service/networkfirewall/rule_group.go +++ b/internal/service/networkfirewall/rule_group.go @@ -159,7 +159,7 @@ func ResourceRuleGroup() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, }, @@ -241,7 +241,7 @@ func ResourceRuleGroup() *schema.Resource { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": { + names.AttrDestination: { Type: schema.TypeSet, Optional: true, Elem: &schema.Resource{ @@ -685,7 +685,7 @@ func expandStatefulRuleHeader(l []interface{}) *networkfirewall.Header { return nil } header := &networkfirewall.Header{} - if v, ok := tfMap["destination"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDestination].(string); ok && v != "" { header.Destination = aws.String(v) } if v, ok := tfMap["destination_port"].(string); ok && v != "" { @@ -1005,7 +1005,7 @@ func expandMatchAttributes(l []interface{}) *networkfirewall.MatchAttributes { return nil } matchAttributes := &networkfirewall.MatchAttributes{} - if v, ok := tfMap["destination"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := tfMap[names.AttrDestination].(*schema.Set); ok && v.Len() > 0 { matchAttributes.Destinations = expandAddresses(v.List()) } if v, ok := tfMap["destination_port"].(*schema.Set); ok && v.Len() > 0 { @@ -1258,12 +1258,12 @@ func flattenHeader(h *networkfirewall.Header) []interface{} { } m := map[string]interface{}{ - "destination": aws.StringValue(h.Destination), - "destination_port": aws.StringValue(h.DestinationPort), - "direction": aws.StringValue(h.Direction), - names.AttrProtocol: aws.StringValue(h.Protocol), - names.AttrSource: aws.StringValue(h.Source), - "source_port": aws.StringValue(h.SourcePort), + names.AttrDestination: aws.StringValue(h.Destination), + "destination_port": aws.StringValue(h.DestinationPort), + "direction": aws.StringValue(h.Direction), + names.AttrProtocol: aws.StringValue(h.Protocol), + names.AttrSource: aws.StringValue(h.Source), + "source_port": aws.StringValue(h.SourcePort), } return []interface{}{m} @@ -1335,12 +1335,12 @@ func flattenMatchAttributes(ma *networkfirewall.MatchAttributes) []interface{} { } m := map[string]interface{}{ - "destination": flattenAddresses(ma.Destinations), - "destination_port": flattenPortRanges(ma.DestinationPorts), - "protocols": flex.FlattenInt64Set(ma.Protocols), - names.AttrSource: flattenAddresses(ma.Sources), - "source_port": flattenPortRanges(ma.SourcePorts), - "tcp_flag": flattenTCPFlags(ma.TCPFlags), + names.AttrDestination: flattenAddresses(ma.Destinations), + "destination_port": flattenPortRanges(ma.DestinationPorts), + "protocols": flex.FlattenInt64Set(ma.Protocols), + names.AttrSource: flattenAddresses(ma.Sources), + "source_port": flattenPortRanges(ma.SourcePorts), + "tcp_flag": flattenTCPFlags(ma.TCPFlags), } return []interface{}{m} From 47989275e3a93b7530d7a5802c5de12ebacbdae3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:15 -0400 Subject: [PATCH 1284/1490] schema: Use constant for destination strings --- .../service/quicksight/schema/visual_sankey_diagram.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/quicksight/schema/visual_sankey_diagram.go b/internal/service/quicksight/schema/visual_sankey_diagram.go index 36cf97b1d27..65969cb43ca 100644 --- a/internal/service/quicksight/schema/visual_sankey_diagram.go +++ b/internal/service/quicksight/schema/visual_sankey_diagram.go @@ -43,9 +43,9 @@ func sankeyDiagramVisualSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination": dimensionFieldSchema(dimensionsFieldMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DimensionField.html - names.AttrSource: dimensionFieldSchema(dimensionsFieldMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DimensionField.html - "weight": measureFieldSchema(measureFieldsMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_MeasureField.html + names.AttrDestination: dimensionFieldSchema(dimensionsFieldMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DimensionField.html + names.AttrSource: dimensionFieldSchema(dimensionsFieldMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_DimensionField.html + "weight": measureFieldSchema(measureFieldsMaxItems200), // https://docs.aws.amazon.com/quicksight/latest/APIReference/API_MeasureField.html }, }, }, @@ -163,7 +163,7 @@ func expandSankeyDiagramAggregatedFieldWells(tfList []interface{}) *quicksight.S config := &quicksight.SankeyDiagramAggregatedFieldWells{} - if v, ok := tfMap["destination"].([]interface{}); ok && len(v) > 0 { + if v, ok := tfMap[names.AttrDestination].([]interface{}); ok && len(v) > 0 { config.Destination = expandDimensionFields(v) } if v, ok := tfMap[names.AttrSource].([]interface{}); ok && len(v) > 0 { @@ -264,7 +264,7 @@ func flattenSankeyDiagramAggregatedFieldWells(apiObject *quicksight.SankeyDiagra tfMap := map[string]interface{}{} if apiObject.Destination != nil { - tfMap["destination"] = flattenDimensionFields(apiObject.Destination) + tfMap[names.AttrDestination] = flattenDimensionFields(apiObject.Destination) } if apiObject.Source != nil { tfMap[names.AttrSource] = flattenDimensionFields(apiObject.Source) From ee4937ac6fa17513af07f65737e0e2ee802078f0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:16 -0400 Subject: [PATCH 1285/1490] rum: Use constant for destination strings --- internal/service/rum/metrics_destination.go | 9 +++++---- internal/service/rum/metrics_destination_test.go | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/service/rum/metrics_destination.go b/internal/service/rum/metrics_destination.go index ea253c1f20a..d668632aa9d 100644 --- a/internal/service/rum/metrics_destination.go +++ b/internal/service/rum/metrics_destination.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_rum_metrics_destination") @@ -36,7 +37,7 @@ func ResourceMetricsDestination() *schema.Resource { Type: schema.TypeString, Required: true, }, - "destination": { + names.AttrDestination: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(cloudwatchrum.MetricDestination_Values(), false), @@ -61,7 +62,7 @@ func resourceMetricsDestinationPut(ctx context.Context, d *schema.ResourceData, name := d.Get("app_monitor_name").(string) input := &cloudwatchrum.PutRumMetricsDestinationInput{ AppMonitorName: aws.String(name), - Destination: aws.String(d.Get("destination").(string)), + Destination: aws.String(d.Get(names.AttrDestination).(string)), } if v, ok := d.GetOk("destination_arn"); ok { @@ -101,7 +102,7 @@ func resourceMetricsDestinationRead(ctx context.Context, d *schema.ResourceData, } d.Set("app_monitor_name", d.Id()) - d.Set("destination", dest.Destination) + d.Set(names.AttrDestination, dest.Destination) d.Set("destination_arn", dest.DestinationArn) d.Set("iam_role_arn", dest.IamRoleArn) @@ -113,7 +114,7 @@ func resourceMetricsDestinationDelete(ctx context.Context, d *schema.ResourceDat input := &cloudwatchrum.DeleteRumMetricsDestinationInput{ AppMonitorName: aws.String(d.Id()), - Destination: aws.String(d.Get("destination").(string)), + Destination: aws.String(d.Get(names.AttrDestination).(string)), } if v, ok := d.GetOk("destination_arn"); ok { diff --git a/internal/service/rum/metrics_destination_test.go b/internal/service/rum/metrics_destination_test.go index 7030c79b5e6..0545df40e64 100644 --- a/internal/service/rum/metrics_destination_test.go +++ b/internal/service/rum/metrics_destination_test.go @@ -36,7 +36,7 @@ func TestAccRUMMetricsDestination_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckMetricsDestinationExists(ctx, resourceName, &dest), resource.TestCheckResourceAttrPair(resourceName, "app_monitor_name", "aws_rum_app_monitor.test", names.AttrName), - resource.TestCheckResourceAttr(resourceName, "destination", "CloudWatch"), + resource.TestCheckResourceAttr(resourceName, names.AttrDestination, "CloudWatch"), ), }, { From 65ca96b770323c0329e16cf29a844f3aa253b074 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:16 -0400 Subject: [PATCH 1286/1490] s3: Use constant for destination strings --- internal/service/s3/bucket.go | 6 +++--- internal/service/s3/bucket_analytics_configuration.go | 6 +++--- internal/service/s3/bucket_inventory.go | 6 +++--- internal/service/s3/bucket_replication_configuration.go | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index a67a99d5cf5..474543bc37f 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -422,7 +422,7 @@ func resourceBucket() *schema.Resource { Optional: true, ValidateFunc: validation.StringInSlice(enum.Slice(types.DeleteMarkerReplicationStatusEnabled), false), }, - "destination": { + names.AttrDestination: { Type: schema.TypeList, MaxItems: 1, MinItems: 1, @@ -2455,7 +2455,7 @@ func expandBucketReplicationRules(ctx context.Context, l []interface{}) []types. continue } - if v, ok := tfRuleMap["destination"].([]interface{}); ok && len(v) > 0 && v[0] != nil { + if v, ok := tfRuleMap[names.AttrDestination].([]interface{}); ok && len(v) > 0 && v[0] != nil { rule.Destination = expandBucketDestination(v) } else { rule.Destination = &types.Destination{} @@ -2638,7 +2638,7 @@ func flattenBucketReplicationRules(ctx context.Context, rules []types.Replicatio } if rule.Destination != nil { - m["destination"] = flattenBucketDestination(rule.Destination) + m[names.AttrDestination] = flattenBucketDestination(rule.Destination) } if rule.Filter != nil { diff --git a/internal/service/s3/bucket_analytics_configuration.go b/internal/service/s3/bucket_analytics_configuration.go index 38262a7fbe7..0e45efb5fa6 100644 --- a/internal/service/s3/bucket_analytics_configuration.go +++ b/internal/service/s3/bucket_analytics_configuration.go @@ -86,7 +86,7 @@ func resourceBucketAnalyticsConfiguration() *schema.Resource { Default: types.StorageClassAnalysisSchemaVersionV1, ValidateDiagFunc: enum.Validate[types.StorageClassAnalysisSchemaVersion](), }, - "destination": { + names.AttrDestination: { Type: schema.TypeList, Required: true, MaxItems: 1, @@ -320,7 +320,7 @@ func expandStorageClassAnalysis(l []interface{}) *types.StorageClassAnalysis { dataExport.OutputSchemaVersion = types.StorageClassAnalysisSchemaVersion(v.(string)) } - dataExport.Destination = expandAnalyticsExportDestination(bar["destination"].([]interface{})) + dataExport.Destination = expandAnalyticsExportDestination(bar[names.AttrDestination].([]interface{})) } } @@ -392,7 +392,7 @@ func flattenStorageClassAnalysis(storageClassAnalysis *types.StorageClassAnalysi "output_schema_version": dataExport.OutputSchemaVersion, } if dataExport.Destination != nil { - de["destination"] = flattenAnalyticsExportDestination(dataExport.Destination) + de[names.AttrDestination] = flattenAnalyticsExportDestination(dataExport.Destination) } result := map[string]interface{}{ "data_export": []interface{}{de}, diff --git a/internal/service/s3/bucket_inventory.go b/internal/service/s3/bucket_inventory.go index a4cace0f3a5..84becdecba5 100644 --- a/internal/service/s3/bucket_inventory.go +++ b/internal/service/s3/bucket_inventory.go @@ -44,7 +44,7 @@ func resourceBucketInventory() *schema.Resource { Required: true, ForceNew: true, }, - "destination": { + names.AttrDestination: { Type: schema.TypeList, Required: true, MaxItems: 1, @@ -183,7 +183,7 @@ func resourceBucketInventoryPut(ctx context.Context, d *schema.ResourceData, met IsEnabled: aws.Bool(d.Get(names.AttrEnabled).(bool)), } - if v, ok := d.GetOk("destination"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrDestination); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { tfMap := v.([]interface{})[0].(map[string]interface{})[names.AttrBucket].([]interface{})[0].(map[string]interface{}) inventoryConfiguration.Destination = &types.InventoryDestination{ S3BucketDestination: expandInventoryBucketDestination(tfMap), @@ -269,7 +269,7 @@ func resourceBucketInventoryRead(ctx context.Context, d *schema.ResourceData, me tfMap := map[string]interface{}{ names.AttrBucket: flattenInventoryBucketDestination(v.S3BucketDestination), } - if err := d.Set("destination", []map[string]interface{}{tfMap}); err != nil { + if err := d.Set(names.AttrDestination, []map[string]interface{}{tfMap}); err != nil { return sdkdiag.AppendErrorf(diags, "setting destination: %s", err) } } diff --git a/internal/service/s3/bucket_replication_configuration.go b/internal/service/s3/bucket_replication_configuration.go index 3707b850651..197e5e8d060 100644 --- a/internal/service/s3/bucket_replication_configuration.go +++ b/internal/service/s3/bucket_replication_configuration.go @@ -68,7 +68,7 @@ func resourceBucketReplicationConfiguration() *schema.Resource { }, }, }, - "destination": { + names.AttrDestination: { Type: schema.TypeList, MaxItems: 1, Required: true, @@ -486,7 +486,7 @@ func expandReplicationRules(ctx context.Context, l []interface{}) []types.Replic rule.DeleteMarkerReplication = expandDeleteMarkerReplication(v) } - if v, ok := tfMap["destination"].([]interface{}); ok && len(v) > 0 && v[0] != nil { + if v, ok := tfMap[names.AttrDestination].([]interface{}); ok && len(v) > 0 && v[0] != nil { rule.Destination = expandDestination(v) } @@ -881,7 +881,7 @@ func flattenReplicationRules(ctx context.Context, rules []types.ReplicationRule) } if rule.Destination != nil { - m["destination"] = flattenDestination(rule.Destination) + m[names.AttrDestination] = flattenDestination(rule.Destination) } if rule.ExistingObjectReplication != nil { From d232b43efe74cf3f86f840936726ab752cc2b260 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:46:16 -0400 Subject: [PATCH 1287/1490] signer: Use constant for destination strings --- internal/service/signer/signing_job.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/signer/signing_job.go b/internal/service/signer/signing_job.go index e12c195cd04..0f7239d890d 100644 --- a/internal/service/signer/signing_job.go +++ b/internal/service/signer/signing_job.go @@ -72,7 +72,7 @@ func ResourceSigningJob() *schema.Resource { }, }, }, - "destination": { + names.AttrDestination: { Type: schema.TypeList, Required: true, ForceNew: true, @@ -209,7 +209,7 @@ func resourceSigningJobCreate(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).SignerClient(ctx) profileName := d.Get("profile_name") source := d.Get(names.AttrSource).([]interface{}) - destination := d.Get("destination").([]interface{}) + destination := d.Get(names.AttrDestination).([]interface{}) startSigningJobInput := &signer.StartSigningJobInput{ ProfileName: aws.String(profileName.(string)), From 278b8a7d21b79ec3c7fed2bc79f60b3a881adfdb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:19 -0400 Subject: [PATCH 1288/1490] ci: Prefer constant for string literal "force_destroy" --- .ci/.semgrep.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index dbc8a11680f..04611063b4e 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -1505,3 +1505,13 @@ rules: - pattern: '"destination"' severity: ERROR fix: "names.AttrDestination" + - id: literal-force_destroy-string-constant + languages: [go] + message: Use the constant `names.AttrForceDestroy` for the string literal "force_destroy" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"force_destroy"' + severity: ERROR + fix: "names.AttrForceDestroy" From ec60fcfa71bdd3b032c935627b5269b2136dcb57 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:19 -0400 Subject: [PATCH 1289/1490] names: Add constant for string literal "force_destroy" --- names/attr_consts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/names/attr_consts.go b/names/attr_consts.go index 1023311ba0f..3cc6492d2c9 100644 --- a/names/attr_consts.go +++ b/names/attr_consts.go @@ -34,6 +34,7 @@ const ( AttrEngineVersion = "engine_version" AttrFileSystemID = "file_system_id" AttrFilter = "filter" + AttrForceDestroy = "force_destroy" AttrFormat = "format" AttrHostedZoneID = "hosted_zone_id" AttrID = "id" // Should be explicitly declared only for Framework resources From b605611e60b73f8e95dbcc9aba1b36731d78df90 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:19 -0400 Subject: [PATCH 1290/1490] athena: Use constant for force_destroy strings --- internal/service/athena/database.go | 4 +-- internal/service/athena/database_test.go | 14 +++++----- internal/service/athena/sweep.go | 3 +- internal/service/athena/workgroup.go | 6 ++-- internal/service/athena/workgroup_test.go | 34 +++++++++++------------ 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/internal/service/athena/database.go b/internal/service/athena/database.go index 7f4e5211ad7..1cc1a5dfc91 100644 --- a/internal/service/athena/database.go +++ b/internal/service/athena/database.go @@ -91,7 +91,7 @@ func resourceDatabase() *schema.Resource { Optional: true, ForceNew: true, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -187,7 +187,7 @@ func resourceDatabaseDelete(ctx context.Context, d *schema.ResourceData, meta in conn := meta.(*conns.AWSClient).AthenaClient(ctx) queryString := fmt.Sprintf("drop database `%s`", d.Id()) - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { queryString += " cascade" } queryString += ";" diff --git a/internal/service/athena/database_test.go b/internal/service/athena/database_test.go index 51abd7ab10b..efd2260024c 100644 --- a/internal/service/athena/database_test.go +++ b/internal/service/athena/database_test.go @@ -49,7 +49,7 @@ func TestAccAthenaDatabase_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{names.AttrBucket, "force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrBucket, names.AttrForceDestroy}, }, }, }) @@ -80,7 +80,7 @@ func TestAccAthenaDatabase_properties(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{names.AttrBucket, "force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrBucket, names.AttrForceDestroy}, }, }, }) @@ -111,7 +111,7 @@ func TestAccAthenaDatabase_acl(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{names.AttrBucket, "acl_configuration", "force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrBucket, "acl_configuration", names.AttrForceDestroy}, }, }, }) @@ -142,7 +142,7 @@ func TestAccAthenaDatabase_encryption(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{names.AttrBucket, "force_destroy", "encryption_configuration"}, + ImportStateVerifyIgnore: []string{names.AttrBucket, names.AttrForceDestroy, "encryption_configuration"}, }, }, }) @@ -171,7 +171,7 @@ func TestAccAthenaDatabase_nameStartsWithUnderscore(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{names.AttrBucket, "force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrBucket, names.AttrForceDestroy}, }, }, }) @@ -268,7 +268,7 @@ func TestAccAthenaDatabase_description(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{names.AttrBucket, "force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrBucket, names.AttrForceDestroy}, }, }, }) @@ -298,7 +298,7 @@ func TestAccAthenaDatabase_unescaped_description(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{names.AttrBucket, "force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrBucket, names.AttrForceDestroy}, }, }, }) diff --git a/internal/service/athena/sweep.go b/internal/service/athena/sweep.go index 2c905d1904c..20ccf6290b5 100644 --- a/internal/service/athena/sweep.go +++ b/internal/service/athena/sweep.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-aws/internal/sweep" "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv2" + "github.com/hashicorp/terraform-provider-aws/names" ) func RegisterSweepers() { @@ -54,7 +55,7 @@ func sweepDatabases(region string) error { r := resourceDatabase() d := r.Data(nil) d.SetId(name) - d.Set("force_destroy", true) + d.Set(names.AttrForceDestroy, true) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } diff --git a/internal/service/athena/workgroup.go b/internal/service/athena/workgroup.go index a2896fbad5e..6415c25c20e 100644 --- a/internal/service/athena/workgroup.go +++ b/internal/service/athena/workgroup.go @@ -156,7 +156,7 @@ func resourceWorkGroup() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(0, 1024), }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -251,7 +251,7 @@ func resourceWorkGroupRead(ctx context.Context, d *schema.ResourceData, meta int return sdkdiag.AppendErrorf(diags, "setting configuration: %s", err) } d.Set(names.AttrDescription, wg.Description) - d.Set("force_destroy", d.Get("force_destroy")) + d.Set(names.AttrForceDestroy, d.Get(names.AttrForceDestroy)) d.Set(names.AttrName, wg.Name) d.Set(names.AttrState, wg.State) @@ -297,7 +297,7 @@ func resourceWorkGroupDelete(ctx context.Context, d *schema.ResourceData, meta i WorkGroup: aws.String(d.Id()), } - if v, ok := d.GetOk("force_destroy"); ok { + if v, ok := d.GetOk(names.AttrForceDestroy); ok { input.RecursiveDeleteOption = aws.Bool(v.(bool)) } diff --git a/internal/service/athena/workgroup_test.go b/internal/service/athena/workgroup_test.go index 2961d8633e8..b999409df71 100644 --- a/internal/service/athena/workgroup_test.go +++ b/internal/service/athena/workgroup_test.go @@ -58,7 +58,7 @@ func TestAccAthenaWorkGroup_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -91,7 +91,7 @@ func TestAccAthenaWorkGroup_aclConfig(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -145,7 +145,7 @@ func TestAccAthenaWorkGroup_bytesScannedCutoffPerQuery(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_configurationBytesScannedCutoffPerQuery(rName, 10485760), @@ -183,7 +183,7 @@ func TestAccAthenaWorkGroup_enforceWorkGroup(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_enforce(rName, true), @@ -223,7 +223,7 @@ func TestAccAthenaWorkGroup_configurationEngineVersion(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_configurationEngineVersion(rName, "AUTO"), @@ -239,7 +239,7 @@ func TestAccAthenaWorkGroup_configurationEngineVersion(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_basic(rName), @@ -278,7 +278,7 @@ func TestAccAthenaWorkGroup_configurationExecutionRole(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -308,7 +308,7 @@ func TestAccAthenaWorkGroup_publishCloudWatchMetricsEnabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_configurationPublishCloudWatchMetricsEnabled(rName, true), @@ -348,7 +348,7 @@ func TestAccAthenaWorkGroup_ResultEncryption_sseS3(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -382,7 +382,7 @@ func TestAccAthenaWorkGroup_ResultEncryption_kms(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_resultEncryptionEncryptionOptionKMS(rName, rEncryption2), @@ -425,7 +425,7 @@ func TestAccAthenaWorkGroup_Result_outputLocation(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_configurationResultConfigurationOutputLocation(rName, rOutputLocation2), @@ -465,7 +465,7 @@ func TestAccAthenaWorkGroup_requesterPaysEnabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_basic(rName), @@ -509,7 +509,7 @@ func TestAccAthenaWorkGroup_ResultOutputLocation_forceDestroy(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_configurationResultConfigurationOutputLocationForceDestroy(rName, rOutputLocation2), @@ -549,7 +549,7 @@ func TestAccAthenaWorkGroup_description(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_description(rName, rDescriptionUpdate), @@ -585,7 +585,7 @@ func TestAccAthenaWorkGroup_state(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_state(rName, string(types.WorkGroupStateEnabled)), @@ -632,7 +632,7 @@ func TestAccAthenaWorkGroup_forceDestroy(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -662,7 +662,7 @@ func TestAccAthenaWorkGroup_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccWorkGroupConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), From f8ca0ae10bad24190d4e2e9600e2c92b7190e223 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:19 -0400 Subject: [PATCH 1291/1490] backup: Use constant for force_destroy strings --- internal/service/backup/sweep.go | 3 ++- internal/service/backup/vault.go | 4 ++-- internal/service/backup/vault_test.go | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/service/backup/sweep.go b/internal/service/backup/sweep.go index ef1a7c69a44..fbf0073e99b 100644 --- a/internal/service/backup/sweep.go +++ b/internal/service/backup/sweep.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-aws/internal/sweep" "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv1" + "github.com/hashicorp/terraform-provider-aws/names" ) func RegisterSweepers() { @@ -310,7 +311,7 @@ func sweepVaults(region string) error { r := ResourceVault() d := r.Data(nil) d.SetId(name) - d.Set("force_destroy", true) + d.Set(names.AttrForceDestroy, true) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } diff --git a/internal/service/backup/vault.go b/internal/service/backup/vault.go index 0c76d21755f..15aa619c3df 100644 --- a/internal/service/backup/vault.go +++ b/internal/service/backup/vault.go @@ -47,7 +47,7 @@ func ResourceVault() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -141,7 +141,7 @@ func resourceVaultDelete(ctx context.Context, d *schema.ResourceData, meta inter var diags diag.Diagnostics conn := meta.(*conns.AWSClient).BackupConn(ctx) - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { input := &backup.ListRecoveryPointsByBackupVaultInput{ BackupVaultName: aws.String(d.Id()), } diff --git a/internal/service/backup/vault_test.go b/internal/service/backup/vault_test.go index 72a7ddda570..b8f6481c239 100644 --- a/internal/service/backup/vault_test.go +++ b/internal/service/backup/vault_test.go @@ -49,7 +49,7 @@ func TestAccBackupVault_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -103,7 +103,7 @@ func TestAccBackupVault_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccVaultConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), @@ -149,7 +149,7 @@ func TestAccBackupVault_withKMSKey(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -178,7 +178,7 @@ func TestAccBackupVault_forceDestroyEmpty(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) From f3fa2f5c3266645f2124e3be6d224757b24ce179 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:20 -0400 Subject: [PATCH 1292/1490] directconnect: Use constant for force_destroy strings --- internal/service/directconnect/lag.go | 4 ++-- internal/service/directconnect/lag_test.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/directconnect/lag.go b/internal/service/directconnect/lag.go index fa3be1c41cb..4e78b864337 100644 --- a/internal/service/directconnect/lag.go +++ b/internal/service/directconnect/lag.go @@ -50,7 +50,7 @@ func ResourceLag() *schema.Resource { ForceNew: true, ValidateFunc: validConnectionBandWidth(), }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -194,7 +194,7 @@ func resourceLagDelete(ctx context.Context, d *schema.ResourceData, meta interfa var diags diag.Diagnostics conn := meta.(*conns.AWSClient).DirectConnectConn(ctx) - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { lag, err := FindLagByID(ctx, conn, d.Id()) if tfresource.NotFound(err) { diff --git a/internal/service/directconnect/lag_test.go b/internal/service/directconnect/lag_test.go index 1c68cbc8909..a1095db5a52 100644 --- a/internal/service/directconnect/lag_test.go +++ b/internal/service/directconnect/lag_test.go @@ -40,7 +40,7 @@ func TestAccDirectConnectLag_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "directconnect", regexache.MustCompile(`dxlag/.+`)), resource.TestCheckNoResourceAttr(resourceName, "connection_id"), resource.TestCheckResourceAttr(resourceName, "connections_bandwidth", "1Gbps"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttrSet(resourceName, "has_logical_redundancy"), resource.TestCheckResourceAttrSet(resourceName, "jumbo_frame_capable"), resource.TestCheckResourceAttrSet(resourceName, "location"), @@ -57,7 +57,7 @@ func TestAccDirectConnectLag_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "directconnect", regexache.MustCompile(`dxlag/.+`)), resource.TestCheckNoResourceAttr(resourceName, "connection_id"), resource.TestCheckResourceAttr(resourceName, "connections_bandwidth", "1Gbps"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttrSet(resourceName, "has_logical_redundancy"), resource.TestCheckResourceAttrSet(resourceName, "jumbo_frame_capable"), resource.TestCheckResourceAttrSet(resourceName, "location"), @@ -71,7 +71,7 @@ func TestAccDirectConnectLag_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -121,7 +121,7 @@ func TestAccDirectConnectLag_connectionID(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "directconnect", regexache.MustCompile(`dxlag/.+`)), resource.TestCheckResourceAttrPair(resourceName, "connection_id", connectionResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, "connections_bandwidth", "1Gbps"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttrSet(resourceName, "has_logical_redundancy"), resource.TestCheckResourceAttrSet(resourceName, "jumbo_frame_capable"), resource.TestCheckResourceAttrSet(resourceName, "location"), @@ -135,7 +135,7 @@ func TestAccDirectConnectLag_connectionID(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"connection_id", "force_destroy"}, + ImportStateVerifyIgnore: []string{"connection_id", names.AttrForceDestroy}, }, }, }) @@ -160,7 +160,7 @@ func TestAccDirectConnectLag_providerName(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "directconnect", regexache.MustCompile(`dxlag/.+`)), resource.TestCheckNoResourceAttr(resourceName, "connection_id"), resource.TestCheckResourceAttr(resourceName, "connections_bandwidth", "1Gbps"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttrSet(resourceName, "has_logical_redundancy"), resource.TestCheckResourceAttrSet(resourceName, "jumbo_frame_capable"), resource.TestCheckResourceAttrSet(resourceName, "location"), @@ -174,7 +174,7 @@ func TestAccDirectConnectLag_providerName(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -205,7 +205,7 @@ func TestAccDirectConnectLag_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccLagConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), From 7015f743fd8c9b8da511a03d818d5d902ea41234 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:20 -0400 Subject: [PATCH 1293/1490] ec2: Use constant for force_destroy strings --- internal/service/ec2/vpc_default_subnet.go | 4 ++-- internal/service/ec2/vpc_default_subnet_test.go | 12 ++++++------ internal/service/ec2/vpc_default_vpc.go | 4 ++-- internal/service/ec2/vpc_default_vpc_test.go | 16 ++++++++-------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/ec2/vpc_default_subnet.go b/internal/service/ec2/vpc_default_subnet.go index 49228add95b..e0c252807d2 100644 --- a/internal/service/ec2/vpc_default_subnet.go +++ b/internal/service/ec2/vpc_default_subnet.go @@ -108,7 +108,7 @@ func ResourceDefaultSubnet() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -255,7 +255,7 @@ func resourceDefaultSubnetCreate(ctx context.Context, d *schema.ResourceData, me func resourceDefaultSubnetDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { return append(diags, resourceSubnetDelete(ctx, d, meta)...) } diff --git a/internal/service/ec2/vpc_default_subnet_test.go b/internal/service/ec2/vpc_default_subnet_test.go index b0275fad945..6a477cb5900 100644 --- a/internal/service/ec2/vpc_default_subnet_test.go +++ b/internal/service/ec2/vpc_default_subnet_test.go @@ -108,7 +108,7 @@ func testAccDefaultSubnet_Existing_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_resource_name_dns_aaaa_record_on_launch", "false"), resource.TestCheckResourceAttr(resourceName, "enable_resource_name_dns_a_record_on_launch", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_subnet", "true"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "ipv6_cidr_block", ""), resource.TestCheckResourceAttr(resourceName, "ipv6_native", "false"), resource.TestCheckResourceAttr(resourceName, "map_customer_owned_ip_on_launch", "false"), @@ -144,7 +144,7 @@ func testAccDefaultSubnet_Existing_forceDestroy(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSubnetExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "existing_default_subnet", "true"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "true"), ), }, }, @@ -181,7 +181,7 @@ func testAccDefaultSubnet_Existing_ipv6(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_resource_name_dns_aaaa_record_on_launch", "false"), resource.TestCheckResourceAttr(resourceName, "enable_resource_name_dns_a_record_on_launch", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_subnet", "true"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "true"), resource.TestCheckResourceAttrSet(resourceName, "ipv6_cidr_block"), resource.TestCheckResourceAttr(resourceName, "ipv6_native", "false"), resource.TestCheckResourceAttr(resourceName, "map_customer_owned_ip_on_launch", "false"), @@ -228,7 +228,7 @@ func testAccDefaultSubnet_Existing_privateDNSNameOptionsOnLaunch(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_resource_name_dns_aaaa_record_on_launch", "false"), resource.TestCheckResourceAttr(resourceName, "enable_resource_name_dns_a_record_on_launch", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_subnet", "true"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "ipv6_cidr_block", ""), resource.TestCheckResourceAttr(resourceName, "ipv6_native", "false"), resource.TestCheckResourceAttr(resourceName, "map_customer_owned_ip_on_launch", "false"), @@ -275,7 +275,7 @@ func testAccDefaultSubnet_NotFound_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_resource_name_dns_aaaa_record_on_launch", "false"), resource.TestCheckResourceAttr(resourceName, "enable_resource_name_dns_a_record_on_launch", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_subnet", "false"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "ipv6_cidr_block", ""), resource.TestCheckResourceAttr(resourceName, "ipv6_native", "false"), resource.TestCheckResourceAttr(resourceName, "map_customer_owned_ip_on_launch", "false"), @@ -321,7 +321,7 @@ func testAccDefaultSubnet_NotFound_ipv6Native(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_resource_name_dns_aaaa_record_on_launch", "true"), resource.TestCheckResourceAttr(resourceName, "enable_resource_name_dns_a_record_on_launch", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_subnet", "false"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "true"), resource.TestCheckResourceAttrSet(resourceName, "ipv6_cidr_block"), resource.TestCheckResourceAttr(resourceName, "ipv6_native", "true"), resource.TestCheckResourceAttr(resourceName, "map_customer_owned_ip_on_launch", "false"), diff --git a/internal/service/ec2/vpc_default_vpc.go b/internal/service/ec2/vpc_default_vpc.go index b3933354371..c16cdc0ca02 100644 --- a/internal/service/ec2/vpc_default_vpc.go +++ b/internal/service/ec2/vpc_default_vpc.go @@ -98,7 +98,7 @@ func ResourceDefaultVPC() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -285,7 +285,7 @@ func resourceDefaultVPCCreate(ctx context.Context, d *schema.ResourceData, meta func resourceDefaultVPCDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { return append(diags, resourceVPCDelete(ctx, d, meta)...) } diff --git a/internal/service/ec2/vpc_default_vpc_test.go b/internal/service/ec2/vpc_default_vpc_test.go index 2ede5d47983..955044d7560 100644 --- a/internal/service/ec2/vpc_default_vpc_test.go +++ b/internal/service/ec2/vpc_default_vpc_test.go @@ -106,7 +106,7 @@ func testAccDefaultVPC_Existing_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_dns_support", "true"), resource.TestCheckResourceAttr(resourceName, "enable_network_address_usage_metrics", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_vpc", "true"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "instance_tenancy", "default"), resource.TestCheckResourceAttr(resourceName, "ipv6_association_id", ""), resource.TestCheckResourceAttr(resourceName, "ipv6_cidr_block", ""), @@ -153,7 +153,7 @@ func testAccDefaultVPC_Existing_assignGeneratedIPv6CIDRBlock(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_dns_support", "true"), resource.TestCheckResourceAttr(resourceName, "enable_network_address_usage_metrics", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_vpc", "true"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "instance_tenancy", "default"), resource.TestCheckResourceAttrSet(resourceName, "ipv6_association_id"), resource.TestMatchResourceAttr(resourceName, "ipv6_cidr_block", regexache.MustCompile(`/56$`)), @@ -190,7 +190,7 @@ func testAccDefaultVPC_Existing_forceDestroy(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( acctest.CheckVPCExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "existing_default_vpc", "true"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "true"), testAccCheckDefaultVPCEmpty(ctx, &v), ), }, @@ -228,7 +228,7 @@ func testAccDefaultVPC_NotFound_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_dns_support", "true"), resource.TestCheckResourceAttr(resourceName, "enable_network_address_usage_metrics", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_vpc", "false"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "instance_tenancy", "default"), resource.TestCheckResourceAttr(resourceName, "ipv6_association_id", ""), resource.TestCheckResourceAttr(resourceName, "ipv6_cidr_block", ""), @@ -275,7 +275,7 @@ func testAccDefaultVPC_NotFound_assignGeneratedIPv6CIDRBlock(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_dns_support", "true"), resource.TestCheckResourceAttr(resourceName, "enable_network_address_usage_metrics", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_vpc", "false"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "instance_tenancy", "default"), resource.TestCheckResourceAttrSet(resourceName, "ipv6_association_id"), resource.TestMatchResourceAttr(resourceName, "ipv6_cidr_block", regexache.MustCompile(`/56$`)), @@ -312,7 +312,7 @@ func testAccDefaultVPC_NotFound_forceDestroy(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( acctest.CheckVPCExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "existing_default_vpc", "false"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "true"), testAccCheckDefaultVPCEmpty(ctx, &v), ), }, @@ -351,7 +351,7 @@ func testAccDefaultVPC_NotFound_assignGeneratedIPv6CIDRBlockAdoption(t *testing. resource.TestCheckResourceAttr(resourceName, "enable_dns_support", "true"), resource.TestCheckResourceAttr(resourceName, "enable_network_address_usage_metrics", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_vpc", "false"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "instance_tenancy", "default"), resource.TestCheckResourceAttrSet(resourceName, "ipv6_association_id"), resource.TestMatchResourceAttr(resourceName, "ipv6_cidr_block", regexache.MustCompile(`/56$`)), @@ -393,7 +393,7 @@ func testAccDefaultVPC_NotFound_assignGeneratedIPv6CIDRBlockAdoption(t *testing. resource.TestCheckResourceAttr(resourceName, "enable_dns_support", "true"), resource.TestCheckResourceAttr(resourceName, "enable_network_address_usage_metrics", "false"), resource.TestCheckResourceAttr(resourceName, "existing_default_vpc", "true"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "instance_tenancy", "default"), resource.TestCheckResourceAttrSet(resourceName, "ipv6_association_id"), resource.TestMatchResourceAttr(resourceName, "ipv6_cidr_block", regexache.MustCompile(`/56$`)), From 12d53e0ed0398b06b7224c8a0131137cbbb026e0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:20 -0400 Subject: [PATCH 1294/1490] ecrpublic: Use constant for force_destroy strings --- internal/service/ecrpublic/repository.go | 10 +++++----- internal/service/ecrpublic/repository_test.go | 2 +- internal/service/ecrpublic/sweep.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/ecrpublic/repository.go b/internal/service/ecrpublic/repository.go index ee99767136c..f4be114b324 100644 --- a/internal/service/ecrpublic/repository.go +++ b/internal/service/ecrpublic/repository.go @@ -101,7 +101,7 @@ func ResourceRepository() *schema.Resource { }, DiffSuppressFunc: verify.SuppressMissingOptionalConfigurationBlock, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -203,10 +203,10 @@ func resourceRepositoryRead(ctx context.Context, d *schema.ResourceData, meta in d.Set(names.AttrARN, repository.RepositoryArn) d.Set("repository_uri", repository.RepositoryUri) - if v, ok := d.GetOk("force_destroy"); ok { - d.Set("force_destroy", v.(bool)) + if v, ok := d.GetOk(names.AttrForceDestroy); ok { + d.Set(names.AttrForceDestroy, v.(bool)) } else { - d.Set("force_destroy", false) + d.Set(names.AttrForceDestroy, false) } var catalogOut *ecrpublic.GetRepositoryCatalogDataOutput @@ -246,7 +246,7 @@ func resourceRepositoryDelete(ctx context.Context, d *schema.ResourceData, meta RegistryId: aws.String(d.Get("registry_id").(string)), } - if v, ok := d.GetOk("force_destroy"); ok { + if v, ok := d.GetOk(names.AttrForceDestroy); ok { force := v.(bool) deleteInput.Force = aws.ToBool(&force) } diff --git a/internal/service/ecrpublic/repository_test.go b/internal/service/ecrpublic/repository_test.go index 76d7860ef44..adf22f76f44 100644 --- a/internal/service/ecrpublic/repository_test.go +++ b/internal/service/ecrpublic/repository_test.go @@ -337,7 +337,7 @@ func TestAccECRPublicRepository_Basic_forceDestroy(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) diff --git a/internal/service/ecrpublic/sweep.go b/internal/service/ecrpublic/sweep.go index 1fd20c1291b..f1fd856f2b7 100644 --- a/internal/service/ecrpublic/sweep.go +++ b/internal/service/ecrpublic/sweep.go @@ -55,7 +55,7 @@ func sweepRepositories(region string) error { d := r.Data(nil) d.SetId(aws.ToString(repository.RepositoryName)) d.Set("registry_id", repository.RegistryId) - d.Set("force_destroy", true) + d.Set(names.AttrForceDestroy, true) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } From 4366ca9d286dbd6ec460c7cdd42c1553ae01660b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:20 -0400 Subject: [PATCH 1295/1490] events: Use constant for force_destroy strings --- internal/service/events/rule.go | 8 ++-- internal/service/events/rule_test.go | 32 +++++++-------- internal/service/events/sweep.go | 5 ++- internal/service/events/target.go | 8 ++-- internal/service/events/target_test.go | 54 +++++++++++++------------- 5 files changed, 54 insertions(+), 53 deletions(-) diff --git a/internal/service/events/rule.go b/internal/service/events/rule.go index c65d3d2ebab..3c833f5c62e 100644 --- a/internal/service/events/rule.go +++ b/internal/service/events/rule.go @@ -80,7 +80,7 @@ func resourceRule() *schema.Resource { return json }, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -231,7 +231,7 @@ func resourceRuleRead(ctx context.Context, d *schema.ResourceData, meta interfac } d.Set("event_pattern", pattern) } - d.Set("force_destroy", d.Get("force_destroy").(bool)) + d.Set(names.AttrForceDestroy, d.Get(names.AttrForceDestroy).(bool)) switch output.State { case types.RuleStateEnabled, types.RuleStateEnabledWithAllCloudtrailManagementEvents: d.Set("is_enabled", true) @@ -251,7 +251,7 @@ func resourceRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interf var diags diag.Diagnostics conn := meta.(*conns.AWSClient).EventsClient(ctx) - if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll, "force_destroy") { + if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll, names.AttrForceDestroy) { _, ruleName, err := ruleParseResourceID(d.Id()) if err != nil { return sdkdiag.AppendFromErr(diags, err) @@ -286,7 +286,7 @@ func resourceRuleDelete(ctx context.Context, d *schema.ResourceData, meta interf input.EventBusName = aws.String(eventBusName) } - if v, ok := d.GetOk("force_destroy"); ok { + if v, ok := d.GetOk(names.AttrForceDestroy); ok { input.Force = v.(bool) } diff --git a/internal/service/events/rule_test.go b/internal/service/events/rule_test.go index 23c7a6c6bd9..6fc58a09aa4 100644 --- a/internal/service/events/rule_test.go +++ b/internal/service/events/rule_test.go @@ -230,14 +230,14 @@ func TestAccEventsRule_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { ResourceName: resourceName, ImportState: true, ImportStateIdFunc: testAccRuleNoBusNameImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccRuleConfig_basic(rName2), @@ -297,7 +297,7 @@ func TestAccEventsRule_eventBusName(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccRuleConfig_busName(rName1, busName1, "description 2"), @@ -347,7 +347,7 @@ func TestAccEventsRule_role(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -377,7 +377,7 @@ func TestAccEventsRule_description(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccRuleConfig_description(rName, "description2"), @@ -416,7 +416,7 @@ func TestAccEventsRule_pattern(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccRuleConfig_pattern(rName, "{\"source\":[\"aws.lambda\"]}"), @@ -480,7 +480,7 @@ func TestAccEventsRule_scheduleAndPattern(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -510,7 +510,7 @@ func TestAccEventsRule_namePrefix(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -539,7 +539,7 @@ func TestAccEventsRule_Name_generated(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -569,7 +569,7 @@ func TestAccEventsRule_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccRuleConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), @@ -617,7 +617,7 @@ func TestAccEventsRule_isEnabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccRuleConfig_isEnabled(rName, true), @@ -632,7 +632,7 @@ func TestAccEventsRule_isEnabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccRuleConfig_isEnabled(rName, false), @@ -672,7 +672,7 @@ func TestAccEventsRule_state(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccRuleConfig_state(rName, string(types.RuleStateEnabled)), @@ -687,7 +687,7 @@ func TestAccEventsRule_state(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -731,7 +731,7 @@ func TestAccEventsRule_partnerEventBus(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -770,7 +770,7 @@ func TestAccEventsRule_eventBusARN(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) diff --git a/internal/service/events/sweep.go b/internal/service/events/sweep.go index be8ea22b4a0..d629050d92c 100644 --- a/internal/service/events/sweep.go +++ b/internal/service/events/sweep.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-aws/internal/sweep" "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv2" + "github.com/hashicorp/terraform-provider-aws/names" ) func RegisterSweepers() { @@ -279,7 +280,7 @@ func sweepRules(region string) error { r := resourceRule() d := r.Data(nil) d.SetId(ruleCreateResourceID(eventBusName, ruleName)) - d.Set("force_destroy", true) + d.Set(names.AttrForceDestroy, true) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } @@ -358,7 +359,7 @@ func sweepTargets(region string) error { d := r.Data(nil) d.SetId(targetCreateResourceID(eventBusName, ruleName, targetID)) d.Set("event_bus_name", eventBusName) - d.Set("force_destroy", true) + d.Set(names.AttrForceDestroy, true) d.Set("rule", ruleName) d.Set("target_id", targetID) diff --git a/internal/service/events/target.go b/internal/service/events/target.go index ca030f2dc1d..cd1e5a23427 100644 --- a/internal/service/events/target.go +++ b/internal/service/events/target.go @@ -255,7 +255,7 @@ func resourceTarget() *schema.Resource { ValidateFunc: validBusNameOrARN, Default: DefaultEventBusName, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -547,7 +547,7 @@ func resourceTargetRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrARN, target.Arn) d.Set("event_bus_name", eventBusName) - d.Set("force_destroy", d.Get("force_destroy").(bool)) + d.Set(names.AttrForceDestroy, d.Get(names.AttrForceDestroy).(bool)) d.Set("input", target.Input) d.Set("input_path", target.InputPath) d.Set(names.AttrRoleARN, target.RoleArn) @@ -628,7 +628,7 @@ func resourceTargetUpdate(ctx context.Context, d *schema.ResourceData, meta inte var diags diag.Diagnostics conn := meta.(*conns.AWSClient).EventsClient(ctx) - if d.HasChangesExcept("force_destroy") { + if d.HasChangesExcept(names.AttrForceDestroy) { input := expandPutTargetsInput(ctx, d) output, err := conn.PutTargets(ctx, input) @@ -658,7 +658,7 @@ func resourceTargetDelete(ctx context.Context, d *schema.ResourceData, meta inte input.EventBusName = aws.String(v.(string)) } - if v, ok := d.GetOk("force_destroy"); ok { + if v, ok := d.GetOk(names.AttrForceDestroy); ok { input.Force = v.(bool) } diff --git a/internal/service/events/target_test.go b/internal/service/events/target_test.go index e71b5cbed2b..afaf655d9fb 100644 --- a/internal/service/events/target_test.go +++ b/internal/service/events/target_test.go @@ -232,14 +232,14 @@ func TestAccEventsTarget_basic(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { ResourceName: resourceName, ImportState: true, ImportStateIdFunc: testAccTargetNoBusNameImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccTargetConfig_defaultBusName(rName), @@ -299,7 +299,7 @@ func TestAccEventsTarget_eventBusName(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -335,7 +335,7 @@ func TestAccEventsTarget_eventBusARN(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -369,7 +369,7 @@ func TestAccEventsTarget_generatedTargetID(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -408,7 +408,7 @@ func TestAccEventsTarget_RetryPolicy_deadLetter(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -445,7 +445,7 @@ func TestAccEventsTarget_full(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -478,7 +478,7 @@ func TestAccEventsTarget_ssmDocument(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -514,7 +514,7 @@ func TestAccEventsTarget_http(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -552,7 +552,7 @@ func TestAccEventsTarget_http_params(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccTargetConfig_httpParameterUpdated(rName), @@ -606,7 +606,7 @@ func TestAccEventsTarget_ecs(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -639,7 +639,7 @@ func TestAccEventsTarget_redshift(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -680,7 +680,7 @@ func TestAccEventsTarget_ecsWithoutLaunchType(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccTargetConfig_ecs(rName), @@ -694,7 +694,7 @@ func TestAccEventsTarget_ecsWithoutLaunchType(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccTargetConfig_ecsNoLaunchType(rName), @@ -743,7 +743,7 @@ func TestAccEventsTarget_ecsWithBlankLaunchType(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccTargetConfig_ecs(rName), @@ -757,7 +757,7 @@ func TestAccEventsTarget_ecsWithBlankLaunchType(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccTargetConfig_ecsBlankLaunchType(rName), @@ -795,7 +795,7 @@ func TestAccEventsTarget_ecsWithBlankTaskCount(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -834,7 +834,7 @@ func TestAccEventsTarget_ecsFull(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -869,7 +869,7 @@ func TestAccEventsTarget_ecsCapacityProvider(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -905,7 +905,7 @@ func TestAccEventsTarget_ecsPlacementStrategy(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -938,7 +938,7 @@ func TestAccEventsTarget_batch(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -969,7 +969,7 @@ func TestAccEventsTarget_kinesis(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1000,7 +1000,7 @@ func TestAccEventsTarget_sqs(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1036,7 +1036,7 @@ func TestAccEventsTarget_sageMakerPipeline(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1095,7 +1095,7 @@ func TestAccEventsTarget_Input_transformer(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1161,7 +1161,7 @@ func TestAccEventsTarget_partnerEventBus(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1194,7 +1194,7 @@ func TestAccEventsTarget_ecsNoPropagateTags(t *testing.T) { ImportState: true, ImportStateIdFunc: testAccTargetImportStateIdFunc(resourceName), ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) From 9b76bce498d67bf2a0107544c130a2526bd2c535 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:20 -0400 Subject: [PATCH 1296/1490] iam: Use constant for force_destroy strings --- internal/service/iam/role_test.go | 2 +- internal/service/iam/sweep.go | 3 +- internal/service/iam/user.go | 4 +- internal/service/iam/user_tags_gen_test.go | 52 +++++++++++----------- internal/service/iam/user_test.go | 22 ++++----- 5 files changed, 42 insertions(+), 41 deletions(-) diff --git a/internal/service/iam/role_test.go b/internal/service/iam/role_test.go index e70d98ba6a0..ba1c64193e6 100644 --- a/internal/service/iam/role_test.go +++ b/internal/service/iam/role_test.go @@ -533,7 +533,7 @@ func TestAccIAMRole_permissionsBoundary(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, // Test removal diff --git a/internal/service/iam/sweep.go b/internal/service/iam/sweep.go index ade729847d4..9c5d44d8485 100644 --- a/internal/service/iam/sweep.go +++ b/internal/service/iam/sweep.go @@ -25,6 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv2" "github.com/hashicorp/terraform-provider-aws/internal/sweep/sdk" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) func RegisterSweepers() { @@ -620,7 +621,7 @@ func sweepUsers(region string) error { r := resourceUser() d := r.Data(nil) d.SetId(aws.ToString(user.UserName)) - d.Set("force_destroy", true) + d.Set(names.AttrForceDestroy, true) // In general, sweeping should use the resource's Delete function. If Delete // is missing something that affects sweeping, fix Delete. Most of the time, diff --git a/internal/service/iam/user.go b/internal/service/iam/user.go index 0241f34e776..8f776483c42 100644 --- a/internal/service/iam/user.go +++ b/internal/service/iam/user.go @@ -46,7 +46,7 @@ func resourceUser() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -234,7 +234,7 @@ func resourceUserDelete(ctx context.Context, d *schema.ResourceData, meta interf } // All access keys, MFA devices and login profile for the user must be removed. - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { for _, v := range []struct { f func(context.Context, *iam.Client, string) error format string diff --git a/internal/service/iam/user_tags_gen_test.go b/internal/service/iam/user_tags_gen_test.go index d15f3e2b974..61a554743bf 100644 --- a/internal/service/iam/user_tags_gen_test.go +++ b/internal/service/iam/user_tags_gen_test.go @@ -53,7 +53,7 @@ func TestAccIAMUser_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -85,7 +85,7 @@ func TestAccIAMUser_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -114,7 +114,7 @@ func TestAccIAMUser_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -136,7 +136,7 @@ func TestAccIAMUser_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -176,7 +176,7 @@ func TestAccIAMUser_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -239,7 +239,7 @@ func TestAccIAMUser_tags_AddOnUpdate(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -284,7 +284,7 @@ func TestAccIAMUser_tags_EmptyTag_OnCreate(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -306,7 +306,7 @@ func TestAccIAMUser_tags_EmptyTag_OnCreate(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -368,7 +368,7 @@ func TestAccIAMUser_tags_EmptyTag_OnUpdate_Add(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -397,7 +397,7 @@ func TestAccIAMUser_tags_EmptyTag_OnUpdate_Add(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -456,7 +456,7 @@ func TestAccIAMUser_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -503,7 +503,7 @@ func TestAccIAMUser_tags_DefaultTags_providerOnly(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -538,7 +538,7 @@ func TestAccIAMUser_tags_DefaultTags_providerOnly(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -570,7 +570,7 @@ func TestAccIAMUser_tags_DefaultTags_providerOnly(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -595,7 +595,7 @@ func TestAccIAMUser_tags_DefaultTags_providerOnly(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -650,7 +650,7 @@ func TestAccIAMUser_tags_DefaultTags_nonOverlapping(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -694,7 +694,7 @@ func TestAccIAMUser_tags_DefaultTags_nonOverlapping(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -719,7 +719,7 @@ func TestAccIAMUser_tags_DefaultTags_nonOverlapping(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -773,7 +773,7 @@ func TestAccIAMUser_tags_DefaultTags_overlapping(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -818,7 +818,7 @@ func TestAccIAMUser_tags_DefaultTags_overlapping(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -857,7 +857,7 @@ func TestAccIAMUser_tags_DefaultTags_overlapping(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -921,7 +921,7 @@ func TestAccIAMUser_tags_DefaultTags_updateToProviderOnly(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -985,7 +985,7 @@ func TestAccIAMUser_tags_DefaultTags_updateToResourceOnly(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -1039,7 +1039,7 @@ func TestAccIAMUser_tags_DefaultTags_emptyResourceTag(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -1088,7 +1088,7 @@ func TestAccIAMUser_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -1137,7 +1137,7 @@ func TestAccIAMUser_tags_DefaultTags_nullNonOverlappingResourceTag(t *testing.T) ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, diff --git a/internal/service/iam/user_test.go b/internal/service/iam/user_test.go index 85975410c41..78226649573 100644 --- a/internal/service/iam/user_test.go +++ b/internal/service/iam/user_test.go @@ -51,7 +51,7 @@ func TestAccIAMUser_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy"}, + names.AttrForceDestroy}, }, { Config: testAccUserConfig_basic(name2, path2), @@ -114,7 +114,7 @@ func TestAccIAMUser_ForceDestroy_accessKey(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy"}, + names.AttrForceDestroy}, }, }, }) @@ -145,7 +145,7 @@ func TestAccIAMUser_ForceDestroy_loginProfile(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy"}, + names.AttrForceDestroy}, }, }, }) @@ -176,7 +176,7 @@ func TestAccIAMUser_ForceDestroy_mfaDevice(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy"}, + names.AttrForceDestroy}, }, }, }) @@ -206,7 +206,7 @@ func TestAccIAMUser_ForceDestroy_sshKey(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -236,7 +236,7 @@ func TestAccIAMUser_ForceDestroy_serviceSpecificCred(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -267,7 +267,7 @@ func TestAccIAMUser_ForceDestroy_signingCertificate(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy"}, + names.AttrForceDestroy}, }, }, }) @@ -372,7 +372,7 @@ func TestAccIAMUser_nameChange(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy"}, + names.AttrForceDestroy}, }, { Config: testAccUserConfig_basic(name2, path), @@ -410,7 +410,7 @@ func TestAccIAMUser_pathChange(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy"}, + names.AttrForceDestroy}, }, { Config: testAccUserConfig_basic(name, path2), @@ -452,7 +452,7 @@ func TestAccIAMUser_permissionsBoundary(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy"}, + names.AttrForceDestroy}, }, // Test update { @@ -468,7 +468,7 @@ func TestAccIAMUser_permissionsBoundary(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, // Test removal { From 831bd43260ffb9bed8cd30ed0a81bcf62d5d72f9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:21 -0400 Subject: [PATCH 1297/1490] rds: Use constant for force_destroy strings --- internal/service/rds/global_cluster.go | 6 +++--- internal/service/rds/global_cluster_test.go | 6 +++--- internal/service/rds/sweep.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/rds/global_cluster.go b/internal/service/rds/global_cluster.go index f9f586e3d66..30d6f177788 100644 --- a/internal/service/rds/global_cluster.go +++ b/internal/service/rds/global_cluster.go @@ -75,7 +75,7 @@ func ResourceGlobalCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, }, @@ -111,7 +111,7 @@ func ResourceGlobalCluster() *schema.Resource { Computed: true, ForceNew: true, ConflictsWith: []string{"engine"}, - RequiredWith: []string{"force_destroy"}, + RequiredWith: []string{names.AttrForceDestroy}, }, "storage_encrypted": { Type: schema.TypeBool, @@ -262,7 +262,7 @@ func resourceGlobalClusterDelete(ctx context.Context, d *schema.ResourceData, me conn := meta.(*conns.AWSClient).RDSConn(ctx) deadline := tfresource.NewDeadline(d.Timeout(schema.TimeoutDelete)) - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { log.Printf("[DEBUG] Removing cluster members from RDS Global Cluster: %s", d.Id()) // The writer cluster must be removed last diff --git a/internal/service/rds/global_cluster_test.go b/internal/service/rds/global_cluster_test.go index 3600ffdd01c..2e7e19fcf40 100644 --- a/internal/service/rds/global_cluster_test.go +++ b/internal/service/rds/global_cluster_test.go @@ -460,7 +460,7 @@ func TestAccRDSGlobalCluster_forceDestroy(t *testing.T) { Config: testAccGlobalClusterConfig_forceDestroy(rName), Check: resource.ComposeTestCheckFunc( testAccCheckGlobalClusterExists(ctx, resourceName, &globalCluster1), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "true"), ), }, }, @@ -491,7 +491,7 @@ func TestAccRDSGlobalCluster_sourceDBClusterIdentifier(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "source_db_cluster_identifier"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "source_db_cluster_identifier"}, }, }, }) @@ -521,7 +521,7 @@ func TestAccRDSGlobalCluster_SourceDBClusterIdentifier_storageEncrypted(t *testi ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "source_db_cluster_identifier"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "source_db_cluster_identifier"}, }, }, }) diff --git a/internal/service/rds/sweep.go b/internal/service/rds/sweep.go index dec81c150a9..71585a8605d 100644 --- a/internal/service/rds/sweep.go +++ b/internal/service/rds/sweep.go @@ -336,7 +336,7 @@ func sweepGlobalClusters(region string) error { r := ResourceGlobalCluster() d := r.Data(nil) d.SetId(aws.StringValue(v.GlobalClusterIdentifier)) - d.Set("force_destroy", true) + d.Set(names.AttrForceDestroy, true) d.Set("global_cluster_members", flattenGlobalClusterMembers(v.GlobalClusterMembers)) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) From ca3e30f13a85e4a48567fa347eacd475a8df2fe3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:21 -0400 Subject: [PATCH 1298/1490] redshift: Use constant for force_destroy strings --- internal/service/redshift/snapshot_schedule.go | 4 ++-- .../service/redshift/snapshot_schedule_test.go | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/redshift/snapshot_schedule.go b/internal/service/redshift/snapshot_schedule.go index c13960379e2..55315540025 100644 --- a/internal/service/redshift/snapshot_schedule.go +++ b/internal/service/redshift/snapshot_schedule.go @@ -52,7 +52,7 @@ func resourceSnapshotSchedule() *schema.Resource { Optional: true, ForceNew: true, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -163,7 +163,7 @@ func resourceSnapshotScheduleDelete(ctx context.Context, d *schema.ResourceData, var diags diag.Diagnostics conn := meta.(*conns.AWSClient).RedshiftConn(ctx) - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { diags = append(diags, snapshotScheduleDisassociateAll(ctx, conn, d.Id())...) if diags.HasError() { diff --git a/internal/service/redshift/snapshot_schedule_test.go b/internal/service/redshift/snapshot_schedule_test.go index a6d9a81113b..84ee4cf436d 100644 --- a/internal/service/redshift/snapshot_schedule_test.go +++ b/internal/service/redshift/snapshot_schedule_test.go @@ -51,7 +51,7 @@ func TestAccRedshiftSnapshotSchedule_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -107,7 +107,7 @@ func TestAccRedshiftSnapshotSchedule_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -155,7 +155,7 @@ func TestAccRedshiftSnapshotSchedule_identifierGenerated(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -186,7 +186,7 @@ func TestAccRedshiftSnapshotSchedule_identifierPrefix(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -219,7 +219,7 @@ func TestAccRedshiftSnapshotSchedule_update(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, { @@ -267,7 +267,7 @@ func TestAccRedshiftSnapshotSchedule_withDescription(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -301,7 +301,7 @@ func TestAccRedshiftSnapshotSchedule_withForceDestroy(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, From 9e1222ec9da8abdfcc69ec8a1fa17c43eca46aa6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:21 -0400 Subject: [PATCH 1299/1490] route53: Use constant for force_destroy strings --- internal/service/route53/sweep.go | 2 +- internal/service/route53/zone.go | 4 ++-- internal/service/route53/zone_test.go | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/route53/sweep.go b/internal/service/route53/sweep.go index 28f0d6bceb7..df5afbc8652 100644 --- a/internal/service/route53/sweep.go +++ b/internal/service/route53/sweep.go @@ -368,7 +368,7 @@ func sweepZones(region string) error { r := ResourceZone() d := r.Data(nil) d.SetId(id) - d.Set("force_destroy", true) + d.Set(names.AttrForceDestroy, true) d.Set(names.AttrName, v.Name) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) diff --git a/internal/service/route53/zone.go b/internal/service/route53/zone.go index 3ffc464eae9..e66ce9499e3 100644 --- a/internal/service/route53/zone.go +++ b/internal/service/route53/zone.go @@ -69,7 +69,7 @@ func ResourceZone() *schema.Resource { ConflictsWith: []string{"vpc"}, ValidateFunc: validation.StringLenBetween(0, 32), }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -303,7 +303,7 @@ func resourceZoneDelete(ctx context.Context, d *schema.ResourceData, meta interf var diags diag.Diagnostics conn := meta.(*conns.AWSClient).Route53Conn(ctx) - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { if err := deleteAllResourceRecordsFromHostedZone(ctx, conn, d.Id(), d.Get(names.AttrName).(string)); err != nil { return sdkdiag.AppendFromErr(diags, err) } diff --git a/internal/service/route53/zone_test.go b/internal/service/route53/zone_test.go index 591c149034c..907a91a977a 100644 --- a/internal/service/route53/zone_test.go +++ b/internal/service/route53/zone_test.go @@ -122,7 +122,7 @@ func TestAccRoute53Zone_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -212,7 +212,7 @@ func TestAccRoute53Zone_comment(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -242,7 +242,7 @@ func TestAccRoute53Zone_delegationSetID(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -322,7 +322,7 @@ func TestAccRoute53Zone_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccZoneConfig_tags2(zoneName, "tag1key", "tag1valueupdated", "tag2key", "tag2value"), @@ -371,7 +371,7 @@ func TestAccRoute53Zone_VPC_single(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -405,7 +405,7 @@ func TestAccRoute53Zone_VPC_multiple(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) From b17dc5471566ffe4d6fcce7a05cabfe54d078ef8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:21 -0400 Subject: [PATCH 1300/1490] s3: Use constant for force_destroy strings --- internal/service/s3/bucket.go | 4 +- internal/service/s3/bucket_object.go | 4 +- internal/service/s3/bucket_object_test.go | 38 ++++----- internal/service/s3/bucket_test.go | 90 ++++++++++---------- internal/service/s3/directory_bucket.go | 2 +- internal/service/s3/directory_bucket_test.go | 2 +- internal/service/s3/object.go | 4 +- internal/service/s3/object_copy.go | 4 +- internal/service/s3/object_copy_test.go | 6 +- internal/service/s3/object_test.go | 48 +++++------ 10 files changed, 101 insertions(+), 101 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index 474543bc37f..cb2f0b937ab 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -150,7 +150,7 @@ func resourceBucket() *schema.Resource { }, }, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -1556,7 +1556,7 @@ func resourceBucketDelete(ctx context.Context, d *schema.ResourceData, meta inte } if tfawserr.ErrCodeEquals(err, errCodeBucketNotEmpty) { - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { // Delete everything including locked objects. // Don't ignore any object errors or we could recurse infinitely. var objectLockEnabled bool diff --git a/internal/service/s3/bucket_object.go b/internal/service/s3/bucket_object.go index aa777d08a7d..69ff40498d0 100644 --- a/internal/service/s3/bucket_object.go +++ b/internal/service/s3/bucket_object.go @@ -119,7 +119,7 @@ func resourceBucketObject() *schema.Resource { Computed: true, ConflictsWith: []string{names.AttrKMSKeyID}, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -340,7 +340,7 @@ func resourceBucketObjectDelete(ctx context.Context, d *schema.ResourceData, met var err error if _, ok := d.GetOk("version_id"); ok { - _, err = deleteAllObjectVersions(ctx, conn, bucket, key, d.Get("force_destroy").(bool), false) + _, err = deleteAllObjectVersions(ctx, conn, bucket, key, d.Get(names.AttrForceDestroy).(bool), false) } else { err = deleteObjectVersion(ctx, conn, bucket, key, "", false) } diff --git a/internal/service/s3/bucket_object_test.go b/internal/service/s3/bucket_object_test.go index b65ec119c9b..7c0136da1dd 100644 --- a/internal/service/s3/bucket_object_test.go +++ b/internal/service/s3/bucket_object_test.go @@ -84,7 +84,7 @@ func TestAccS3BucketObject_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_language", ""), resource.TestCheckResourceAttr(resourceName, "content_type", "application/octet-stream"), resource.TestCheckResourceAttrSet(resourceName, "etag"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, names.AttrKey, "test-key"), resource.TestCheckNoResourceAttr(resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttr(resourceName, "metadata.%", "0"), @@ -104,7 +104,7 @@ func TestAccS3BucketObject_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -137,7 +137,7 @@ func TestAccS3BucketObject_source(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -168,7 +168,7 @@ func TestAccS3BucketObject_content(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "content", "content_base64", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", "content", "content_base64", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -202,7 +202,7 @@ func TestAccS3BucketObject_etagEncryption(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -283,7 +283,7 @@ func TestAccS3BucketObject_sourceHashTrigger(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "content", "content_base64", "force_destroy", names.AttrSource, "source_hash"}, + ImportStateVerifyIgnore: []string{"acl", "content", "content_base64", names.AttrForceDestroy, names.AttrSource, "source_hash"}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -344,7 +344,7 @@ func TestAccS3BucketObject_nonVersioned(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -394,7 +394,7 @@ func TestAccS3BucketObject_updates(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -487,7 +487,7 @@ func TestAccS3BucketObject_updatesWithVersioning(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -562,7 +562,7 @@ func TestAccS3BucketObject_kms(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -597,7 +597,7 @@ func TestAccS3BucketObject_sse(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", names.AttrSource, "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrSource, names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -649,7 +649,7 @@ func TestAccS3BucketObject_acl(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "content", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", "content", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -697,7 +697,7 @@ func TestAccS3BucketObject_metadata(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -761,7 +761,7 @@ func TestAccS3BucketObject_storageClass(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"content", "acl", "force_destroy"}, + ImportStateVerifyIgnore: []string{"content", "acl", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -834,7 +834,7 @@ func TestAccS3BucketObject_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"content", "acl", "force_destroy"}, + ImportStateVerifyIgnore: []string{"content", "acl", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/%s", rName, key), }, }, @@ -907,7 +907,7 @@ func TestAccS3BucketObject_tagsLeadingSingleSlash(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"content", "acl", "force_destroy"}, + ImportStateVerifyIgnore: []string{"content", "acl", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/%s", rName, key), }, }, @@ -1071,7 +1071,7 @@ func TestAccS3BucketObject_tags_EmptyTag_OnCreate(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/%s", rName, key), }, }, @@ -1112,7 +1112,7 @@ func TestAccS3BucketObject_tags_EmptyTag_OnUpdate_Add(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/%s", rName, key), }, }, @@ -1152,7 +1152,7 @@ func TestAccS3BucketObject_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/%s", rName, key), }, }, diff --git a/internal/service/s3/bucket_test.go b/internal/service/s3/bucket_test.go index bac329b3930..39d201b3c05 100644 --- a/internal/service/s3/bucket_test.go +++ b/internal/service/s3/bucket_test.go @@ -73,7 +73,7 @@ func TestAccS3Bucket_Basic_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrBucketPrefix, ""), resource.TestCheckResourceAttr(resourceName, "bucket_regional_domain_name", testAccBucketRegionalDomainName(rName, region)), resource.TestCheckResourceAttr(resourceName, "cors_rule.#", "0"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "grant.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "grant.*", map[string]string{ "permissions.#": "1", @@ -108,7 +108,7 @@ func TestAccS3Bucket_Basic_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -138,7 +138,7 @@ func TestAccS3Bucket_Basic_emptyString(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -166,7 +166,7 @@ func TestAccS3Bucket_Basic_nameGenerated(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -194,7 +194,7 @@ func TestAccS3Bucket_Basic_namePrefix(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -320,7 +320,7 @@ func TestAccS3Bucket_Basic_acceleration(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccBucketConfig_acceleration(bucketName, string(types.BucketAccelerateStatusSuspended)), @@ -360,7 +360,7 @@ func TestAccS3Bucket_Basic_keyEnabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, }, }) @@ -388,7 +388,7 @@ func TestAccS3Bucket_Basic_requestPayer(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, { Config: testAccBucketConfig_requestPayer(bucketName, string(types.PayerRequester)), @@ -507,7 +507,7 @@ func TestAccS3Bucket_Tags_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -538,7 +538,7 @@ func TestAccS3Bucket_Tags_withNoSystemTags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccBucketConfig_updatedTags(bucketName), @@ -596,7 +596,7 @@ func TestAccS3Bucket_Tags_EmptyTag_OnCreate(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -634,7 +634,7 @@ func TestAccS3Bucket_Tags_EmptyTag_OnUpdate_Add(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -671,7 +671,7 @@ func TestAccS3Bucket_Tags_EmptyTag_OnUpdate_Replace(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -726,7 +726,7 @@ func TestAccS3Bucket_Tags_withSystemTags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccBucketConfig_tags(bucketName), @@ -888,7 +888,7 @@ func TestAccS3Bucket_Manage_lifecycleBasic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, { Config: testAccBucketConfig_basic(bucketName), @@ -926,7 +926,7 @@ func TestAccS3Bucket_Manage_lifecycleExpireMarkerOnly(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, { Config: testAccBucketConfig_basic(bucketName), @@ -982,7 +982,7 @@ func TestAccS3Bucket_Manage_lifecycleRuleAbortIncompleteMultipartUploadDaysNoExp ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1044,7 +1044,7 @@ func TestAccS3Bucket_Manage_objectLock(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccBucketConfig_objectLockEnabledDefaultRetention(bucketName), @@ -1086,7 +1086,7 @@ func TestAccS3Bucket_Manage_objectLock_deprecatedEnabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1144,7 +1144,7 @@ func TestAccS3Bucket_Manage_objectLockWithVersioning(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1174,7 +1174,7 @@ func TestAccS3Bucket_Manage_objectLockWithVersioning_deprecatedEnabled(t *testin ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1204,7 +1204,7 @@ func TestAccS3Bucket_Manage_versioning(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, { Config: testAccBucketConfig_versioning(bucketName, false), @@ -1219,7 +1219,7 @@ func TestAccS3Bucket_Manage_versioning(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, }, }) @@ -1249,7 +1249,7 @@ func TestAccS3Bucket_Manage_versioningDisabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, }, }) @@ -1279,7 +1279,7 @@ func TestAccS3Bucket_Manage_MFADeleteDisabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, }, }) @@ -1309,7 +1309,7 @@ func TestAccS3Bucket_Manage_versioningAndMFADeleteDisabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, }, }) @@ -1431,7 +1431,7 @@ func TestAccS3Bucket_Replication_multipleDestinationsEmptyFilter(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, "acl", }, }, @@ -1505,7 +1505,7 @@ func TestAccS3Bucket_Replication_multipleDestinationsNonEmptyFilter(t *testing.T ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, "acl", }, }, @@ -1569,7 +1569,7 @@ func TestAccS3Bucket_Replication_twoDestination(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, "acl", }, }, @@ -1611,7 +1611,7 @@ func TestAccS3Bucket_Replication_ruleDestinationAccessControlTranslation(t *test ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, "acl", "versioning", "replication_configuration.0.rules.0.priority", @@ -1665,7 +1665,7 @@ func TestAccS3Bucket_Replication_ruleDestinationAddAccessControlTranslation(t *t ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, "acl", "versioning", "replication_configuration.0.rules.0.priority", @@ -1717,7 +1717,7 @@ func TestAccS3Bucket_Replication_withoutStorageClass(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, "acl", "replication_configuration.0.rules.0.priority", }, @@ -1783,7 +1783,7 @@ func TestAccS3Bucket_Replication_withoutPrefix(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, "acl", "replication_configuration.0.rules.0.priority", }, @@ -1838,7 +1838,7 @@ func TestAccS3Bucket_Replication_schemaV2(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, "acl", "replication_configuration.0.rules.0.priority", }, @@ -1905,7 +1905,7 @@ func TestAccS3Bucket_Replication_schemaV2SameRegion(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, "acl", "replication_configuration.0.rules.0.priority", }, @@ -2077,7 +2077,7 @@ func TestAccS3Bucket_Security_corsUpdate(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, }, }) @@ -2157,7 +2157,7 @@ func TestAccS3Bucket_Security_corsEmptyOrigin(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -2184,7 +2184,7 @@ func TestAccS3Bucket_Security_corsSingleMethodAndEmptyOrigin(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -2214,7 +2214,7 @@ func TestAccS3Bucket_Security_logging(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, }, }) @@ -2246,7 +2246,7 @@ func TestAccS3Bucket_Security_enableDefaultEncryptionWhenTypical(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, }, }) @@ -2278,7 +2278,7 @@ func TestAccS3Bucket_Security_enableDefaultEncryptionWhenAES256IsUsed(t *testing ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, }, }) @@ -2305,7 +2305,7 @@ func TestAccS3Bucket_Security_disableDefaultEncryptionWhenDefaultEncryptionIsEna ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl"}, }, { // As ServerSide Encryption Configuration is a Computed field, removing them from terraform will not @@ -2345,7 +2345,7 @@ func TestAccS3Bucket_Web_simple(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl", "grant"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl", "grant"}, }, { Config: testAccBucketConfig_websiteAndError(bucketName), @@ -2398,7 +2398,7 @@ func TestAccS3Bucket_Web_redirect(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl", "grant"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl", "grant"}, }, { Config: testAccBucketConfig_websiteAndHTTPSRedirect(bucketName), @@ -2451,7 +2451,7 @@ func TestAccS3Bucket_Web_routingRules(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "acl", "grant"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "acl", "grant"}, }, { // As Website is a Computed field, removing them from terraform will not diff --git a/internal/service/s3/directory_bucket.go b/internal/service/s3/directory_bucket.go index be2080ab978..6b6a270188c 100644 --- a/internal/service/s3/directory_bucket.go +++ b/internal/service/s3/directory_bucket.go @@ -79,7 +79,7 @@ func (r *directoryBucketResource) Schema(ctx context.Context, request resource.S stringplanmodifier.RequiresReplace(), }, }, - "force_destroy": schema.BoolAttribute{ + names.AttrForceDestroy: schema.BoolAttribute{ Optional: true, Computed: true, Default: booldefault.StaticBool(false), diff --git a/internal/service/s3/directory_bucket_test.go b/internal/service/s3/directory_bucket_test.go index 5043d053810..a5a1d9db261 100644 --- a/internal/service/s3/directory_bucket_test.go +++ b/internal/service/s3/directory_bucket_test.go @@ -46,7 +46,7 @@ func TestAccS3DirectoryBucket_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) diff --git a/internal/service/s3/object.go b/internal/service/s3/object.go index 038d5b676d9..79c2ea129db 100644 --- a/internal/service/s3/object.go +++ b/internal/service/s3/object.go @@ -146,7 +146,7 @@ func resourceObject() *schema.Resource { Computed: true, ConflictsWith: []string{names.AttrKMSKeyID}, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -416,7 +416,7 @@ func resourceObjectDelete(ctx context.Context, d *schema.ResourceData, meta inte var err error if _, ok := d.GetOk("version_id"); ok { - _, err = deleteAllObjectVersions(ctx, conn, bucket, key, d.Get("force_destroy").(bool), false, optFns...) + _, err = deleteAllObjectVersions(ctx, conn, bucket, key, d.Get(names.AttrForceDestroy).(bool), false, optFns...) } else { err = deleteObjectVersion(ctx, conn, bucket, key, "", false, optFns...) } diff --git a/internal/service/s3/object_copy.go b/internal/service/s3/object_copy.go index 296deff89d4..2a27116f2c2 100644 --- a/internal/service/s3/object_copy.go +++ b/internal/service/s3/object_copy.go @@ -161,7 +161,7 @@ func resourceObjectCopy() *schema.Resource { Optional: true, ValidateFunc: validation.IsRFC3339Time, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -476,7 +476,7 @@ func resourceObjectCopyDelete(ctx context.Context, d *schema.ResourceData, meta var err error if _, ok := d.GetOk("version_id"); ok { - _, err = deleteAllObjectVersions(ctx, conn, bucket, key, d.Get("force_destroy").(bool), false, optFns...) + _, err = deleteAllObjectVersions(ctx, conn, bucket, key, d.Get(names.AttrForceDestroy).(bool), false, optFns...) } else { err = deleteObjectVersion(ctx, conn, bucket, key, "", false, optFns...) } diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index dbbfe55c899..c4b35332d83 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -64,7 +64,7 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { resource.TestCheckNoResourceAttr(resourceName, "expected_source_bucket_owner"), resource.TestCheckResourceAttr(resourceName, "expiration", ""), resource.TestCheckNoResourceAttr(resourceName, "expires"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "grant.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrKey, names.AttrTarget), resource.TestCheckResourceAttr(resourceName, "kms_encryption_context", ""), @@ -548,7 +548,7 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { resource.TestCheckNoResourceAttr(resourceName, "expected_source_bucket_owner"), resource.TestCheckResourceAttr(resourceName, "expiration", ""), resource.TestCheckNoResourceAttr(resourceName, "expires"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "grant.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrKey, names.AttrTarget), resource.TestCheckResourceAttr(resourceName, "kms_encryption_context", ""), @@ -620,7 +620,7 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { resource.TestCheckNoResourceAttr(resourceName, "expected_source_bucket_owner"), resource.TestCheckResourceAttr(resourceName, "expiration", ""), resource.TestCheckNoResourceAttr(resourceName, "expires"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "grant.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrKey, names.AttrTarget), resource.TestCheckResourceAttr(resourceName, "kms_encryption_context", ""), diff --git a/internal/service/s3/object_test.go b/internal/service/s3/object_test.go index c64def8b094..210155ddd6f 100644 --- a/internal/service/s3/object_test.go +++ b/internal/service/s3/object_test.go @@ -141,7 +141,7 @@ func TestAccS3Object_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_language", ""), resource.TestCheckResourceAttr(resourceName, "content_type", "application/octet-stream"), resource.TestCheckResourceAttrSet(resourceName, "etag"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, names.AttrKey, "test-key"), resource.TestCheckNoResourceAttr(resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttr(resourceName, "metadata.%", "0"), @@ -161,7 +161,7 @@ func TestAccS3Object_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -274,7 +274,7 @@ func TestAccS3Object_source(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -304,7 +304,7 @@ func TestAccS3Object_content(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"content", "content_base64", "force_destroy"}, + ImportStateVerifyIgnore: []string{"content", "content_base64", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -337,7 +337,7 @@ func TestAccS3Object_etagEncryption(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -415,7 +415,7 @@ func TestAccS3Object_sourceHashTrigger(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"content", "content_base64", "force_destroy", names.AttrSource, "source_hash"}, + ImportStateVerifyIgnore: []string{"content", "content_base64", names.AttrForceDestroy, names.AttrSource, "source_hash"}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -476,7 +476,7 @@ func TestAccS3Object_nonVersioned(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -526,7 +526,7 @@ func TestAccS3Object_updates(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -619,7 +619,7 @@ func TestAccS3Object_updatesWithVersioning(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/updateable-key", rName), }, }, @@ -694,7 +694,7 @@ func TestAccS3Object_kms(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -728,7 +728,7 @@ func TestAccS3Object_sse(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", names.AttrSource}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, names.AttrSource}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -780,7 +780,7 @@ func TestAccS3Object_acl(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"acl", "content", "force_destroy"}, + ImportStateVerifyIgnore: []string{"acl", "content", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -828,7 +828,7 @@ func TestAccS3Object_metadata(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -891,7 +891,7 @@ func TestAccS3Object_storageClass(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"content", "force_destroy"}, + ImportStateVerifyIgnore: []string{"content", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -960,7 +960,7 @@ func TestAccS3Object_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"content", "force_destroy"}, + ImportStateVerifyIgnore: []string{"content", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/%s", rName, key), }, }, @@ -1029,7 +1029,7 @@ func TestAccS3Object_tagsLeadingSingleSlash(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"content", "force_destroy"}, + ImportStateVerifyIgnore: []string{"content", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/%s", rName, key), }, }, @@ -1185,7 +1185,7 @@ func TestAccS3Object_tags_EmptyTag_OnCreate(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/%s", rName, key), }, }, @@ -1226,7 +1226,7 @@ func TestAccS3Object_tags_EmptyTag_OnUpdate_Add(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/%s", rName, key), }, }, @@ -1266,7 +1266,7 @@ func TestAccS3Object_tags_EmptyTag_OnUpdate_Replace(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/%s", rName, key), }, }, @@ -1301,7 +1301,7 @@ func TestAccS3Object_DefaultTags_providerOnly(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, }, @@ -1925,7 +1925,7 @@ func TestAccS3Object_checksumAlgorithm(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"checksum_algorithm", "checksum_crc32", "content", "force_destroy"}, + ImportStateVerifyIgnore: []string{"checksum_algorithm", "checksum_crc32", "content", names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/test-key", rName), }, { @@ -2013,7 +2013,7 @@ func TestAccS3Object_directoryBucket(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_language", ""), resource.TestCheckResourceAttr(resourceName, "content_type", "application/octet-stream"), resource.TestCheckResourceAttrSet(resourceName, "etag"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, names.AttrKey, "test-key"), resource.TestCheckNoResourceAttr(resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttr(resourceName, "metadata.%", "0"), @@ -2037,7 +2037,7 @@ func TestAccS3Object_directoryBucket(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "override_provider"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "override_provider"}, ImportStateIdFunc: func(s *terraform.State) (string, error) { rs, ok := s.RootModule().Resources[resourceName] if !ok { @@ -2127,7 +2127,7 @@ func TestAccS3Object_prefix(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, ImportStateId: fmt.Sprintf("s3://%s/pfx/", rName), }, }, From 6f4795f87c77032c53b79f002b170fb0f3eae272 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:22 -0400 Subject: [PATCH 1301/1490] servicediscovery: Use constant for force_destroy strings --- internal/service/servicediscovery/service.go | 4 ++-- internal/service/servicediscovery/service_test.go | 14 +++++++------- internal/service/servicediscovery/sweep.go | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/internal/service/servicediscovery/service.go b/internal/service/servicediscovery/service.go index ec74ddb753f..61c4c632da4 100644 --- a/internal/service/servicediscovery/service.go +++ b/internal/service/servicediscovery/service.go @@ -84,7 +84,7 @@ func ResourceService() *schema.Resource { }, }, }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -282,7 +282,7 @@ func resourceServiceUpdate(ctx context.Context, d *schema.ResourceData, meta int func resourceServiceDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { conn := meta.(*conns.AWSClient).ServiceDiscoveryConn(ctx) - if d.Get("force_destroy").(bool) { + if d.Get(names.AttrForceDestroy).(bool) { var errs []error input := &servicediscovery.ListInstancesInput{ ServiceId: aws.String(d.Id()), diff --git a/internal/service/servicediscovery/service_test.go b/internal/service/servicediscovery/service_test.go index d33d2eb28cb..3813a04828f 100644 --- a/internal/service/servicediscovery/service_test.go +++ b/internal/service/servicediscovery/service_test.go @@ -46,7 +46,7 @@ func TestAccServiceDiscoveryService_private(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "dns_config.0.dns_records.0.type", "A"), resource.TestCheckResourceAttr(resourceName, "dns_config.0.dns_records.0.ttl", "5"), resource.TestCheckResourceAttr(resourceName, "dns_config.0.routing_policy", "MULTIVALUE"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "health_check_config.#", "0"), resource.TestCheckResourceAttr(resourceName, "health_check_custom_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "health_check_custom_config.0.failure_threshold", "5"), @@ -58,7 +58,7 @@ func TestAccServiceDiscoveryService_private(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServiceConfig_privateUpdate(rName, 5), @@ -72,7 +72,7 @@ func TestAccServiceDiscoveryService_private(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "dns_config.0.dns_records.0.ttl", "10"), resource.TestCheckResourceAttr(resourceName, "dns_config.0.dns_records.1.type", "AAAA"), resource.TestCheckResourceAttr(resourceName, "dns_config.0.dns_records.1.ttl", "5"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "health_check_config.#", "0"), resource.TestCheckResourceAttr(resourceName, "health_check_custom_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "health_check_custom_config.0.failure_threshold", "5"), @@ -119,7 +119,7 @@ func TestAccServiceDiscoveryService_public(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServiceConfig_public(rName, 3, "/updated-path"), @@ -177,7 +177,7 @@ func TestAccServiceDiscoveryService_private_http(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -207,7 +207,7 @@ func TestAccServiceDiscoveryService_http(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -259,7 +259,7 @@ func TestAccServiceDiscoveryService_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServiceConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), diff --git a/internal/service/servicediscovery/sweep.go b/internal/service/servicediscovery/sweep.go index 01adca6a17a..c2df6f51f41 100644 --- a/internal/service/servicediscovery/sweep.go +++ b/internal/service/servicediscovery/sweep.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-aws/internal/sweep" "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv1" + "github.com/hashicorp/terraform-provider-aws/names" ) func RegisterSweepers() { @@ -181,7 +182,7 @@ func sweepServices(region string) error { r := ResourceService() d := r.Data(nil) d.SetId(aws.StringValue(v.Id)) - d.Set("force_destroy", true) + d.Set(names.AttrForceDestroy, true) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) } From ae866f065c06cf998427be3cbdd942697dfc2ecb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 14:49:22 -0400 Subject: [PATCH 1302/1490] transfer: Use constant for force_destroy strings --- internal/service/transfer/server.go | 4 +- internal/service/transfer/server_test.go | 68 ++++++++++++------------ internal/service/transfer/sweep.go | 3 +- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/internal/service/transfer/server.go b/internal/service/transfer/server.go index 0000c186832..15c9b98dc5b 100644 --- a/internal/service/transfer/server.go +++ b/internal/service/transfer/server.go @@ -124,7 +124,7 @@ func resourceServer() *schema.Resource { Default: transfer.EndpointTypePublic, ValidateFunc: validation.StringInSlice(transfer.EndpointType_Values(), false), }, - "force_destroy": { + names.AttrForceDestroy: { Type: schema.TypeBool, Optional: true, Default: false, @@ -789,7 +789,7 @@ func resourceServerDelete(ctx context.Context, d *schema.ResourceData, meta inte var diags diag.Diagnostics conn := meta.(*conns.AWSClient).TransferConn(ctx) - if d.Get("force_destroy").(bool) && d.Get("identity_provider_type").(string) == transfer.IdentityProviderTypeServiceManaged { + if d.Get(names.AttrForceDestroy).(bool) && d.Get("identity_provider_type").(string) == transfer.IdentityProviderTypeServiceManaged { input := &transfer.ListUsersInput{ ServerId: aws.String(d.Id()), } diff --git a/internal/service/transfer/server_test.go b/internal/service/transfer/server_test.go index 5b0801ba27a..1215abf9fdb 100644 --- a/internal/service/transfer/server_test.go +++ b/internal/service/transfer/server_test.go @@ -56,7 +56,7 @@ func testAccServer_basic(t *testing.T) { acctest.MatchResourceAttrRegionalHostname(resourceName, names.AttrEndpoint, "server.transfer", regexache.MustCompile(`s-[0-9a-z]+`)), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "0"), resource.TestCheckResourceAttr(resourceName, "endpoint_type", "PUBLIC"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "function", ""), resource.TestCheckNoResourceAttr(resourceName, "host_key"), resource.TestCheckResourceAttrSet(resourceName, "host_key_fingerprint"), @@ -85,7 +85,7 @@ func testAccServer_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_updated(rName), @@ -97,7 +97,7 @@ func testAccServer_basic(t *testing.T) { acctest.MatchResourceAttrRegionalHostname(resourceName, names.AttrEndpoint, "server.transfer", regexache.MustCompile(`s-[0-9a-z]+`)), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "0"), resource.TestCheckResourceAttr(resourceName, "endpoint_type", "PUBLIC"), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "function", ""), resource.TestCheckNoResourceAttr(resourceName, "host_key"), resource.TestCheckResourceAttrSet(resourceName, "host_key_fingerprint"), @@ -161,7 +161,7 @@ func testAccServer_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_tags2("key1", "value1updated", "key2", "value2"), @@ -207,7 +207,7 @@ func testAccServer_domain(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -236,7 +236,7 @@ func testAccServer_securityPolicy(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_securityPolicy(rName, "TransferSecurityPolicy-2018-11"), @@ -300,7 +300,7 @@ func testAccServer_securityPolicyFIPS(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_securityPolicy(rName, "TransferSecurityPolicy-FIPS-2024-01"), @@ -346,7 +346,7 @@ func testAccServer_vpc(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_vpcUpdate(rName), @@ -418,7 +418,7 @@ func testAccServer_vpcAddressAllocationIDs(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_vpcAddressAllocationIdsUpdate(rName), @@ -487,7 +487,7 @@ func testAccServer_vpcSecurityGroupIDs(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_vpcSecurityGroupIdsUpdate(rName), @@ -545,7 +545,7 @@ func testAccServer_vpcAddressAllocationIds_securityGroupIDs(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_vpcAddressAllocationIdsSecurityGroupIdsUpdate(rName), @@ -599,7 +599,7 @@ func testAccServer_updateEndpointType_publicToVPC(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -637,7 +637,7 @@ func testAccServer_updateEndpointType_publicToVPC_addressAllocationIDs(t *testin ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -675,7 +675,7 @@ func testAccServer_updateEndpointType_vpcEndpointToVPC(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "endpoint_details.0.security_group_ids"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "endpoint_details.0.security_group_ids"}, }, }, }) @@ -713,7 +713,7 @@ func testAccServer_updateEndpointType_vpcEndpointToVPC_addressAllocationIDs(t *t ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "endpoint_details.0.security_group_ids"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "endpoint_details.0.security_group_ids"}, }, }, }) @@ -751,7 +751,7 @@ func testAccServer_updateEndpointType_vpcEndpointToVPC_securityGroupIDs(t *testi ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -789,7 +789,7 @@ func testAccServer_updateEndpointType_vpcToPublic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -820,7 +820,7 @@ func testAccServer_structuredLogDestinations(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_structuredLogDestinationsUpdate(rName), @@ -867,7 +867,7 @@ func testAccServer_protocols(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, // We need to create and activate the CA before issuing a certificate. { @@ -927,7 +927,7 @@ func testAccServer_protocolDetails(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_protocolDetails("8.8.8.8", "ENABLE_NO_OP", "DISABLED"), @@ -967,7 +967,7 @@ func testAccServer_s3StorageOptions(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_s3StorageOptions("DISABLED"), @@ -981,7 +981,7 @@ func testAccServer_s3StorageOptions(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1012,7 +1012,7 @@ func testAccServer_apiGateway(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1042,7 +1042,7 @@ func testAccServer_apiGateway_forceDestroy(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1077,7 +1077,7 @@ func testAccServer_directoryService(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1110,14 +1110,14 @@ func testAccServer_forceDestroy(t *testing.T) { testAccCheckServerExists(ctx, resourceName, &s), testAccCheckUserExists(ctx, userResourceName, &u), testAccCheckSSHKeyExists(ctx, sshKeyResourceName, &k), - resource.TestCheckResourceAttr(resourceName, "force_destroy", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "true"), ), }, { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "host_key"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "host_key"}, }, }, }) @@ -1147,7 +1147,7 @@ func testAccServer_hostKey(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "host_key"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "host_key"}, }, }, }) @@ -1187,7 +1187,7 @@ func testAccServer_vpcEndpointID(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy", "host_key"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy, "host_key"}, }, }, }) @@ -1218,7 +1218,7 @@ func testAccServer_lambdaFunction(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1249,7 +1249,7 @@ func testAccServer_identityProviderType_sftpAuthenticationMethods(t *testing.T) ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1289,7 +1289,7 @@ func testAccServer_updateIdentityProviderType_sftpAuthenticationMethods(t *testi ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1318,7 +1318,7 @@ func testAccServer_authenticationLoginBanners(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, }, }) @@ -1353,7 +1353,7 @@ func testAccServer_workflowDetails(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"force_destroy"}, + ImportStateVerifyIgnore: []string{names.AttrForceDestroy}, }, { Config: testAccServerConfig_workflowUpdated(rName), diff --git a/internal/service/transfer/sweep.go b/internal/service/transfer/sweep.go index e3d7b7182dd..0f10c2cbc70 100644 --- a/internal/service/transfer/sweep.go +++ b/internal/service/transfer/sweep.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-aws/internal/sweep" "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv1" + "github.com/hashicorp/terraform-provider-aws/names" ) func RegisterSweepers() { @@ -48,7 +49,7 @@ func sweepServers(region string) error { r := resourceServer() d := r.Data(nil) d.SetId(aws.StringValue(server.ServerId)) - d.Set("force_destroy", true) // In lieu of an aws_transfer_user sweeper. + d.Set(names.AttrForceDestroy, true) // In lieu of an aws_transfer_user sweeper. d.Set("identity_provider_type", server.IdentityProviderType) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) From b6d86d441d21b7f8a25d3e4800f21cbe465d51f5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 15:03:12 -0400 Subject: [PATCH 1303/1490] Fixes after constant replacement --- internal/service/autoscaling/groups_data_source.go | 8 ++++---- internal/service/iam/instance_profiles_data_source.go | 6 +++--- internal/service/iam/roles_data_source.go | 6 +++--- internal/service/iam/users_data_source.go | 6 +++--- internal/service/imagebuilder/components_data_source.go | 6 +++--- .../service/imagebuilder/container_recipes_data_source.go | 6 +++--- .../distribution_configurations_data_source.go | 6 +++--- .../service/imagebuilder/image_pipelines_data_source.go | 6 +++--- .../service/imagebuilder/image_recipes_data_source.go | 6 +++--- .../infrastructure_configurations_data_source.go | 6 +++--- internal/service/kendra/index_test.go | 1 - 11 files changed, 31 insertions(+), 32 deletions(-) diff --git a/internal/service/autoscaling/groups_data_source.go b/internal/service/autoscaling/groups_data_source.go index d8d6a358b8a..574eb0c13e9 100644 --- a/internal/service/autoscaling/groups_data_source.go +++ b/internal/service/autoscaling/groups_data_source.go @@ -103,19 +103,19 @@ func dataSourceGroupsRead(ctx context.Context, d *schema.ResourceData, meta inte return sdkdiag.AppendErrorf(diags, "reading Auto Scaling Groups: %s", err) } - var arns, names []string + var arns, nms []string for _, group := range groups { arns = append(arns, aws.ToString(group.AutoScalingGroupARN)) - names = append(names, aws.ToString(group.AutoScalingGroupName)) + nms = append(nms, aws.ToString(group.AutoScalingGroupName)) } sort.Strings(arns) - sort.Strings(names) + sort.Strings(nms) d.SetId(meta.(*conns.AWSClient).Region) d.Set(names.AttrARNs, arns) - d.Set("names", names) + d.Set("names", nms) return diags } diff --git a/internal/service/iam/instance_profiles_data_source.go b/internal/service/iam/instance_profiles_data_source.go index 583ca96579e..e5058e08e16 100644 --- a/internal/service/iam/instance_profiles_data_source.go +++ b/internal/service/iam/instance_profiles_data_source.go @@ -61,17 +61,17 @@ func dataSourceInstanceProfilesRead(ctx context.Context, d *schema.ResourceData, return sdkdiag.AppendErrorf(diags, "reading IAM Instance Profiles for Role (%s): %s", roleName, err) } - var arns, names, paths []string + var arns, nms, paths []string for _, v := range instanceProfiles { arns = append(arns, aws.ToString(v.Arn)) - names = append(names, aws.ToString(v.InstanceProfileName)) + nms = append(nms, aws.ToString(v.InstanceProfileName)) paths = append(paths, aws.ToString(v.Path)) } d.SetId(roleName) d.Set(names.AttrARNs, arns) - d.Set("names", names) + d.Set("names", nms) d.Set("paths", paths) return diags diff --git a/internal/service/iam/roles_data_source.go b/internal/service/iam/roles_data_source.go index 9125c4d1b8a..17fa5dbe998 100644 --- a/internal/service/iam/roles_data_source.go +++ b/internal/service/iam/roles_data_source.go @@ -82,18 +82,18 @@ func dataSourceRolesRead(ctx context.Context, d *schema.ResourceData, meta inter d.SetId(meta.(*conns.AWSClient).Region) - var arns, names []string + var arns, nms []string for _, r := range results { arns = append(arns, aws.ToString(r.Arn)) - names = append(names, aws.ToString(r.RoleName)) + nms = append(nms, aws.ToString(r.RoleName)) } if err := d.Set(names.AttrARNs, arns); err != nil { return sdkdiag.AppendErrorf(diags, "setting arns: %s", err) } - if err := d.Set("names", names); err != nil { + if err := d.Set("names", nms); err != nil { return sdkdiag.AppendErrorf(diags, "setting names: %s", err) } diff --git a/internal/service/iam/users_data_source.go b/internal/service/iam/users_data_source.go index 4b28c381b2f..bad3a78cd87 100644 --- a/internal/service/iam/users_data_source.go +++ b/internal/service/iam/users_data_source.go @@ -58,14 +58,14 @@ func dataSourceUsersRead(ctx context.Context, d *schema.ResourceData, meta inter d.SetId(meta.(*conns.AWSClient).Region) - var arns, names []string + var arns, nms []string for _, r := range results { - names = append(names, aws.ToString(r.UserName)) + nms = append(nms, aws.ToString(r.UserName)) arns = append(arns, aws.ToString(r.Arn)) } - if err := d.Set("names", names); err != nil { + if err := d.Set("names", nms); err != nil { return sdkdiag.AppendErrorf(diags, "setting names: %s", err) } diff --git a/internal/service/imagebuilder/components_data_source.go b/internal/service/imagebuilder/components_data_source.go index 8b1f422f56b..fdc234c5d23 100644 --- a/internal/service/imagebuilder/components_data_source.go +++ b/internal/service/imagebuilder/components_data_source.go @@ -78,16 +78,16 @@ func dataSourceComponentsRead(ctx context.Context, d *schema.ResourceData, meta return sdkdiag.AppendErrorf(diags, "reading Image Builder Components: %s", err) } - var arns, names []string + var arns, nms []string for _, r := range results { arns = append(arns, aws.StringValue(r.Arn)) - names = append(names, aws.StringValue(r.Name)) + nms = append(nms, aws.StringValue(r.Name)) } d.SetId(meta.(*conns.AWSClient).Region) d.Set(names.AttrARNs, arns) - d.Set("names", names) + d.Set("names", nms) return diags } diff --git a/internal/service/imagebuilder/container_recipes_data_source.go b/internal/service/imagebuilder/container_recipes_data_source.go index e360336156c..28998f3ad1b 100644 --- a/internal/service/imagebuilder/container_recipes_data_source.go +++ b/internal/service/imagebuilder/container_recipes_data_source.go @@ -78,16 +78,16 @@ func dataSourceContainerRecipesRead(ctx context.Context, d *schema.ResourceData, return sdkdiag.AppendErrorf(diags, "reading Image Builder Container Recipes: %s", err) } - var arns, names []string + var arns, nms []string for _, r := range results { arns = append(arns, aws.StringValue(r.Arn)) - names = append(names, aws.StringValue(r.Name)) + nms = append(nms, aws.StringValue(r.Name)) } d.SetId(meta.(*conns.AWSClient).Region) d.Set(names.AttrARNs, arns) - d.Set("names", names) + d.Set("names", nms) return diags } diff --git a/internal/service/imagebuilder/distribution_configurations_data_source.go b/internal/service/imagebuilder/distribution_configurations_data_source.go index bb61b9f0f35..ba640f7c6ab 100644 --- a/internal/service/imagebuilder/distribution_configurations_data_source.go +++ b/internal/service/imagebuilder/distribution_configurations_data_source.go @@ -68,16 +68,16 @@ func dataSourceDistributionConfigurationsRead(ctx context.Context, d *schema.Res return sdkdiag.AppendErrorf(diags, "reading Image Builder Distribution Configurations: %s", err) } - var arns, names []string + var arns, nms []string for _, r := range results { arns = append(arns, aws.StringValue(r.Arn)) - names = append(names, aws.StringValue(r.Name)) + nms = append(nms, aws.StringValue(r.Name)) } d.SetId(meta.(*conns.AWSClient).Region) d.Set(names.AttrARNs, arns) - d.Set("names", names) + d.Set("names", nms) return diags } diff --git a/internal/service/imagebuilder/image_pipelines_data_source.go b/internal/service/imagebuilder/image_pipelines_data_source.go index af7e5a3c0cc..ce8b3bb6840 100644 --- a/internal/service/imagebuilder/image_pipelines_data_source.go +++ b/internal/service/imagebuilder/image_pipelines_data_source.go @@ -68,16 +68,16 @@ func dataSourceImagePipelinesRead(ctx context.Context, d *schema.ResourceData, m return sdkdiag.AppendErrorf(diags, "reading Image Builder Image Pipelines: %s", err) } - var arns, names []string + var arns, nms []string for _, r := range results { arns = append(arns, aws.StringValue(r.Arn)) - names = append(names, aws.StringValue(r.Name)) + nms = append(nms, aws.StringValue(r.Name)) } d.SetId(meta.(*conns.AWSClient).Region) d.Set(names.AttrARNs, arns) - d.Set("names", names) + d.Set("names", nms) return diags } diff --git a/internal/service/imagebuilder/image_recipes_data_source.go b/internal/service/imagebuilder/image_recipes_data_source.go index 633d63e938b..1f0561473e5 100644 --- a/internal/service/imagebuilder/image_recipes_data_source.go +++ b/internal/service/imagebuilder/image_recipes_data_source.go @@ -78,16 +78,16 @@ func dataSourceImageRecipesRead(ctx context.Context, d *schema.ResourceData, met return sdkdiag.AppendErrorf(diags, "reading Image Builder Image Recipes: %s", err) } - var arns, names []string + var arns, nms []string for _, r := range results { arns = append(arns, aws.StringValue(r.Arn)) - names = append(names, aws.StringValue(r.Name)) + nms = append(nms, aws.StringValue(r.Name)) } d.SetId(meta.(*conns.AWSClient).Region) d.Set(names.AttrARNs, arns) - d.Set("names", names) + d.Set("names", nms) return diags } diff --git a/internal/service/imagebuilder/infrastructure_configurations_data_source.go b/internal/service/imagebuilder/infrastructure_configurations_data_source.go index df4a5f52526..8b9f5eee63e 100644 --- a/internal/service/imagebuilder/infrastructure_configurations_data_source.go +++ b/internal/service/imagebuilder/infrastructure_configurations_data_source.go @@ -68,16 +68,16 @@ func dataSourceInfrastructureConfigurationsRead(ctx context.Context, d *schema.R return sdkdiag.AppendErrorf(diags, "reading Image Builder Infrastructure Configurations: %s", err) } - var arns, names []string + var arns, nms []string for _, r := range results { arns = append(arns, aws.StringValue(r.Arn)) - names = append(names, aws.StringValue(r.Name)) + nms = append(nms, aws.StringValue(r.Name)) } d.SetId(meta.(*conns.AWSClient).Region) d.Set(names.AttrARNs, arns) - d.Set("names", names) + d.Set("names", nms) return diags } diff --git a/internal/service/kendra/index_test.go b/internal/service/kendra/index_test.go index 98e3dc49a3f..64c99b90eb4 100644 --- a/internal/service/kendra/index_test.go +++ b/internal/service/kendra/index_test.go @@ -257,7 +257,6 @@ func TestAccKendraIndex_updateUserTokenJSON(t *testing.T) { rName2 := sdkacctest.RandomWithPrefix("resource-test-terraform") rName3 := sdkacctest.RandomWithPrefix("resource-test-terraform") originalGroupAttributeField := "groups" - originalUserNameAttributeField := names.AttrUsername updatedGroupAttributeField := "groupings" updatedUserNameAttributeField := "usernames" resourceName := "aws_kendra_index.test" From 8dc01858fcd7fe2b7d7e5c4c81e37b4563aafe05 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 15:19:14 -0400 Subject: [PATCH 1304/1490] generate: Use constants --- internal/generate/tagstests/test.go.gtpl | 16 +++++++------- .../accessanalyzer/analyzer_tags_gen_test.go | 16 +++++++------- .../certificate_authority_tags_gen_test.go | 16 +++++++------- .../compute_environment_tags_gen_test.go | 16 +++++++------- .../batch/job_definition_tags_gen_test.go | 16 +++++++------- .../service/batch/job_queue_tags_gen_test.go | 16 +++++++------- .../batch/scheduling_policy_tags_gen_test.go | 16 +++++++------- .../iam/instance_profile_tags_gen_test.go | 16 +++++++------- .../openid_connect_provider_tags_gen_test.go | 16 +++++++------- internal/service/iam/policy_tags_gen_test.go | 16 +++++++------- internal/service/iam/role_tags_gen_test.go | 16 +++++++------- .../iam/service_linked_role_tags_gen_test.go | 16 +++++++------- internal/service/iam/user_tags_gen_test.go | 22 +++++++++---------- .../iam/virtual_mfa_device_tags_gen_test.go | 16 +++++++------- .../servicecatalog/portfolio_tags_gen_test.go | 16 +++++++------- .../servicecatalog/product_tags_gen_test.go | 16 +++++++------- .../provisioned_product_tags_test.go | 16 +++++++------- internal/service/xray/group_tags_gen_test.go | 16 +++++++------- .../xray/sampling_rule_tags_gen_test.go | 16 +++++++------- 19 files changed, 155 insertions(+), 155 deletions(-) diff --git a/internal/generate/tagstests/test.go.gtpl b/internal/generate/tagstests/test.go.gtpl index 74e16388a7b..cb0ad3c9942 100644 --- a/internal/generate/tagstests/test.go.gtpl +++ b/internal/generate/tagstests/test.go.gtpl @@ -1046,12 +1046,12 @@ func {{ template "testname" . }}_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( {{- template "ExistsCheck" . -}} resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags"){{ if eq .Implementation "framework" }}.AtMapKey("computedkey1"){{ end}}), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags){{ if eq .Implementation "framework" }}.AtMapKey("computedkey1"){{ end}}), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1085,7 +1085,7 @@ func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1108,12 +1108,12 @@ func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Add(t *testing.T) { {{- template "ExistsCheck" . -}} resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags"){{ if eq .Implementation "framework" }}.AtMapKey("computedkey1"){{ end}}), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags){{ if eq .Implementation "framework" }}.AtMapKey("computedkey1"){{ end}}), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1149,7 +1149,7 @@ func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Replace(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1169,12 +1169,12 @@ func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Replace(t *testing.T) Check: resource.ComposeAggregateTestCheckFunc( {{- template "ExistsCheck" . -}} resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags"){{ if eq .Implementation "framework" }}.AtMapKey("key1"){{ end}}), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags){{ if eq .Implementation "framework" }}.AtMapKey("key1"){{ end}}), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/accessanalyzer/analyzer_tags_gen_test.go b/internal/service/accessanalyzer/analyzer_tags_gen_test.go index 25d3285d462..21f9b524a7b 100644 --- a/internal/service/accessanalyzer/analyzer_tags_gen_test.go +++ b/internal/service/accessanalyzer/analyzer_tags_gen_test.go @@ -1109,12 +1109,12 @@ func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAnalyzerExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1155,7 +1155,7 @@ func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1178,12 +1178,12 @@ func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckAnalyzerExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1226,7 +1226,7 @@ func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Replace(t *testing. ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1246,12 +1246,12 @@ func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Replace(t *testing. Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAnalyzerExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/acmpca/certificate_authority_tags_gen_test.go b/internal/service/acmpca/certificate_authority_tags_gen_test.go index e5b46a6ef1c..b11983411d2 100644 --- a/internal/service/acmpca/certificate_authority_tags_gen_test.go +++ b/internal/service/acmpca/certificate_authority_tags_gen_test.go @@ -1164,12 +1164,12 @@ func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1213,7 +1213,7 @@ func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnUpdate_Add(t *testing. ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1236,12 +1236,12 @@ func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnUpdate_Add(t *testing. testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1287,7 +1287,7 @@ func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnUpdate_Replace(t *test ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1307,12 +1307,12 @@ func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnUpdate_Replace(t *test Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/batch/compute_environment_tags_gen_test.go b/internal/service/batch/compute_environment_tags_gen_test.go index cd58043b46d..c053a0f1f83 100644 --- a/internal/service/batch/compute_environment_tags_gen_test.go +++ b/internal/service/batch/compute_environment_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccBatchComputeEnvironment_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Add(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Add(t *testing.T) testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Replace(t *testing ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Replace(t *testing Check: resource.ComposeAggregateTestCheckFunc( testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/batch/job_definition_tags_gen_test.go b/internal/service/batch/job_definition_tags_gen_test.go index aa6b80793d2..e3daba082d1 100644 --- a/internal/service/batch/job_definition_tags_gen_test.go +++ b/internal/service/batch/job_definition_tags_gen_test.go @@ -1165,12 +1165,12 @@ func TestAccBatchJobDefinition_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckJobDefinitionExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1214,7 +1214,7 @@ func TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1237,12 +1237,12 @@ func TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckJobDefinitionExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1288,7 +1288,7 @@ func TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1308,12 +1308,12 @@ func TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckJobDefinitionExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/batch/job_queue_tags_gen_test.go b/internal/service/batch/job_queue_tags_gen_test.go index 5191a22d7e5..596383aa447 100644 --- a/internal/service/batch/job_queue_tags_gen_test.go +++ b/internal/service/batch/job_queue_tags_gen_test.go @@ -1093,12 +1093,12 @@ func TestAccBatchJobQueue_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckJobQueueExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags").AtMapKey("computedkey1")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags).AtMapKey("computedkey1")), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1139,7 +1139,7 @@ func TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1162,12 +1162,12 @@ func TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckJobQueueExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags").AtMapKey("computedkey1")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags).AtMapKey("computedkey1")), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1210,7 +1210,7 @@ func TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1230,12 +1230,12 @@ func TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckJobQueueExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags").AtMapKey("key1")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags).AtMapKey("key1")), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/batch/scheduling_policy_tags_gen_test.go b/internal/service/batch/scheduling_policy_tags_gen_test.go index 1f6524586dc..29c94317b89 100644 --- a/internal/service/batch/scheduling_policy_tags_gen_test.go +++ b/internal/service/batch/scheduling_policy_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnUpdate_Replace(t *testing.T ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnUpdate_Replace(t *testing.T Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/instance_profile_tags_gen_test.go b/internal/service/iam/instance_profile_tags_gen_test.go index a82a92fb39a..f36fa37abf5 100644 --- a/internal/service/iam/instance_profile_tags_gen_test.go +++ b/internal/service/iam/instance_profile_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccIAMInstanceProfile_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccIAMInstanceProfile_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccIAMInstanceProfile_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckInstanceProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccIAMInstanceProfile_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccIAMInstanceProfile_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/openid_connect_provider_tags_gen_test.go b/internal/service/iam/openid_connect_provider_tags_gen_test.go index 7be39ba2ad3..ad5ef6c8bf9 100644 --- a/internal/service/iam/openid_connect_provider_tags_gen_test.go +++ b/internal/service/iam/openid_connect_provider_tags_gen_test.go @@ -1071,12 +1071,12 @@ func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1116,7 +1116,7 @@ func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnUpdate_Add(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1139,12 +1139,12 @@ func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnUpdate_Add(t *testing.T) testAccCheckOpenIDConnectProviderExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1186,7 +1186,7 @@ func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnUpdate_Replace(t *testin ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1206,12 +1206,12 @@ func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnUpdate_Replace(t *testin Check: resource.ComposeAggregateTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/policy_tags_gen_test.go b/internal/service/iam/policy_tags_gen_test.go index c887591290d..281af0b8d4a 100644 --- a/internal/service/iam/policy_tags_gen_test.go +++ b/internal/service/iam/policy_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccIAMPolicy_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccIAMPolicy_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Policy/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccIAMPolicy_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccIAMPolicy_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Policy/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccIAMPolicy_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/role_tags_gen_test.go b/internal/service/iam/role_tags_gen_test.go index 05405ddfc77..c77465c8e2a 100644 --- a/internal/service/iam/role_tags_gen_test.go +++ b/internal/service/iam/role_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccIAMRole_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccIAMRole_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Role/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccIAMRole_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckRoleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccIAMRole_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Role/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccIAMRole_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/service_linked_role_tags_gen_test.go b/internal/service/iam/service_linked_role_tags_gen_test.go index 643d8388815..e6679b97481 100644 --- a/internal/service/iam/service_linked_role_tags_gen_test.go +++ b/internal/service/iam/service_linked_role_tags_gen_test.go @@ -1071,12 +1071,12 @@ func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckServiceLinkedRoleExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1116,7 +1116,7 @@ func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1139,12 +1139,12 @@ func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckServiceLinkedRoleExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1186,7 +1186,7 @@ func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnUpdate_Replace(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1206,12 +1206,12 @@ func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnUpdate_Replace(t *testing.T) Check: resource.ComposeAggregateTestCheckFunc( testAccCheckServiceLinkedRoleExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/user_tags_gen_test.go b/internal/service/iam/user_tags_gen_test.go index 61a554743bf..afcb8fe432b 100644 --- a/internal/service/iam/user_tags_gen_test.go +++ b/internal/service/iam/user_tags_gen_test.go @@ -1165,12 +1165,12 @@ func TestAccIAMUser_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1191,7 +1191,7 @@ func TestAccIAMUser_tags_ComputedTag_OnCreate(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -1214,7 +1214,7 @@ func TestAccIAMUser_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/User/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1237,12 +1237,12 @@ func TestAccIAMUser_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckUserExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1265,7 +1265,7 @@ func TestAccIAMUser_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, @@ -1288,7 +1288,7 @@ func TestAccIAMUser_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/User/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1308,12 +1308,12 @@ func TestAccIAMUser_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1334,7 +1334,7 @@ func TestAccIAMUser_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "force_destroy", + names.AttrForceDestroy, }, }, }, diff --git a/internal/service/iam/virtual_mfa_device_tags_gen_test.go b/internal/service/iam/virtual_mfa_device_tags_gen_test.go index 14e2c0a840a..66f6b8464aa 100644 --- a/internal/service/iam/virtual_mfa_device_tags_gen_test.go +++ b/internal/service/iam/virtual_mfa_device_tags_gen_test.go @@ -1165,12 +1165,12 @@ func TestAccIAMVirtualMFADevice_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVirtualMFADeviceExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1214,7 +1214,7 @@ func TestAccIAMVirtualMFADevice_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/VirtualMFADevice/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1237,12 +1237,12 @@ func TestAccIAMVirtualMFADevice_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckVirtualMFADeviceExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1288,7 +1288,7 @@ func TestAccIAMVirtualMFADevice_tags_ComputedTag_OnUpdate_Replace(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/VirtualMFADevice/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1308,12 +1308,12 @@ func TestAccIAMVirtualMFADevice_tags_ComputedTag_OnUpdate_Replace(t *testing.T) Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVirtualMFADeviceExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/servicecatalog/portfolio_tags_gen_test.go b/internal/service/servicecatalog/portfolio_tags_gen_test.go index d4334b0b5df..7eedf8e2e45 100644 --- a/internal/service/servicecatalog/portfolio_tags_gen_test.go +++ b/internal/service/servicecatalog/portfolio_tags_gen_test.go @@ -1095,12 +1095,12 @@ func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPortfolioExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1141,7 +1141,7 @@ func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnUpdate_Add(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1164,12 +1164,12 @@ func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnUpdate_Add(t *testing.T) testAccCheckPortfolioExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1212,7 +1212,7 @@ func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnUpdate_Replace(t *testing ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1232,12 +1232,12 @@ func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnUpdate_Replace(t *testing Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPortfolioExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/servicecatalog/product_tags_gen_test.go b/internal/service/servicecatalog/product_tags_gen_test.go index 9c6ad5c5350..c5858d4c07e 100644 --- a/internal/service/servicecatalog/product_tags_gen_test.go +++ b/internal/service/servicecatalog/product_tags_gen_test.go @@ -1157,12 +1157,12 @@ func TestAccServiceCatalogProduct_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckProductExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1205,7 +1205,7 @@ func TestAccServiceCatalogProduct_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Product/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1228,12 +1228,12 @@ func TestAccServiceCatalogProduct_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckProductExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1278,7 +1278,7 @@ func TestAccServiceCatalogProduct_tags_ComputedTag_OnUpdate_Replace(t *testing.T ConfigDirectory: config.StaticDirectory("testdata/Product/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1298,12 +1298,12 @@ func TestAccServiceCatalogProduct_tags_ComputedTag_OnUpdate_Replace(t *testing.T Check: resource.ComposeAggregateTestCheckFunc( testAccCheckProductExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/servicecatalog/provisioned_product_tags_test.go b/internal/service/servicecatalog/provisioned_product_tags_test.go index 79ef322b95a..84a4a760de9 100644 --- a/internal/service/servicecatalog/provisioned_product_tags_test.go +++ b/internal/service/servicecatalog/provisioned_product_tags_test.go @@ -1177,12 +1177,12 @@ func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnCreate(t *testin Check: resource.ComposeAggregateTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1226,7 +1226,7 @@ func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnUpdate_Add(t *te ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1249,12 +1249,12 @@ func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnUpdate_Add(t *te testAccCheckProvisionedProductExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1300,7 +1300,7 @@ func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnUpdate_Replace(t ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1320,12 +1320,12 @@ func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnUpdate_Replace(t Check: resource.ComposeAggregateTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/xray/group_tags_gen_test.go b/internal/service/xray/group_tags_gen_test.go index d1e7ddc21c5..e9dc394c95f 100644 --- a/internal/service/xray/group_tags_gen_test.go +++ b/internal/service/xray/group_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccXRayGroup_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckGroupExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccXRayGroup_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Group/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccXRayGroup_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckGroupExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccXRayGroup_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Group/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccXRayGroup_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckGroupExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/xray/sampling_rule_tags_gen_test.go b/internal/service/xray/sampling_rule_tags_gen_test.go index 9d8ece9c083..58a541c33e9 100644 --- a/internal/service/xray/sampling_rule_tags_gen_test.go +++ b/internal/service/xray/sampling_rule_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccXRaySamplingRule_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSamplingRuleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccXRaySamplingRule_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccXRaySamplingRule_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckSamplingRuleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccXRaySamplingRule_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccXRaySamplingRule_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSamplingRuleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), From 817842422c08f0b7859f98cdee87cb5051fdda08 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Fri, 10 May 2024 13:20:50 -0700 Subject: [PATCH 1305/1490] Uses `names` constants --- internal/generate/tagstests/test.go.gtpl | 16 +++++++-------- .../accessanalyzer/analyzer_tags_gen_test.go | 16 +++++++-------- .../certificate_authority_tags_gen_test.go | 16 +++++++-------- .../compute_environment_tags_gen_test.go | 16 +++++++-------- .../batch/job_definition_tags_gen_test.go | 16 +++++++-------- .../service/batch/job_queue_tags_gen_test.go | 16 +++++++-------- .../batch/scheduling_policy_tags_gen_test.go | 16 +++++++-------- .../iam/instance_profile_tags_gen_test.go | 16 +++++++-------- .../openid_connect_provider_tags_gen_test.go | 16 +++++++-------- internal/service/iam/policy_tags_gen_test.go | 16 +++++++-------- internal/service/iam/role_tags_gen_test.go | 16 +++++++-------- .../iam/service_linked_role_tags_gen_test.go | 16 +++++++-------- internal/service/iam/user_tags_gen_test.go | 16 +++++++-------- .../iam/virtual_mfa_device_tags_gen_test.go | 16 +++++++-------- .../servicecatalog/portfolio_tags_gen_test.go | 16 +++++++-------- .../servicecatalog/product_tags_gen_test.go | 16 +++++++-------- .../provisioned_product_tags_test.go | 20 +++++++++---------- internal/service/xray/group_tags_gen_test.go | 16 +++++++-------- .../xray/sampling_rule_tags_gen_test.go | 16 +++++++-------- 19 files changed, 154 insertions(+), 154 deletions(-) diff --git a/internal/generate/tagstests/test.go.gtpl b/internal/generate/tagstests/test.go.gtpl index 74e16388a7b..cb0ad3c9942 100644 --- a/internal/generate/tagstests/test.go.gtpl +++ b/internal/generate/tagstests/test.go.gtpl @@ -1046,12 +1046,12 @@ func {{ template "testname" . }}_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( {{- template "ExistsCheck" . -}} resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags"){{ if eq .Implementation "framework" }}.AtMapKey("computedkey1"){{ end}}), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags){{ if eq .Implementation "framework" }}.AtMapKey("computedkey1"){{ end}}), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1085,7 +1085,7 @@ func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1108,12 +1108,12 @@ func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Add(t *testing.T) { {{- template "ExistsCheck" . -}} resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags"){{ if eq .Implementation "framework" }}.AtMapKey("computedkey1"){{ end}}), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags){{ if eq .Implementation "framework" }}.AtMapKey("computedkey1"){{ end}}), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1149,7 +1149,7 @@ func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Replace(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/{{ .Name }}/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1169,12 +1169,12 @@ func {{ template "testname" . }}_tags_ComputedTag_OnUpdate_Replace(t *testing.T) Check: resource.ComposeAggregateTestCheckFunc( {{- template "ExistsCheck" . -}} resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags"){{ if eq .Implementation "framework" }}.AtMapKey("key1"){{ end}}), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags){{ if eq .Implementation "framework" }}.AtMapKey("key1"){{ end}}), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/accessanalyzer/analyzer_tags_gen_test.go b/internal/service/accessanalyzer/analyzer_tags_gen_test.go index 25d3285d462..21f9b524a7b 100644 --- a/internal/service/accessanalyzer/analyzer_tags_gen_test.go +++ b/internal/service/accessanalyzer/analyzer_tags_gen_test.go @@ -1109,12 +1109,12 @@ func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAnalyzerExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1155,7 +1155,7 @@ func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1178,12 +1178,12 @@ func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckAnalyzerExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1226,7 +1226,7 @@ func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Replace(t *testing. ConfigDirectory: config.StaticDirectory("testdata/Analyzer/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1246,12 +1246,12 @@ func testAccAccessAnalyzerAnalyzer_tags_ComputedTag_OnUpdate_Replace(t *testing. Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAnalyzerExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/acmpca/certificate_authority_tags_gen_test.go b/internal/service/acmpca/certificate_authority_tags_gen_test.go index e5b46a6ef1c..b11983411d2 100644 --- a/internal/service/acmpca/certificate_authority_tags_gen_test.go +++ b/internal/service/acmpca/certificate_authority_tags_gen_test.go @@ -1164,12 +1164,12 @@ func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1213,7 +1213,7 @@ func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnUpdate_Add(t *testing. ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1236,12 +1236,12 @@ func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnUpdate_Add(t *testing. testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1287,7 +1287,7 @@ func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnUpdate_Replace(t *test ConfigDirectory: config.StaticDirectory("testdata/CertificateAuthority/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1307,12 +1307,12 @@ func TestAccACMPCACertificateAuthority_tags_ComputedTag_OnUpdate_Replace(t *test Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateAuthorityExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/batch/compute_environment_tags_gen_test.go b/internal/service/batch/compute_environment_tags_gen_test.go index cd58043b46d..c053a0f1f83 100644 --- a/internal/service/batch/compute_environment_tags_gen_test.go +++ b/internal/service/batch/compute_environment_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccBatchComputeEnvironment_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Add(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Add(t *testing.T) testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Replace(t *testing ConfigDirectory: config.StaticDirectory("testdata/ComputeEnvironment/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccBatchComputeEnvironment_tags_ComputedTag_OnUpdate_Replace(t *testing Check: resource.ComposeAggregateTestCheckFunc( testAccCheckComputeEnvironmentExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/batch/job_definition_tags_gen_test.go b/internal/service/batch/job_definition_tags_gen_test.go index aa6b80793d2..e3daba082d1 100644 --- a/internal/service/batch/job_definition_tags_gen_test.go +++ b/internal/service/batch/job_definition_tags_gen_test.go @@ -1165,12 +1165,12 @@ func TestAccBatchJobDefinition_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckJobDefinitionExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1214,7 +1214,7 @@ func TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1237,12 +1237,12 @@ func TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckJobDefinitionExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1288,7 +1288,7 @@ func TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/JobDefinition/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1308,12 +1308,12 @@ func TestAccBatchJobDefinition_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckJobDefinitionExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/batch/job_queue_tags_gen_test.go b/internal/service/batch/job_queue_tags_gen_test.go index 5191a22d7e5..596383aa447 100644 --- a/internal/service/batch/job_queue_tags_gen_test.go +++ b/internal/service/batch/job_queue_tags_gen_test.go @@ -1093,12 +1093,12 @@ func TestAccBatchJobQueue_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckJobQueueExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags").AtMapKey("computedkey1")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags).AtMapKey("computedkey1")), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1139,7 +1139,7 @@ func TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1162,12 +1162,12 @@ func TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckJobQueueExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags").AtMapKey("computedkey1")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags).AtMapKey("computedkey1")), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1210,7 +1210,7 @@ func TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/JobQueue/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1230,12 +1230,12 @@ func TestAccBatchJobQueue_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckJobQueueExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags").AtMapKey("key1")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags).AtMapKey("key1")), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/batch/scheduling_policy_tags_gen_test.go b/internal/service/batch/scheduling_policy_tags_gen_test.go index 1f6524586dc..29c94317b89 100644 --- a/internal/service/batch/scheduling_policy_tags_gen_test.go +++ b/internal/service/batch/scheduling_policy_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnUpdate_Replace(t *testing.T ConfigDirectory: config.StaticDirectory("testdata/SchedulingPolicy/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccBatchSchedulingPolicy_tags_ComputedTag_OnUpdate_Replace(t *testing.T Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSchedulingPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/instance_profile_tags_gen_test.go b/internal/service/iam/instance_profile_tags_gen_test.go index a82a92fb39a..f36fa37abf5 100644 --- a/internal/service/iam/instance_profile_tags_gen_test.go +++ b/internal/service/iam/instance_profile_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccIAMInstanceProfile_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccIAMInstanceProfile_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccIAMInstanceProfile_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckInstanceProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccIAMInstanceProfile_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/InstanceProfile/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccIAMInstanceProfile_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceProfileExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/openid_connect_provider_tags_gen_test.go b/internal/service/iam/openid_connect_provider_tags_gen_test.go index 7be39ba2ad3..ad5ef6c8bf9 100644 --- a/internal/service/iam/openid_connect_provider_tags_gen_test.go +++ b/internal/service/iam/openid_connect_provider_tags_gen_test.go @@ -1071,12 +1071,12 @@ func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1116,7 +1116,7 @@ func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnUpdate_Add(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1139,12 +1139,12 @@ func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnUpdate_Add(t *testing.T) testAccCheckOpenIDConnectProviderExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1186,7 +1186,7 @@ func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnUpdate_Replace(t *testin ConfigDirectory: config.StaticDirectory("testdata/OpenIDConnectProvider/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1206,12 +1206,12 @@ func TestAccIAMOpenIDConnectProvider_tags_ComputedTag_OnUpdate_Replace(t *testin Check: resource.ComposeAggregateTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/policy_tags_gen_test.go b/internal/service/iam/policy_tags_gen_test.go index c887591290d..281af0b8d4a 100644 --- a/internal/service/iam/policy_tags_gen_test.go +++ b/internal/service/iam/policy_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccIAMPolicy_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccIAMPolicy_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Policy/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccIAMPolicy_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccIAMPolicy_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Policy/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccIAMPolicy_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPolicyExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/role_tags_gen_test.go b/internal/service/iam/role_tags_gen_test.go index 05405ddfc77..c77465c8e2a 100644 --- a/internal/service/iam/role_tags_gen_test.go +++ b/internal/service/iam/role_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccIAMRole_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccIAMRole_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Role/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccIAMRole_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckRoleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccIAMRole_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Role/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccIAMRole_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/service_linked_role_tags_gen_test.go b/internal/service/iam/service_linked_role_tags_gen_test.go index 643d8388815..e6679b97481 100644 --- a/internal/service/iam/service_linked_role_tags_gen_test.go +++ b/internal/service/iam/service_linked_role_tags_gen_test.go @@ -1071,12 +1071,12 @@ func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckServiceLinkedRoleExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1116,7 +1116,7 @@ func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1139,12 +1139,12 @@ func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckServiceLinkedRoleExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1186,7 +1186,7 @@ func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnUpdate_Replace(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/ServiceLinkedRole/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1206,12 +1206,12 @@ func TestAccIAMServiceLinkedRole_tags_ComputedTag_OnUpdate_Replace(t *testing.T) Check: resource.ComposeAggregateTestCheckFunc( testAccCheckServiceLinkedRoleExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/user_tags_gen_test.go b/internal/service/iam/user_tags_gen_test.go index d15f3e2b974..b26708c0d0d 100644 --- a/internal/service/iam/user_tags_gen_test.go +++ b/internal/service/iam/user_tags_gen_test.go @@ -1165,12 +1165,12 @@ func TestAccIAMUser_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1214,7 +1214,7 @@ func TestAccIAMUser_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/User/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1237,12 +1237,12 @@ func TestAccIAMUser_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckUserExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1288,7 +1288,7 @@ func TestAccIAMUser_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/User/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1308,12 +1308,12 @@ func TestAccIAMUser_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/iam/virtual_mfa_device_tags_gen_test.go b/internal/service/iam/virtual_mfa_device_tags_gen_test.go index 14e2c0a840a..66f6b8464aa 100644 --- a/internal/service/iam/virtual_mfa_device_tags_gen_test.go +++ b/internal/service/iam/virtual_mfa_device_tags_gen_test.go @@ -1165,12 +1165,12 @@ func TestAccIAMVirtualMFADevice_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVirtualMFADeviceExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1214,7 +1214,7 @@ func TestAccIAMVirtualMFADevice_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/VirtualMFADevice/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1237,12 +1237,12 @@ func TestAccIAMVirtualMFADevice_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckVirtualMFADeviceExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1288,7 +1288,7 @@ func TestAccIAMVirtualMFADevice_tags_ComputedTag_OnUpdate_Replace(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/VirtualMFADevice/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1308,12 +1308,12 @@ func TestAccIAMVirtualMFADevice_tags_ComputedTag_OnUpdate_Replace(t *testing.T) Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVirtualMFADeviceExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/servicecatalog/portfolio_tags_gen_test.go b/internal/service/servicecatalog/portfolio_tags_gen_test.go index d4334b0b5df..7eedf8e2e45 100644 --- a/internal/service/servicecatalog/portfolio_tags_gen_test.go +++ b/internal/service/servicecatalog/portfolio_tags_gen_test.go @@ -1095,12 +1095,12 @@ func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPortfolioExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1141,7 +1141,7 @@ func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnUpdate_Add(t *testing.T) ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1164,12 +1164,12 @@ func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnUpdate_Add(t *testing.T) testAccCheckPortfolioExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1212,7 +1212,7 @@ func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnUpdate_Replace(t *testing ConfigDirectory: config.StaticDirectory("testdata/Portfolio/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1232,12 +1232,12 @@ func TestAccServiceCatalogPortfolio_tags_ComputedTag_OnUpdate_Replace(t *testing Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPortfolioExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/servicecatalog/product_tags_gen_test.go b/internal/service/servicecatalog/product_tags_gen_test.go index 9c6ad5c5350..c5858d4c07e 100644 --- a/internal/service/servicecatalog/product_tags_gen_test.go +++ b/internal/service/servicecatalog/product_tags_gen_test.go @@ -1157,12 +1157,12 @@ func TestAccServiceCatalogProduct_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckProductExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1205,7 +1205,7 @@ func TestAccServiceCatalogProduct_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Product/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1228,12 +1228,12 @@ func TestAccServiceCatalogProduct_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckProductExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1278,7 +1278,7 @@ func TestAccServiceCatalogProduct_tags_ComputedTag_OnUpdate_Replace(t *testing.T ConfigDirectory: config.StaticDirectory("testdata/Product/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1298,12 +1298,12 @@ func TestAccServiceCatalogProduct_tags_ComputedTag_OnUpdate_Replace(t *testing.T Check: resource.ComposeAggregateTestCheckFunc( testAccCheckProductExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/servicecatalog/provisioned_product_tags_test.go b/internal/service/servicecatalog/provisioned_product_tags_test.go index 79ef322b95a..a80c0a49371 100644 --- a/internal/service/servicecatalog/provisioned_product_tags_test.go +++ b/internal/service/servicecatalog/provisioned_product_tags_test.go @@ -96,7 +96,7 @@ func TestAccServiceCatalogProvisionedProduct_tags(t *testing.T) { // ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tags/"), // ConfigVariables: config.Variables{ // "rName": config.StringVariable(rName), - // "tags": config.MapVariable(map[string]config.Variable{ + // names.AttrTags: config.MapVariable(map[string]config.Variable{ // "key2": config.StringVariable("value2"), // }), // }, @@ -110,7 +110,7 @@ func TestAccServiceCatalogProvisionedProduct_tags(t *testing.T) { // ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tags/"), // ConfigVariables: config.Variables{ // "rName": config.StringVariable(rName), - // "tags": config.MapVariable(map[string]config.Variable{ + // names.AttrTags: config.MapVariable(map[string]config.Variable{ // "key2": config.StringVariable("value2"), // }), // }, @@ -1177,12 +1177,12 @@ func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnCreate(t *testin Check: resource.ComposeAggregateTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1226,7 +1226,7 @@ func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnUpdate_Add(t *te ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1249,12 +1249,12 @@ func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnUpdate_Add(t *te testAccCheckProvisionedProductExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1300,7 +1300,7 @@ func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnUpdate_Replace(t ConfigDirectory: config.StaticDirectory("testdata/ProvisionedProduct/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1320,12 +1320,12 @@ func TestAccServiceCatalogProvisionedProduct_tags_ComputedTag_OnUpdate_Replace(t Check: resource.ComposeAggregateTestCheckFunc( testAccCheckProvisionedProductExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/xray/group_tags_gen_test.go b/internal/service/xray/group_tags_gen_test.go index d1e7ddc21c5..e9dc394c95f 100644 --- a/internal/service/xray/group_tags_gen_test.go +++ b/internal/service/xray/group_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccXRayGroup_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckGroupExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccXRayGroup_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Group/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccXRayGroup_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckGroupExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccXRayGroup_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/Group/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccXRayGroup_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckGroupExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), diff --git a/internal/service/xray/sampling_rule_tags_gen_test.go b/internal/service/xray/sampling_rule_tags_gen_test.go index 9d8ece9c083..58a541c33e9 100644 --- a/internal/service/xray/sampling_rule_tags_gen_test.go +++ b/internal/service/xray/sampling_rule_tags_gen_test.go @@ -1087,12 +1087,12 @@ func TestAccXRaySamplingRule_tags_ComputedTag_OnCreate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSamplingRuleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1133,7 +1133,7 @@ func TestAccXRaySamplingRule_tags_ComputedTag_OnUpdate_Add(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1156,12 +1156,12 @@ func TestAccXRaySamplingRule_tags_ComputedTag_OnUpdate_Add(t *testing.T) { testAccCheckSamplingRuleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.computedkey1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), @@ -1204,7 +1204,7 @@ func TestAccXRaySamplingRule_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { ConfigDirectory: config.StaticDirectory("testdata/SamplingRule/tags/"), ConfigVariables: config.Variables{ "rName": config.StringVariable(rName), - "tags": config.MapVariable(map[string]config.Variable{ + names.AttrTags: config.MapVariable(map[string]config.Variable{ "key1": config.StringVariable("value1"), }), }, @@ -1224,12 +1224,12 @@ func TestAccXRaySamplingRule_tags_ComputedTag_OnUpdate_Replace(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckSamplingRuleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), - resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", "id"), + resource.TestCheckResourceAttrPair(resourceName, "tags.key1", "null_resource.test", names.AttrID), ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), - plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New("tags")), + plancheck.ExpectUnknownValue(resourceName, tfjsonpath.New(names.AttrTags)), }, PostApplyPreRefresh: []plancheck.PlanCheck{ plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), From 1e18077db26e6cf91060d671395713ac03b23d15 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Fri, 10 May 2024 14:28:00 -0700 Subject: [PATCH 1306/1490] Use consts --- internal/service/ecs/account_setting_default.go | 4 ++-- internal/service/ecs/consts.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/service/ecs/account_setting_default.go b/internal/service/ecs/account_setting_default.go index 2a3cbd8a50b..3f9eba9489b 100644 --- a/internal/service/ecs/account_setting_default.go +++ b/internal/service/ecs/account_setting_default.go @@ -150,8 +150,8 @@ func resourceAccountSettingDefaultDelete(ctx context.Context, d *schema.Resource settingValue := "disabled" //Default value: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-maintenance.html#task-retirement-change - if settingName == "fargateTaskRetirementWaitPeriod" { - settingValue = "7" + if settingName == ecs.SettingNameFargateTaskRetirementWaitPeriod { + settingValue = fargateTaskRetirementWaitPeriodValue } log.Printf("[WARN] Disabling ECS Account Setting Default %s", settingName) diff --git a/internal/service/ecs/consts.go b/internal/service/ecs/consts.go index 51cea2cb9ae..fe907535958 100644 --- a/internal/service/ecs/consts.go +++ b/internal/service/ecs/consts.go @@ -17,3 +17,7 @@ const ( clusterStatusInactive = "INACTIVE" clusterStatusProvisioning = "PROVISIONING" ) + +const ( + fargateTaskRetirementWaitPeriodValue = "7" +) From 121157e921b424fb19cf55dea7837a1eb08072f2 Mon Sep 17 00:00:00 2001 From: changelogbot Date: Fri, 10 May 2024 21:33:14 +0000 Subject: [PATCH 1307/1490] Update CHANGELOG.md for #37438 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66b5683c61e..00a9de6e2c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,10 @@ ENHANCEMENTS: +* data-source/aws_budgets_budget: Add `tags` attribute ([#37361](https://github.com/hashicorp/terraform-provider-aws/issues/37361)) * data-source/aws_instance: Add `launch_time` attribute ([#37002](https://github.com/hashicorp/terraform-provider-aws/issues/37002)) +* resource/aws_budgets_budget: Add `tags` argument ([#37361](https://github.com/hashicorp/terraform-provider-aws/issues/37361)) +* resource/aws_budgets_budget_action: Add `tags` argument ([#37361](https://github.com/hashicorp/terraform-provider-aws/issues/37361)) BUG FIXES: From 5f005a4ec79a566857888566d5d6bb08bb367c8b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 18:46:37 -0400 Subject: [PATCH 1308/1490] names: Rework attr constants --- names/README.md | 2 +- names/attr_constants.csv | 88 +++++++++++++++++ names/attr_consts.go | 95 ------------------ names/attr_consts_gen.go | 201 ++++++++++++++++++++++++++++++++++++++ names/caps.csv | 1 + names/caps.md | 1 + names/data/names_data.csv | 2 +- names/data/read.go | 20 ++-- names/names.go | 28 +++--- 9 files changed, 317 insertions(+), 121 deletions(-) create mode 100644 names/attr_constants.csv delete mode 100644 names/attr_consts.go create mode 100644 names/attr_consts_gen.go diff --git a/names/README.md b/names/README.md index 97bf493fd2c..66ad5f336b8 100644 --- a/names/README.md +++ b/names/README.md @@ -43,7 +43,7 @@ The columns of `data/names_data.csv` are as follows: | 21 | **EndpointOnly** | Code | If **NotImplemented** is non-blank, whether the service endpoint should be included in the provider `endpoints` configuration | | 22 | **AllowedSubcategory** | Code | If **Exclude** is non-blank, whether to include **HumanFriendly** in `website/allowed-subcategories.txt` anyway. In other words, if non-blank, overrides **Exclude** in some situations. Some excluded pseudo-services (_e.g._, VPC is part of EC2) are still subcategories. Only applies if **Exclude** is non-blank. | | 23 | **DeprecatedEnvVar** | Code | Deprecated `AWS__ENDPOINT` envvar defined for some services | -| 24 | **TfAwsEnvVar** | Code | `TF_AWS__ENDPOINT` envvar defined for some services | +| 24 | **TFAWSEnvVar** | Code | `TF_AWS__ENDPOINT` envvar defined for some services | | 25 | **Note** | Reference | Very brief note usually to explain why excluded | For more information about service naming, see [the Naming Guide](https://hashicorp.github.io/terraform-provider-aws/naming/#service-identifier). diff --git a/names/attr_constants.csv b/names/attr_constants.csv new file mode 100644 index 00000000000..99d6ad93b2a --- /dev/null +++ b/names/attr_constants.csv @@ -0,0 +1,88 @@ +arn,ARN +arns,ARNs +access_key,AccessKey +account_id,AccountID +action,Action +address,Address +auto_minor_version_upgrade,AutoMinorVersionUpgrade +availability_zone,AvailabilityZone +availability_zones,AvailabilityZones +bucket,Bucket +bucket_name,BucketName +bucket_prefix,BucketPrefix +catalog_id,CatalogID +cluster_identifier,ClusterIdentifier +configuration,Configuration +created_at,CreatedAt +created_date,CreatedDate +database_name,DatabaseName +delete_on_termination,DeleteOnTermination +description,Description +destination,Destination +device_name,DeviceName +domain_name,DomainName +enabled,Enabled +encrypted,Encrypted +endpoint,Endpoint +endpoints,Endpoints +engine_version,EngineVersion +file_system_id,FileSystemID +filter,Filter +force_destroy,ForceDestroy +format,Format +hosted_zone_id,HostedZoneID +id,ID +instance_id,InstanceID +instance_type,InstanceType +kms_key_arn,KMSKeyARN +kms_key_id,KMSKeyID +key,Key +last_updated_date,LastUpdatedDate +max,Max +min,Min +mode,Mode +name,Name +name_prefix,NamePrefix +network_interface_id,NetworkInterfaceID +owner_id,OwnerID +parameter,Parameter +parameters,Parameters +password,Password +path,Path +policy,Policy +port,Port +preferred_maintenance_window,PreferredMaintenanceWindow +prefix,Prefix +priority,Priority +profile,Profile +protocol,Protocol +region,Region +resource_arn,ResourceARN +role_arn,RoleARN +secret_key,SecretKey +security_group_ids,SecurityGroupIDs +security_groups,SecurityGroups +session,Session +shared_config_files,SharedConfigFiles +skip_credentials_validation,SkipCredentialsValidation +skip_requesting_account_id,SkipRequestingAccountID +source,Source +state,State +status,Status +subnet_id,SubnetID +subnet_ids,SubnetIDs +tags,Tags +tags_all,TagsAll +target,Target +timeouts,Timeouts +transit_gateway_attachment_id,TransitGatewayAttachmentID +transit_gateway_id,TransitGatewayID +type,Type +url,URL +unit,Unit +username,Username +vpc_id,VPCID +vpc_security_group_ids,VPCSecurityGroupIDs +value,Value +values,Values +version,Version \ No newline at end of file diff --git a/names/attr_consts.go b/names/attr_consts.go deleted file mode 100644 index 3cc6492d2c9..00000000000 --- a/names/attr_consts.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package names - -const ( - AttrARN = "arn" - AttrARNs = "arns" - AttrAccessKey = "access_key" - AttrAccountID = "account_id" - AttrAction = "action" - AttrAddress = "address" - AttrAutoMinorVersionUpgrade = "auto_minor_version_upgrade" - AttrAvailabilityZone = "availability_zone" - AttrAvailabilityZones = "availability_zones" - AttrBucket = "bucket" - AttrBucketName = "bucket_name" - AttrBucketPrefix = "bucket_prefix" - AttrCatalogID = "catalog_id" - AttrClusterIdentifier = "cluster_identifier" - AttrConfiguration = "configuration" - AttrCreatedAt = "created_at" - AttrCreatedDate = "created_date" - AttrDatabaseName = "database_name" - AttrDeleteOnTermination = "delete_on_termination" - AttrDescription = "description" - AttrDestination = "destination" - AttrDeviceName = "device_name" - AttrDomainName = "domain_name" - AttrEnabled = "enabled" - AttrEncrypted = "encrypted" - AttrEndpoint = "endpoint" - AttrEndpoints = "endpoints" - AttrEngineVersion = "engine_version" - AttrFileSystemID = "file_system_id" - AttrFilter = "filter" - AttrForceDestroy = "force_destroy" - AttrFormat = "format" - AttrHostedZoneID = "hosted_zone_id" - AttrID = "id" // Should be explicitly declared only for Framework resources - AttrInstanceID = "instance_id" - AttrInstanceType = "instance_type" - AttrKMSKeyARN = "kms_key_arn" - AttrKMSKeyID = "kms_key_id" - AttrKey = "key" - AttrLastUpdatedDate = "last_updated_date" - AttrMax = "max" - AttrMin = "min" - AttrMode = "mode" - AttrName = "name" - AttrNamePrefix = "name_prefix" - AttrNetworkInterfaceID = "network_interface_id" - AttrOwnerID = "owner_id" - AttrParameter = "parameter" - AttrParameters = "parameters" - AttrPassword = "password" - AttrPath = "path" - AttrPolicy = "policy" - AttrPort = "port" - AttrPreferredMaintenanceWindow = "preferred_maintenance_window" - AttrPrefix = "prefix" - AttrPriority = "priority" - AttrProfile = "profile" - AttrProtocol = "protocol" - AttrRegion = "region" - AttrResourceARN = "resource_arn" - AttrRoleARN = "role_arn" - AttrSecretKey = "secret_key" - AttrSecurityGroupIDs = "security_group_ids" - AttrSecurityGroups = "security_groups" - AttrSession = "session" - AttrSharedConfigFiles = "shared_config_files" - AttrSkipCredentialsValidation = "skip_credentials_validation" - AttrSkipRequestingAccountID = "skip_requesting_account_id" - AttrSource = "source" - AttrState = "state" - AttrStatus = "status" - AttrSubnetID = "subnet_id" - AttrSubnetIDs = "subnet_ids" - AttrTags = "tags" - AttrTagsAll = "tags_all" - AttrTarget = "target" - AttrTimeouts = "timeouts" // Should be explicitly declared only for Framework resources - AttrTransitGatewayAttachmentID = "transit_gateway_attachment_id" - AttrTransitGatewayID = "transit_gateway_id" - AttrType = "type" - AttrURL = "url" - AttrUnit = "unit" - AttrUsername = "username" - AttrVPCID = "vpc_id" - AttrVPCSecurityGroupIDs = "vpc_security_group_ids" - AttrValue = "value" - AttrValues = "values" - AttrVersion = "version" -) diff --git a/names/attr_consts_gen.go b/names/attr_consts_gen.go new file mode 100644 index 00000000000..1d9e2d4d934 --- /dev/null +++ b/names/attr_consts_gen.go @@ -0,0 +1,201 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 +// Code generated by internal/generate/attrconsts/main.go; DO NOT EDIT. + +package names + +import ( + "fmt" +) + +const ( + AttrARN = "arn" + AttrARNs = "arns" + AttrAccessKey = "access_key" + AttrAccountID = "account_id" + AttrAction = "action" + AttrAddress = "address" + AttrAutoMinorVersionUpgrade = "auto_minor_version_upgrade" + AttrAvailabilityZone = "availability_zone" + AttrAvailabilityZones = "availability_zones" + AttrBucket = "bucket" + AttrBucketName = "bucket_name" + AttrBucketPrefix = "bucket_prefix" + AttrCatalogID = "catalog_id" + AttrClusterIdentifier = "cluster_identifier" + AttrConfiguration = "configuration" + AttrCreatedAt = "created_at" + AttrCreatedDate = "created_date" + AttrDatabaseName = "database_name" + AttrDeleteOnTermination = "delete_on_termination" + AttrDescription = "description" + AttrDestination = "destination" + AttrDeviceName = "device_name" + AttrDomainName = "domain_name" + AttrEnabled = "enabled" + AttrEncrypted = "encrypted" + AttrEndpoint = "endpoint" + AttrEndpoints = "endpoints" + AttrEngineVersion = "engine_version" + AttrFileSystemID = "file_system_id" + AttrFilter = "filter" + AttrForceDestroy = "force_destroy" + AttrFormat = "format" + AttrHostedZoneID = "hosted_zone_id" + AttrID = "id" + AttrInstanceID = "instance_id" + AttrInstanceType = "instance_type" + AttrKMSKeyARN = "kms_key_arn" + AttrKMSKeyID = "kms_key_id" + AttrKey = "key" + AttrLastUpdatedDate = "last_updated_date" + AttrMax = "max" + AttrMin = "min" + AttrMode = "mode" + AttrName = "name" + AttrNamePrefix = "name_prefix" + AttrNetworkInterfaceID = "network_interface_id" + AttrOwnerID = "owner_id" + AttrParameter = "parameter" + AttrParameters = "parameters" + AttrPassword = "password" + AttrPath = "path" + AttrPolicy = "policy" + AttrPort = "port" + AttrPreferredMaintenanceWindow = "preferred_maintenance_window" + AttrPrefix = "prefix" + AttrPriority = "priority" + AttrProfile = "profile" + AttrProtocol = "protocol" + AttrRegion = "region" + AttrResourceARN = "resource_arn" + AttrRoleARN = "role_arn" + AttrSecretKey = "secret_key" + AttrSecurityGroupIDs = "security_group_ids" + AttrSecurityGroups = "security_groups" + AttrSession = "session" + AttrSharedConfigFiles = "shared_config_files" + AttrSkipCredentialsValidation = "skip_credentials_validation" + AttrSkipRequestingAccountID = "skip_requesting_account_id" + AttrSource = "source" + AttrState = "state" + AttrStatus = "status" + AttrSubnetID = "subnet_id" + AttrSubnetIDs = "subnet_ids" + AttrTags = "tags" + AttrTagsAll = "tags_all" + AttrTarget = "target" + AttrTimeouts = "timeouts" + AttrTransitGatewayAttachmentID = "transit_gateway_attachment_id" + AttrTransitGatewayID = "transit_gateway_id" + AttrType = "type" + AttrURL = "url" + AttrUnit = "unit" + AttrUsername = "username" + AttrVPCID = "vpc_id" + AttrVPCSecurityGroupIDs = "vpc_security_group_ids" + AttrValue = "value" + AttrValues = "values" + AttrVersion = "version" +) + +// ConstOrQuote returns the constant name for the given attribute if it exists. +// Otherwise, it returns the attribute quoted. This is intended for use in +// generated code and templates. +func ConstOrQuote(constant string) string { + allConstants := map[string]string{ + "arn": "AttrARN", + "arns": "AttrARNs", + "access_key": "AttrAccessKey", + "account_id": "AttrAccountID", + "action": "AttrAction", + "address": "AttrAddress", + "auto_minor_version_upgrade": "AttrAutoMinorVersionUpgrade", + "availability_zone": "AttrAvailabilityZone", + "availability_zones": "AttrAvailabilityZones", + "bucket": "AttrBucket", + "bucket_name": "AttrBucketName", + "bucket_prefix": "AttrBucketPrefix", + "catalog_id": "AttrCatalogID", + "cluster_identifier": "AttrClusterIdentifier", + "configuration": "AttrConfiguration", + "created_at": "AttrCreatedAt", + "created_date": "AttrCreatedDate", + "database_name": "AttrDatabaseName", + "delete_on_termination": "AttrDeleteOnTermination", + "description": "AttrDescription", + "destination": "AttrDestination", + "device_name": "AttrDeviceName", + "domain_name": "AttrDomainName", + "enabled": "AttrEnabled", + "encrypted": "AttrEncrypted", + "endpoint": "AttrEndpoint", + "endpoints": "AttrEndpoints", + "engine_version": "AttrEngineVersion", + "file_system_id": "AttrFileSystemID", + "filter": "AttrFilter", + "force_destroy": "AttrForceDestroy", + "format": "AttrFormat", + "hosted_zone_id": "AttrHostedZoneID", + "id": "AttrID", + "instance_id": "AttrInstanceID", + "instance_type": "AttrInstanceType", + "kms_key_arn": "AttrKMSKeyARN", + "kms_key_id": "AttrKMSKeyID", + "key": "AttrKey", + "last_updated_date": "AttrLastUpdatedDate", + "max": "AttrMax", + "min": "AttrMin", + "mode": "AttrMode", + "name": "AttrName", + "name_prefix": "AttrNamePrefix", + "network_interface_id": "AttrNetworkInterfaceID", + "owner_id": "AttrOwnerID", + "parameter": "AttrParameter", + "parameters": "AttrParameters", + "password": "AttrPassword", + "path": "AttrPath", + "policy": "AttrPolicy", + "port": "AttrPort", + "preferred_maintenance_window": "AttrPreferredMaintenanceWindow", + "prefix": "AttrPrefix", + "priority": "AttrPriority", + "profile": "AttrProfile", + "protocol": "AttrProtocol", + "region": "AttrRegion", + "resource_arn": "AttrResourceARN", + "role_arn": "AttrRoleARN", + "secret_key": "AttrSecretKey", + "security_group_ids": "AttrSecurityGroupIDs", + "security_groups": "AttrSecurityGroups", + "session": "AttrSession", + "shared_config_files": "AttrSharedConfigFiles", + "skip_credentials_validation": "AttrSkipCredentialsValidation", + "skip_requesting_account_id": "AttrSkipRequestingAccountID", + "source": "AttrSource", + "state": "AttrState", + "status": "AttrStatus", + "subnet_id": "AttrSubnetID", + "subnet_ids": "AttrSubnetIDs", + "tags": "AttrTags", + "tags_all": "AttrTagsAll", + "target": "AttrTarget", + "timeouts": "AttrTimeouts", + "transit_gateway_attachment_id": "AttrTransitGatewayAttachmentID", + "transit_gateway_id": "AttrTransitGatewayID", + "type": "AttrType", + "url": "AttrURL", + "unit": "AttrUnit", + "username": "AttrUsername", + "vpc_id": "AttrVPCID", + "vpc_security_group_ids": "AttrVPCSecurityGroupIDs", + "value": "AttrValue", + "values": "AttrValues", + "version": "AttrVersion", + } + + if v, ok := allConstants[constant]; ok { + return fmt.Sprintf("names.%s", v) + } + return fmt.Sprintf("%q", constant) +} diff --git a/names/caps.csv b/names/caps.csv index cb4c2dfcf98..422e7f0db33 100644 --- a/names/caps.csv +++ b/names/caps.csv @@ -93,6 +93,7 @@ Rds,RDS Rfc,RFC Sagemaker,SageMaker Sasl,SASL +Sdk,SDK Sfn,SFN Smb,SMB Sms,SMS diff --git a/names/caps.md b/names/caps.md index d740f234c9b..ebab74aa04c 100644 --- a/names/caps.md +++ b/names/caps.md @@ -120,6 +120,7 @@ The caps enforced are as follows: | Rfc | RFC | caps3 | | Sagemaker | SageMaker | caps0 | | Sasl | SASL | caps1 | +| Sdk | SDK | caps3 | | Sfn | SFN | caps3 | | Smb | SMB | caps3 | | Sms | SMS | caps3 | diff --git a/names/data/names_data.csv b/names/data/names_data.csv index 3d567e120f8..afb9ba73024 100644 --- a/names/data/names_data.csv +++ b/names/data/names_data.csv @@ -1,4 +1,4 @@ -AWSCLIV2Command,AWSCLIV2CommandNoDashes,GoV1Package,GoV2Package,ProviderPackageActual,ProviderPackageCorrect,SplitPackageRealPackage,Aliases,ProviderNameUpper,GoV1ClientTypeName,SkipClientGenerate,ClientSDKV1,ClientSDKV2,ResourcePrefixActual,ResourcePrefixCorrect,FilePrefix,DocPrefix,HumanFriendly,Brand,Exclude,NotImplemented,EndpointOnly,AllowedSubcategory,DeprecatedEnvVar,TfAwsEnvVar,SdkId,EndpointAPICall,EndpointAPIParams,Note +AWSCLIV2Command,AWSCLIV2CommandNoDashes,GoV1Package,GoV2Package,ProviderPackageActual,ProviderPackageCorrect,SplitPackageRealPackage,Aliases,ProviderNameUpper,GoV1ClientTypeName,SkipClientGenerate,ClientSDKV1,ClientSDKV2,ResourcePrefixActual,ResourcePrefixCorrect,FilePrefix,DocPrefix,HumanFriendly,Brand,Exclude,NotImplemented,EndpointOnly,AllowedSubcategory,DeprecatedEnvVar,TFAWSEnvVar,SDKID,EndpointAPICall,EndpointAPIParams,Note accessanalyzer,accessanalyzer,accessanalyzer,accessanalyzer,,accessanalyzer,,,AccessAnalyzer,AccessAnalyzer,,,2,,aws_accessanalyzer_,,accessanalyzer_,IAM Access Analyzer,AWS,,,,,,,AccessAnalyzer,ListAnalyzers,, account,account,account,account,,account,,,Account,Account,,,2,,aws_account_,,account_,Account Management,AWS,,,,,,,Account,ListRegions,, acm,acm,acm,acm,,acm,,,ACM,ACM,,,2,,aws_acm_,,acm_,ACM (Certificate Manager),AWS,,,,,,,ACM,ListCertificates,, diff --git a/names/data/read.go b/names/data/read.go index 51440e47ba4..cd7051bf25c 100644 --- a/names/data/read.go +++ b/names/data/read.go @@ -147,20 +147,20 @@ func (sr ServiceRecord) DeprecatedEnvVar() string { return sr[colDeprecatedEnvVar] } -func (sr ServiceRecord) TfAwsEnvVar() string { - return sr[colTfAwsEnvVar] +func (sr ServiceRecord) TFAWSEnvVar() string { + return sr[colTFAWSEnvVar] } -func (sr ServiceRecord) SdkId() string { - return sr[colSdkId] +func (sr ServiceRecord) SDKID() string { + return sr[colSDKID] } -func (sr ServiceRecord) AwsServiceEnvVar() string { - return "AWS_ENDPOINT_URL_" + strings.ReplaceAll(strings.ToUpper(sr.SdkId()), " ", "_") +func (sr ServiceRecord) AWSServiceEnvVar() string { + return "AWS_ENDPOINT_URL_" + strings.ReplaceAll(strings.ToUpper(sr.SDKID()), " ", "_") } -func (sr ServiceRecord) AwsConfigParameter() string { - return strings.ReplaceAll(strings.ToLower(sr.SdkId()), " ", "_") +func (sr ServiceRecord) AWSConfigParameter() string { + return strings.ReplaceAll(strings.ToLower(sr.SDKID()), " ", "_") } func (sr ServiceRecord) EndpointAPICall() string { @@ -227,8 +227,8 @@ const ( colEndpointOnly // If set, the service is included in list of endpoints colAllowedSubcategory colDeprecatedEnvVar // Deprecated `AWS__ENDPOINT` envvar defined for some services - colTfAwsEnvVar // `TF_AWS__ENDPOINT` envvar defined for some services - colSdkId // Service SDK ID from AWS SDK for Go v2 + colTFAWSEnvVar // `TF_AWS__ENDPOINT` envvar defined for some services + colSDKID // Service SDK ID from AWS SDK for Go v2 colEndpointAPICall // API call to use for endpoint tests colEndpointAPIParams // Any needed parameters for endpoint tests colNote diff --git a/names/names.go b/names/names.go index af0b4bd1fc6..ebfe70e73dc 100644 --- a/names/names.go +++ b/names/names.go @@ -227,7 +227,7 @@ func ReverseDNS(hostname string) string { // described in detail in README.md. type ServiceDatum struct { Aliases []string - AwsServiceEnvVar string + AWSServiceEnvVar string Brand string ClientSDKV1 bool DeprecatedEnvVar string @@ -237,8 +237,8 @@ type ServiceDatum struct { GoV2Package string HumanFriendly string ProviderNameUpper string - SdkId string - TfAwsEnvVar string + SDKID string + TFAWSEnvVar string } // serviceData key is the AWS provider service package @@ -274,7 +274,7 @@ func readCSVIntoServiceData() error { p := l.ProviderPackage() serviceData[p] = &ServiceDatum{ - AwsServiceEnvVar: l.AwsServiceEnvVar(), + AWSServiceEnvVar: l.AWSServiceEnvVar(), Brand: l.Brand(), ClientSDKV1: l.ClientSDKV1(), DeprecatedEnvVar: l.DeprecatedEnvVar(), @@ -284,8 +284,8 @@ func readCSVIntoServiceData() error { GoV2Package: l.GoV2Package(), HumanFriendly: l.HumanFriendly(), ProviderNameUpper: l.ProviderNameUpper(), - SdkId: l.SdkId(), - TfAwsEnvVar: l.TfAwsEnvVar(), + SDKID: l.SDKID(), + TFAWSEnvVar: l.TFAWSEnvVar(), } a := []string{p} @@ -358,7 +358,7 @@ func Endpoints() []Endpoint { type ServiceNameUpper struct { ProviderPackage string ProviderNameUpper string - SdkID string + SDKID string } func ServiceNamesUpper() []ServiceNameUpper { @@ -368,7 +368,7 @@ func ServiceNamesUpper() []ServiceNameUpper { sn := ServiceNameUpper{ ProviderPackage: k, ProviderNameUpper: v.ProviderNameUpper, - SdkID: v.SdkId, + SDKID: v.SDKID, } serviceNames = append(serviceNames, sn) } @@ -394,27 +394,27 @@ func DeprecatedEnvVar(service string) string { } // Deprecated `TF_AWS__ENDPOINT` envvar defined for some services -func TfAwsEnvVar(service string) string { +func TFAWSEnvVar(service string) string { if v, ok := serviceData[service]; ok { - return v.TfAwsEnvVar + return v.TFAWSEnvVar } return "" } // Standard service endpoint envvar defined by AWS -func AwsServiceEnvVar(service string) string { +func AWSServiceEnvVar(service string) string { if v, ok := serviceData[service]; ok { - return v.AwsServiceEnvVar + return v.AWSServiceEnvVar } return "" } // Service SDK ID from AWS SDK for Go v2 -func SdkId(service string) string { +func SDKID(service string) string { if v, ok := serviceData[service]; ok { - return v.SdkId + return v.SDKID } return "" From 9869982a3d503cec54e9819da723292dc1360005 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 18:47:09 -0400 Subject: [PATCH 1309/1490] generate: New generator for constants --- internal/generate/attrconsts/file.tmpl | 31 +++++++ internal/generate/attrconsts/generate.go | 11 +++ internal/generate/attrconsts/main.go | 103 ++++++++++++++++++++++ internal/generate/attrconsts/semgrep.tmpl | 14 +++ 4 files changed, 159 insertions(+) create mode 100644 internal/generate/attrconsts/file.tmpl create mode 100644 internal/generate/attrconsts/generate.go create mode 100644 internal/generate/attrconsts/main.go create mode 100644 internal/generate/attrconsts/semgrep.tmpl diff --git a/internal/generate/attrconsts/file.tmpl b/internal/generate/attrconsts/file.tmpl new file mode 100644 index 00000000000..923275eca2b --- /dev/null +++ b/internal/generate/attrconsts/file.tmpl @@ -0,0 +1,31 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 +// Code generated by internal/generate/attrconsts/main.go; DO NOT EDIT. + +package names + +import ( + "fmt" +) + +const ( +{{- range .Constants }} + Attr{{ .Constant }} = "{{ .ConstantLower }}" +{{- end }} +) + +// ConstOrQuote returns the constant name for the given attribute if it exists. +// Otherwise, it returns the attribute quoted. This is intended for use in +// generated code and templates. +func ConstOrQuote(constant string) string { + allConstants := map[string]string{ + {{- range .Constants }} + "{{ .ConstantLower }}": "Attr{{ .Constant }}", + {{- end }} + } + + if v, ok := allConstants[constant]; ok { + return fmt.Sprintf("names.%s", v) + } + return fmt.Sprintf("%q", constant) +} diff --git a/internal/generate/attrconsts/generate.go b/internal/generate/attrconsts/generate.go new file mode 100644 index 00000000000..0abee36c1e2 --- /dev/null +++ b/internal/generate/attrconsts/generate.go @@ -0,0 +1,11 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +//go:generate go run main.go +// ONLY generate directives and package declaration! Do not add anything else to this file. + +// names/attr_consts_gen.go is used by other generators so it is very important +// that it is generated first. This is accomplished by using generate.go in this +// directory rather names/generate.go. + +package attrconsts diff --git a/internal/generate/attrconsts/main.go b/internal/generate/attrconsts/main.go new file mode 100644 index 00000000000..020f19e7d86 --- /dev/null +++ b/internal/generate/attrconsts/main.go @@ -0,0 +1,103 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +//go:build generate +// +build generate + +package main + +import ( + _ "embed" + "sort" + "strings" + + "github.com/hashicorp/terraform-provider-aws/internal/generate/common" +) + +// names/attr_consts_gen.go is used by other generators so it is very important +// that it is generated first. This is accomplished by using generate.go in this +// directory rather names/generate.go. + +//go:embed file.tmpl +var tmpl string + +//go:embed semgrep.tmpl +var semgrepTmpl string + +type ConstantDatum struct { + Constant string + ConstantLower string +} + +type TemplateData struct { + Constants []ConstantDatum +} + +func main() { + const ( + filename = "../../../names/attr_consts_gen.go" + semgrepFilename = "../../../.ci/.semgrep-constants.yml" + constantDataFile = "../../../names/attr_constants.csv" + ) + g := common.NewGenerator() + + constants, err := readConstants(constantDataFile) + + if err != nil { + g.Fatalf("error reading %s: %s", constantDataFile, err) + } + + td := TemplateData{} + td.Constants = constants + + g.Infof("Generating %s", strings.TrimPrefix(filename, "../../../")) + + d := g.NewGoFileDestination(filename) + + if err := d.WriteTemplate("constantlist", tmpl, td); err != nil { + g.Fatalf("generating file (%s): %s", filename, err) + } + + if err := d.Write(); err != nil { + g.Fatalf("generating file (%s): %s", filename, err) + } + + g.Infof("Generating %s", strings.TrimPrefix(semgrepFilename, "../../../")) + + d = g.NewUnformattedFileDestination(semgrepFilename) + + if err := d.WriteTemplate("semgrep-constants", semgrepTmpl, td); err != nil { + g.Fatalf("generating file (%s): %s", semgrepFilename, err) + } + + if err := d.Write(); err != nil { + g.Fatalf("generating file (%s): %s", semgrepFilename, err) + } +} + +func readConstants(filename string) ([]ConstantDatum, error) { + constants, err := common.ReadAllCSVData(filename) + + if err != nil { + return nil, err + } + + var constantList []ConstantDatum + + for _, row := range constants { + if row[0] == "" { + continue + } + + constantList = append(constantList, ConstantDatum{ + ConstantLower: row[0], + Constant: row[1], + }) + } + + sort.SliceStable(constantList, func(i, j int) bool { + return constantList[j].Constant > constantList[i].Constant + }) + + return constantList, nil +} diff --git a/internal/generate/attrconsts/semgrep.tmpl b/internal/generate/attrconsts/semgrep.tmpl new file mode 100644 index 00000000000..9bed82f4ffe --- /dev/null +++ b/internal/generate/attrconsts/semgrep.tmpl @@ -0,0 +1,14 @@ +# Generated by internal/generate/attrconsts/main.go; DO NOT EDIT. +rules: +{{- range .Constants }} + - id: literal-{{ .ConstantLower }}-string-constant + languages: [go] + message: Use the constant `names.Attr{{ .Constant }}` for the string literal "{{ .ConstantLower }}" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"{{ .ConstantLower }}"' + severity: ERROR + fix: "names.Attr{{ .Constant }}" +{{- end }} From 31f613671b745e2273ff31160f2e33526b97f61b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 18:47:43 -0400 Subject: [PATCH 1310/1490] ci: New semgrep file --- .ci/.semgrep-caps-aws-ec2.yml | 12 +- .ci/.semgrep-constants.yml | 882 ++++++++++++++++++++++++++++++++++ .ci/.semgrep.yml | 881 --------------------------------- 3 files changed, 888 insertions(+), 887 deletions(-) create mode 100644 .ci/.semgrep-constants.yml diff --git a/.ci/.semgrep-caps-aws-ec2.yml b/.ci/.semgrep-caps-aws-ec2.yml index 062ed9821d1..0909bccf744 100644 --- a/.ci/.semgrep-caps-aws-ec2.yml +++ b/.ci/.semgrep-caps-aws-ec2.yml @@ -240,7 +240,7 @@ rules: - metavariable-pattern: metavariable: $NAME patterns: - - pattern-regex: "(Fsx|Gcm|Gp2|Gp3|Hsm|Hvm|Iam|Iot|Kms|Mfa|Msk|Nfs|Php|Rds|Rfc|Sfn|Smb|Sms|Sns|Sql|Sqs)" + - pattern-regex: "(Fsx|Gcm|Gp2|Gp3|Hsm|Hvm|Iam|Iot|Kms|Mfa|Msk|Nfs|Php|Rds|Rfc|Sdk|Sfn|Smb|Sms|Sns|Sql)" - focus-metavariable: $NAME severity: WARNING - id: caps4-in-const-name @@ -255,7 +255,7 @@ rules: - metavariable-pattern: metavariable: $NAME patterns: - - pattern-regex: "(Fsx|Gcm|Gp2|Gp3|Hsm|Hvm|Iam|Iot|Kms|Mfa|Msk|Nfs|Php|Rds|Rfc|Sfn|Smb|Sms|Sns|Sql|Sqs)" + - pattern-regex: "(Fsx|Gcm|Gp2|Gp3|Hsm|Hvm|Iam|Iot|Kms|Mfa|Msk|Nfs|Php|Rds|Rfc|Sdk|Sfn|Smb|Sms|Sns|Sql)" severity: WARNING - id: caps4-in-var-name languages: @@ -269,7 +269,7 @@ rules: - metavariable-pattern: metavariable: $NAME patterns: - - pattern-regex: "(Fsx|Gcm|Gp2|Gp3|Hsm|Hvm|Iam|Iot|Kms|Mfa|Msk|Nfs|Php|Rds|Rfc|Sfn|Smb|Sms|Sns|Sql|Sqs)" + - pattern-regex: "(Fsx|Gcm|Gp2|Gp3|Hsm|Hvm|Iam|Iot|Kms|Mfa|Msk|Nfs|Php|Rds|Rfc|Sdk|Sfn|Smb|Sms|Sns|Sql)" severity: WARNING - id: caps5-in-func-name languages: @@ -283,7 +283,7 @@ rules: - metavariable-pattern: metavariable: $NAME patterns: - - pattern-regex: "(Ssh|Ssl|Ssm|Sso|Sts|Swf|Tcp|Tls|Ttl|Uri|Url|Vgw|Vpc|Vpn|Waf|Xss|Db|Ip)" + - pattern-regex: "(Sqs|Ssh|Ssl|Ssm|Sso|Sts|Swf|Tcp|Tls|Ttl|Uri|Url|Vgw|Vpc|Vpn|Waf|Xss|Db|Ip)" - focus-metavariable: $NAME severity: WARNING - id: caps5-in-const-name @@ -298,7 +298,7 @@ rules: - metavariable-pattern: metavariable: $NAME patterns: - - pattern-regex: "(Ssh|Ssl|Ssm|Sso|Sts|Swf|Tcp|Tls|Ttl|Uri|Url|Vgw|Vpc|Vpn|Waf|Xss|Db|Ip)" + - pattern-regex: "(Sqs|Ssh|Ssl|Ssm|Sso|Sts|Swf|Tcp|Tls|Ttl|Uri|Url|Vgw|Vpc|Vpn|Waf|Xss|Db|Ip)" severity: WARNING - id: caps5-in-var-name languages: @@ -312,7 +312,7 @@ rules: - metavariable-pattern: metavariable: $NAME patterns: - - pattern-regex: "(Ssh|Ssl|Ssm|Sso|Sts|Swf|Tcp|Tls|Ttl|Uri|Url|Vgw|Vpc|Vpn|Waf|Xss|Db|Ip)" + - pattern-regex: "(Sqs|Ssh|Ssl|Ssm|Sso|Sts|Swf|Tcp|Tls|Ttl|Uri|Url|Vgw|Vpc|Vpn|Waf|Xss|Db|Ip)" severity: WARNING - id: ec2-in-func-name languages: diff --git a/.ci/.semgrep-constants.yml b/.ci/.semgrep-constants.yml new file mode 100644 index 00000000000..7d50c2113a5 --- /dev/null +++ b/.ci/.semgrep-constants.yml @@ -0,0 +1,882 @@ +# Generated by internal/generate/attrconsts/main.go; DO NOT EDIT. +rules: + - id: literal-arn-string-constant + languages: [go] + message: Use the constant `names.AttrARN` for the string literal "arn" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"arn"' + severity: ERROR + fix: "names.AttrARN" + - id: literal-arns-string-constant + languages: [go] + message: Use the constant `names.AttrARNs` for the string literal "arns" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"arns"' + severity: ERROR + fix: "names.AttrARNs" + - id: literal-access_key-string-constant + languages: [go] + message: Use the constant `names.AttrAccessKey` for the string literal "access_key" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"access_key"' + severity: ERROR + fix: "names.AttrAccessKey" + - id: literal-account_id-string-constant + languages: [go] + message: Use the constant `names.AttrAccountID` for the string literal "account_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"account_id"' + severity: ERROR + fix: "names.AttrAccountID" + - id: literal-action-string-constant + languages: [go] + message: Use the constant `names.AttrAction` for the string literal "action" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"action"' + severity: ERROR + fix: "names.AttrAction" + - id: literal-address-string-constant + languages: [go] + message: Use the constant `names.AttrAddress` for the string literal "address" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"address"' + severity: ERROR + fix: "names.AttrAddress" + - id: literal-auto_minor_version_upgrade-string-constant + languages: [go] + message: Use the constant `names.AttrAutoMinorVersionUpgrade` for the string literal "auto_minor_version_upgrade" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"auto_minor_version_upgrade"' + severity: ERROR + fix: "names.AttrAutoMinorVersionUpgrade" + - id: literal-availability_zone-string-constant + languages: [go] + message: Use the constant `names.AttrAvailabilityZone` for the string literal "availability_zone" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"availability_zone"' + severity: ERROR + fix: "names.AttrAvailabilityZone" + - id: literal-availability_zones-string-constant + languages: [go] + message: Use the constant `names.AttrAvailabilityZones` for the string literal "availability_zones" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"availability_zones"' + severity: ERROR + fix: "names.AttrAvailabilityZones" + - id: literal-bucket-string-constant + languages: [go] + message: Use the constant `names.AttrBucket` for the string literal "bucket" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"bucket"' + severity: ERROR + fix: "names.AttrBucket" + - id: literal-bucket_name-string-constant + languages: [go] + message: Use the constant `names.AttrBucketName` for the string literal "bucket_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"bucket_name"' + severity: ERROR + fix: "names.AttrBucketName" + - id: literal-bucket_prefix-string-constant + languages: [go] + message: Use the constant `names.AttrBucketPrefix` for the string literal "bucket_prefix" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"bucket_prefix"' + severity: ERROR + fix: "names.AttrBucketPrefix" + - id: literal-catalog_id-string-constant + languages: [go] + message: Use the constant `names.AttrCatalogID` for the string literal "catalog_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"catalog_id"' + severity: ERROR + fix: "names.AttrCatalogID" + - id: literal-cluster_identifier-string-constant + languages: [go] + message: Use the constant `names.AttrClusterIdentifier` for the string literal "cluster_identifier" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"cluster_identifier"' + severity: ERROR + fix: "names.AttrClusterIdentifier" + - id: literal-configuration-string-constant + languages: [go] + message: Use the constant `names.AttrConfiguration` for the string literal "configuration" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"configuration"' + severity: ERROR + fix: "names.AttrConfiguration" + - id: literal-created_at-string-constant + languages: [go] + message: Use the constant `names.AttrCreatedAt` for the string literal "created_at" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"created_at"' + severity: ERROR + fix: "names.AttrCreatedAt" + - id: literal-created_date-string-constant + languages: [go] + message: Use the constant `names.AttrCreatedDate` for the string literal "created_date" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"created_date"' + severity: ERROR + fix: "names.AttrCreatedDate" + - id: literal-database_name-string-constant + languages: [go] + message: Use the constant `names.AttrDatabaseName` for the string literal "database_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"database_name"' + severity: ERROR + fix: "names.AttrDatabaseName" + - id: literal-delete_on_termination-string-constant + languages: [go] + message: Use the constant `names.AttrDeleteOnTermination` for the string literal "delete_on_termination" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"delete_on_termination"' + severity: ERROR + fix: "names.AttrDeleteOnTermination" + - id: literal-description-string-constant + languages: [go] + message: Use the constant `names.AttrDescription` for the string literal "description" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"description"' + severity: ERROR + fix: "names.AttrDescription" + - id: literal-destination-string-constant + languages: [go] + message: Use the constant `names.AttrDestination` for the string literal "destination" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"destination"' + severity: ERROR + fix: "names.AttrDestination" + - id: literal-device_name-string-constant + languages: [go] + message: Use the constant `names.AttrDeviceName` for the string literal "device_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"device_name"' + severity: ERROR + fix: "names.AttrDeviceName" + - id: literal-domain_name-string-constant + languages: [go] + message: Use the constant `names.AttrDomainName` for the string literal "domain_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"domain_name"' + severity: ERROR + fix: "names.AttrDomainName" + - id: literal-enabled-string-constant + languages: [go] + message: Use the constant `names.AttrEnabled` for the string literal "enabled" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"enabled"' + severity: ERROR + fix: "names.AttrEnabled" + - id: literal-encrypted-string-constant + languages: [go] + message: Use the constant `names.AttrEncrypted` for the string literal "encrypted" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"encrypted"' + severity: ERROR + fix: "names.AttrEncrypted" + - id: literal-endpoint-string-constant + languages: [go] + message: Use the constant `names.AttrEndpoint` for the string literal "endpoint" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"endpoint"' + severity: ERROR + fix: "names.AttrEndpoint" + - id: literal-endpoints-string-constant + languages: [go] + message: Use the constant `names.AttrEndpoints` for the string literal "endpoints" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"endpoints"' + severity: ERROR + fix: "names.AttrEndpoints" + - id: literal-engine_version-string-constant + languages: [go] + message: Use the constant `names.AttrEngineVersion` for the string literal "engine_version" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"engine_version"' + severity: ERROR + fix: "names.AttrEngineVersion" + - id: literal-file_system_id-string-constant + languages: [go] + message: Use the constant `names.AttrFileSystemID` for the string literal "file_system_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"file_system_id"' + severity: ERROR + fix: "names.AttrFileSystemID" + - id: literal-filter-string-constant + languages: [go] + message: Use the constant `names.AttrFilter` for the string literal "filter" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"filter"' + severity: ERROR + fix: "names.AttrFilter" + - id: literal-force_destroy-string-constant + languages: [go] + message: Use the constant `names.AttrForceDestroy` for the string literal "force_destroy" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"force_destroy"' + severity: ERROR + fix: "names.AttrForceDestroy" + - id: literal-format-string-constant + languages: [go] + message: Use the constant `names.AttrFormat` for the string literal "format" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"format"' + severity: ERROR + fix: "names.AttrFormat" + - id: literal-hosted_zone_id-string-constant + languages: [go] + message: Use the constant `names.AttrHostedZoneID` for the string literal "hosted_zone_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"hosted_zone_id"' + severity: ERROR + fix: "names.AttrHostedZoneID" + - id: literal-id-string-constant + languages: [go] + message: Use the constant `names.AttrID` for the string literal "id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"id"' + severity: ERROR + fix: "names.AttrID" + - id: literal-instance_id-string-constant + languages: [go] + message: Use the constant `names.AttrInstanceID` for the string literal "instance_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"instance_id"' + severity: ERROR + fix: "names.AttrInstanceID" + - id: literal-instance_type-string-constant + languages: [go] + message: Use the constant `names.AttrInstanceType` for the string literal "instance_type" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"instance_type"' + severity: ERROR + fix: "names.AttrInstanceType" + - id: literal-kms_key_arn-string-constant + languages: [go] + message: Use the constant `names.AttrKMSKeyARN` for the string literal "kms_key_arn" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"kms_key_arn"' + severity: ERROR + fix: "names.AttrKMSKeyARN" + - id: literal-kms_key_id-string-constant + languages: [go] + message: Use the constant `names.AttrKMSKeyID` for the string literal "kms_key_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"kms_key_id"' + severity: ERROR + fix: "names.AttrKMSKeyID" + - id: literal-key-string-constant + languages: [go] + message: Use the constant `names.AttrKey` for the string literal "key" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"key"' + severity: ERROR + fix: "names.AttrKey" + - id: literal-last_updated_date-string-constant + languages: [go] + message: Use the constant `names.AttrLastUpdatedDate` for the string literal "last_updated_date" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"last_updated_date"' + severity: ERROR + fix: "names.AttrLastUpdatedDate" + - id: literal-max-string-constant + languages: [go] + message: Use the constant `names.AttrMax` for the string literal "max" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"max"' + severity: ERROR + fix: "names.AttrMax" + - id: literal-min-string-constant + languages: [go] + message: Use the constant `names.AttrMin` for the string literal "min" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"min"' + severity: ERROR + fix: "names.AttrMin" + - id: literal-mode-string-constant + languages: [go] + message: Use the constant `names.AttrMode` for the string literal "mode" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"mode"' + severity: ERROR + fix: "names.AttrMode" + - id: literal-name-string-constant + languages: [go] + message: Use the constant `names.AttrName` for the string literal "name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"name"' + severity: ERROR + fix: "names.AttrName" + - id: literal-name_prefix-string-constant + languages: [go] + message: Use the constant `names.AttrNamePrefix` for the string literal "name_prefix" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"name_prefix"' + severity: ERROR + fix: "names.AttrNamePrefix" + - id: literal-network_interface_id-string-constant + languages: [go] + message: Use the constant `names.AttrNetworkInterfaceID` for the string literal "network_interface_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"network_interface_id"' + severity: ERROR + fix: "names.AttrNetworkInterfaceID" + - id: literal-owner_id-string-constant + languages: [go] + message: Use the constant `names.AttrOwnerID` for the string literal "owner_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"owner_id"' + severity: ERROR + fix: "names.AttrOwnerID" + - id: literal-parameter-string-constant + languages: [go] + message: Use the constant `names.AttrParameter` for the string literal "parameter" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"parameter"' + severity: ERROR + fix: "names.AttrParameter" + - id: literal-parameters-string-constant + languages: [go] + message: Use the constant `names.AttrParameters` for the string literal "parameters" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"parameters"' + severity: ERROR + fix: "names.AttrParameters" + - id: literal-password-string-constant + languages: [go] + message: Use the constant `names.AttrPassword` for the string literal "password" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"password"' + severity: ERROR + fix: "names.AttrPassword" + - id: literal-path-string-constant + languages: [go] + message: Use the constant `names.AttrPath` for the string literal "path" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"path"' + severity: ERROR + fix: "names.AttrPath" + - id: literal-policy-string-constant + languages: [go] + message: Use the constant `names.AttrPolicy` for the string literal "policy" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"policy"' + severity: ERROR + fix: "names.AttrPolicy" + - id: literal-port-string-constant + languages: [go] + message: Use the constant `names.AttrPort` for the string literal "port" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"port"' + severity: ERROR + fix: "names.AttrPort" + - id: literal-preferred_maintenance_window-string-constant + languages: [go] + message: Use the constant `names.AttrPreferredMaintenanceWindow` for the string literal "preferred_maintenance_window" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"preferred_maintenance_window"' + severity: ERROR + fix: "names.AttrPreferredMaintenanceWindow" + - id: literal-prefix-string-constant + languages: [go] + message: Use the constant `names.AttrPrefix` for the string literal "prefix" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"prefix"' + severity: ERROR + fix: "names.AttrPrefix" + - id: literal-priority-string-constant + languages: [go] + message: Use the constant `names.AttrPriority` for the string literal "priority" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"priority"' + severity: ERROR + fix: "names.AttrPriority" + - id: literal-profile-string-constant + languages: [go] + message: Use the constant `names.AttrProfile` for the string literal "profile" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"profile"' + severity: ERROR + fix: "names.AttrProfile" + - id: literal-protocol-string-constant + languages: [go] + message: Use the constant `names.AttrProtocol` for the string literal "protocol" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"protocol"' + severity: ERROR + fix: "names.AttrProtocol" + - id: literal-region-string-constant + languages: [go] + message: Use the constant `names.AttrRegion` for the string literal "region" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"region"' + severity: ERROR + fix: "names.AttrRegion" + - id: literal-resource_arn-string-constant + languages: [go] + message: Use the constant `names.AttrResourceARN` for the string literal "resource_arn" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"resource_arn"' + severity: ERROR + fix: "names.AttrResourceARN" + - id: literal-role_arn-string-constant + languages: [go] + message: Use the constant `names.AttrRoleARN` for the string literal "role_arn" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"role_arn"' + severity: ERROR + fix: "names.AttrRoleARN" + - id: literal-secret_key-string-constant + languages: [go] + message: Use the constant `names.AttrSecretKey` for the string literal "secret_key" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"secret_key"' + severity: ERROR + fix: "names.AttrSecretKey" + - id: literal-security_group_ids-string-constant + languages: [go] + message: Use the constant `names.AttrSecurityGroupIDs` for the string literal "security_group_ids" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"security_group_ids"' + severity: ERROR + fix: "names.AttrSecurityGroupIDs" + - id: literal-security_groups-string-constant + languages: [go] + message: Use the constant `names.AttrSecurityGroups` for the string literal "security_groups" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"security_groups"' + severity: ERROR + fix: "names.AttrSecurityGroups" + - id: literal-session-string-constant + languages: [go] + message: Use the constant `names.AttrSession` for the string literal "session" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"session"' + severity: ERROR + fix: "names.AttrSession" + - id: literal-shared_config_files-string-constant + languages: [go] + message: Use the constant `names.AttrSharedConfigFiles` for the string literal "shared_config_files" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"shared_config_files"' + severity: ERROR + fix: "names.AttrSharedConfigFiles" + - id: literal-skip_credentials_validation-string-constant + languages: [go] + message: Use the constant `names.AttrSkipCredentialsValidation` for the string literal "skip_credentials_validation" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"skip_credentials_validation"' + severity: ERROR + fix: "names.AttrSkipCredentialsValidation" + - id: literal-skip_requesting_account_id-string-constant + languages: [go] + message: Use the constant `names.AttrSkipRequestingAccountID` for the string literal "skip_requesting_account_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"skip_requesting_account_id"' + severity: ERROR + fix: "names.AttrSkipRequestingAccountID" + - id: literal-source-string-constant + languages: [go] + message: Use the constant `names.AttrSource` for the string literal "source" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"source"' + severity: ERROR + fix: "names.AttrSource" + - id: literal-state-string-constant + languages: [go] + message: Use the constant `names.AttrState` for the string literal "state" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"state"' + severity: ERROR + fix: "names.AttrState" + - id: literal-status-string-constant + languages: [go] + message: Use the constant `names.AttrStatus` for the string literal "status" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"status"' + severity: ERROR + fix: "names.AttrStatus" + - id: literal-subnet_id-string-constant + languages: [go] + message: Use the constant `names.AttrSubnetID` for the string literal "subnet_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"subnet_id"' + severity: ERROR + fix: "names.AttrSubnetID" + - id: literal-subnet_ids-string-constant + languages: [go] + message: Use the constant `names.AttrSubnetIDs` for the string literal "subnet_ids" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"subnet_ids"' + severity: ERROR + fix: "names.AttrSubnetIDs" + - id: literal-tags-string-constant + languages: [go] + message: Use the constant `names.AttrTags` for the string literal "tags" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"tags"' + severity: ERROR + fix: "names.AttrTags" + - id: literal-tags_all-string-constant + languages: [go] + message: Use the constant `names.AttrTagsAll` for the string literal "tags_all" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"tags_all"' + severity: ERROR + fix: "names.AttrTagsAll" + - id: literal-target-string-constant + languages: [go] + message: Use the constant `names.AttrTarget` for the string literal "target" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"target"' + severity: ERROR + fix: "names.AttrTarget" + - id: literal-timeouts-string-constant + languages: [go] + message: Use the constant `names.AttrTimeouts` for the string literal "timeouts" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"timeouts"' + severity: ERROR + fix: "names.AttrTimeouts" + - id: literal-transit_gateway_attachment_id-string-constant + languages: [go] + message: Use the constant `names.AttrTransitGatewayAttachmentID` for the string literal "transit_gateway_attachment_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"transit_gateway_attachment_id"' + severity: ERROR + fix: "names.AttrTransitGatewayAttachmentID" + - id: literal-transit_gateway_id-string-constant + languages: [go] + message: Use the constant `names.AttrTransitGatewayID` for the string literal "transit_gateway_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"transit_gateway_id"' + severity: ERROR + fix: "names.AttrTransitGatewayID" + - id: literal-type-string-constant + languages: [go] + message: Use the constant `names.AttrType` for the string literal "type" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"type"' + severity: ERROR + fix: "names.AttrType" + - id: literal-url-string-constant + languages: [go] + message: Use the constant `names.AttrURL` for the string literal "url" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"url"' + severity: ERROR + fix: "names.AttrURL" + - id: literal-unit-string-constant + languages: [go] + message: Use the constant `names.AttrUnit` for the string literal "unit" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"unit"' + severity: ERROR + fix: "names.AttrUnit" + - id: literal-username-string-constant + languages: [go] + message: Use the constant `names.AttrUsername` for the string literal "username" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"username"' + severity: ERROR + fix: "names.AttrUsername" + - id: literal-vpc_id-string-constant + languages: [go] + message: Use the constant `names.AttrVPCID` for the string literal "vpc_id" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"vpc_id"' + severity: ERROR + fix: "names.AttrVPCID" + - id: literal-vpc_security_group_ids-string-constant + languages: [go] + message: Use the constant `names.AttrVPCSecurityGroupIDs` for the string literal "vpc_security_group_ids" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"vpc_security_group_ids"' + severity: ERROR + fix: "names.AttrVPCSecurityGroupIDs" + - id: literal-value-string-constant + languages: [go] + message: Use the constant `names.AttrValue` for the string literal "value" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"value"' + severity: ERROR + fix: "names.AttrValue" + - id: literal-values-string-constant + languages: [go] + message: Use the constant `names.AttrValues` for the string literal "values" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"values"' + severity: ERROR + fix: "names.AttrValues" + - id: literal-version-string-constant + languages: [go] + message: Use the constant `names.AttrVersion` for the string literal "version" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"version"' + severity: ERROR + fix: "names.AttrVersion" diff --git a/.ci/.semgrep.yml b/.ci/.semgrep.yml index 04611063b4e..4ddce8038f0 100644 --- a/.ci/.semgrep.yml +++ b/.ci/.semgrep.yml @@ -634,884 +634,3 @@ rules: patterns: - pattern-regex: "(Create|Read|Update|Delete)Context:" severity: ERROR - - - id: literal-arn-string-constant - languages: [go] - message: Use the constant `names.AttrARN` for the string literal `arn` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"arn"' - severity: ERROR - fix: "names.AttrARN" - - id: literal-availability_zone-string-constant - languages: [go] - message: Use the constant `names.AttrAvailabilityZone` for the string literal `availability_zone` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"availability_zone"' - severity: ERROR - fix: "names.AttrAvailabilityZone" - - id: literal-bucket-string-constant - languages: [go] - message: Use the constant `names.AttrBucket` for the string literal `bucket` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"bucket"' - severity: ERROR - fix: "names.AttrBucket" - - id: literal-description-string-constant - languages: [go] - message: Use the constant `names.AttrDescription` for the string literal `description` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"description"' - severity: ERROR - fix: "names.AttrDescription" - - id: literal-enabled-string-constant - languages: [go] - message: Use the constant `names.AttrEnabled` for the string literal `enabled` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"enabled"' - severity: ERROR - fix: "names.AttrEnabled" - - id: literal-id-string-constant - languages: [go] - message: Use the constant `names.AttrID` for the string literal `id` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"id"' - severity: ERROR - fix: "names.AttrID" - - id: literal-kms_key_arn-string-constant - languages: [go] - message: Use the constant `names.AttrKMSKeyARN` for the string literal `kms_key_arn` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"kms_key_arn"' - severity: ERROR - fix: "names.AttrKMSKeyARN" - - id: literal-kms_key_id-string-constant - languages: [go] - message: Use the constant `names.AttrKMSKeyID` for the string literal `kms_key_id` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"kms_key_id"' - severity: ERROR - fix: "names.AttrKMSKeyID" - - id: literal-key-string-constant - languages: [go] - message: Use the constant `names.AttrKey` for the string literal `key` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"key"' - severity: ERROR - fix: "names.AttrKey" - - id: literal-max-string-constant - languages: [go] - message: Use the constant `names.AttrMax` for the string literal `max` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"max"' - severity: ERROR - fix: "names.AttrMax" - - id: literal-min-string-constant - languages: [go] - message: Use the constant `names.AttrMin` for the string literal `min` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"min"' - severity: ERROR - fix: "names.AttrMin" - - id: literal-name-string-constant - languages: [go] - message: Use the constant `names.AttrName` for the string literal `name` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"name"' - severity: ERROR - fix: "names.AttrName" - - id: literal-owner_id-string-constant - languages: [go] - message: Use the constant `names.AttrOwnerID` for the string literal `owner_id` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"owner_id"' - severity: ERROR - fix: "names.AttrOwnerID" - - id: literal-parameters-string-constant - languages: [go] - message: Use the constant `names.AttrParameters` for the string literal `parameters` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"parameters"' - severity: ERROR - fix: "names.AttrParameters" - - id: literal-policy-string-constant - languages: [go] - message: Use the constant `names.AttrPolicy` for the string literal `policy` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"policy"' - severity: ERROR - fix: "names.AttrPolicy" - - id: literal-port-string-constant - languages: [go] - message: Use the constant `names.AttrPort` for the string literal `port` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"port"' - severity: ERROR - fix: "names.AttrPort" - - id: literal-role_arn-string-constant - languages: [go] - message: Use the constant `names.AttrRoleARN` for the string literal `role_arn` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"role_arn"' - severity: ERROR - fix: "names.AttrRoleARN" - - id: literal-state-string-constant - languages: [go] - message: Use the constant `names.AttrState` for the string literal `state` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"state"' - severity: ERROR - fix: "names.AttrState" - - id: literal-security_group_ids-string-constant - languages: [go] - message: Use the constant `names.AttrSecurityGroupIDs` for the string literal `security_group_ids` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"security_group_ids"' - severity: ERROR - fix: "names.AttrSecurityGroupIDs" - - id: literal-status-string-constant - languages: [go] - message: Use the constant `names.AttrStatus` for the string literal `status` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"status"' - severity: ERROR - fix: "names.AttrStatus" - - id: literal-subnet_ids-string-constant - languages: [go] - message: Use the constant `names.AttrSubnetIDs` for the string literal `subnet_ids` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"subnet_ids"' - severity: ERROR - fix: "names.AttrSubnetIDs" - - id: literal-tags-string-constant - languages: [go] - message: Use the constant `names.AttrTags` for the string literal `tags` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"tags"' - severity: ERROR - fix: "names.AttrTags" - - id: literal-tags_all-string-constant - languages: [go] - message: Use the constant `names.AttrTagsAll` for the string literal `tags_all` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"tags_all"' - severity: ERROR - fix: "names.AttrTagsAll" - - id: literal-timeouts-string-constant - languages: [go] - message: Use the constant `names.AttrTimeouts` for the string literal `timeouts` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"timeouts"' - severity: ERROR - fix: "names.AttrTimeouts" - - id: literal-type-string-constant - languages: [go] - message: Use the constant `names.AttrType` for the string literal `type` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"type"' - severity: ERROR - fix: "names.AttrType" - - id: literal-vpc_id-string-constant - languages: [go] - message: Use the constant `names.AttrVPCID` for the string literal `vpc_id` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"vpc_id"' - severity: ERROR - fix: "names.AttrVPCID" - - id: literal-value-string-constant - languages: [go] - message: Use the constant `names.AttrValue` for the string literal `value` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"value"' - severity: ERROR - fix: "names.AttrValue" - - id: literal-version-string-constant - languages: [go] - message: Use the constant `names.AttrVersion` for the string literal `version` - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"version"' - severity: ERROR - fix: "names.AttrVersion" - - id: literal-instance_type-string-constant - languages: [go] - message: Use the constant `names.AttrInstanceType` for the string literal "instance_type" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"instance_type"' - severity: ERROR - fix: "names.AttrInstanceType" - - id: literal-name_prefix-string-constant - languages: [go] - message: Use the constant `names.AttrNamePrefix` for the string literal "name_prefix" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"name_prefix"' - severity: ERROR - fix: "names.AttrNamePrefix" - - id: literal-availability_zones-string-constant - languages: [go] - message: Use the constant `names.AttrAvailabilityZones` for the string literal "availability_zones" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"availability_zones"' - severity: ERROR - fix: "names.AttrAvailabilityZones" - - id: literal-network_interface_id-string-constant - languages: [go] - message: Use the constant `names.AttrNetworkInterfaceID` for the string literal "network_interface_id" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"network_interface_id"' - severity: ERROR - fix: "names.AttrNetworkInterfaceID" - - id: literal-engine_version-string-constant - languages: [go] - message: Use the constant `names.AttrEngineVersion` for the string literal "engine_version" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"engine_version"' - severity: ERROR - fix: "names.AttrEngineVersion" - - id: literal-domain_name-string-constant - languages: [go] - message: Use the constant `names.AttrDomainName` for the string literal "domain_name" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"domain_name"' - severity: ERROR - fix: "names.AttrDomainName" - - id: literal-resource_arn-string-constant - languages: [go] - message: Use the constant `names.AttrResourceARN` for the string literal "resource_arn" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"resource_arn"' - severity: ERROR - fix: "names.AttrResourceARN" - - id: literal-security_groups-string-constant - languages: [go] - message: Use the constant `names.AttrSecurityGroups` for the string literal "security_groups" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"security_groups"' - severity: ERROR - fix: "names.AttrSecurityGroups" - - id: literal-database_name-string-constant - languages: [go] - message: Use the constant `names.AttrDatabaseName` for the string literal "database_name" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"database_name"' - severity: ERROR - fix: "names.AttrDatabaseName" - - id: literal-bucket_name-string-constant - languages: [go] - message: Use the constant `names.AttrBucketName` for the string literal "bucket_name" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"bucket_name"' - severity: ERROR - fix: "names.AttrBucketName" - - id: literal-instance_id-string-constant - languages: [go] - message: Use the constant `names.AttrInstanceID` for the string literal "instance_id" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"instance_id"' - severity: ERROR - fix: "names.AttrInstanceID" - - id: literal-vpc_security_group_ids-string-constant - languages: [go] - message: Use the constant `names.AttrVPCSecurityGroupIDs` for the string literal "vpc_security_group_ids" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"vpc_security_group_ids"' - severity: ERROR - fix: "names.AttrVPCSecurityGroupIDs" - - id: literal-delete_on_termination-string-constant - languages: [go] - message: Use the constant `names.AttrDeleteOnTermination` for the string literal "delete_on_termination" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"delete_on_termination"' - severity: ERROR - fix: "names.AttrDeleteOnTermination" - - id: literal-account_id-string-constant - languages: [go] - message: Use the constant `names.AttrAccountID` for the string literal "account_id" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"account_id"' - severity: ERROR - fix: "names.AttrAccountID" - - id: literal-transit_gateway_id-string-constant - languages: [go] - message: Use the constant `names.AttrTransitGatewayID` for the string literal "transit_gateway_id" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"transit_gateway_id"' - severity: ERROR - fix: "names.AttrTransitGatewayID" - - id: literal-created_date-string-constant - languages: [go] - message: Use the constant `names.AttrCreatedDate` for the string literal "created_date" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"created_date"' - severity: ERROR - fix: "names.AttrCreatedDate" - - id: literal-cluster_identifier-string-constant - languages: [go] - message: Use the constant `names.AttrClusterIdentifier` for the string literal "cluster_identifier" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"cluster_identifier"' - severity: ERROR - fix: "names.AttrClusterIdentifier" - - id: literal-transit_gateway_attachment_id-string-constant - languages: [go] - message: Use the constant `names.AttrTransitGatewayAttachmentID` for the string literal "transit_gateway_attachment_id" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"transit_gateway_attachment_id"' - severity: ERROR - fix: "names.AttrTransitGatewayAttachmentID" - - id: literal-last_updated_date-string-constant - languages: [go] - message: Use the constant `names.AttrLastUpdatedDate` for the string literal "last_updated_date" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"last_updated_date"' - severity: ERROR - fix: "names.AttrLastUpdatedDate" - - id: literal-created_at-string-constant - languages: [go] - message: Use the constant `names.AttrCreatedAt` for the string literal "created_at" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"created_at"' - severity: ERROR - fix: "names.AttrCreatedAt" - - id: literal-preferred_maintenance_window-string-constant - languages: [go] - message: Use the constant `names.AttrPreferredMaintenanceWindow` for the string literal "preferred_maintenance_window" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"preferred_maintenance_window"' - severity: ERROR - fix: "names.AttrPreferredMaintenanceWindow" - - id: literal-auto_minor_version_upgrade-string-constant - languages: [go] - message: Use the constant `names.AttrAutoMinorVersionUpgrade` for the string literal "auto_minor_version_upgrade" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"auto_minor_version_upgrade"' - severity: ERROR - fix: "names.AttrAutoMinorVersionUpgrade" - - id: literal-protocol-string-constant - languages: [go] - message: Use the constant `names.AttrProtocol` for the string literal "protocol" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"protocol"' - severity: ERROR - fix: "names.AttrProtocol" - - id: literal-subnet_id-string-constant - languages: [go] - message: Use the constant `names.AttrSubnetID` for the string literal "subnet_id" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"subnet_id"' - severity: ERROR - fix: "names.AttrSubnetID" - - id: literal-values-string-constant - languages: [go] - message: Use the constant `names.AttrValues` for the string literal "values" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"values"' - severity: ERROR - fix: "names.AttrValues" - - id: literal-region-string-constant - languages: [go] - message: Use the constant `names.AttrRegion` for the string literal "region" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"region"' - severity: ERROR - fix: "names.AttrRegion" - - id: literal-access_key-string-constant - languages: [go] - message: Use the constant `names.AttrAccessKey` for the string literal "access_key" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"access_key"' - severity: ERROR - fix: "names.AttrAccessKey" - - id: literal-endpoints-string-constant - languages: [go] - message: Use the constant `names.AttrEndpoints` for the string literal "endpoints" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"endpoints"' - severity: ERROR - fix: "names.AttrEndpoints" - - id: literal-profile-string-constant - languages: [go] - message: Use the constant `names.AttrProfile` for the string literal "profile" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"profile"' - severity: ERROR - fix: "names.AttrProfile" - - id: literal-secret_key-string-constant - languages: [go] - message: Use the constant `names.AttrSecretKey` for the string literal "secret_key" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"secret_key"' - severity: ERROR - fix: "names.AttrSecretKey" - - id: literal-shared_config_files-string-constant - languages: [go] - message: Use the constant `names.AttrSharedConfigFiles` for the string literal "shared_config_files" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"shared_config_files"' - severity: ERROR - fix: "names.AttrSharedConfigFiles" - - id: literal-skip_credentials_validation-string-constant - languages: [go] - message: Use the constant `names.AttrSkipCredentialsValidation` for the string literal "skip_credentials_validation" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"skip_credentials_validation"' - severity: ERROR - fix: "names.AttrSkipCredentialsValidation" - - id: literal-skip_requesting_account_id-string-constant - languages: [go] - message: Use the constant `names.AttrSkipRequestingAccountID` for the string literal "skip_requesting_account_id" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"skip_requesting_account_id"' - severity: ERROR - fix: "names.AttrSkipRequestingAccountID" - - id: literal-endpoint-string-constant - languages: [go] - message: Use the constant `names.AttrEndpoint` for the string literal "endpoint" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"endpoint"' - severity: ERROR - fix: "names.AttrEndpoint" - - id: literal-session-string-constant - languages: [go] - message: Use the constant `names.AttrSession` for the string literal "session" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"session"' - severity: ERROR - fix: "names.AttrSession" - - id: literal-hosted_zone_id-string-constant - languages: [go] - message: Use the constant `names.AttrHostedZoneID` for the string literal "hosted_zone_id" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"hosted_zone_id"' - severity: ERROR - fix: "names.AttrHostedZoneID" - - id: literal-device_name-string-constant - languages: [go] - message: Use the constant `names.AttrDeviceName` for the string literal "device_name" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"device_name"' - severity: ERROR - fix: "names.AttrDeviceName" - - id: literal-catalog_id-string-constant - languages: [go] - message: Use the constant `names.AttrCatalogID` for the string literal "catalog_id" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"catalog_id"' - severity: ERROR - fix: "names.AttrCatalogID" - - id: literal-bucket_prefix-string-constant - languages: [go] - message: Use the constant `names.AttrBucketPrefix` for the string literal "bucket_prefix" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"bucket_prefix"' - severity: ERROR - fix: "names.AttrBucketPrefix" - - id: literal-encrypted-string-constant - languages: [go] - message: Use the constant `names.AttrEncrypted` for the string literal "encrypted" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"encrypted"' - severity: ERROR - fix: "names.AttrEncrypted" - - id: literal-file_system_id-string-constant - languages: [go] - message: Use the constant `names.AttrFileSystemID` for the string literal "file_system_id" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"file_system_id"' - severity: ERROR - fix: "names.AttrFileSystemID" - - id: literal-action-string-constant - languages: [go] - message: Use the constant `names.AttrAction` for the string literal "action" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"action"' - severity: ERROR - fix: "names.AttrAction" - - id: literal-source-string-constant - languages: [go] - message: Use the constant `names.AttrSource` for the string literal "source" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"source"' - severity: ERROR - fix: "names.AttrSource" - - id: literal-password-string-constant - languages: [go] - message: Use the constant `names.AttrPassword` for the string literal "password" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"password"' - severity: ERROR - fix: "names.AttrPassword" - - id: literal-target-string-constant - languages: [go] - message: Use the constant `names.AttrTarget` for the string literal "target" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"target"' - severity: ERROR - fix: "names.AttrTarget" - - id: literal-filter-string-constant - languages: [go] - message: Use the constant `names.AttrFilter` for the string literal "filter" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"filter"' - severity: ERROR - fix: "names.AttrFilter" - - id: literal-prefix-string-constant - languages: [go] - message: Use the constant `names.AttrPrefix` for the string literal "prefix" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"prefix"' - severity: ERROR - fix: "names.AttrPrefix" - - id: literal-priority-string-constant - languages: [go] - message: Use the constant `names.AttrPriority` for the string literal "priority" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"priority"' - severity: ERROR - fix: "names.AttrPriority" - - id: literal-path-string-constant - languages: [go] - message: Use the constant `names.AttrPath` for the string literal "path" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"path"' - severity: ERROR - fix: "names.AttrPath" - - id: literal-url-string-constant - languages: [go] - message: Use the constant `names.AttrURL` for the string literal "url" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"url"' - severity: ERROR - fix: "names.AttrURL" - - id: literal-arns-string-constant - languages: [go] - message: Use the constant `names.AttrARNs` for the string literal "arns" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"arns"' - severity: ERROR - fix: "names.AttrARNs" - - id: literal-username-string-constant - languages: [go] - message: Use the constant `names.AttrUsername` for the string literal "username" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"username"' - severity: ERROR - fix: "names.AttrUsername" - - id: literal-configuration-string-constant - languages: [go] - message: Use the constant `names.AttrConfiguration` for the string literal "configuration" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"configuration"' - severity: ERROR - fix: "names.AttrConfiguration" - - id: literal-parameter-string-constant - languages: [go] - message: Use the constant `names.AttrParameter` for the string literal "parameter" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"parameter"' - severity: ERROR - fix: "names.AttrParameter" - - id: literal-format-string-constant - languages: [go] - message: Use the constant `names.AttrFormat` for the string literal "format" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"format"' - severity: ERROR - fix: "names.AttrFormat" - - id: literal-mode-string-constant - languages: [go] - message: Use the constant `names.AttrMode` for the string literal "mode" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"mode"' - severity: ERROR - fix: "names.AttrMode" - - id: literal-unit-string-constant - languages: [go] - message: Use the constant `names.AttrUnit` for the string literal "unit" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"unit"' - severity: ERROR - fix: "names.AttrUnit" - - id: literal-address-string-constant - languages: [go] - message: Use the constant `names.AttrAddress` for the string literal "address" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"address"' - severity: ERROR - fix: "names.AttrAddress" - - id: literal-destination-string-constant - languages: [go] - message: Use the constant `names.AttrDestination` for the string literal "destination" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"destination"' - severity: ERROR - fix: "names.AttrDestination" - - id: literal-force_destroy-string-constant - languages: [go] - message: Use the constant `names.AttrForceDestroy` for the string literal "force_destroy" - paths: - include: - - "internal/service/**/*.go" - patterns: - - pattern: '"force_destroy"' - severity: ERROR - fix: "names.AttrForceDestroy" From c92248d13e98e11b5ad4472900e9053630a2a2a2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 18:51:15 -0400 Subject: [PATCH 1311/1490] make: Add semgrep config --- GNUmakefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index cf0e2bb3618..e1726333521 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -337,6 +337,7 @@ semall: semgrep-validate ## Run semgrep on all files @SEMGREP_TIMEOUT=300 semgrep --error --metrics=off \ $(if $(filter-out $(origin PKG), undefined),--include $(PKG_NAME),) \ --config .ci/.semgrep.yml \ + --config .ci/.semgrep-constants.yml \ --config .ci/.semgrep-caps-aws-ec2.yml \ --config .ci/.semgrep-configs.yml \ --config .ci/.semgrep-service-name0.yml \ @@ -358,6 +359,7 @@ semfix: semgrep-validate ## Run semgrep on all files @SEMGREP_TIMEOUT=300 semgrep --error --metrics=off --autofix \ $(if $(filter-out $(origin PKG), undefined),--include $(PKG_NAME),) \ --config .ci/.semgrep.yml \ + --config .ci/.semgrep-constants.yml \ --config .ci/.semgrep-caps-aws-ec2.yml \ --config .ci/.semgrep-configs.yml \ --config .ci/.semgrep-service-name0.yml \ @@ -375,6 +377,7 @@ semfix: semgrep-validate ## Run semgrep on all files semgrep-validate: ## Validate semgrep configuration files @SEMGREP_TIMEOUT=300 semgrep --error --validate \ --config .ci/.semgrep.yml \ + --config .ci/.semgrep-constants.yml \ --config .ci/.semgrep-caps-aws-ec2.yml \ --config .ci/.semgrep-configs.yml \ --config .ci/.semgrep-service-name0.yml \ @@ -385,7 +388,7 @@ semgrep-validate: ## Validate semgrep configuration files semgrep: semgrep-validate ## Run semgrep @echo "make: running Semgrep static analysis..." - @docker run --rm --volume "${PWD}:/src" returntocorp/semgrep semgrep --config .ci/.semgrep.yml + @docker run --rm --volume "${PWD}:/src" returntocorp/semgrep semgrep --config .ci/.semgrep.yml .ci/.semgrep-constants.yml skaff: prereq-go ## Install skaff cd skaff && $(GO_VER) install github.com/hashicorp/terraform-provider-aws/skaff From 5c7930520cd28e2e5f74fa67a93f92ea363860e3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 18:51:32 -0400 Subject: [PATCH 1312/1490] ci: Add semgrep config --- .github/workflows/semgrep-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/semgrep-ci.yml b/.github/workflows/semgrep-ci.yml index dd025353144..94448ee2acd 100644 --- a/.github/workflows/semgrep-ci.yml +++ b/.github/workflows/semgrep-ci.yml @@ -28,10 +28,12 @@ jobs: - run: | semgrep --validate \ --config .ci/.semgrep.yml \ + --config .ci/.semgrep-constants.yml \ --config .ci/semgrep/ - run: | semgrep $COMMON_PARAMS \ --config .ci/.semgrep.yml \ + --config .ci/.semgrep-constants.yml \ --config .ci/semgrep/ \ --config 'r/dgryski.semgrep-go.badnilguard' \ --config 'r/dgryski.semgrep-go.errnilcheck' \ From 9d27bac75839057c75e39a8aa29e717db5a78e64 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 18:52:06 -0400 Subject: [PATCH 1313/1490] generate: Modify for constants --- internal/generate/checknames/main.go | 8 ++++---- internal/generate/namesconsts/file.tmpl | 2 +- .../generate/serviceendpointtests/file.tmpl | 18 +++++++++--------- internal/generate/serviceendpointtests/main.go | 8 ++++---- internal/generate/servicepackage/main.go | 14 ++------------ internal/generate/tagstests/main.go | 5 +++++ internal/generate/tagstests/test.go.gtpl | 2 +- 7 files changed, 26 insertions(+), 31 deletions(-) diff --git a/internal/generate/checknames/main.go b/internal/generate/checknames/main.go index 85698270c4d..110ba6b3b75 100644 --- a/internal/generate/checknames/main.go +++ b/internal/generate/checknames/main.go @@ -168,13 +168,13 @@ func main() { } deprecatedEnvVar := l.DeprecatedEnvVar() != "" - tfAwsEnvVar := l.TfAwsEnvVar() != "" + tfAwsEnvVar := l.TFAWSEnvVar() != "" if deprecatedEnvVar != tfAwsEnvVar { - log.Fatalf("in service data, line %d, for service %s, either both DeprecatedEnvVar and TfAwsEnvVar must be specified or neither can be", i+lineOffset, l.HumanFriendly()) + log.Fatalf("in service data, line %d, for service %s, either both DeprecatedEnvVar and TFAWSEnvVar must be specified or neither can be", i+lineOffset, l.HumanFriendly()) } - if l.SdkId() == "" && !l.Exclude() { - log.Fatalf("in service data, line %d, for service %s, SdkId is required unless Exclude is set", i+lineOffset, l.HumanFriendly()) + if l.SDKID() == "" && !l.Exclude() { + log.Fatalf("in service data, line %d, for service %s, SDKID is required unless Exclude is set", i+lineOffset, l.HumanFriendly()) } if l.EndpointAPICall() == "" && !l.NotImplemented() && !l.Exclude() { diff --git a/internal/generate/namesconsts/file.tmpl b/internal/generate/namesconsts/file.tmpl index 102108e9e7d..af869097a0d 100644 --- a/internal/generate/namesconsts/file.tmpl +++ b/internal/generate/namesconsts/file.tmpl @@ -11,6 +11,6 @@ const ( // Equivalent to .ServiceID const ( {{- range .Services }} - {{ .ProviderNameUpper }}ServiceID = "{{ .SdkID }}" + {{ .ProviderNameUpper }}ServiceID = "{{ .SDKID }}" {{- end }} ) diff --git a/internal/generate/serviceendpointtests/file.tmpl b/internal/generate/serviceendpointtests/file.tmpl index ec925e1154f..74c8052dee5 100644 --- a/internal/generate/serviceendpointtests/file.tmpl +++ b/internal/generate/serviceendpointtests/file.tmpl @@ -82,7 +82,7 @@ const ( baseEnvvarEndpoint = "https://base-envvar.endpoint.test/" serviceConfigFileEndpoint = "https://service-configfile.endpoint.test/" baseConfigFileEndpoint = "https://base-configfile.endpoint.test/" - {{ if ne .TfAwsEnvVar "" -}} + {{ if ne .TFAWSEnvVar "" -}} tfAwsEnvvarEndpoint = "https://service-tf-aws-envvar.endpoint.test/" {{- end }} {{ if ne .DeprecatedEnvVar "" -}} @@ -98,8 +98,8 @@ const ( awsEnvVar = "{{ .AwsEnvVar }}" baseEnvVar = "AWS_ENDPOINT_URL" configParam = "{{ .ConfigParameter }}" - {{ if ne .TfAwsEnvVar "" -}} - tfAwsEnvVar = "{{ .TfAwsEnvVar }}" + {{ if ne .TFAWSEnvVar "" -}} + tfAwsEnvVar = "{{ .TFAWSEnvVar }}" {{- end }} {{ if ne .DeprecatedEnvVar "" -}} deprecatedEnvVar = "{{ .DeprecatedEnvVar }}" @@ -145,7 +145,7 @@ func TestEndpointConfiguration(t *testing.T) { //nolint:paralleltest // uses t.S expected: expectPackageNameConfigEndpoint(), }, -{{ if ne .TfAwsEnvVar "" }} +{{ if ne .TFAWSEnvVar "" }} "package name endpoint config overrides TF_AWS envvar": { with: []setupFunc{ withPackageNameEndpointInConfig, @@ -190,7 +190,7 @@ func TestEndpointConfiguration(t *testing.T) { //nolint:paralleltest // uses t.S }, {{ $aliases := .Aliases }} -{{ $tfAwsEnvVar := .TfAwsEnvVar }} +{{ $tfAwsEnvVar := .TFAWSEnvVar }} {{ $deprecatedEnvVar := .DeprecatedEnvVar }} {{ range $i, $alias := .Aliases }} // Alias name {{ $i }} endpoint on Config @@ -275,7 +275,7 @@ func TestEndpointConfiguration(t *testing.T) { //nolint:paralleltest // uses t.S expected: expectAwsEnvVarEndpoint(), }, -{{ if ne .TfAwsEnvVar "" }} +{{ if ne .TFAWSEnvVar "" }} "service aws envvar overrides TF_AWS envvar": { with: []setupFunc{ withAwsEnvVar, @@ -319,7 +319,7 @@ func TestEndpointConfiguration(t *testing.T) { //nolint:paralleltest // uses t.S expected: expectAwsEnvVarEndpoint(), }, -{{ if ne .TfAwsEnvVar "" }} +{{ if ne .TFAWSEnvVar "" }} // Service endpoint in TF_AWS envvar "service TF_AWS envvar": { @@ -613,7 +613,7 @@ func withAwsEnvVar(setup *caseSetup) { setup.environmentVariables[awsEnvVar] = awsServiceEnvvarEndpoint } -{{ if ne .TfAwsEnvVar "" }} +{{ if ne .TFAWSEnvVar "" }} func withTfAwsEnvVar(setup *caseSetup) { setup.environmentVariables[tfAwsEnvVar] = tfAwsEnvvarEndpoint } @@ -669,7 +669,7 @@ func expectBaseEnvVarEndpoint() caseExpectations { } } -{{ if ne .TfAwsEnvVar "" }} +{{ if ne .TFAWSEnvVar "" }} func expectTfAwsEnvVarEndpoint() caseExpectations { return caseExpectations{ endpoint: tfAwsEnvvarEndpoint, diff --git a/internal/generate/serviceendpointtests/main.go b/internal/generate/serviceendpointtests/main.go index b06048fa816..a2e6ca6f8d3 100644 --- a/internal/generate/serviceendpointtests/main.go +++ b/internal/generate/serviceendpointtests/main.go @@ -60,10 +60,10 @@ func main() { Region: "us-west-2", APICall: l.EndpointAPICall(), APICallParams: l.EndpointAPIParams(), - AwsEnvVar: l.AwsServiceEnvVar(), - ConfigParameter: l.AwsConfigParameter(), + AwsEnvVar: l.AWSServiceEnvVar(), + ConfigParameter: l.AWSConfigParameter(), DeprecatedEnvVar: l.DeprecatedEnvVar(), - TfAwsEnvVar: l.TfAwsEnvVar(), + TFAWSEnvVar: l.TFAWSEnvVar(), Aliases: l.Aliases(), } if l.ClientSDKV1() { @@ -124,7 +124,7 @@ type TemplateData struct { AwsEnvVar string ConfigParameter string DeprecatedEnvVar string - TfAwsEnvVar string + TFAWSEnvVar string V1NameResolverNeedsUnknownService bool V1AlternateInputPackage string Aliases []string diff --git a/internal/generate/servicepackage/main.go b/internal/generate/servicepackage/main.go index 9a23c651a43..5e52e443733 100644 --- a/internal/generate/servicepackage/main.go +++ b/internal/generate/servicepackage/main.go @@ -20,6 +20,7 @@ import ( "github.com/YakDriver/regexache" "github.com/hashicorp/terraform-provider-aws/internal/generate/common" + "github.com/hashicorp/terraform-provider-aws/names" "github.com/hashicorp/terraform-provider-aws/names/data" ) @@ -201,18 +202,7 @@ func (v *visitor) processFuncDecl(funcDecl *ast.FuncDecl) { v.errs = append(v.errs, fmt.Errorf("multiple Tags annotations: %s", fmt.Sprintf("%s.%s", v.packageName, v.functionName))) } - switch attr { - case "arn": - d.TagsIdentifierAttribute = "names.AttrARN" - case "bucket": - d.TagsIdentifierAttribute = "names.AttrBucket" - case "id": - d.TagsIdentifierAttribute = "names.AttrID" - case "name": - d.TagsIdentifierAttribute = "names.AttrName" - default: - d.TagsIdentifierAttribute = fmt.Sprintf("\"%s\"", attr) - } + d.TagsIdentifierAttribute = names.ConstOrQuote(attr) } if attr, ok := args.Keyword["resourceType"]; ok { diff --git a/internal/generate/tagstests/main.go b/internal/generate/tagstests/main.go index 8bdbe722a49..f50a246c319 100644 --- a/internal/generate/tagstests/main.go +++ b/internal/generate/tagstests/main.go @@ -22,6 +22,7 @@ import ( "github.com/YakDriver/regexache" "github.com/hashicorp/terraform-provider-aws/internal/generate/common" + "github.com/hashicorp/terraform-provider-aws/names" "github.com/hashicorp/terraform-provider-aws/names/data" ) @@ -298,6 +299,10 @@ func (v *visitor) processFuncDecl(funcDecl *ast.FuncDecl) { } if attr, ok := args.Keyword["importIgnore"]; ok { d.ImportIgnore = strings.Split(attr, ";") + + for i, val := range d.ImportIgnore { + d.ImportIgnore[i] = names.ConstOrQuote(val) + } } if attr, ok := args.Keyword["name"]; ok { d.Name = strings.ReplaceAll(attr, " ", "") diff --git a/internal/generate/tagstests/test.go.gtpl b/internal/generate/tagstests/test.go.gtpl index cb0ad3c9942..f61dd9f4915 100644 --- a/internal/generate/tagstests/test.go.gtpl +++ b/internal/generate/tagstests/test.go.gtpl @@ -30,7 +30,7 @@ ImportStateVerify: true, {{ if gt (len .) 0 -}} ImportStateVerifyIgnore: []string{ - {{ range $i, $v := . }}"{{ $v }}",{{ end }} + {{ range $i, $v := . }}{{ $v }},{{ end }} }, {{- end }} {{ end }} From fe92da5872d184735178e0001260440a923050d0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 18:52:40 -0400 Subject: [PATCH 1314/1490] provider: Clean up function names --- internal/conns/awsclient.go | 4 ++-- internal/provider/provider.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/conns/awsclient.go b/internal/conns/awsclient.go index da71bbcb510..9baddcf2243 100644 --- a/internal/conns/awsclient.go +++ b/internal/conns/awsclient.go @@ -297,7 +297,7 @@ func (c *AWSClient) resolveEndpoint(ctx context.Context, servicePackageName stri if names.ClientSDKV1(servicePackageName) { endpoint = aws_sdkv2.ToString(c.awsConfig.BaseEndpoint) - envvar := names.AwsServiceEnvVar(servicePackageName) + envvar := names.AWSServiceEnvVar(servicePackageName) svc := os.Getenv(envvar) if svc != "" { return svc @@ -307,7 +307,7 @@ func (c *AWSClient) resolveEndpoint(ctx context.Context, servicePackageName stri return base } - sdkId := names.SdkId(servicePackageName) + sdkId := names.SDKID(servicePackageName) endpoint, found, err := resolveServiceBaseEndpoint(ctx, sdkId, c.awsConfig.ConfigSources) if found && err == nil { return endpoint diff --git a/internal/provider/provider.go b/internal/provider/provider.go index a459ad5da67..d60d3f21b4d 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -941,13 +941,13 @@ func expandEndpoints(_ context.Context, tfList []interface{}) (map[string]string } // We only need to handle the services with custom envvars here before we hand off to `aws-sdk-go-base` - tfAwsEnvVar := names.TfAwsEnvVar(pkg) + tfAwsEnvVar := names.TFAWSEnvVar(pkg) deprecatedEnvVar := names.DeprecatedEnvVar(pkg) if tfAwsEnvVar == "" && deprecatedEnvVar == "" { continue } - awsEnvVar := names.AwsServiceEnvVar(pkg) + awsEnvVar := names.AWSServiceEnvVar(pkg) if awsEnvVar != "" { if v := os.Getenv(awsEnvVar); v != "" { endpoints[pkg] = v From c4585d0f4188a78a002f1a609c9cb316e41bd6e2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:00:59 -0400 Subject: [PATCH 1315/1490] Fix caps --- internal/conns/config.go | 8 ++++---- internal/service/apigateway/sdk_data_source_test.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/conns/config.go b/internal/conns/config.go index d8e96106e05..fbba342b8e0 100644 --- a/internal/conns/config.go +++ b/internal/conns/config.go @@ -149,7 +149,7 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS for _, d := range awsDiags { diags = append(diags, diag.Diagnostic{ - Severity: baseSeverityToSdkSeverity(d.Severity()), + Severity: baseSeverityToSDKSeverity(d.Severity()), Summary: d.Summary(), Detail: d.Detail(), }) @@ -173,7 +173,7 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS for _, d := range awsDiags { diags = append(diags, diag.Diagnostic{ - Severity: baseSeverityToSdkSeverity(d.Severity()), + Severity: baseSeverityToSDKSeverity(d.Severity()), Summary: fmt.Sprintf("creating AWS SDK v1 session: %s", d.Summary()), Detail: d.Detail(), }) @@ -187,7 +187,7 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS accountID, partition, awsDiags := awsbase.GetAwsAccountIDAndPartition(ctx, cfg, &awsbaseConfig) for _, d := range awsDiags { diags = append(diags, diag.Diagnostic{ - Severity: baseSeverityToSdkSeverity(d.Severity()), + Severity: baseSeverityToSDKSeverity(d.Severity()), Summary: fmt.Sprintf("Retrieving AWS account details: %s", d.Summary()), Detail: d.Detail(), }) @@ -231,7 +231,7 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS return client, diags } -func baseSeverityToSdkSeverity(s basediag.Severity) diag.Severity { +func baseSeverityToSDKSeverity(s basediag.Severity) diag.Severity { switch s { case basediag.SeverityWarning: return diag.Warning diff --git a/internal/service/apigateway/sdk_data_source_test.go b/internal/service/apigateway/sdk_data_source_test.go index 5871f9abfde..57bfbac48bf 100644 --- a/internal/service/apigateway/sdk_data_source_test.go +++ b/internal/service/apigateway/sdk_data_source_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/names" ) -func TestAccAPIGatewaySdkDataSource_basic(t *testing.T) { +func TestAccAPIGatewaySDKDataSource_basic(t *testing.T) { ctx := acctest.Context(t) rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) dataSourceName := "data.aws_api_gateway_sdk.test" @@ -23,7 +23,7 @@ func TestAccAPIGatewaySdkDataSource_basic(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccSdkDataSourceConfig_basic(rName), + Config: testAccSDKDataSourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair("aws_api_gateway_stage.test", "rest_api_id", dataSourceName, "rest_api_id"), resource.TestCheckResourceAttrPair("aws_api_gateway_stage.test", "stage_name", dataSourceName, "stage_name"), @@ -36,7 +36,7 @@ func TestAccAPIGatewaySdkDataSource_basic(t *testing.T) { }) } -func testAccSdkDataSourceConfig_basic(rName string) string { +func testAccSDKDataSourceConfig_basic(rName string) string { return acctest.ConfigCompose(testAccStageConfig_base(rName), ` resource "aws_api_gateway_stage" "test" { rest_api_id = aws_api_gateway_rest_api.test.id From 62975f60ec23b9f34b0c61c6630300ba9e5f8209 Mon Sep 17 00:00:00 2001 From: Sharon Nam Date: Fri, 10 May 2024 16:35:23 -0700 Subject: [PATCH 1316/1490] Linter fixes --- internal/service/ecs/account_setting_default.go | 2 +- internal/service/ecs/account_setting_default_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/ecs/account_setting_default.go b/internal/service/ecs/account_setting_default.go index 3f9eba9489b..9f324d029bd 100644 --- a/internal/service/ecs/account_setting_default.go +++ b/internal/service/ecs/account_setting_default.go @@ -146,7 +146,7 @@ func resourceAccountSettingDefaultDelete(ctx context.Context, d *schema.Resource var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ECSConn(ctx) - settingName := d.Get("name").(string) + settingName := d.Get(names.AttrName).(string) settingValue := "disabled" //Default value: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-maintenance.html#task-retirement-change diff --git a/internal/service/ecs/account_setting_default_test.go b/internal/service/ecs/account_setting_default_test.go index e95a9958e3a..f664a3e58cf 100644 --- a/internal/service/ecs/account_setting_default_test.go +++ b/internal/service/ecs/account_setting_default_test.go @@ -193,8 +193,8 @@ func testAccAccountSettingDefault_fargateTaskRetirementWaitPeriod(t *testing.T) { Config: testAccAccountSettingDefaultConfig_fargateTaskRetirementWaitPeriod(settingName), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(resourceName, "name", "fargateTaskRetirementWaitPeriod"), - resource.TestCheckResourceAttr(resourceName, "value", "14"), + resource.TestCheckResourceAttr(resourceName, names.AttrName, "fargateTaskRetirementWaitPeriod"), + resource.TestCheckResourceAttr(resourceName, names.AttrValue, "14"), acctest.MatchResourceAttrGlobalARN(resourceName, "principal_arn", "iam", regexache.MustCompile("root")), ), }, From 47e222c08b59b30f1373e40c73334f3ca84d2438 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:38 -0400 Subject: [PATCH 1317/1490] ci: Prefer constant for string literals --- .ci/.semgrep-constants.yml | 120 +++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/.ci/.semgrep-constants.yml b/.ci/.semgrep-constants.yml index 7d50c2113a5..b140cad2367 100644 --- a/.ci/.semgrep-constants.yml +++ b/.ci/.semgrep-constants.yml @@ -60,6 +60,16 @@ rules: - pattern: '"address"' severity: ERROR fix: "names.AttrAddress" + - id: literal-apply_immediately-string-constant + languages: [go] + message: Use the constant `names.AttrApplyImmediately` for the string literal "apply_immediately" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"apply_immediately"' + severity: ERROR + fix: "names.AttrApplyImmediately" - id: literal-auto_minor_version_upgrade-string-constant languages: [go] message: Use the constant `names.AttrAutoMinorVersionUpgrade` for the string literal "auto_minor_version_upgrade" @@ -130,6 +140,16 @@ rules: - pattern: '"catalog_id"' severity: ERROR fix: "names.AttrCatalogID" + - id: literal-certificate_arn-string-constant + languages: [go] + message: Use the constant `names.AttrCertificateARN` for the string literal "certificate_arn" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"certificate_arn"' + severity: ERROR + fix: "names.AttrCertificateARN" - id: literal-cluster_identifier-string-constant languages: [go] message: Use the constant `names.AttrClusterIdentifier` for the string literal "cluster_identifier" @@ -170,6 +190,26 @@ rules: - pattern: '"created_date"' severity: ERROR fix: "names.AttrCreatedDate" + - id: literal-creation_date-string-constant + languages: [go] + message: Use the constant `names.AttrCreationDate` for the string literal "creation_date" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"creation_date"' + severity: ERROR + fix: "names.AttrCreationDate" + - id: literal-creation_time-string-constant + languages: [go] + message: Use the constant `names.AttrCreationTime` for the string literal "creation_time" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"creation_time"' + severity: ERROR + fix: "names.AttrCreationTime" - id: literal-database_name-string-constant languages: [go] message: Use the constant `names.AttrDatabaseName` for the string literal "database_name" @@ -210,6 +250,16 @@ rules: - pattern: '"destination"' severity: ERROR fix: "names.AttrDestination" + - id: literal-destination_arn-string-constant + languages: [go] + message: Use the constant `names.AttrDestinationARN` for the string literal "destination_arn" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"destination_arn"' + severity: ERROR + fix: "names.AttrDestinationARN" - id: literal-device_name-string-constant languages: [go] message: Use the constant `names.AttrDeviceName` for the string literal "device_name" @@ -220,6 +270,16 @@ rules: - pattern: '"device_name"' severity: ERROR fix: "names.AttrDeviceName" + - id: literal-display_name-string-constant + languages: [go] + message: Use the constant `names.AttrDisplayName` for the string literal "display_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"display_name"' + severity: ERROR + fix: "names.AttrDisplayName" - id: literal-domain_name-string-constant languages: [go] message: Use the constant `names.AttrDomainName` for the string literal "domain_name" @@ -250,6 +310,16 @@ rules: - pattern: '"encrypted"' severity: ERROR fix: "names.AttrEncrypted" + - id: literal-encryption_configuration-string-constant + languages: [go] + message: Use the constant `names.AttrEncryptionConfiguration` for the string literal "encryption_configuration" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"encryption_configuration"' + severity: ERROR + fix: "names.AttrEncryptionConfiguration" - id: literal-endpoint-string-constant languages: [go] message: Use the constant `names.AttrEndpoint` for the string literal "endpoint" @@ -280,6 +350,16 @@ rules: - pattern: '"engine_version"' severity: ERROR fix: "names.AttrEngineVersion" + - id: literal-execution_role_arn-string-constant + languages: [go] + message: Use the constant `names.AttrExecutionRoleARN` for the string literal "execution_role_arn" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"execution_role_arn"' + severity: ERROR + fix: "names.AttrExecutionRoleARN" - id: literal-file_system_id-string-constant languages: [go] message: Use the constant `names.AttrFileSystemID` for the string literal "file_system_id" @@ -450,6 +530,16 @@ rules: - pattern: '"name_prefix"' severity: ERROR fix: "names.AttrNamePrefix" + - id: literal-network_configuration-string-constant + languages: [go] + message: Use the constant `names.AttrNetworkConfiguration` for the string literal "network_configuration" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"network_configuration"' + severity: ERROR + fix: "names.AttrNetworkConfiguration" - id: literal-network_interface_id-string-constant languages: [go] message: Use the constant `names.AttrNetworkInterfaceID` for the string literal "network_interface_id" @@ -580,6 +670,16 @@ rules: - pattern: '"protocol"' severity: ERROR fix: "names.AttrProtocol" + - id: literal-publicly_accessible-string-constant + languages: [go] + message: Use the constant `names.AttrPubliclyAccessible` for the string literal "publicly_accessible" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"publicly_accessible"' + severity: ERROR + fix: "names.AttrPubliclyAccessible" - id: literal-region-string-constant languages: [go] message: Use the constant `names.AttrRegion` for the string literal "region" @@ -600,6 +700,16 @@ rules: - pattern: '"resource_arn"' severity: ERROR fix: "names.AttrResourceARN" + - id: literal-resource_type-string-constant + languages: [go] + message: Use the constant `names.AttrResourceType` for the string literal "resource_type" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"resource_type"' + severity: ERROR + fix: "names.AttrResourceType" - id: literal-role_arn-string-constant languages: [go] message: Use the constant `names.AttrRoleARN` for the string literal "role_arn" @@ -610,6 +720,16 @@ rules: - pattern: '"role_arn"' severity: ERROR fix: "names.AttrRoleARN" + - id: literal-schedule_expression-string-constant + languages: [go] + message: Use the constant `names.AttrScheduleExpression` for the string literal "schedule_expression" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"schedule_expression"' + severity: ERROR + fix: "names.AttrScheduleExpression" - id: literal-secret_key-string-constant languages: [go] message: Use the constant `names.AttrSecretKey` for the string literal "secret_key" From 1a6c1f5809a3c40130d617a4e96b64154495ebbc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:38 -0400 Subject: [PATCH 1318/1490] acm: Use constants for strings --- internal/service/acm/certificate_validation.go | 8 ++++---- .../service/acm/certificate_validation_test.go | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/acm/certificate_validation.go b/internal/service/acm/certificate_validation.go index 379a8fd1111..3722f9e25fa 100644 --- a/internal/service/acm/certificate_validation.go +++ b/internal/service/acm/certificate_validation.go @@ -35,7 +35,7 @@ func resourceCertificateValidation() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -55,7 +55,7 @@ func resourceCertificateValidationCreate(ctx context.Context, d *schema.Resource conn := meta.(*conns.AWSClient).ACMClient(ctx) - arn := d.Get("certificate_arn").(string) + arn := d.Get(names.AttrCertificateARN).(string) certificate, err := findCertificateByARN(ctx, conn, arn) if err != nil { @@ -110,7 +110,7 @@ func resourceCertificateValidationRead(ctx context.Context, d *schema.ResourceDa conn := meta.(*conns.AWSClient).ACMClient(ctx) - arn := d.Get("certificate_arn").(string) + arn := d.Get(names.AttrCertificateARN).(string) certificate, err := findCertificateValidationByARN(ctx, conn, arn) if !d.IsNewResource() && tfresource.NotFound(err) { @@ -123,7 +123,7 @@ func resourceCertificateValidationRead(ctx context.Context, d *schema.ResourceDa return sdkdiag.AppendErrorf(diags, "reading ACM Certificate (%s): %s", arn, err) } - d.Set("certificate_arn", certificate.CertificateArn) + d.Set(names.AttrCertificateARN, certificate.CertificateArn) return diags } diff --git a/internal/service/acm/certificate_validation_test.go b/internal/service/acm/certificate_validation_test.go index 4972c5a094a..8794fca11db 100644 --- a/internal/service/acm/certificate_validation_test.go +++ b/internal/service/acm/certificate_validation_test.go @@ -36,7 +36,7 @@ func TestAccACMCertificateValidation_basic(t *testing.T) { Config: testAccCertificateValidationConfig_basic(rootDomain, domain), Check: resource.ComposeTestCheckFunc( testAccCheckCertificateValidationExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", certificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, certificateResourceName, names.AttrARN), ), }, }, @@ -85,7 +85,7 @@ func TestAccACMCertificateValidation_validationRecordFQDNS(t *testing.T) { Config: testAccCertificateValidationConfig_recordFQDNsOneRoute53Record(rootDomain, domain), Check: resource.ComposeTestCheckFunc( testAccCheckCertificateValidationExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", certificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, certificateResourceName, names.AttrARN), ), }, }, @@ -127,7 +127,7 @@ func TestAccACMCertificateValidation_validationRecordFQDNSRoot(t *testing.T) { Config: testAccCertificateValidationConfig_recordFQDNsOneRoute53Record(rootDomain, rootDomain), Check: resource.ComposeTestCheckFunc( testAccCheckCertificateValidationExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", certificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, certificateResourceName, names.AttrARN), ), }, }, @@ -151,7 +151,7 @@ func TestAccACMCertificateValidation_validationRecordFQDNSRootAndWildcard(t *tes Config: testAccCertificateValidationConfig_recordFQDNsTwoRoute53Records(rootDomain, rootDomain, strconv.Quote(wildcardDomain)), Check: resource.ComposeTestCheckFunc( testAccCheckCertificateValidationExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", certificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, certificateResourceName, names.AttrARN), ), }, }, @@ -176,7 +176,7 @@ func TestAccACMCertificateValidation_validationRecordFQDNSSan(t *testing.T) { Config: testAccCertificateValidationConfig_recordFQDNsTwoRoute53Records(rootDomain, domain, strconv.Quote(sanDomain)), Check: resource.ComposeTestCheckFunc( testAccCheckCertificateValidationExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", certificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, certificateResourceName, names.AttrARN), ), }, }, @@ -200,7 +200,7 @@ func TestAccACMCertificateValidation_validationRecordFQDNSWildcard(t *testing.T) Config: testAccCertificateValidationConfig_recordFQDNsOneRoute53Record(rootDomain, wildcardDomain), Check: resource.ComposeTestCheckFunc( testAccCheckCertificateValidationExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", certificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, certificateResourceName, names.AttrARN), ), // ExpectNonEmptyPlan: true, // https://github.com/hashicorp/terraform-provider-aws/issues/16913 }, @@ -225,7 +225,7 @@ func TestAccACMCertificateValidation_validationRecordFQDNSWildcardAndRoot(t *tes Config: testAccCertificateValidationConfig_recordFQDNsTwoRoute53Records(rootDomain, wildcardDomain, strconv.Quote(rootDomain)), Check: resource.ComposeTestCheckFunc( testAccCheckCertificateValidationExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", certificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, certificateResourceName, names.AttrARN), ), // ExpectNonEmptyPlan: true, // https://github.com/hashicorp/terraform-provider-aws/issues/16913 }, @@ -246,7 +246,7 @@ func testAccCheckCertificateValidationExists(ctx context.Context, n string) reso conn := acctest.Provider.Meta().(*conns.AWSClient).ACMClient(ctx) - _, err := tfacm.FindCertificateValidationByARN(ctx, conn, rs.Primary.Attributes["certificate_arn"]) + _, err := tfacm.FindCertificateValidationByARN(ctx, conn, rs.Primary.Attributes[names.AttrCertificateARN]) return err } From 8c5cf4c9fcc056a27862be2e0d2cb03c6166f3f6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:38 -0400 Subject: [PATCH 1319/1490] amplify: Use constants for strings --- internal/service/amplify/branch.go | 10 +++++----- internal/service/amplify/branch_test.go | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/amplify/branch.go b/internal/service/amplify/branch.go index 8a5a6ff17d2..f67ee677876 100644 --- a/internal/service/amplify/branch.go +++ b/internal/service/amplify/branch.go @@ -97,7 +97,7 @@ func resourceBranch() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -200,7 +200,7 @@ func resourceBranchCreate(ctx context.Context, d *schema.ResourceData, meta inte input.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("display_name"); ok { + if v, ok := d.GetOk(names.AttrDisplayName); ok { input.DisplayName = aws.String(v.(string)) } @@ -281,7 +281,7 @@ func resourceBranchRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("custom_domains", branch.CustomDomains) d.Set(names.AttrDescription, branch.Description) d.Set("destination_branch", branch.DestinationBranch) - d.Set("display_name", branch.DisplayName) + d.Set(names.AttrDisplayName, branch.DisplayName) d.Set("enable_auto_build", branch.EnableAutoBuild) d.Set("enable_basic_auth", branch.EnableBasicAuth) d.Set("enable_notification", branch.EnableNotification) @@ -326,8 +326,8 @@ func resourceBranchUpdate(ctx context.Context, d *schema.ResourceData, meta inte input.Description = aws.String(d.Get(names.AttrDescription).(string)) } - if d.HasChange("display_name") { - input.DisplayName = aws.String(d.Get("display_name").(string)) + if d.HasChange(names.AttrDisplayName) { + input.DisplayName = aws.String(d.Get(names.AttrDisplayName).(string)) } if d.HasChange("enable_auto_build") { diff --git a/internal/service/amplify/branch_test.go b/internal/service/amplify/branch_test.go index 85ed2b40992..594e4caf39c 100644 --- a/internal/service/amplify/branch_test.go +++ b/internal/service/amplify/branch_test.go @@ -45,7 +45,7 @@ func testAccBranch_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "custom_domains.#", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, "destination_branch", ""), - resource.TestCheckResourceAttr(resourceName, "display_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, rName), resource.TestCheckResourceAttr(resourceName, "enable_auto_build", "true"), resource.TestCheckResourceAttr(resourceName, "enable_basic_auth", "false"), resource.TestCheckResourceAttr(resourceName, "enable_notification", "false"), @@ -254,7 +254,7 @@ func testAccBranch_OptionalArguments(t *testing.T) { testAccCheckBranchExists(ctx, resourceName, &branch), resource.TestCheckResourceAttrPair(resourceName, "backend_environment_arn", backendEnvironment1ResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "testdescription1"), - resource.TestCheckResourceAttr(resourceName, "display_name", "testdisplayname1"), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, "testdisplayname1"), resource.TestCheckResourceAttr(resourceName, "enable_auto_build", "false"), resource.TestCheckResourceAttr(resourceName, "enable_notification", "true"), resource.TestCheckResourceAttr(resourceName, "enable_performance_mode", "true"), @@ -276,7 +276,7 @@ func testAccBranch_OptionalArguments(t *testing.T) { testAccCheckBranchExists(ctx, resourceName, &branch), resource.TestCheckResourceAttrPair(resourceName, "backend_environment_arn", backendEnvironment2ResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "testdescription2"), - resource.TestCheckResourceAttr(resourceName, "display_name", "testdisplayname2"), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, "testdisplayname2"), resource.TestCheckResourceAttr(resourceName, "enable_auto_build", "true"), resource.TestCheckResourceAttr(resourceName, "enable_notification", "false"), resource.TestCheckResourceAttr(resourceName, "enable_performance_mode", "false"), From 46612d0518925c7ae0375976484ba8f6c5232446 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:39 -0400 Subject: [PATCH 1320/1490] apigateway: Use constants for strings --- internal/service/apigateway/domain_name.go | 22 +++++++++---------- .../apigateway/domain_name_data_source.go | 4 ++-- .../domain_name_data_source_test.go | 2 +- .../service/apigateway/domain_name_test.go | 2 +- internal/service/apigateway/stage.go | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/service/apigateway/domain_name.go b/internal/service/apigateway/domain_name.go index 81f7a190567..ff6de9cbad6 100644 --- a/internal/service/apigateway/domain_name.go +++ b/internal/service/apigateway/domain_name.go @@ -49,7 +49,7 @@ func resourceDomainName() *schema.Resource { //According to AWS Documentation, ACM will be the only way to add certificates //to ApiGateway DomainNames. When this happens, we will be deprecating all certificate methods //except certificate_arn. We are not quite sure when this will happen. - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"certificate_body", "certificate_chain", "certificate_name", "certificate_private_key", "regional_certificate_arn", "regional_certificate_name"}, @@ -58,25 +58,25 @@ func resourceDomainName() *schema.Resource { Type: schema.TypeString, ForceNew: true, Optional: true, - ConflictsWith: []string{"certificate_arn", "regional_certificate_arn"}, + ConflictsWith: []string{names.AttrCertificateARN, "regional_certificate_arn"}, }, "certificate_chain": { Type: schema.TypeString, ForceNew: true, Optional: true, - ConflictsWith: []string{"certificate_arn", "regional_certificate_arn"}, + ConflictsWith: []string{names.AttrCertificateARN, "regional_certificate_arn"}, }, "certificate_name": { Type: schema.TypeString, Optional: true, - ConflictsWith: []string{"certificate_arn", "regional_certificate_arn", "regional_certificate_name"}, + ConflictsWith: []string{names.AttrCertificateARN, "regional_certificate_arn", "regional_certificate_name"}, }, "certificate_private_key": { Type: schema.TypeString, ForceNew: true, Optional: true, Sensitive: true, - ConflictsWith: []string{"certificate_arn", "regional_certificate_arn"}, + ConflictsWith: []string{names.AttrCertificateARN, "regional_certificate_arn"}, }, "certificate_upload_date": { Type: schema.TypeString, @@ -143,12 +143,12 @@ func resourceDomainName() *schema.Resource { "regional_certificate_arn": { Type: schema.TypeString, Optional: true, - ConflictsWith: []string{"certificate_arn", "certificate_body", "certificate_chain", "certificate_name", "certificate_private_key", "regional_certificate_name"}, + ConflictsWith: []string{names.AttrCertificateARN, "certificate_body", "certificate_chain", "certificate_name", "certificate_private_key", "regional_certificate_name"}, }, "regional_certificate_name": { Type: schema.TypeString, Optional: true, - ConflictsWith: []string{"certificate_arn", "certificate_name", "regional_certificate_arn"}, + ConflictsWith: []string{names.AttrCertificateARN, "certificate_name", "regional_certificate_arn"}, }, "regional_domain_name": { Type: schema.TypeString, @@ -183,7 +183,7 @@ func resourceDomainNameCreate(ctx context.Context, d *schema.ResourceData, meta Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("certificate_arn"); ok { + if v, ok := d.GetOk(names.AttrCertificateARN); ok { input.CertificateArn = aws.String(v.(string)) } @@ -251,7 +251,7 @@ func resourceDomainNameRead(ctx context.Context, d *schema.ResourceData, meta in } d.Set(names.AttrARN, domainNameARN(meta.(*conns.AWSClient), d.Id())) - d.Set("certificate_arn", domainName.CertificateArn) + d.Set(names.AttrCertificateARN, domainName.CertificateArn) d.Set("certificate_name", domainName.CertificateName) if domainName.CertificateUploadDate != nil { d.Set("certificate_upload_date", domainName.CertificateUploadDate.Format(time.RFC3339)) @@ -286,11 +286,11 @@ func resourceDomainNameUpdate(ctx context.Context, d *schema.ResourceData, meta if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll) { var operations []types.PatchOperation - if d.HasChange("certificate_arn") { + if d.HasChange(names.AttrCertificateARN) { operations = append(operations, types.PatchOperation{ Op: types.OpReplace, Path: aws.String("/certificateArn"), - Value: aws.String(d.Get("certificate_arn").(string)), + Value: aws.String(d.Get(names.AttrCertificateARN).(string)), }) } diff --git a/internal/service/apigateway/domain_name_data_source.go b/internal/service/apigateway/domain_name_data_source.go index 14be7b5a02d..f2128eab3ad 100644 --- a/internal/service/apigateway/domain_name_data_source.go +++ b/internal/service/apigateway/domain_name_data_source.go @@ -27,7 +27,7 @@ func dataSourceDomainName() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Computed: true, }, @@ -102,7 +102,7 @@ func dataSourceDomainNameRead(ctx context.Context, d *schema.ResourceData, meta d.SetId(aws.ToString(output.DomainName)) d.Set(names.AttrARN, domainNameARN(meta.(*conns.AWSClient), d.Id())) - d.Set("certificate_arn", output.CertificateArn) + d.Set(names.AttrCertificateARN, output.CertificateArn) d.Set("certificate_name", output.CertificateName) if output.CertificateUploadDate != nil { d.Set("certificate_upload_date", output.CertificateUploadDate.Format(time.RFC3339)) diff --git a/internal/service/apigateway/domain_name_data_source_test.go b/internal/service/apigateway/domain_name_data_source_test.go index e8e3652157f..2551af595a8 100644 --- a/internal/service/apigateway/domain_name_data_source_test.go +++ b/internal/service/apigateway/domain_name_data_source_test.go @@ -30,7 +30,7 @@ func TestAccAPIGatewayDomainNameDataSource_basic(t *testing.T) { Config: testAccDomainNameDataSourceConfig_regionalCertificateARN(rName, key, certificate), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(resourceName, names.AttrARN, dataSourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", dataSourceName, "certificate_arn"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, dataSourceName, names.AttrCertificateARN), resource.TestCheckResourceAttrPair(resourceName, "certificate_name", dataSourceName, "certificate_name"), resource.TestCheckResourceAttrPair(resourceName, "certificate_upload_date", dataSourceName, "certificate_upload_date"), resource.TestCheckResourceAttrPair(resourceName, "cloudfront_domain_name", dataSourceName, "cloudfront_domain_name"), diff --git a/internal/service/apigateway/domain_name_test.go b/internal/service/apigateway/domain_name_test.go index 6cebfc82f10..910fc1bdba0 100644 --- a/internal/service/apigateway/domain_name_test.go +++ b/internal/service/apigateway/domain_name_test.go @@ -42,7 +42,7 @@ func TestAccAPIGatewayDomainName_certificateARN(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckDomainNameExists(ctx, resourceName, &domainName), testAccCheckResourceAttrRegionalARNEdgeDomainName(resourceName, names.AttrARN, "apigateway", domain), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", acmCertificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, acmCertificateResourceName, names.AttrARN), resource.TestMatchResourceAttr(resourceName, "cloudfront_domain_name", regexache.MustCompile(`[0-9a-z]+.cloudfront.net`)), resource.TestCheckResourceAttr(resourceName, "cloudfront_zone_id", "Z2FDTNDATAQYW2"), resource.TestCheckResourceAttrPair(resourceName, names.AttrDomainName, acmCertificateResourceName, names.AttrDomainName), diff --git a/internal/service/apigateway/stage.go b/internal/service/apigateway/stage.go index be610862f76..18fbb413287 100644 --- a/internal/service/apigateway/stage.go +++ b/internal/service/apigateway/stage.go @@ -59,7 +59,7 @@ func resourceStage() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -553,7 +553,7 @@ func flattenAccessLogSettings(accessLogSettings *types.AccessLogSettings) []map[ result := make([]map[string]interface{}, 0, 1) if accessLogSettings != nil { result = append(result, map[string]interface{}{ - "destination_arn": aws.ToString(accessLogSettings.DestinationArn), + names.AttrDestinationARN: aws.ToString(accessLogSettings.DestinationArn), names.AttrFormat: aws.ToString(accessLogSettings.Format), }) } From f3214d82698bb8fd732fb58048523ec8ad482187 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:39 -0400 Subject: [PATCH 1321/1490] apigatewayv2: Use constants for strings --- internal/service/apigatewayv2/domain_name.go | 6 +++--- internal/service/apigatewayv2/stage.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/apigatewayv2/domain_name.go b/internal/service/apigatewayv2/domain_name.go index c31f3c00106..db39bcf393d 100644 --- a/internal/service/apigatewayv2/domain_name.go +++ b/internal/service/apigatewayv2/domain_name.go @@ -67,7 +67,7 @@ func resourceDomainName() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -316,7 +316,7 @@ func waitDomainNameAvailable(ctx context.Context, conn *apigatewayv2.Client, nam func expandDomainNameConfiguration(tfMap map[string]interface{}) awstypes.DomainNameConfiguration { apiObject := awstypes.DomainNameConfiguration{} - if v, ok := tfMap["certificate_arn"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCertificateARN].(string); ok && v != "" { apiObject.CertificateArn = aws.String(v) } @@ -360,7 +360,7 @@ func flattenDomainNameConfiguration(apiObject awstypes.DomainNameConfiguration) tfMap := map[string]interface{}{} if v := apiObject.CertificateArn; v != nil { - tfMap["certificate_arn"] = aws.ToString(v) + tfMap[names.AttrCertificateARN] = aws.ToString(v) } tfMap["endpoint_type"] = string(apiObject.EndpointType) diff --git a/internal/service/apigatewayv2/stage.go b/internal/service/apigatewayv2/stage.go index 8d6857d323d..cbaf774cc8b 100644 --- a/internal/service/apigatewayv2/stage.go +++ b/internal/service/apigatewayv2/stage.go @@ -49,7 +49,7 @@ func resourceStage() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -477,7 +477,7 @@ func expandAccessLogSettings(vSettings []interface{}) *awstypes.AccessLogSetting } mSettings := vSettings[0].(map[string]interface{}) - if vDestinationArn, ok := mSettings["destination_arn"].(string); ok && vDestinationArn != "" { + if vDestinationArn, ok := mSettings[names.AttrDestinationARN].(string); ok && vDestinationArn != "" { settings.DestinationArn = aws.String(vDestinationArn) } if vFormat, ok := mSettings[names.AttrFormat].(string); ok && vFormat != "" { @@ -493,7 +493,7 @@ func flattenAccessLogSettings(settings *awstypes.AccessLogSettings) []interface{ } return []interface{}{map[string]interface{}{ - "destination_arn": aws.ToString(settings.DestinationArn), + names.AttrDestinationARN: aws.ToString(settings.DestinationArn), names.AttrFormat: aws.ToString(settings.Format), }} } From 94f5f3cc77305453d25788e74625bd50beecb672 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:39 -0400 Subject: [PATCH 1322/1490] appflow: Use constants for strings --- internal/service/appflow/flow.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/appflow/flow.go b/internal/service/appflow/flow.go index f2b9df8f3a8..937f008aff5 100644 --- a/internal/service/appflow/flow.go +++ b/internal/service/appflow/flow.go @@ -1213,7 +1213,7 @@ func resourceFlow() *schema.Resource { Optional: true, ValidateFunc: validation.IsRFC3339Time, }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 256), @@ -2604,7 +2604,7 @@ func expandScheduledTriggerProperties(tfMap map[string]interface{}) *types.Sched a.ScheduleEndTime = aws.Time(v) } - if v, ok := tfMap["schedule_expression"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrScheduleExpression].(string); ok && v != "" { a.ScheduleExpression = aws.String(v) } @@ -3602,7 +3602,7 @@ func flattenScheduled(scheduledTriggerProperties *types.ScheduledTriggerProperti } if v := scheduledTriggerProperties.ScheduleExpression; v != nil { - m["schedule_expression"] = aws.ToString(v) + m[names.AttrScheduleExpression] = aws.ToString(v) } if v := scheduledTriggerProperties.ScheduleOffset; v != nil { From 9e2be0d2efecd6c4d165d14c5e12e4f9b00204bc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:39 -0400 Subject: [PATCH 1323/1490] appintegrations: Use constants for strings --- internal/service/appintegrations/data_integration.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/appintegrations/data_integration.go b/internal/service/appintegrations/data_integration.go index 19d4b223e95..a8a67b97602 100644 --- a/internal/service/appintegrations/data_integration.go +++ b/internal/service/appintegrations/data_integration.go @@ -82,7 +82,7 @@ func ResourceDataIntegration() *schema.Resource { validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z\/\._\-]+$`), "should be not be more than 255 alphanumeric, forward slashes, dots, underscores, or hyphen characters"), ), }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -220,7 +220,7 @@ func expandScheduleConfig(scheduleConfig []interface{}) *awstypes.ScheduleConfig result := &awstypes.ScheduleConfiguration{ FirstExecutionFrom: aws.String(tfMap["first_execution_from"].(string)), Object: aws.String(tfMap["object"].(string)), - ScheduleExpression: aws.String(tfMap["schedule_expression"].(string)), + ScheduleExpression: aws.String(tfMap[names.AttrScheduleExpression].(string)), } return result @@ -234,7 +234,7 @@ func flattenScheduleConfig(scheduleConfig *awstypes.ScheduleConfiguration) []int values := map[string]interface{}{ "first_execution_from": aws.ToString(scheduleConfig.FirstExecutionFrom), "object": aws.ToString(scheduleConfig.Object), - "schedule_expression": aws.ToString(scheduleConfig.ScheduleExpression), + names.AttrScheduleExpression: aws.ToString(scheduleConfig.ScheduleExpression), } return []interface{}{values} From 4fc4212d20fb6bc5e7a02b8f90120544911559b8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:39 -0400 Subject: [PATCH 1324/1490] appmesh: Use constants for strings --- internal/service/appmesh/flex.go | 4 ++-- internal/service/appmesh/virtual_gateway.go | 6 +++--- internal/service/appmesh/virtual_node.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/appmesh/flex.go b/internal/service/appmesh/flex.go index eedb55f8c69..dcc1f6e0e80 100644 --- a/internal/service/appmesh/flex.go +++ b/internal/service/appmesh/flex.go @@ -912,7 +912,7 @@ func expandVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec { mAcm := vAcm[0].(map[string]interface{}) - if vCertificateArn, ok := mAcm["certificate_arn"].(string); ok && vCertificateArn != "" { + if vCertificateArn, ok := mAcm[names.AttrCertificateARN].(string); ok && vCertificateArn != "" { acm.CertificateArn = aws.String(vCertificateArn) } @@ -1765,7 +1765,7 @@ func flattenVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} { if acm := certificate.Acm; acm != nil { mAcm := map[string]interface{}{ - "certificate_arn": aws.StringValue(acm.CertificateArn), + names.AttrCertificateARN: aws.StringValue(acm.CertificateArn), } mCertificate["acm"] = []interface{}{mAcm} diff --git a/internal/service/appmesh/virtual_gateway.go b/internal/service/appmesh/virtual_gateway.go index ed38811b3b4..8b743f97f0b 100644 --- a/internal/service/appmesh/virtual_gateway.go +++ b/internal/service/appmesh/virtual_gateway.go @@ -449,7 +449,7 @@ func resourceVirtualGatewaySpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -977,7 +977,7 @@ func expandVirtualGatewaySpec(vSpec []interface{}) *appmesh.VirtualGatewaySpec { mAcm := vAcm[0].(map[string]interface{}) - if vCertificateArn, ok := mAcm["certificate_arn"].(string); ok && vCertificateArn != "" { + if vCertificateArn, ok := mAcm[names.AttrCertificateARN].(string); ok && vCertificateArn != "" { acm.CertificateArn = aws.String(vCertificateArn) } @@ -1352,7 +1352,7 @@ func flattenVirtualGatewaySpec(spec *appmesh.VirtualGatewaySpec) []interface{} { if acm := certificate.Acm; acm != nil { mAcm := map[string]interface{}{ - "certificate_arn": aws.StringValue(acm.CertificateArn), + names.AttrCertificateARN: aws.StringValue(acm.CertificateArn), } mCertificate["acm"] = []interface{}{mAcm} diff --git a/internal/service/appmesh/virtual_node.go b/internal/service/appmesh/virtual_node.go index 3993099907d..81fbdff1d21 100644 --- a/internal/service/appmesh/virtual_node.go +++ b/internal/service/appmesh/virtual_node.go @@ -704,7 +704,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, From 7fe2411375070246fb278355be4bd3913cffaf40 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:40 -0400 Subject: [PATCH 1325/1490] apprunner: Use constants for strings --- internal/service/apprunner/service.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/apprunner/service.go b/internal/service/apprunner/service.go index d938806a2e7..24c0d938317 100644 --- a/internal/service/apprunner/service.go +++ b/internal/service/apprunner/service.go @@ -51,7 +51,7 @@ func resourceService() *schema.Resource { Computed: true, ValidateFunc: verify.ValidARN, }, - "encryption_configuration": { + names.AttrEncryptionConfiguration: { Type: schema.TypeList, Optional: true, ForceNew: true, @@ -148,7 +148,7 @@ func resourceService() *schema.Resource { }, }, }, - "network_configuration": { + names.AttrNetworkConfiguration: { Type: schema.TypeList, Optional: true, Computed: true, @@ -447,7 +447,7 @@ func resourceServiceCreate(ctx context.Context, d *schema.ResourceData, meta int input.AutoScalingConfigurationArn = aws.String(v.(string)) } - if v, ok := d.GetOk("encryption_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrEncryptionConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.EncryptionConfiguration = expandServiceEncryptionConfiguration(v.([]interface{})) } @@ -459,7 +459,7 @@ func resourceServiceCreate(ctx context.Context, d *schema.ResourceData, meta int input.InstanceConfiguration = expandServiceInstanceConfiguration(v.([]interface{})) } - if v, ok := d.GetOk("network_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrNetworkConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.NetworkConfiguration = expandNetworkConfiguration(v.([]interface{})) } @@ -524,7 +524,7 @@ func resourceServiceRead(ctx context.Context, d *schema.ResourceData, meta inter } else { d.Set("auto_scaling_configuration_arn", nil) } - if err := d.Set("encryption_configuration", flattenServiceEncryptionConfiguration(service.EncryptionConfiguration)); err != nil { + if err := d.Set(names.AttrEncryptionConfiguration, flattenServiceEncryptionConfiguration(service.EncryptionConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting encryption_configuration: %s", err) } if err := d.Set("health_check_configuration", flattenServiceHealthCheckConfiguration(service.HealthCheckConfiguration)); err != nil { @@ -533,7 +533,7 @@ func resourceServiceRead(ctx context.Context, d *schema.ResourceData, meta inter if err := d.Set("instance_configuration", flattenServiceInstanceConfiguration(service.InstanceConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting instance_configuration: %s", err) } - if err := d.Set("network_configuration", flattenNetworkConfiguration(service.NetworkConfiguration)); err != nil { + if err := d.Set(names.AttrNetworkConfiguration, flattenNetworkConfiguration(service.NetworkConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting network_configuration: %s", err) } if err := d.Set("observability_configuration", flattenServiceObservabilityConfiguration(service.ObservabilityConfiguration)); err != nil { @@ -572,8 +572,8 @@ func resourceServiceUpdate(ctx context.Context, d *schema.ResourceData, meta int input.InstanceConfiguration = expandServiceInstanceConfiguration(d.Get("instance_configuration").([]interface{})) } - if d.HasChange("network_configuration") { - input.NetworkConfiguration = expandNetworkConfiguration(d.Get("network_configuration").([]interface{})) + if d.HasChange(names.AttrNetworkConfiguration) { + input.NetworkConfiguration = expandNetworkConfiguration(d.Get(names.AttrNetworkConfiguration).([]interface{})) } if d.HasChange("observability_configuration") { From 386ff1c51e015b468d396397accf33b2fd124e42 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:40 -0400 Subject: [PATCH 1326/1490] appstream: Use constants for strings --- internal/service/appstream/fleet.go | 10 +++++----- internal/service/appstream/fleet_test.go | 4 ++-- internal/service/appstream/image_builder.go | 6 +++--- internal/service/appstream/stack.go | 10 +++++----- internal/service/appstream/stack_test.go | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/service/appstream/fleet.go b/internal/service/appstream/fleet.go index c131bfe5d47..1dccfabdee1 100644 --- a/internal/service/appstream/fleet.go +++ b/internal/service/appstream/fleet.go @@ -101,7 +101,7 @@ func ResourceFleet() *schema.Resource { Computed: true, ValidateFunc: validation.IntBetween(60, 360000), }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -241,7 +241,7 @@ func resourceFleetCreate(ctx context.Context, d *schema.ResourceData, meta inter input.IdleDisconnectTimeoutInSeconds = aws.Int64(int64(v.(int))) } - if v, ok := d.GetOk("display_name"); ok { + if v, ok := d.GetOk(names.AttrDisplayName); ok { input.DisplayName = aws.String(v.(string)) } @@ -372,7 +372,7 @@ func resourceFleetRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set("created_time", aws.TimeValue(fleet.CreatedTime).Format(time.RFC3339)) d.Set(names.AttrDescription, fleet.Description) - d.Set("display_name", fleet.DisplayName) + d.Set(names.AttrDisplayName, fleet.DisplayName) d.Set("disconnect_timeout_in_seconds", fleet.DisconnectTimeoutInSeconds) if fleet.DomainJoinInfo != nil { @@ -457,8 +457,8 @@ func resourceFleetUpdate(ctx context.Context, d *schema.ResourceData, meta inter input.IdleDisconnectTimeoutInSeconds = aws.Int64(int64(d.Get("idle_disconnect_timeout_in_seconds").(int))) } - if d.HasChange("display_name") { - input.DisplayName = aws.String(d.Get("display_name").(string)) + if d.HasChange(names.AttrDisplayName) { + input.DisplayName = aws.String(d.Get(names.AttrDisplayName).(string)) } if d.HasChange("image_name") { diff --git a/internal/service/appstream/fleet_test.go b/internal/service/appstream/fleet_test.go index 98edf281e69..cb6982695e6 100644 --- a/internal/service/appstream/fleet_test.go +++ b/internal/service/appstream/fleet_test.go @@ -178,7 +178,7 @@ func TestAccAppStreamFleet_completeWithoutStop(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrInstanceType, instanceType), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), acctest.CheckResourceAttrRFC3339(resourceName, "created_time"), - resource.TestCheckResourceAttr(resourceName, "display_name", displayName), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, displayName), ), }, { @@ -191,7 +191,7 @@ func TestAccAppStreamFleet_completeWithoutStop(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), acctest.CheckResourceAttrRFC3339(resourceName, "created_time"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), - resource.TestCheckResourceAttr(resourceName, "display_name", displayNameUpdated), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, displayNameUpdated), ), }, { diff --git a/internal/service/appstream/image_builder.go b/internal/service/appstream/image_builder.go index c2ab3394362..6d3e72c162a 100644 --- a/internal/service/appstream/image_builder.go +++ b/internal/service/appstream/image_builder.go @@ -80,7 +80,7 @@ func ResourceImageBuilder() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(0, 256), }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -203,7 +203,7 @@ func resourceImageBuilderCreate(ctx context.Context, d *schema.ResourceData, met input.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("display_name"); ok { + if v, ok := d.GetOk(names.AttrDisplayName); ok { input.DisplayName = aws.String(v.(string)) } @@ -273,7 +273,7 @@ func resourceImageBuilderRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrARN, arn) d.Set("created_time", aws.TimeValue(imageBuilder.CreatedTime).Format(time.RFC3339)) d.Set(names.AttrDescription, imageBuilder.Description) - d.Set("display_name", imageBuilder.DisplayName) + d.Set(names.AttrDisplayName, imageBuilder.DisplayName) if imageBuilder.DomainJoinInfo != nil { if err = d.Set("domain_join_info", []interface{}{flattenDomainInfo(imageBuilder.DomainJoinInfo)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting domain_join_info: %s", err) diff --git a/internal/service/appstream/stack.go b/internal/service/appstream/stack.go index 9bc5ddbf543..0ff81d32a9b 100644 --- a/internal/service/appstream/stack.go +++ b/internal/service/appstream/stack.go @@ -99,7 +99,7 @@ func ResourceStack() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(0, 256), }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 100), @@ -275,7 +275,7 @@ func resourceStackCreate(ctx context.Context, d *schema.ResourceData, meta inter input.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("display_name"); ok { + if v, ok := d.GetOk(names.AttrDisplayName); ok { input.DisplayName = aws.String(v.(string)) } @@ -342,7 +342,7 @@ func resourceStackRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set(names.AttrARN, stack.Arn) d.Set("created_time", aws.TimeValue(stack.CreatedTime).Format(time.RFC3339)) d.Set(names.AttrDescription, stack.Description) - d.Set("display_name", stack.DisplayName) + d.Set(names.AttrDisplayName, stack.DisplayName) if err = d.Set("embed_host_domains", flex.FlattenStringList(stack.EmbedHostDomains)); err != nil { return sdkdiag.AppendErrorf(diags, "setting embed_host_domains: %s", err) } @@ -384,8 +384,8 @@ func resourceStackUpdate(ctx context.Context, d *schema.ResourceData, meta inter input.Description = aws.String(d.Get(names.AttrDescription).(string)) } - if d.HasChange("display_name") { - input.DisplayName = aws.String(d.Get("display_name").(string)) + if d.HasChange(names.AttrDisplayName) { + input.DisplayName = aws.String(d.Get(names.AttrDisplayName).(string)) } if d.HasChange("feedback_url") { diff --git a/internal/service/appstream/stack_test.go b/internal/service/appstream/stack_test.go index 56ecdaee2bc..799670a2ca7 100644 --- a/internal/service/appstream/stack_test.go +++ b/internal/service/appstream/stack_test.go @@ -42,7 +42,7 @@ func TestAccAppStreamStack_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "application_settings.0.enabled", "false"), resource.TestCheckResourceAttr(resourceName, "application_settings.0.settings_group", ""), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), - resource.TestCheckResourceAttr(resourceName, "display_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, ""), resource.TestCheckResourceAttr(resourceName, "embed_host_domains.#", "0"), resource.TestCheckResourceAttr(resourceName, "feedback_url", ""), resource.TestCheckResourceAttr(resourceName, "redirect_url", ""), @@ -113,7 +113,7 @@ func TestAccAppStreamStack_complete(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "application_settings.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_settings.0.enabled", "true"), resource.TestCheckResourceAttr(resourceName, "application_settings.0.settings_group", "SettingsGroup"), - resource.TestCheckResourceAttr(resourceName, "display_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, ""), resource.TestCheckResourceAttr(resourceName, "feedback_url", ""), resource.TestCheckResourceAttr(resourceName, "redirect_url", ""), resource.TestCheckResourceAttr(resourceName, "storage_connectors.#", "1"), From 3f71417b63576d5558654572e9cf0ff1fbd40d69 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:40 -0400 Subject: [PATCH 1327/1490] appsync: Use constants for strings --- internal/service/appsync/domain_name.go | 6 +++--- internal/service/appsync/domain_name_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/appsync/domain_name.go b/internal/service/appsync/domain_name.go index 94e103582b6..ea231219ed9 100644 --- a/internal/service/appsync/domain_name.go +++ b/internal/service/appsync/domain_name.go @@ -38,7 +38,7 @@ func ResourceDomainName() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -66,7 +66,7 @@ func resourceDomainNameCreate(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).AppSyncConn(ctx) params := &appsync.CreateDomainNameInput{ - CertificateArn: aws.String(d.Get("certificate_arn").(string)), + CertificateArn: aws.String(d.Get(names.AttrCertificateARN).(string)), Description: aws.String(d.Get(names.AttrDescription).(string)), DomainName: aws.String(d.Get(names.AttrDomainName).(string)), } @@ -98,7 +98,7 @@ func resourceDomainNameRead(ctx context.Context, d *schema.ResourceData, meta in d.Set(names.AttrDomainName, domainName.DomainName) d.Set(names.AttrDescription, domainName.Description) - d.Set("certificate_arn", domainName.CertificateArn) + d.Set(names.AttrCertificateARN, domainName.CertificateArn) d.Set(names.AttrHostedZoneID, domainName.HostedZoneId) d.Set("appsync_domain_name", domainName.AppsyncDomainName) diff --git a/internal/service/appsync/domain_name_test.go b/internal/service/appsync/domain_name_test.go index bd753adf62f..4b28e443be8 100644 --- a/internal/service/appsync/domain_name_test.go +++ b/internal/service/appsync/domain_name_test.go @@ -40,7 +40,7 @@ func testAccDomainName_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckDomainNameExists(ctx, resourceName, &domainName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", acmCertificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, acmCertificateResourceName, names.AttrARN), ), }, { From d1c991652fa2d5c3c97e880c271484277bc4af07 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:40 -0400 Subject: [PATCH 1328/1490] athena: Use constants for strings --- internal/service/athena/database.go | 4 ++-- internal/service/athena/database_test.go | 2 +- internal/service/athena/workgroup.go | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/athena/database.go b/internal/service/athena/database.go index 1cc1a5dfc91..33d55768ad8 100644 --- a/internal/service/athena/database.go +++ b/internal/service/athena/database.go @@ -65,7 +65,7 @@ func resourceDatabase() *schema.Resource { Optional: true, ForceNew: true, }, - "encryption_configuration": { + names.AttrEncryptionConfiguration: { Type: schema.TypeList, Optional: true, ForceNew: true, @@ -239,7 +239,7 @@ func findDatabaseByName(ctx context.Context, conn *athena.Client, name string) ( func expandResultConfiguration(d *schema.ResourceData) *types.ResultConfiguration { resultConfig := &types.ResultConfiguration{ OutputLocation: aws.String("s3://" + d.Get(names.AttrBucket).(string)), - EncryptionConfiguration: expandResultConfigurationEncryptionConfig(d.Get("encryption_configuration").([]interface{})), + EncryptionConfiguration: expandResultConfigurationEncryptionConfig(d.Get(names.AttrEncryptionConfiguration).([]interface{})), } if v, ok := d.GetOk("expected_bucket_owner"); ok { diff --git a/internal/service/athena/database_test.go b/internal/service/athena/database_test.go index efd2260024c..c8450c5312a 100644 --- a/internal/service/athena/database_test.go +++ b/internal/service/athena/database_test.go @@ -142,7 +142,7 @@ func TestAccAthenaDatabase_encryption(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{names.AttrBucket, names.AttrForceDestroy, "encryption_configuration"}, + ImportStateVerifyIgnore: []string{names.AttrBucket, names.AttrForceDestroy, names.AttrEncryptionConfiguration}, }, }, }) diff --git a/internal/service/athena/workgroup.go b/internal/service/athena/workgroup.go index 6415c25c20e..13f84230367 100644 --- a/internal/service/athena/workgroup.go +++ b/internal/service/athena/workgroup.go @@ -113,7 +113,7 @@ func resourceWorkGroup() *schema.Resource { }, }, }, - "encryption_configuration": { + names.AttrEncryptionConfiguration: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -442,7 +442,7 @@ func expandWorkGroupResultConfiguration(l []interface{}) *types.ResultConfigurat resultConfiguration := &types.ResultConfiguration{} - if v, ok := m["encryption_configuration"]; ok { + if v, ok := m[names.AttrEncryptionConfiguration]; ok { resultConfiguration.EncryptionConfiguration = expandWorkGroupEncryptionConfiguration(v.([]interface{})) } @@ -470,7 +470,7 @@ func expandWorkGroupResultConfigurationUpdates(l []interface{}) *types.ResultCon resultConfigurationUpdates := &types.ResultConfigurationUpdates{} - if v, ok := m["encryption_configuration"]; ok { + if v, ok := m[names.AttrEncryptionConfiguration]; ok { resultConfigurationUpdates.EncryptionConfiguration = expandWorkGroupEncryptionConfiguration(v.([]interface{})) } else { resultConfigurationUpdates.RemoveEncryptionConfiguration = aws.Bool(true) @@ -554,7 +554,7 @@ func flattenWorkGroupResultConfiguration(resultConfiguration *types.ResultConfig } m := map[string]interface{}{ - "encryption_configuration": flattenWorkGroupEncryptionConfiguration(resultConfiguration.EncryptionConfiguration), + names.AttrEncryptionConfiguration: flattenWorkGroupEncryptionConfiguration(resultConfiguration.EncryptionConfiguration), "output_location": aws.ToString(resultConfiguration.OutputLocation), } From 7aa1c4576d458889f771bff6cf48713614bffdb2 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:40 -0400 Subject: [PATCH 1329/1490] backup: Use constants for strings --- internal/service/backup/framework.go | 4 +-- .../service/backup/framework_data_source.go | 4 +-- .../backup/framework_data_source_test.go | 4 +-- internal/service/backup/framework_test.go | 26 +++++++++---------- internal/service/backup/plan.go | 6 ++--- internal/service/backup/plan_test.go | 4 +-- internal/service/backup/report_plan.go | 4 +-- .../service/backup/report_plan_data_source.go | 4 +-- .../backup/report_plan_data_source_test.go | 4 +-- internal/service/backup/report_plan_test.go | 18 ++++++------- 10 files changed, 39 insertions(+), 39 deletions(-) diff --git a/internal/service/backup/framework.go b/internal/service/backup/framework.go index aae41b2be78..809d24165c2 100644 --- a/internal/service/backup/framework.go +++ b/internal/service/backup/framework.go @@ -107,7 +107,7 @@ func ResourceFramework() *schema.Resource { }, }, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -192,7 +192,7 @@ func resourceFrameworkRead(ctx context.Context, d *schema.ResourceData, meta int d.Set(names.AttrName, resp.FrameworkName) d.Set(names.AttrStatus, resp.FrameworkStatus) - if err := d.Set("creation_time", resp.CreationTime.Format(time.RFC3339)); err != nil { + if err := d.Set(names.AttrCreationTime, resp.CreationTime.Format(time.RFC3339)); err != nil { return sdkdiag.AppendErrorf(diags, "setting creation_time: %s", err) } diff --git a/internal/service/backup/framework_data_source.go b/internal/service/backup/framework_data_source.go index 10da3eda94e..cacd33ee8b2 100644 --- a/internal/service/backup/framework_data_source.go +++ b/internal/service/backup/framework_data_source.go @@ -78,7 +78,7 @@ func DataSourceFramework() *schema.Resource { }, }, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -125,7 +125,7 @@ func dataSourceFrameworkRead(ctx context.Context, d *schema.ResourceData, meta i d.Set(names.AttrName, resp.FrameworkName) d.Set(names.AttrStatus, resp.FrameworkStatus) - if err := d.Set("creation_time", resp.CreationTime.Format(time.RFC3339)); err != nil { + if err := d.Set(names.AttrCreationTime, resp.CreationTime.Format(time.RFC3339)); err != nil { return sdkdiag.AppendErrorf(diags, "setting creation_time: %s", err) } diff --git a/internal/service/backup/framework_data_source_test.go b/internal/service/backup/framework_data_source_test.go index 0733a28e74a..f69a2afae23 100644 --- a/internal/service/backup/framework_data_source_test.go +++ b/internal/service/backup/framework_data_source_test.go @@ -53,7 +53,7 @@ func testAccFrameworkDataSource_basic(t *testing.T) { names.AttrName: "BACKUP_RECOVERY_POINT_MANUAL_DELETION_DISABLED", }), resource.TestCheckTypeSetElemAttrPair(datasourceName, "control.*.scope.0.compliance_resource_ids.0", "aws_ebs_volume.test", names.AttrID), - resource.TestCheckResourceAttrPair(datasourceName, "creation_time", resourceName, "creation_time"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrCreationTime, resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(datasourceName, "deployment_status", resourceName, "deployment_status"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), @@ -86,7 +86,7 @@ func testAccFrameworkDataSource_controlScopeTag(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "control.0.scope.#", resourceName, "control.0.scope.#"), resource.TestCheckResourceAttrPair(datasourceName, "control.0.scope.0.tags.%", resourceName, "control.0.scope.0.tags.%"), resource.TestCheckResourceAttrPair(datasourceName, "control.0.scope.0.tags.Name", resourceName, "control.0.scope.0.tags.Name"), - resource.TestCheckResourceAttrPair(datasourceName, "creation_time", resourceName, "creation_time"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrCreationTime, resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(datasourceName, "deployment_status", resourceName, "deployment_status"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), diff --git a/internal/service/backup/framework_test.go b/internal/service/backup/framework_test.go index b8b4d02309e..36637095fa8 100644 --- a/internal/service/backup/framework_test.go +++ b/internal/service/backup/framework_test.go @@ -65,7 +65,7 @@ func testAccFramework_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "control.0.scope.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.0", "EBS"), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, originalDescription), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -89,7 +89,7 @@ func testAccFramework_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "control.0.scope.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.0", "EBS"), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, updatedDescription), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -126,7 +126,7 @@ func testAccFramework_updateTags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "control.0.scope.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.0", "EBS"), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -150,7 +150,7 @@ func testAccFramework_updateTags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "control.0.scope.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.0", "EBS"), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -175,7 +175,7 @@ func testAccFramework_updateTags(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "control.0.scope.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.0", "EBS"), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -216,7 +216,7 @@ func testAccFramework_updateControlScope(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "control.0.scope.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.0", "EBS"), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -242,7 +242,7 @@ func testAccFramework_updateControlScope(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "control.0.scope.0.compliance_resource_ids.0", "aws_ebs_volume.test", names.AttrID), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.0", "EBS"), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -266,7 +266,7 @@ func testAccFramework_updateControlScope(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "control.0.scope.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.tags.Name", originalControlScopeTagValue), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -290,7 +290,7 @@ func testAccFramework_updateControlScope(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "control.0.scope.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.tags.Name", updatedControlScopeTagValue), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -339,7 +339,7 @@ func testAccFramework_updateControlInputParameters(t *testing.T) { names.AttrName: "requiredFrequencyValue", names.AttrValue: "1", }), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -373,7 +373,7 @@ func testAccFramework_updateControlInputParameters(t *testing.T) { names.AttrName: "requiredFrequencyValue", names.AttrValue: "1", }), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -410,7 +410,7 @@ func testAccFramework_updateControls(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "control.0.scope.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.#", "1"), resource.TestCheckResourceAttr(resourceName, "control.0.scope.0.compliance_resource_types.0", "EBS"), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), @@ -452,7 +452,7 @@ func testAccFramework_updateControls(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "control.*", map[string]string{ names.AttrName: "BACKUP_RECOVERY_POINT_MANUAL_DELETION_DISABLED", }), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), diff --git a/internal/service/backup/plan.go b/internal/service/backup/plan.go index d02ebe43b2f..dd4522fb8bf 100644 --- a/internal/service/backup/plan.go +++ b/internal/service/backup/plan.go @@ -52,7 +52,7 @@ func ResourcePlan() *schema.Resource { Required: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ @@ -373,7 +373,7 @@ func expandPlanAdvancedSettings(vAdvancedBackupSettings *schema.Set) []*backup.A if v, ok := mAdvancedBackupSetting["backup_options"].(map[string]interface{}); ok && v != nil { advancedBackupSetting.BackupOptions = flex.ExpandStringMap(v) } - if v, ok := mAdvancedBackupSetting["resource_type"].(string); ok && v != "" { + if v, ok := mAdvancedBackupSetting[names.AttrResourceType].(string); ok && v != "" { advancedBackupSetting.ResourceType = aws.String(v) } @@ -462,7 +462,7 @@ func flattenPlanAdvancedSettings(advancedBackupSettings []*backup.AdvancedBackup for _, advancedBackupSetting := range advancedBackupSettings { mAdvancedBackupSetting := map[string]interface{}{ "backup_options": aws.StringValueMap(advancedBackupSetting.BackupOptions), - "resource_type": aws.StringValue(advancedBackupSetting.ResourceType), + names.AttrResourceType: aws.StringValue(advancedBackupSetting.ResourceType), } vAdvancedBackupSettings = append(vAdvancedBackupSettings, mAdvancedBackupSetting) diff --git a/internal/service/backup/plan_test.go b/internal/service/backup/plan_test.go index be200919a9f..deeb2ef09ba 100644 --- a/internal/service/backup/plan_test.go +++ b/internal/service/backup/plan_test.go @@ -585,7 +585,7 @@ func TestAccBackupPlan_advancedBackupSetting(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "advanced_backup_setting.*", map[string]string{ "backup_options.%": "1", "backup_options.WindowsVSS": names.AttrEnabled, - "resource_type": "EC2", + names.AttrResourceType: "EC2", }), ), }, @@ -603,7 +603,7 @@ func TestAccBackupPlan_advancedBackupSetting(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "advanced_backup_setting.*", map[string]string{ "backup_options.%": "1", "backup_options.WindowsVSS": "disabled", - "resource_type": "EC2", + names.AttrResourceType: "EC2", }), ), }, diff --git a/internal/service/backup/report_plan.go b/internal/service/backup/report_plan.go index 2036b0afc80..9d7b755a027 100644 --- a/internal/service/backup/report_plan.go +++ b/internal/service/backup/report_plan.go @@ -43,7 +43,7 @@ func ResourceReportPlan() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -193,7 +193,7 @@ func resourceReportPlanRead(ctx context.Context, d *schema.ResourceData, meta in } d.Set(names.AttrARN, reportPlan.ReportPlanArn) - d.Set("creation_time", reportPlan.CreationTime.Format(time.RFC3339)) + d.Set(names.AttrCreationTime, reportPlan.CreationTime.Format(time.RFC3339)) d.Set("deployment_status", reportPlan.DeploymentStatus) d.Set(names.AttrDescription, reportPlan.ReportPlanDescription) d.Set(names.AttrName, reportPlan.ReportPlanName) diff --git a/internal/service/backup/report_plan_data_source.go b/internal/service/backup/report_plan_data_source.go index 73616adacc4..8a57a51a85e 100644 --- a/internal/service/backup/report_plan_data_source.go +++ b/internal/service/backup/report_plan_data_source.go @@ -26,7 +26,7 @@ func DataSourceReportPlan() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -129,7 +129,7 @@ func dataSourceReportPlanRead(ctx context.Context, d *schema.ResourceData, meta d.SetId(aws.StringValue(reportPlan.ReportPlanName)) d.Set(names.AttrARN, reportPlan.ReportPlanArn) - d.Set("creation_time", reportPlan.CreationTime.Format(time.RFC3339)) + d.Set(names.AttrCreationTime, reportPlan.CreationTime.Format(time.RFC3339)) d.Set("deployment_status", reportPlan.DeploymentStatus) d.Set(names.AttrDescription, reportPlan.ReportPlanDescription) d.Set(names.AttrName, reportPlan.ReportPlanName) diff --git a/internal/service/backup/report_plan_data_source_test.go b/internal/service/backup/report_plan_data_source_test.go index 95550921455..479e4012de7 100644 --- a/internal/service/backup/report_plan_data_source_test.go +++ b/internal/service/backup/report_plan_data_source_test.go @@ -34,7 +34,7 @@ func TestAccBackupReportPlanDataSource_basic(t *testing.T) { Config: testAccReportPlanDataSourceConfig_basic(rName, rName2), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(datasourceName, "creation_time", resourceName, "creation_time"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrCreationTime, resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(datasourceName, "deployment_status"), // CREATE_IN_PROGRESS | UPDATE_IN_PROGRESS | DELETE_IN_PROGRESS | COMPLETED resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(datasourceName, "report_delivery_channel.#", resourceName, "report_delivery_channel.#"), @@ -68,7 +68,7 @@ func TestAccBackupReportPlanDataSource_reportSettings(t *testing.T) { Config: testAccReportPlanDataSourceConfig_reportSettings(rName, rName2), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(datasourceName, "creation_time", resourceName, "creation_time"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrCreationTime, resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(datasourceName, "deployment_status"), // CREATE_IN_PROGRESS | UPDATE_IN_PROGRESS | DELETE_IN_PROGRESS | COMPLETED resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(datasourceName, "report_delivery_channel.#", resourceName, "report_delivery_channel.#"), diff --git a/internal/service/backup/report_plan_test.go b/internal/service/backup/report_plan_test.go index 0954885dad9..5857ed21239 100644 --- a/internal/service/backup/report_plan_test.go +++ b/internal/service/backup/report_plan_test.go @@ -39,7 +39,7 @@ func TestAccBackupReportPlan_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckReportPlanExists(ctx, resourceName, &reportPlan), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, originalDescription), resource.TestCheckResourceAttr(resourceName, "report_delivery_channel.#", "1"), @@ -62,7 +62,7 @@ func TestAccBackupReportPlan_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckReportPlanExists(ctx, resourceName, &reportPlan), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, updatedDescription), resource.TestCheckResourceAttr(resourceName, "report_delivery_channel.#", "1"), @@ -98,7 +98,7 @@ func TestAccBackupReportPlan_updateTags(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckReportPlanExists(ctx, resourceName, &reportPlan), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, "report_delivery_channel.#", "1"), @@ -121,7 +121,7 @@ func TestAccBackupReportPlan_updateTags(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckReportPlanExists(ctx, resourceName, &reportPlan), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, "report_delivery_channel.#", "1"), @@ -145,7 +145,7 @@ func TestAccBackupReportPlan_updateTags(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckReportPlanExists(ctx, resourceName, &reportPlan), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, "report_delivery_channel.#", "1"), @@ -183,7 +183,7 @@ func TestAccBackupReportPlan_updateReportDeliveryChannel(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckReportPlanExists(ctx, resourceName, &reportPlan), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, "report_delivery_channel.#", "1"), @@ -206,7 +206,7 @@ func TestAccBackupReportPlan_updateReportDeliveryChannel(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckReportPlanExists(ctx, resourceName, &reportPlan), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, "report_delivery_channel.#", "1"), @@ -243,7 +243,7 @@ func TestAccBackupReportPlan_updateReportSettings(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckReportPlanExists(ctx, resourceName, &reportPlan), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, "report_delivery_channel.#", "1"), @@ -268,7 +268,7 @@ func TestAccBackupReportPlan_updateReportSettings(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckReportPlanExists(ctx, resourceName, &reportPlan), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "deployment_status"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttr(resourceName, "report_delivery_channel.#", "1"), From 07fcbd283648ee9f896e7ccb3ca1e291bbc8e32b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:41 -0400 Subject: [PATCH 1330/1490] bedrock: Use constants for strings --- internal/service/bedrock/custom_model_data_source.go | 2 +- internal/service/bedrock/custom_models_data_source.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/bedrock/custom_model_data_source.go b/internal/service/bedrock/custom_model_data_source.go index 85e8ec3ce7a..f2b7135f6e7 100644 --- a/internal/service/bedrock/custom_model_data_source.go +++ b/internal/service/bedrock/custom_model_data_source.go @@ -39,7 +39,7 @@ func (d *customModelDataSource) Schema(ctx context.Context, request datasource.S "base_model_arn": schema.StringAttribute{ Computed: true, }, - "creation_time": schema.StringAttribute{ + names.AttrCreationTime: schema.StringAttribute{ CustomType: timetypes.RFC3339Type{}, Computed: true, }, diff --git a/internal/service/bedrock/custom_models_data_source.go b/internal/service/bedrock/custom_models_data_source.go index 334980dfa21..24ecc5fdc6c 100644 --- a/internal/service/bedrock/custom_models_data_source.go +++ b/internal/service/bedrock/custom_models_data_source.go @@ -40,7 +40,7 @@ func (d *customModelsDataSource) Schema(ctx context.Context, request datasource. Computed: true, ElementType: types.ObjectType{ AttrTypes: map[string]attr.Type{ - "creation_time": timetypes.RFC3339Type{}, + names.AttrCreationTime: timetypes.RFC3339Type{}, "model_arn": types.StringType, "model_name": types.StringType, }, From 75e8b3e18b472f420021334b3656b71441759f88 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:41 -0400 Subject: [PATCH 1331/1490] budgets: Use constants for strings --- internal/service/budgets/budget_action.go | 10 +++++----- internal/service/budgets/budget_action_test.go | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/budgets/budget_action.go b/internal/service/budgets/budget_action.go index c829763604a..f694d658c20 100644 --- a/internal/service/budgets/budget_action.go +++ b/internal/service/budgets/budget_action.go @@ -188,7 +188,7 @@ func ResourceBudgetAction() *schema.Resource { }, }, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -245,7 +245,7 @@ func resourceBudgetActionCreate(ctx context.Context, d *schema.ResourceData, met ApprovalModel: awstypes.ApprovalModel(d.Get("approval_model").(string)), BudgetName: aws.String(d.Get("budget_name").(string)), Definition: expandBudgetActionActionDefinition(d.Get("definition").([]interface{})), - ExecutionRoleArn: aws.String(d.Get("execution_role_arn").(string)), + ExecutionRoleArn: aws.String(d.Get(names.AttrExecutionRoleARN).(string)), NotificationType: awstypes.NotificationType(d.Get("notification_type").(string)), Subscribers: expandBudgetActionSubscriber(d.Get("subscriber").(*schema.Set)), ResourceTags: getTagsIn(ctx), @@ -310,7 +310,7 @@ func resourceBudgetActionRead(ctx context.Context, d *schema.ResourceData, meta if err := d.Set("definition", flattenBudgetActionDefinition(output.Definition)); err != nil { return sdkdiag.AppendErrorf(diags, "setting definition: %s", err) } - d.Set("execution_role_arn", output.ExecutionRoleArn) + d.Set(names.AttrExecutionRoleARN, output.ExecutionRoleArn) d.Set("notification_type", output.NotificationType) d.Set(names.AttrStatus, output.Status) if err := d.Set("subscriber", flattenBudgetActionSubscriber(output.Subscribers)); err != nil { @@ -349,8 +349,8 @@ func resourceBudgetActionUpdate(ctx context.Context, d *schema.ResourceData, met input.Definition = expandBudgetActionActionDefinition(d.Get("definition").([]interface{})) } - if d.HasChange("execution_role_arn") { - input.ExecutionRoleArn = aws.String(d.Get("execution_role_arn").(string)) + if d.HasChange(names.AttrExecutionRoleARN) { + input.ExecutionRoleArn = aws.String(d.Get(names.AttrExecutionRoleARN).(string)) } if d.HasChange("notification_type") { diff --git a/internal/service/budgets/budget_action_test.go b/internal/service/budgets/budget_action_test.go index 6f2ef65f35c..75b3e6bc55d 100644 --- a/internal/service/budgets/budget_action_test.go +++ b/internal/service/budgets/budget_action_test.go @@ -40,7 +40,7 @@ func TestAccBudgetsBudgetAction_basic(t *testing.T) { testAccBudgetActionExists(ctx, resourceName, &conf), acctest.MatchResourceAttrGlobalARN(resourceName, names.AttrARN, "budgets", regexache.MustCompile(fmt.Sprintf(`budget/%s/action/.+`, rName))), resource.TestCheckResourceAttrPair(resourceName, "budget_name", "aws_budgets_budget.test", names.AttrName), - resource.TestCheckResourceAttrPair(resourceName, "execution_role_arn", "aws_iam_role.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExecutionRoleARN, "aws_iam_role.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "action_type", "APPLY_IAM_POLICY"), resource.TestCheckResourceAttr(resourceName, "approval_model", string(awstypes.ApprovalModelAuto)), resource.TestCheckResourceAttr(resourceName, "notification_type", "ACTUAL"), @@ -84,7 +84,7 @@ func TestAccBudgetsBudgetAction_triggeredAutomatic(t *testing.T) { testAccBudgetActionExists(ctx, resourceName, &conf), acctest.MatchResourceAttrGlobalARN(resourceName, names.AttrARN, "budgets", regexache.MustCompile(fmt.Sprintf(`budget/%s/action/.+`, rName))), resource.TestCheckResourceAttrPair(resourceName, "budget_name", "aws_budgets_budget.test", names.AttrName), - resource.TestCheckResourceAttrPair(resourceName, "execution_role_arn", "aws_iam_role.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExecutionRoleARN, "aws_iam_role.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "action_type", "APPLY_IAM_POLICY"), resource.TestCheckResourceAttr(resourceName, "approval_model", string(awstypes.ApprovalModelAuto)), resource.TestCheckResourceAttr(resourceName, "notification_type", "ACTUAL"), @@ -128,7 +128,7 @@ func TestAccBudgetsBudgetAction_triggeredManual(t *testing.T) { testAccBudgetActionExists(ctx, resourceName, &conf), acctest.MatchResourceAttrGlobalARN(resourceName, names.AttrARN, "budgets", regexache.MustCompile(fmt.Sprintf(`budget/%s/action/.+`, rName))), resource.TestCheckResourceAttrPair(resourceName, "budget_name", "aws_budgets_budget.test", names.AttrName), - resource.TestCheckResourceAttrPair(resourceName, "execution_role_arn", "aws_iam_role.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExecutionRoleARN, "aws_iam_role.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "action_type", "APPLY_IAM_POLICY"), resource.TestCheckResourceAttr(resourceName, "approval_model", string(awstypes.ApprovalModelManual)), resource.TestCheckResourceAttr(resourceName, "notification_type", "ACTUAL"), From 0c021d5dbdd5f18827398c15f21ee0ec79bbce9b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:41 -0400 Subject: [PATCH 1332/1490] cleanrooms: Use constants for strings --- internal/service/cleanrooms/collaboration.go | 6 +++--- internal/service/cleanrooms/collaboration_test.go | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/cleanrooms/collaboration.go b/internal/service/cleanrooms/collaboration.go index 03a7779f9a3..d1b66945c24 100644 --- a/internal/service/cleanrooms/collaboration.go +++ b/internal/service/cleanrooms/collaboration.go @@ -114,7 +114,7 @@ func ResourceCollaboration() *schema.Resource { Required: true, ForceNew: true, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -381,7 +381,7 @@ func expandMembers(data []interface{}) *[]types.MemberSpecification { member := &types.MemberSpecification{ AccountId: aws.String(memberMap[names.AttrAccountID].(string)), MemberAbilities: expandMemberAbilities(memberMap["member_abilities"].([]interface{})), - DisplayName: aws.String(memberMap["display_name"].(string)), + DisplayName: aws.String(memberMap[names.AttrDisplayName].(string)), } members = append(members, *member) } @@ -407,7 +407,7 @@ func flattenMembers(members []types.MemberSummary, ownerAccount *string) []inter memberMap := map[string]interface{}{} memberMap[names.AttrStatus] = member.Status memberMap[names.AttrAccountID] = member.AccountId - memberMap["display_name"] = member.DisplayName + memberMap[names.AttrDisplayName] = member.DisplayName memberMap["member_abilities"] = flattenMemberAbilities(member.Abilities) flattenedMembers = append(flattenedMembers, memberMap) } diff --git a/internal/service/cleanrooms/collaboration_test.go b/internal/service/cleanrooms/collaboration_test.go index 384022b8d9f..d7d6979ce4c 100644 --- a/internal/service/cleanrooms/collaboration_test.go +++ b/internal/service/cleanrooms/collaboration_test.go @@ -60,7 +60,7 @@ func TestAccCleanRoomsCollaboration_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -124,7 +124,7 @@ func TestAccCleanRoomsCollaboration_mutableProperties(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -159,7 +159,7 @@ func TestAccCleanRoomsCollaboration_updateCreatorDisplayName(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -193,7 +193,7 @@ func TestAccCleanRoomsCollaboration_updateQueryLogStatus(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -239,7 +239,7 @@ func TestAccCleanRoomsCollaboration_dataEncryptionSettings(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -279,7 +279,7 @@ func TestAccCleanRoomsCollaboration_updateMemberAbilities(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) From 61195143331e22c64917f8b09f8c98a967ec1b26 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:41 -0400 Subject: [PATCH 1333/1490] cloudformation: Use constants for strings --- internal/service/cloudformation/type.go | 6 +++--- internal/service/cloudformation/type_data_source.go | 4 ++-- internal/service/cloudformation/type_data_source_test.go | 4 ++-- internal/service/cloudformation/type_test.go | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/cloudformation/type.go b/internal/service/cloudformation/type.go index 81a04ae6aa3..e4bca7b9c79 100644 --- a/internal/service/cloudformation/type.go +++ b/internal/service/cloudformation/type.go @@ -55,7 +55,7 @@ func resourceType() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -151,7 +151,7 @@ func resourceTypeCreate(ctx context.Context, d *schema.ResourceData, meta interf TypeName: aws.String(typeName), } - if v, ok := d.GetOk("execution_role_arn"); ok { + if v, ok := d.GetOk(names.AttrExecutionRoleARN); ok { input.ExecutionRoleArn = aws.String(v.(string)) } @@ -207,7 +207,7 @@ func resourceTypeRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set("deprecated_status", output.DeprecatedStatus) d.Set(names.AttrDescription, output.Description) d.Set("documentation_url", output.DocumentationUrl) - d.Set("execution_role_arn", output.ExecutionRoleArn) + d.Set(names.AttrExecutionRoleARN, output.ExecutionRoleArn) d.Set("is_default_version", output.IsDefaultVersion) if output.LoggingConfig != nil { if err := d.Set("logging_config", []interface{}{flattenLoggingConfig(output.LoggingConfig)}); err != nil { diff --git a/internal/service/cloudformation/type_data_source.go b/internal/service/cloudformation/type_data_source.go index c680c694844..be834953351 100644 --- a/internal/service/cloudformation/type_data_source.go +++ b/internal/service/cloudformation/type_data_source.go @@ -46,7 +46,7 @@ func dataSourceType() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Computed: true, }, @@ -147,7 +147,7 @@ func dataSourceTypeRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("deprecated_status", output.DeprecatedStatus) d.Set(names.AttrDescription, output.Description) d.Set("documentation_url", output.DocumentationUrl) - d.Set("execution_role_arn", output.ExecutionRoleArn) + d.Set(names.AttrExecutionRoleARN, output.ExecutionRoleArn) d.Set("is_default_version", output.IsDefaultVersion) if output.LoggingConfig != nil { if err := d.Set("logging_config", []interface{}{flattenLoggingConfig(output.LoggingConfig)}); err != nil { diff --git a/internal/service/cloudformation/type_data_source_test.go b/internal/service/cloudformation/type_data_source_test.go index bad330e8205..dee7b351bb5 100644 --- a/internal/service/cloudformation/type_data_source_test.go +++ b/internal/service/cloudformation/type_data_source_test.go @@ -36,7 +36,7 @@ func TestAccCloudFormationTypeDataSource_ARN_private(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "deprecated_status", resourceName, "deprecated_status"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), resource.TestCheckResourceAttrPair(dataSourceName, "documentation_url", resourceName, "documentation_url"), - resource.TestCheckResourceAttrPair(dataSourceName, "execution_role_arn", resourceName, "execution_role_arn"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrExecutionRoleARN, resourceName, names.AttrExecutionRoleARN), resource.TestCheckResourceAttrPair(dataSourceName, "is_default_version", resourceName, "is_default_version"), resource.TestCheckResourceAttrPair(dataSourceName, "logging_config.#", resourceName, "logging_config.#"), resource.TestCheckResourceAttrPair(dataSourceName, "provisioning_type", resourceName, "provisioning_type"), @@ -103,7 +103,7 @@ func TestAccCloudFormationTypeDataSource_TypeName_private(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "deprecated_status", resourceName, "deprecated_status"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), resource.TestCheckResourceAttrPair(dataSourceName, "documentation_url", resourceName, "documentation_url"), - resource.TestCheckResourceAttrPair(dataSourceName, "execution_role_arn", resourceName, "execution_role_arn"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrExecutionRoleARN, resourceName, names.AttrExecutionRoleARN), resource.TestCheckResourceAttrPair(dataSourceName, "is_default_version", resourceName, "is_default_version"), resource.TestCheckResourceAttrPair(dataSourceName, "logging_config.#", resourceName, "logging_config.#"), resource.TestCheckResourceAttrPair(dataSourceName, "provisioning_type", resourceName, "provisioning_type"), diff --git a/internal/service/cloudformation/type_test.go b/internal/service/cloudformation/type_test.go index c2569ad3203..34c6d866740 100644 --- a/internal/service/cloudformation/type_test.go +++ b/internal/service/cloudformation/type_test.go @@ -48,7 +48,7 @@ func TestAccCloudFormationType_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "default_version_id", ""), resource.TestCheckResourceAttr(resourceName, "deprecated_status", string(awstypes.DeprecatedStatusLive)), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "An example resource schema demonstrating some basic constructs and validation rules."), - resource.TestCheckResourceAttr(resourceName, "execution_role_arn", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrExecutionRoleARN, ""), resource.TestCheckResourceAttr(resourceName, "is_default_version", "true"), resource.TestCheckResourceAttr(resourceName, "logging_config.#", "0"), resource.TestCheckResourceAttr(resourceName, "provisioning_type", string(awstypes.ProvisioningTypeFullyMutable)), @@ -111,7 +111,7 @@ func TestAccCloudFormationType_executionRoleARN(t *testing.T) { Config: testAccTypeConfig_executionRoleARN(rName, zipPath, typeName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckTypeExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "execution_role_arn", iamRoleResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExecutionRoleARN, iamRoleResourceName, names.AttrARN), ), }, }, From 0c959b7215a86cdae33ad07c2ab9a6cac268479a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:41 -0400 Subject: [PATCH 1334/1490] cloudwatch: Use constants for strings --- internal/service/cloudwatch/metric_stream.go | 4 ++-- internal/service/cloudwatch/metric_stream_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/cloudwatch/metric_stream.go b/internal/service/cloudwatch/metric_stream.go index 3ae995469df..24a500b4c04 100644 --- a/internal/service/cloudwatch/metric_stream.go +++ b/internal/service/cloudwatch/metric_stream.go @@ -54,7 +54,7 @@ func resourceMetricStream() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -279,7 +279,7 @@ func resourceMetricStreamRead(ctx context.Context, d *schema.ResourceData, meta } d.Set(names.AttrARN, output.Arn) - d.Set("creation_date", output.CreationDate.Format(time.RFC3339)) + d.Set(names.AttrCreationDate, output.CreationDate.Format(time.RFC3339)) if output.ExcludeFilters != nil { if err := d.Set("exclude_filter", flattenMetricStreamFilters(output.ExcludeFilters)); err != nil { return sdkdiag.AppendErrorf(diags, "setting exclude_filter: %s", err) diff --git a/internal/service/cloudwatch/metric_stream_test.go b/internal/service/cloudwatch/metric_stream_test.go index afba2005955..55d64d4fc36 100644 --- a/internal/service/cloudwatch/metric_stream_test.go +++ b/internal/service/cloudwatch/metric_stream_test.go @@ -46,7 +46,7 @@ func TestAccCloudWatchMetricStream_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMetricStreamExists(ctx, resourceName), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "cloudwatch", fmt.Sprintf("metric-stream/%s", rName)), - acctest.CheckResourceAttrRFC3339(resourceName, "creation_date"), + acctest.CheckResourceAttrRFC3339(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(resourceName, "exclude_filter.#", "0"), resource.TestCheckResourceAttr(resourceName, "include_filter.#", "0"), resource.TestCheckResourceAttr(resourceName, "include_linked_accounts_metrics", "false"), From ec8c5eadd9d3857c035516939f3c0e80ae0d33bf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:41 -0400 Subject: [PATCH 1335/1490] codecatalyst: Use constants for strings --- internal/service/codecatalyst/project.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/codecatalyst/project.go b/internal/service/codecatalyst/project.go index 1b9da38c192..e3a182df74e 100644 --- a/internal/service/codecatalyst/project.go +++ b/internal/service/codecatalyst/project.go @@ -51,7 +51,7 @@ func ResourceProject() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Required: true, }, @@ -73,18 +73,18 @@ func resourceProjectCreate(ctx context.Context, d *schema.ResourceData, meta int conn := meta.(*conns.AWSClient).CodeCatalystClient(ctx) in := &codecatalyst.CreateProjectInput{ - DisplayName: aws.String(d.Get("display_name").(string)), + DisplayName: aws.String(d.Get(names.AttrDisplayName).(string)), SpaceName: aws.String(d.Get("space_name").(string)), Description: aws.String(d.Get(names.AttrDescription).(string)), } out, err := conn.CreateProject(ctx, in) if err != nil { - return create.AppendDiagError(diags, names.CodeCatalyst, create.ErrActionCreating, ResNameProject, d.Get("display_name").(string), err) + return create.AppendDiagError(diags, names.CodeCatalyst, create.ErrActionCreating, ResNameProject, d.Get(names.AttrDisplayName).(string), err) } if out == nil || out.Name == nil { - return create.AppendDiagError(diags, names.CodeCatalyst, create.ErrActionCreating, ResNameProject, d.Get("display_name").(string), errors.New("empty output")) + return create.AppendDiagError(diags, names.CodeCatalyst, create.ErrActionCreating, ResNameProject, d.Get(names.AttrDisplayName).(string), errors.New("empty output")) } d.SetId(aws.ToString(out.Name)) @@ -125,7 +125,7 @@ func resourceProjectUpdate(ctx context.Context, d *schema.ResourceData, meta int update := false in := &codecatalyst.UpdateProjectInput{ - Name: aws.String(d.Get("display_name").(string)), + Name: aws.String(d.Get(names.AttrDisplayName).(string)), SpaceName: aws.String(d.Get("space_name").(string)), Description: aws.String(d.Get(names.AttrDescription).(string)), } From b13b189b6a91a7b7e2cef1528b078b9f195b211c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:42 -0400 Subject: [PATCH 1336/1490] codecommit: Use constants for strings --- internal/service/codecommit/approval_rule_template.go | 4 ++-- .../codecommit/approval_rule_template_data_source.go | 4 ++-- .../codecommit/approval_rule_template_data_source_test.go | 2 +- internal/service/codecommit/approval_rule_template_test.go | 2 +- internal/service/codecommit/trigger.go | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/codecommit/approval_rule_template.go b/internal/service/codecommit/approval_rule_template.go index 499495c5753..9d717bf8bf1 100644 --- a/internal/service/codecommit/approval_rule_template.go +++ b/internal/service/codecommit/approval_rule_template.go @@ -54,7 +54,7 @@ func resourceApprovalRuleTemplate() *schema.Resource { validation.StringLenBetween(1, 3000), ), }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -128,7 +128,7 @@ func resourceApprovalRuleTemplateRead(ctx context.Context, d *schema.ResourceDat d.Set("approval_rule_template_id", result.ApprovalRuleTemplateId) d.Set(names.AttrDescription, result.ApprovalRuleTemplateDescription) d.Set("content", result.ApprovalRuleTemplateContent) - d.Set("creation_date", result.CreationDate.Format(time.RFC3339)) + d.Set(names.AttrCreationDate, result.CreationDate.Format(time.RFC3339)) d.Set("last_modified_date", result.LastModifiedDate.Format(time.RFC3339)) d.Set("last_modified_user", result.LastModifiedUser) d.Set(names.AttrName, result.ApprovalRuleTemplateName) diff --git a/internal/service/codecommit/approval_rule_template_data_source.go b/internal/service/codecommit/approval_rule_template_data_source.go index 9c9d55f4eea..12927b41dbe 100644 --- a/internal/service/codecommit/approval_rule_template_data_source.go +++ b/internal/service/codecommit/approval_rule_template_data_source.go @@ -30,7 +30,7 @@ func dataSourceApprovalRuleTemplate() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -73,7 +73,7 @@ func dataSourceApprovalRuleTemplateRead(ctx context.Context, d *schema.ResourceD d.SetId(aws.ToString(result.ApprovalRuleTemplateName)) d.Set("approval_rule_template_id", result.ApprovalRuleTemplateId) d.Set("content", result.ApprovalRuleTemplateContent) - d.Set("creation_date", result.CreationDate.Format(time.RFC3339)) + d.Set(names.AttrCreationDate, result.CreationDate.Format(time.RFC3339)) d.Set(names.AttrDescription, result.ApprovalRuleTemplateDescription) d.Set("last_modified_date", result.LastModifiedDate.Format(time.RFC3339)) d.Set("last_modified_user", result.LastModifiedUser) diff --git a/internal/service/codecommit/approval_rule_template_data_source_test.go b/internal/service/codecommit/approval_rule_template_data_source_test.go index 993a16198c1..635a3ca4134 100644 --- a/internal/service/codecommit/approval_rule_template_data_source_test.go +++ b/internal/service/codecommit/approval_rule_template_data_source_test.go @@ -30,7 +30,7 @@ func TestAccCodeCommitApprovalRuleTemplateDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, names.AttrDescription, resourceName, names.AttrDescription), resource.TestCheckResourceAttrPair(datasourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(datasourceName, "content", resourceName, "content"), - resource.TestCheckResourceAttrPair(datasourceName, "creation_date", resourceName, "creation_date"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrCreationDate, resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(datasourceName, "last_modified_date", resourceName, "last_modified_date"), resource.TestCheckResourceAttrPair(datasourceName, "last_modified_user", resourceName, "last_modified_user"), resource.TestCheckResourceAttrPair(datasourceName, "rule_content_sha256", resourceName, "rule_content_sha256"), diff --git a/internal/service/codecommit/approval_rule_template_test.go b/internal/service/codecommit/approval_rule_template_test.go index dd9a8e4eb39..84fa3573eea 100644 --- a/internal/service/codecommit/approval_rule_template_test.go +++ b/internal/service/codecommit/approval_rule_template_test.go @@ -36,7 +36,7 @@ func TestAccCodeCommitApprovalRuleTemplate_basic(t *testing.T) { testAccCheckApprovalRuleTemplateContent(resourceName, 2), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrSet(resourceName, "approval_rule_template_id"), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_user"), resource.TestCheckResourceAttrSet(resourceName, "rule_content_sha256"), diff --git a/internal/service/codecommit/trigger.go b/internal/service/codecommit/trigger.go index f82317181ce..60b436eab87 100644 --- a/internal/service/codecommit/trigger.go +++ b/internal/service/codecommit/trigger.go @@ -58,7 +58,7 @@ func resourceTrigger() *schema.Resource { Optional: true, ForceNew: true, }, - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -203,7 +203,7 @@ func expandRepositoryTriggers(tfList []interface{}) []types.RepositoryTrigger { apiObject.CustomData = aws.String(v) } - if v, ok := tfMap["destination_arn"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDestinationARN].(string); ok && v != "" { apiObject.DestinationArn = aws.String(v) } @@ -240,7 +240,7 @@ func flattenRepositoryTriggers(apiObjects []types.RepositoryTrigger) []interface } if v := apiObject.DestinationArn; v != nil { - tfMap["destination_arn"] = aws.ToString(v) + tfMap[names.AttrDestinationARN] = aws.ToString(v) } if v := apiObject.Events; v != nil { From e5e65cc3fa1e28308804c7608f555a8adc9ad795 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:42 -0400 Subject: [PATCH 1337/1490] cognitoidp: Use constants for strings --- internal/service/cognitoidp/user.go | 4 +-- internal/service/cognitoidp/user_pool.go | 4 +-- .../service/cognitoidp/user_pool_domain.go | 12 ++++---- .../cognitoidp/user_pool_domain_test.go | 6 ++-- internal/service/cognitoidp/user_pool_test.go | 2 +- .../cognitoidp/user_pool_ui_customization.go | 4 +-- .../user_pool_ui_customization_test.go | 30 +++++++++---------- internal/service/cognitoidp/user_test.go | 2 +- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/internal/service/cognitoidp/user.go b/internal/service/cognitoidp/user.go index 6521b752011..06be292ef2f 100644 --- a/internal/service/cognitoidp/user.go +++ b/internal/service/cognitoidp/user.go @@ -58,7 +58,7 @@ func resourceUser() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Optional: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -254,7 +254,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set("preferred_mfa_setting", user.PreferredMfaSetting) d.Set(names.AttrStatus, user.UserStatus) d.Set(names.AttrEnabled, user.Enabled) - d.Set("creation_date", user.UserCreateDate.Format(time.RFC3339)) + d.Set(names.AttrCreationDate, user.UserCreateDate.Format(time.RFC3339)) d.Set("last_modified_date", user.UserLastModifiedDate.Format(time.RFC3339)) d.Set("sub", retrieveUserSub(user.UserAttributes)) diff --git a/internal/service/cognitoidp/user_pool.go b/internal/service/cognitoidp/user_pool.go index 862e172fe56..aaa8a8d5b78 100644 --- a/internal/service/cognitoidp/user_pool.go +++ b/internal/service/cognitoidp/user_pool.go @@ -132,7 +132,7 @@ func resourceUserPool() *schema.Resource { ValidateFunc: validation.StringInSlice(cognitoidentityprovider.VerifiedAttributeType_Values(), false), }, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -846,7 +846,7 @@ func resourceUserPoolRead(ctx context.Context, d *schema.ResourceData, meta inte } d.Set(names.AttrARN, userPool.Arn) d.Set("auto_verified_attributes", aws.StringValueSlice(userPool.AutoVerifiedAttributes)) - d.Set("creation_date", userPool.CreationDate.Format(time.RFC3339)) + d.Set(names.AttrCreationDate, userPool.CreationDate.Format(time.RFC3339)) d.Set("custom_domain", userPool.CustomDomain) d.Set("deletion_protection", userPool.DeletionProtection) if err := d.Set("device_configuration", flattenUserPoolDeviceConfiguration(userPool.DeviceConfiguration)); err != nil { diff --git a/internal/service/cognitoidp/user_pool_domain.go b/internal/service/cognitoidp/user_pool_domain.go index fff7d23008f..11b2f35a291 100644 --- a/internal/service/cognitoidp/user_pool_domain.go +++ b/internal/service/cognitoidp/user_pool_domain.go @@ -41,7 +41,7 @@ func resourceUserPoolDomain() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, @@ -79,7 +79,7 @@ func resourceUserPoolDomain() *schema.Resource { }, }, - CustomizeDiff: customdiff.ForceNewIfChange("certificate_arn", func(_ context.Context, old, new, meta interface{}) bool { + CustomizeDiff: customdiff.ForceNewIfChange(names.AttrCertificateARN, func(_ context.Context, old, new, meta interface{}) bool { // If the cert arn is being changed to a new arn, don't force new. return !(old.(string) != "" && new.(string) != "") }), @@ -97,7 +97,7 @@ func resourceUserPoolDomainCreate(ctx context.Context, d *schema.ResourceData, m UserPoolId: aws.String(d.Get("user_pool_id").(string)), } - if v, ok := d.GetOk("certificate_arn"); ok { + if v, ok := d.GetOk(names.AttrCertificateARN); ok { input.CustomDomainConfig = &cognitoidentityprovider.CustomDomainConfigType{ CertificateArn: aws.String(v.(string)), } @@ -136,9 +136,9 @@ func resourceUserPoolDomainRead(ctx context.Context, d *schema.ResourceData, met } d.Set("aws_account_id", desc.AWSAccountId) - d.Set("certificate_arn", "") + d.Set(names.AttrCertificateARN, "") if desc.CustomDomainConfig != nil { - d.Set("certificate_arn", desc.CustomDomainConfig.CertificateArn) + d.Set(names.AttrCertificateARN, desc.CustomDomainConfig.CertificateArn) } d.Set("cloudfront_distribution", desc.CloudFrontDistribution) d.Set("cloudfront_distribution_arn", desc.CloudFrontDistribution) @@ -157,7 +157,7 @@ func resourceUserPoolDomainUpdate(ctx context.Context, d *schema.ResourceData, m input := &cognitoidentityprovider.UpdateUserPoolDomainInput{ CustomDomainConfig: &cognitoidentityprovider.CustomDomainConfigType{ - CertificateArn: aws.String(d.Get("certificate_arn").(string)), + CertificateArn: aws.String(d.Get(names.AttrCertificateARN).(string)), }, Domain: aws.String(d.Id()), UserPoolId: aws.String(d.Get("user_pool_id").(string)), diff --git a/internal/service/cognitoidp/user_pool_domain_test.go b/internal/service/cognitoidp/user_pool_domain_test.go index ffe9b369ec5..319a18da70c 100644 --- a/internal/service/cognitoidp/user_pool_domain_test.go +++ b/internal/service/cognitoidp/user_pool_domain_test.go @@ -100,7 +100,7 @@ func TestAccCognitoIDPUserPoolDomain_custom(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolDomainExists(ctx, resourceName), acctest.CheckResourceAttrAccountID(resourceName, "aws_account_id"), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", acmCertificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, acmCertificateResourceName, names.AttrARN), resource.TestCheckResourceAttrSet(resourceName, "cloudfront_distribution"), resource.TestCheckResourceAttr(resourceName, "cloudfront_distribution_zone_id", "Z2FDTNDATAQYW2"), resource.TestCheckResourceAttrPair(resourceName, "domain", acmCertificateResourceName, names.AttrDomainName), @@ -143,14 +143,14 @@ func TestAccCognitoIDPUserPoolDomain_customCertUpdate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolDomainExists(ctx, cognitoPoolResourceName), testAccCheckUserPoolDomainCertMatches(ctx, cognitoPoolResourceName, acmInitialCertResourceName), - resource.TestCheckResourceAttrPair(cognitoPoolResourceName, "certificate_arn", acmInitialCertResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(cognitoPoolResourceName, names.AttrCertificateARN, acmInitialCertResourceName, names.AttrARN), ), }, { Config: testAccUserPoolDomainConfig_customCertUpdate(rootDomain, domain, poolName, acmUpdatedValidationResourceName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolDomainCertMatches(ctx, cognitoPoolResourceName, acmUpdatedCertResourceName), - resource.TestCheckResourceAttrPair(cognitoPoolResourceName, "certificate_arn", acmUpdatedCertResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(cognitoPoolResourceName, names.AttrCertificateARN, acmUpdatedCertResourceName, names.AttrARN), ), }, }, diff --git a/internal/service/cognitoidp/user_pool_test.go b/internal/service/cognitoidp/user_pool_test.go index c701e5388cb..d26fae52199 100644 --- a/internal/service/cognitoidp/user_pool_test.go +++ b/internal/service/cognitoidp/user_pool_test.go @@ -51,7 +51,7 @@ func TestAccCognitoIDPUserPool_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "cognito-idp", regexache.MustCompile(`userpool/.+`)), resource.TestMatchResourceAttr(resourceName, names.AttrEndpoint, regexache.MustCompile(`^cognito-idp\.[^.]+\.amazonaws.com/[\w-]+_[0-9A-Za-z]+$`)), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), resource.TestCheckResourceAttr(resourceName, "mfa_configuration", "OFF"), resource.TestCheckResourceAttr(resourceName, "sms_configuration.#", "0"), diff --git a/internal/service/cognitoidp/user_pool_ui_customization.go b/internal/service/cognitoidp/user_pool_ui_customization.go index 16f2b8f6ce4..3dcdde87856 100644 --- a/internal/service/cognitoidp/user_pool_ui_customization.go +++ b/internal/service/cognitoidp/user_pool_ui_customization.go @@ -40,7 +40,7 @@ func resourceUserPoolUICustomization() *schema.Resource { Optional: true, Default: "ALL", }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -135,7 +135,7 @@ func resourceUserPoolUICustomizationRead(ctx context.Context, d *schema.Resource } d.Set("client_id", uiCustomization.ClientId) - d.Set("creation_date", aws.TimeValue(uiCustomization.CreationDate).Format(time.RFC3339)) + d.Set(names.AttrCreationDate, aws.TimeValue(uiCustomization.CreationDate).Format(time.RFC3339)) d.Set("css", uiCustomization.CSS) d.Set("css_version", uiCustomization.CSSVersion) d.Set("image_url", uiCustomization.ImageUrl) diff --git a/internal/service/cognitoidp/user_pool_ui_customization_test.go b/internal/service/cognitoidp/user_pool_ui_customization_test.go index 2e3bd2861ba..9e4d31a4e04 100644 --- a/internal/service/cognitoidp/user_pool_ui_customization_test.go +++ b/internal/service/cognitoidp/user_pool_ui_customization_test.go @@ -38,7 +38,7 @@ func TestAccCognitoIDPUserPoolUICustomization_AllClients_CSS(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "css", css), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "css_version"), resource.TestCheckResourceAttr(resourceName, "client_id", "ALL"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), @@ -55,7 +55,7 @@ func TestAccCognitoIDPUserPoolUICustomization_AllClients_CSS(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "css", cssUpdated), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "css_version"), resource.TestCheckResourceAttr(resourceName, "client_id", "ALL"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), @@ -115,7 +115,7 @@ func TestAccCognitoIDPUserPoolUICustomization_AllClients_imageFile(t *testing.T) Config: testAccUserPoolUICustomizationConfig_allClientsImage(rName, filename), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(resourceName, "client_id", "ALL"), resource.TestCheckResourceAttrSet(resourceName, "image_url"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), @@ -132,7 +132,7 @@ func TestAccCognitoIDPUserPoolUICustomization_AllClients_imageFile(t *testing.T) Config: testAccUserPoolUICustomizationConfig_allClientsImage(rName, updatedFilename), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(resourceName, "client_id", "ALL"), resource.TestCheckResourceAttrSet(resourceName, "image_url"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), @@ -169,7 +169,7 @@ func TestAccCognitoIDPUserPoolUICustomization_AllClients_CSSAndImageFile(t *test Config: testAccUserPoolUICustomizationConfig_allClientsCSSAndImage(rName, css, filename), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(resourceName, "client_id", "ALL"), resource.TestCheckResourceAttr(resourceName, "css", css), resource.TestCheckResourceAttrSet(resourceName, "css_version"), @@ -189,7 +189,7 @@ func TestAccCognitoIDPUserPoolUICustomization_AllClients_CSSAndImageFile(t *test Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "css", css), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "css_version"), resource.TestCheckResourceAttr(resourceName, "client_id", "ALL"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), @@ -200,7 +200,7 @@ func TestAccCognitoIDPUserPoolUICustomization_AllClients_CSSAndImageFile(t *test Config: testAccUserPoolUICustomizationConfig_allClientsImage(rName, updatedFilename), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(resourceName, "client_id", "ALL"), resource.TestCheckResourceAttrSet(resourceName, "image_url"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), @@ -238,7 +238,7 @@ func TestAccCognitoIDPUserPoolUICustomization_Client_CSS(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "css", css), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "css_version"), resource.TestCheckResourceAttrPair(resourceName, "client_id", clientResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), @@ -255,7 +255,7 @@ func TestAccCognitoIDPUserPoolUICustomization_Client_CSS(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "css", cssUpdated), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "css_version"), resource.TestCheckResourceAttrPair(resourceName, "client_id", clientResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), @@ -316,7 +316,7 @@ func TestAccCognitoIDPUserPoolUICustomization_Client_image(t *testing.T) { Config: testAccUserPoolUICustomizationConfig_clientImage(rName, filename), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(resourceName, "client_id", clientResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "image_url"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), @@ -333,7 +333,7 @@ func TestAccCognitoIDPUserPoolUICustomization_Client_image(t *testing.T) { Config: testAccUserPoolUICustomizationConfig_clientImage(rName, updatedFilename), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(resourceName, "client_id", clientResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "image_url"), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), @@ -374,12 +374,12 @@ func TestAccCognitoIDPUserPoolUICustomization_ClientAndAll_cSS(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), testAccCheckUserPoolUICustomizationExists(ctx, clientUIResourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(resourceName, "css", allCSS), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), resource.TestCheckResourceAttrPair(resourceName, "user_pool_id", userPoolResourceName, names.AttrID), resource.TestCheckResourceAttrPair(clientUIResourceName, "client_id", clientResourceName, names.AttrID), - resource.TestCheckResourceAttrSet(clientUIResourceName, "creation_date"), + resource.TestCheckResourceAttrSet(clientUIResourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(clientUIResourceName, "css", allCSS), resource.TestCheckResourceAttrSet(clientUIResourceName, "last_modified_date"), resource.TestCheckResourceAttrPair(clientUIResourceName, "user_pool_id", userPoolResourceName, names.AttrID), @@ -401,12 +401,12 @@ func TestAccCognitoIDPUserPoolUICustomization_ClientAndAll_cSS(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckUserPoolUICustomizationExists(ctx, resourceName), testAccCheckUserPoolUICustomizationExists(ctx, clientUIResourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(resourceName, "css", allCSS), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), resource.TestCheckResourceAttrPair(resourceName, "user_pool_id", userPoolResourceName, names.AttrID), resource.TestCheckResourceAttrPair(clientUIResourceName, "client_id", clientResourceName, names.AttrID), - resource.TestCheckResourceAttrSet(clientUIResourceName, "creation_date"), + resource.TestCheckResourceAttrSet(clientUIResourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(clientUIResourceName, "css", clientCSS), resource.TestCheckResourceAttrSet(clientUIResourceName, "last_modified_date"), resource.TestCheckResourceAttrPair(clientUIResourceName, "user_pool_id", userPoolResourceName, names.AttrID), diff --git a/internal/service/cognitoidp/user_test.go b/internal/service/cognitoidp/user_test.go index 2615656b3c0..cd87646e930 100644 --- a/internal/service/cognitoidp/user_test.go +++ b/internal/service/cognitoidp/user_test.go @@ -37,7 +37,7 @@ func TestAccCognitoIDPUser_basic(t *testing.T) { Config: testAccUserConfig_basic(rUserPoolName, rUserName), Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "last_modified_date"), resource.TestCheckResourceAttrSet(resourceName, "sub"), resource.TestCheckResourceAttr(resourceName, "preferred_mfa_setting", ""), From ad98ce0fca8a3710169f46cbcfa9594cbc84681d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:42 -0400 Subject: [PATCH 1338/1490] configservice: Use constants for strings --- .../service/configservice/remediation_configuration.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/configservice/remediation_configuration.go b/internal/service/configservice/remediation_configuration.go index 9800aa0cea6..4dcf85ac085 100644 --- a/internal/service/configservice/remediation_configuration.go +++ b/internal/service/configservice/remediation_configuration.go @@ -113,7 +113,7 @@ func resourceRemediationConfiguration() *schema.Resource { }, }, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Optional: true, }, @@ -165,7 +165,7 @@ func resourceRemediationConfigurationPut(ctx context.Context, d *schema.Resource remediationConfiguration.Parameters = expandRemediationParameterValues(v.([]interface{})) } - if v, ok := d.GetOk("resource_type"); ok { + if v, ok := d.GetOk(names.AttrResourceType); ok { remediationConfiguration.ResourceType = aws.String(v.(string)) } @@ -226,7 +226,7 @@ func resourceRemediationConfigurationRead(ctx context.Context, d *schema.Resourc if err := d.Set(names.AttrParameter, flattenRemediationParameterValues(remediationConfiguration.Parameters)); err != nil { return sdkdiag.AppendErrorf(diags, "setting parameter: %s", err) } - d.Set("resource_type", remediationConfiguration.ResourceType) + d.Set(names.AttrResourceType, remediationConfiguration.ResourceType) d.Set("retry_attempt_seconds", remediationConfiguration.RetryAttemptSeconds) d.Set("target_id", remediationConfiguration.TargetId) d.Set("target_type", remediationConfiguration.TargetType) @@ -243,7 +243,7 @@ func resourceRemediationConfigurationDelete(ctx context.Context, d *schema.Resou ConfigRuleName: aws.String(d.Id()), } - if v, ok := d.GetOk("resource_type"); ok { + if v, ok := d.GetOk(names.AttrResourceType); ok { input.ResourceType = aws.String(v.(string)) } From f1e9df5f77ae244a62556911ed86e87e5246dc9c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:42 -0400 Subject: [PATCH 1339/1490] connect: Use constants for strings --- .../connect/instance_storage_config.go | 6 ++--- .../instance_storage_config_data_source.go | 4 ++-- ...nstance_storage_config_data_source_test.go | 8 +++---- .../connect/instance_storage_config_test.go | 22 +++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/internal/service/connect/instance_storage_config.go b/internal/service/connect/instance_storage_config.go index 55460343a5e..809c35afea3 100644 --- a/internal/service/connect/instance_storage_config.go +++ b/internal/service/connect/instance_storage_config.go @@ -42,7 +42,7 @@ func ResourceInstanceStorageConfig() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 100), }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -184,7 +184,7 @@ func resourceInstanceStorageConfigCreate(ctx context.Context, d *schema.Resource conn := meta.(*conns.AWSClient).ConnectConn(ctx) instanceId := d.Get(names.AttrInstanceID).(string) - resourceType := d.Get("resource_type").(string) + resourceType := d.Get(names.AttrResourceType).(string) input := &connect.AssociateInstanceStorageConfigInput{ InstanceId: aws.String(instanceId), @@ -243,7 +243,7 @@ func resourceInstanceStorageConfigRead(ctx context.Context, d *schema.ResourceDa d.Set("association_id", storageConfig.AssociationId) d.Set(names.AttrInstanceID, instanceId) - d.Set("resource_type", resourceType) + d.Set(names.AttrResourceType, resourceType) if err := d.Set("storage_config", flattenStorageConfig(storageConfig)); err != nil { return sdkdiag.AppendErrorf(diags, "setting storage_config: %s", err) diff --git a/internal/service/connect/instance_storage_config_data_source.go b/internal/service/connect/instance_storage_config_data_source.go index 6c278c5da52..6d07b8f9bb9 100644 --- a/internal/service/connect/instance_storage_config_data_source.go +++ b/internal/service/connect/instance_storage_config_data_source.go @@ -32,7 +32,7 @@ func DataSourceInstanceStorageConfig() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 100), }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(connect.InstanceStorageResourceType_Values(), false), @@ -148,7 +148,7 @@ func dataSourceInstanceStorageConfigRead(ctx context.Context, d *schema.Resource associationId := d.Get("association_id").(string) instanceId := d.Get(names.AttrInstanceID).(string) - resourceType := d.Get("resource_type").(string) + resourceType := d.Get(names.AttrResourceType).(string) input := &connect.DescribeInstanceStorageConfigInput{ AssociationId: aws.String(associationId), diff --git a/internal/service/connect/instance_storage_config_data_source_test.go b/internal/service/connect/instance_storage_config_data_source_test.go index 646bab0a49e..15d173e5d3d 100644 --- a/internal/service/connect/instance_storage_config_data_source_test.go +++ b/internal/service/connect/instance_storage_config_data_source_test.go @@ -29,7 +29,7 @@ func testAccInstanceStorageConfigDataSource_KinesisFirehoseConfig(t *testing.T) Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "association_id", resourceName, "association_id"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrInstanceID, resourceName, names.AttrInstanceID), - resource.TestCheckResourceAttrPair(datasourceName, "resource_type", resourceName, "resource_type"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrResourceType, resourceName, names.AttrResourceType), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.#", resourceName, "storage_config.#"), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.0.kinesis_firehose_config.#", resourceName, "storage_config.0.kinesis_firehose_config.#"), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.0.kinesis_firehose_config.0.firehose_arn", resourceName, "storage_config.0.kinesis_firehose_config.0.firehose_arn"), @@ -57,7 +57,7 @@ func testAccInstanceStorageConfigDataSource_KinesisStreamConfig(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "association_id", resourceName, "association_id"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrInstanceID, resourceName, names.AttrInstanceID), - resource.TestCheckResourceAttrPair(datasourceName, "resource_type", resourceName, "resource_type"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrResourceType, resourceName, names.AttrResourceType), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.#", resourceName, "storage_config.#"), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.0.kinesis_stream_config.#", resourceName, "storage_config.0.kinesis_stream_config.#"), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.0.kinesis_stream_config.0.stream_arn", resourceName, "storage_config.0.kinesis_stream_config.0.stream_arn"), @@ -84,7 +84,7 @@ func testAccInstanceStorageConfigDataSource_KinesisVideoStreamConfig(t *testing. Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "association_id", resourceName, "association_id"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrInstanceID, resourceName, names.AttrInstanceID), - resource.TestCheckResourceAttrPair(datasourceName, "resource_type", resourceName, "resource_type"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrResourceType, resourceName, names.AttrResourceType), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.#", resourceName, "storage_config.#"), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.0.kinesis_video_stream_config.#", resourceName, "storage_config.0.kinesis_video_stream_config.#"), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.0.kinesis_video_stream_config.0.prefix", resourceName, "storage_config.0.kinesis_video_stream_config.0.prefix"), @@ -116,7 +116,7 @@ func testAccInstanceStorageConfigDataSource_S3Config(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, "association_id", resourceName, "association_id"), resource.TestCheckResourceAttrPair(datasourceName, names.AttrInstanceID, resourceName, names.AttrInstanceID), - resource.TestCheckResourceAttrPair(datasourceName, "resource_type", resourceName, "resource_type"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrResourceType, resourceName, names.AttrResourceType), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.#", resourceName, "storage_config.#"), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.0.s3_config.#", resourceName, "storage_config.0.s3_config.#"), resource.TestCheckResourceAttrPair(datasourceName, "storage_config.0.s3_config.0.bucket_name", resourceName, "storage_config.0.s3_config.0.bucket_name"), diff --git a/internal/service/connect/instance_storage_config_test.go b/internal/service/connect/instance_storage_config_test.go index f701da6a247..40f285416b2 100644 --- a/internal/service/connect/instance_storage_config_test.go +++ b/internal/service/connect/instance_storage_config_test.go @@ -40,7 +40,7 @@ func testAccInstanceStorageConfig_basic(t *testing.T) { testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), resource.TestCheckResourceAttrSet(resourceName, "association_id"), resource.TestCheckResourceAttrPair(resourceName, names.AttrInstanceID, "aws_connect_instance.test", names.AttrID), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeChatTranscripts), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeChatTranscripts), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.s3_config.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "storage_config.0.s3_config.0.bucket_name", "aws_s3_bucket.test", names.AttrID), @@ -76,7 +76,7 @@ func testAccInstanceStorageConfig_KinesisFirehoseConfig_FirehoseARN(t *testing.T Config: testAccInstanceStorageConfigConfig_kinesisFirehoseConfig_firehoseARN(rName, rName2, rName3, rName4, "first"), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeContactTraceRecords), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeContactTraceRecords), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_firehose_config.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "storage_config.0.kinesis_firehose_config.0.firehose_arn", "aws_kinesis_firehose_delivery_stream.test", names.AttrARN), @@ -92,7 +92,7 @@ func testAccInstanceStorageConfig_KinesisFirehoseConfig_FirehoseARN(t *testing.T Config: testAccInstanceStorageConfigConfig_kinesisFirehoseConfig_firehoseARN(rName, rName2, rName3, rName4, "second"), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeContactTraceRecords), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeContactTraceRecords), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_firehose_config.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "storage_config.0.kinesis_firehose_config.0.firehose_arn", "aws_kinesis_firehose_delivery_stream.test2", names.AttrARN), @@ -121,7 +121,7 @@ func testAccInstanceStorageConfig_KinesisStreamConfig_StreamARN(t *testing.T) { Config: testAccInstanceStorageConfigConfig_kinesisStreamConfig_streamARN(rName, rName2, rName3, "first"), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeContactTraceRecords), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeContactTraceRecords), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_stream_config.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "storage_config.0.kinesis_stream_config.0.stream_arn", "aws_kinesis_stream.test", names.AttrARN), @@ -137,7 +137,7 @@ func testAccInstanceStorageConfig_KinesisStreamConfig_StreamARN(t *testing.T) { Config: testAccInstanceStorageConfigConfig_kinesisStreamConfig_streamARN(rName, rName2, rName3, "second"), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeContactTraceRecords), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeContactTraceRecords), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_stream_config.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "storage_config.0.kinesis_stream_config.0.stream_arn", "aws_kinesis_stream.test2", names.AttrARN), @@ -169,7 +169,7 @@ func testAccInstanceStorageConfig_KinesisVideoStreamConfig_Prefix(t *testing.T) Config: testAccInstanceStorageConfigConfig_kinesisVideoStreamConfig_prefixRetention(rName, originalPrefix, retention), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeMediaStreams), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeMediaStreams), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.0.encryption_config.#", "1"), @@ -189,7 +189,7 @@ func testAccInstanceStorageConfig_KinesisVideoStreamConfig_Prefix(t *testing.T) Config: testAccInstanceStorageConfigConfig_kinesisVideoStreamConfig_prefixRetention(rName, updatedPrefix, retention), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeMediaStreams), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeMediaStreams), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.0.encryption_config.#", "1"), @@ -225,7 +225,7 @@ func testAccInstanceStorageConfig_KinesisVideoStreamConfig_Retention(t *testing. Config: testAccInstanceStorageConfigConfig_kinesisVideoStreamConfig_prefixRetention(rName, prefix, originalRetention), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeMediaStreams), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeMediaStreams), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.0.encryption_config.#", "1"), @@ -245,7 +245,7 @@ func testAccInstanceStorageConfig_KinesisVideoStreamConfig_Retention(t *testing. Config: testAccInstanceStorageConfigConfig_kinesisVideoStreamConfig_prefixRetention(rName, prefix, updatedRetention), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeMediaStreams), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeMediaStreams), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.0.encryption_config.#", "1"), @@ -276,7 +276,7 @@ func testAccInstanceStorageConfig_KinesisVideoStreamConfig_EncryptionConfig(t *t Config: testAccInstanceStorageConfigConfig_kinesisVideoStreamConfig_encryptionConfig(rName, "first"), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeMediaStreams), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeMediaStreams), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.0.encryption_config.#", "1"), @@ -294,7 +294,7 @@ func testAccInstanceStorageConfig_KinesisVideoStreamConfig_EncryptionConfig(t *t Config: testAccInstanceStorageConfigConfig_kinesisVideoStreamConfig_encryptionConfig(rName, "second"), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceStorageConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_type", connect.InstanceStorageResourceTypeMediaStreams), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, connect.InstanceStorageResourceTypeMediaStreams), resource.TestCheckResourceAttr(resourceName, "storage_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_config.0.kinesis_video_stream_config.0.encryption_config.#", "1"), From f6edfc487658069e72d0973057243b84736ce76d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:42 -0400 Subject: [PATCH 1340/1490] datasync: Use constants for strings --- .../service/datasync/location_fsx_lustre_file_system.go | 4 ++-- .../datasync/location_fsx_lustre_file_system_test.go | 2 +- internal/service/datasync/location_fsx_ontap_file_system.go | 4 ++-- .../service/datasync/location_fsx_ontap_file_system_test.go | 2 +- .../service/datasync/location_fsx_openzfs_file_system.go | 4 ++-- .../datasync/location_fsx_openzfs_file_system_test.go | 2 +- .../service/datasync/location_fsx_windows_file_system.go | 4 ++-- .../datasync/location_fsx_windows_file_system_test.go | 2 +- internal/service/datasync/task.go | 6 +++--- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/service/datasync/location_fsx_lustre_file_system.go b/internal/service/datasync/location_fsx_lustre_file_system.go index 7c574c68353..3147561b799 100644 --- a/internal/service/datasync/location_fsx_lustre_file_system.go +++ b/internal/service/datasync/location_fsx_lustre_file_system.go @@ -58,7 +58,7 @@ func resourceLocationFSxLustreFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -147,7 +147,7 @@ func resourceLocationFSxLustreFileSystemRead(ctx context.Context, d *schema.Reso } d.Set(names.AttrARN, output.LocationArn) - d.Set("creation_time", output.CreationTime.Format(time.RFC3339)) + d.Set(names.AttrCreationTime, output.CreationTime.Format(time.RFC3339)) d.Set("fsx_filesystem_arn", d.Get("fsx_filesystem_arn")) d.Set("security_group_arns", output.SecurityGroupArns) d.Set("subdirectory", subdirectory) diff --git a/internal/service/datasync/location_fsx_lustre_file_system_test.go b/internal/service/datasync/location_fsx_lustre_file_system_test.go index e3fc18bceb4..dfe18ffbdfe 100644 --- a/internal/service/datasync/location_fsx_lustre_file_system_test.go +++ b/internal/service/datasync/location_fsx_lustre_file_system_test.go @@ -47,7 +47,7 @@ func TestAccDataSyncLocationFSxLustreFileSystem_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "subdirectory", "/"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestMatchResourceAttr(resourceName, "uri", regexache.MustCompile(`^fsxl://.+/`)), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), ), }, { diff --git a/internal/service/datasync/location_fsx_ontap_file_system.go b/internal/service/datasync/location_fsx_ontap_file_system.go index e5371e426d1..3491cb465ef 100644 --- a/internal/service/datasync/location_fsx_ontap_file_system.go +++ b/internal/service/datasync/location_fsx_ontap_file_system.go @@ -59,7 +59,7 @@ func resourceLocationFSxONTAPFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -242,7 +242,7 @@ func resourceLocationFSxONTAPFileSystemRead(ctx context.Context, d *schema.Resou } d.Set(names.AttrARN, output.LocationArn) - d.Set("creation_time", output.CreationTime.Format(time.RFC3339)) + d.Set(names.AttrCreationTime, output.CreationTime.Format(time.RFC3339)) d.Set("fsx_filesystem_arn", output.FsxFilesystemArn) // SMB Password is not returned from the API. if output.Protocol != nil && output.Protocol.SMB != nil && aws.ToString(output.Protocol.SMB.Password) == "" { diff --git a/internal/service/datasync/location_fsx_ontap_file_system_test.go b/internal/service/datasync/location_fsx_ontap_file_system_test.go index 083a42848cc..c9a5c8fecd9 100644 --- a/internal/service/datasync/location_fsx_ontap_file_system_test.go +++ b/internal/service/datasync/location_fsx_ontap_file_system_test.go @@ -44,7 +44,7 @@ func TestAccDataSyncLocationFSxONTAPFileSystem_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckLocationFSxONTAPExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "datasync", regexache.MustCompile(`location/loc-.+`)), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(resourceName, "fsx_filesystem_arn", fsResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "protocol.#", "1"), resource.TestCheckResourceAttr(resourceName, "protocol.0.nfs.#", "1"), diff --git a/internal/service/datasync/location_fsx_openzfs_file_system.go b/internal/service/datasync/location_fsx_openzfs_file_system.go index 98d79c08277..bbc9fc9f247 100644 --- a/internal/service/datasync/location_fsx_openzfs_file_system.go +++ b/internal/service/datasync/location_fsx_openzfs_file_system.go @@ -59,7 +59,7 @@ func resourceLocationFSxOpenZFSFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -185,7 +185,7 @@ func resourceLocationFSxOpenZFSFileSystemRead(ctx context.Context, d *schema.Res } d.Set(names.AttrARN, output.LocationArn) - d.Set("creation_time", output.CreationTime.Format(time.RFC3339)) + d.Set(names.AttrCreationTime, output.CreationTime.Format(time.RFC3339)) d.Set("fsx_filesystem_arn", d.Get("fsx_filesystem_arn")) if err := d.Set(names.AttrProtocol, flattenProtocol(output.Protocol)); err != nil { return sdkdiag.AppendErrorf(diags, "setting protocol: %s", err) diff --git a/internal/service/datasync/location_fsx_openzfs_file_system_test.go b/internal/service/datasync/location_fsx_openzfs_file_system_test.go index d3bd03c6474..6acc3800f47 100644 --- a/internal/service/datasync/location_fsx_openzfs_file_system_test.go +++ b/internal/service/datasync/location_fsx_openzfs_file_system_test.go @@ -43,7 +43,7 @@ func TestAccDataSyncLocationFSxOpenZFSFileSystem_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckLocationFSxOpenZFSExists(ctx, resourceName, &v), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "datasync", regexache.MustCompile(`location/loc-.+`)), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(resourceName, "fsx_filesystem_arn", fsResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "subdirectory", "/fsx/"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), diff --git a/internal/service/datasync/location_fsx_windows_file_system.go b/internal/service/datasync/location_fsx_windows_file_system.go index 219c8882494..fd06c719141 100644 --- a/internal/service/datasync/location_fsx_windows_file_system.go +++ b/internal/service/datasync/location_fsx_windows_file_system.go @@ -58,7 +58,7 @@ func resourceLocationFSxWindowsFileSystem() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -171,7 +171,7 @@ func resourceLocationFSxWindowsFileSystemRead(ctx context.Context, d *schema.Res } d.Set(names.AttrARN, output.LocationArn) - d.Set("creation_time", output.CreationTime.Format(time.RFC3339)) + d.Set(names.AttrCreationTime, output.CreationTime.Format(time.RFC3339)) d.Set("domain", output.Domain) d.Set("fsx_filesystem_arn", d.Get("fsx_filesystem_arn")) d.Set("security_group_arns", output.SecurityGroupArns) diff --git a/internal/service/datasync/location_fsx_windows_file_system_test.go b/internal/service/datasync/location_fsx_windows_file_system_test.go index 525978f0033..e23e8fd8746 100644 --- a/internal/service/datasync/location_fsx_windows_file_system_test.go +++ b/internal/service/datasync/location_fsx_windows_file_system_test.go @@ -48,7 +48,7 @@ func TestAccDataSyncLocationFSxWindowsFileSystem_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "subdirectory", "/"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestMatchResourceAttr(resourceName, "uri", regexache.MustCompile(`^fsxw://.+/`)), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), ), }, { diff --git a/internal/service/datasync/task.go b/internal/service/datasync/task.go index a5e42cfbb4a..9ad9cd01637 100644 --- a/internal/service/datasync/task.go +++ b/internal/service/datasync/task.go @@ -204,7 +204,7 @@ func resourceTask() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -647,7 +647,7 @@ func expandTaskSchedule(l []interface{}) *awstypes.TaskSchedule { m := l[0].(map[string]interface{}) schedule := &awstypes.TaskSchedule{ - ScheduleExpression: aws.String(m["schedule_expression"].(string)), + ScheduleExpression: aws.String(m[names.AttrScheduleExpression].(string)), } return schedule @@ -659,7 +659,7 @@ func flattenTaskSchedule(schedule *awstypes.TaskSchedule) []interface{} { } m := map[string]interface{}{ - "schedule_expression": aws.ToString(schedule.ScheduleExpression), + names.AttrScheduleExpression: aws.ToString(schedule.ScheduleExpression), } return []interface{}{m} From fe55f6591342348c552a0835cb573d78d68ad496 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:43 -0400 Subject: [PATCH 1341/1490] datazone: Use constants for strings --- internal/service/datazone/domain_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/datazone/domain_test.go b/internal/service/datazone/domain_test.go index 1a3990891da..54cd4df57f5 100644 --- a/internal/service/datazone/domain_test.go +++ b/internal/service/datazone/domain_test.go @@ -51,7 +51,7 @@ func TestAccDataZoneDomain_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -113,7 +113,7 @@ func TestAccDataZoneDomain_kms_key_identifier(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -148,7 +148,7 @@ func TestAccDataZoneDomain_description(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) From 5cdf4f31127aaa011bba2655ca2c0749d271d840 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:43 -0400 Subject: [PATCH 1342/1490] dlm: Use constants for strings --- internal/service/dlm/lifecycle_policy.go | 16 ++++++++-------- internal/service/dlm/lifecycle_policy_test.go | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/dlm/lifecycle_policy.go b/internal/service/dlm/lifecycle_policy.go index 79ff64415b3..278af960de9 100644 --- a/internal/service/dlm/lifecycle_policy.go +++ b/internal/service/dlm/lifecycle_policy.go @@ -49,7 +49,7 @@ func ResourceLifecyclePolicy() *schema.Resource { validation.StringLenBetween(1, 500), ), }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -72,7 +72,7 @@ func ResourceLifecyclePolicy() *schema.Resource { MaxItems: 3, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "encryption_configuration": { + names.AttrEncryptionConfiguration: { Type: schema.TypeList, Required: true, MaxItems: 1, @@ -506,7 +506,7 @@ func resourceLifecyclePolicyCreate(ctx context.Context, d *schema.ResourceData, input := dlm.CreateLifecyclePolicyInput{ Description: aws.String(d.Get(names.AttrDescription).(string)), - ExecutionRoleArn: aws.String(d.Get("execution_role_arn").(string)), + ExecutionRoleArn: aws.String(d.Get(names.AttrExecutionRoleARN).(string)), PolicyDetails: expandPolicyDetails(d.Get("policy_details").([]interface{})), State: aws.String(d.Get(names.AttrState).(string)), Tags: getTagsIn(ctx), @@ -547,7 +547,7 @@ func resourceLifecyclePolicyRead(ctx context.Context, d *schema.ResourceData, me d.Set(names.AttrARN, out.Policy.PolicyArn) d.Set(names.AttrDescription, out.Policy.Description) - d.Set("execution_role_arn", out.Policy.ExecutionRoleArn) + d.Set(names.AttrExecutionRoleARN, out.Policy.ExecutionRoleArn) d.Set(names.AttrState, out.Policy.State) if err := d.Set("policy_details", flattenPolicyDetails(out.Policy.PolicyDetails)); err != nil { return sdkdiag.AppendErrorf(diags, "setting policy details %s", err) @@ -570,8 +570,8 @@ func resourceLifecyclePolicyUpdate(ctx context.Context, d *schema.ResourceData, if d.HasChange(names.AttrDescription) { input.Description = aws.String(d.Get(names.AttrDescription).(string)) } - if d.HasChange("execution_role_arn") { - input.ExecutionRoleArn = aws.String(d.Get("execution_role_arn").(string)) + if d.HasChange(names.AttrExecutionRoleARN) { + input.ExecutionRoleArn = aws.String(d.Get(names.AttrExecutionRoleARN).(string)) } if d.HasChange(names.AttrState) { input.State = aws.String(d.Get(names.AttrState).(string)) @@ -782,7 +782,7 @@ func expandActionCrossRegionCopyRules(l []interface{}) []*dlm.CrossRegionCopyAct } rule := &dlm.CrossRegionCopyAction{} - if v, ok := m["encryption_configuration"].([]interface{}); ok { + if v, ok := m[names.AttrEncryptionConfiguration].([]interface{}); ok { rule.EncryptionConfiguration = expandActionCrossRegionCopyRuleEncryptionConfiguration(v) } if v, ok := m["retain_rule"].([]interface{}); ok && len(v) > 0 && v[0] != nil { @@ -811,7 +811,7 @@ func flattenActionCrossRegionCopyRules(rules []*dlm.CrossRegionCopyAction) []int } m := map[string]interface{}{ - "encryption_configuration": flattenActionCrossRegionCopyRuleEncryptionConfiguration(rule.EncryptionConfiguration), + names.AttrEncryptionConfiguration: flattenActionCrossRegionCopyRuleEncryptionConfiguration(rule.EncryptionConfiguration), "retain_rule": flattenCrossRegionCopyRuleRetainRule(rule.RetainRule), names.AttrTarget: aws.StringValue(rule.Target), } diff --git a/internal/service/dlm/lifecycle_policy_test.go b/internal/service/dlm/lifecycle_policy_test.go index cd5a68e75dc..c8c3fa20b90 100644 --- a/internal/service/dlm/lifecycle_policy_test.go +++ b/internal/service/dlm/lifecycle_policy_test.go @@ -38,7 +38,7 @@ func TestAccDLMLifecyclePolicy_basic(t *testing.T) { checkLifecyclePolicyExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "dlm", regexache.MustCompile(`policy/.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "tf-acc-basic"), - resource.TestCheckResourceAttrSet(resourceName, "execution_role_arn"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrExecutionRoleARN), resource.TestCheckResourceAttr(resourceName, names.AttrState, "ENABLED"), resource.TestCheckResourceAttr(resourceName, "policy_details.0.resource_types.0", "VOLUME"), resource.TestCheckResourceAttr(resourceName, "policy_details.0.policy_type", "EBS_SNAPSHOT_MANAGEMENT"), @@ -81,7 +81,7 @@ func TestAccDLMLifecyclePolicy_event(t *testing.T) { checkLifecyclePolicyExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "dlm", regexache.MustCompile(`policy/.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "tf-acc-basic"), - resource.TestCheckResourceAttrSet(resourceName, "execution_role_arn"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrExecutionRoleARN), resource.TestCheckResourceAttr(resourceName, names.AttrState, "ENABLED"), resource.TestCheckResourceAttr(resourceName, "policy_details.0.resource_types.#", "0"), resource.TestCheckResourceAttr(resourceName, "policy_details.0.policy_type", "EVENT_BASED_POLICY"), @@ -355,7 +355,7 @@ func TestAccDLMLifecyclePolicy_full(t *testing.T) { Check: resource.ComposeTestCheckFunc( checkLifecyclePolicyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "tf-acc-full"), - resource.TestCheckResourceAttrSet(resourceName, "execution_role_arn"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrExecutionRoleARN), resource.TestCheckResourceAttr(resourceName, names.AttrState, "ENABLED"), resource.TestCheckResourceAttr(resourceName, "policy_details.0.resource_types.0", "VOLUME"), resource.TestCheckResourceAttr(resourceName, "policy_details.0.schedule.0.name", "tf-acc-full"), @@ -378,7 +378,7 @@ func TestAccDLMLifecyclePolicy_full(t *testing.T) { Check: resource.ComposeTestCheckFunc( checkLifecyclePolicyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "tf-acc-full-updated"), - resource.TestCheckResourceAttrSet(resourceName, "execution_role_arn"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrExecutionRoleARN), resource.TestCheckResourceAttr(resourceName, names.AttrState, "DISABLED"), resource.TestCheckResourceAttr(resourceName, "policy_details.0.resource_types.0", "VOLUME"), resource.TestCheckResourceAttr(resourceName, "policy_details.0.schedule.0.name", "tf-acc-full-updated"), From f48633ad1de75ee015d58c0ae420570aacca6452 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:43 -0400 Subject: [PATCH 1343/1490] dms: Use constants for strings --- internal/service/dms/certificate.go | 6 ++-- .../service/dms/certificate_data_source.go | 4 +-- internal/service/dms/certificate_test.go | 2 +- internal/service/dms/endpoint.go | 10 +++---- internal/service/dms/endpoint_data_source.go | 2 +- internal/service/dms/replication_instance.go | 10 +++---- .../dms/replication_instance_data_source.go | 4 +-- .../service/dms/replication_instance_test.go | 30 +++++++++---------- internal/service/dms/s3_endpoint.go | 12 ++++---- internal/service/dms/service_package_gen.go | 2 +- 10 files changed, 41 insertions(+), 41 deletions(-) diff --git a/internal/service/dms/certificate.go b/internal/service/dms/certificate.go index f7a071a249c..8834c89d50e 100644 --- a/internal/service/dms/certificate.go +++ b/internal/service/dms/certificate.go @@ -38,7 +38,7 @@ func ResourceCertificate() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Computed: true, }, @@ -143,7 +143,7 @@ func resourceCertificateDelete(ctx context.Context, d *schema.ResourceData, meta log.Printf("[DEBUG] Deleting DMS Certificate: %s", d.Id()) _, err := conn.DeleteCertificateWithContext(ctx, &dms.DeleteCertificateInput{ - CertificateArn: aws.String(d.Get("certificate_arn").(string)), + CertificateArn: aws.String(d.Get(names.AttrCertificateARN).(string)), }) if tfawserr.ErrCodeEquals(err, dms.ErrCodeResourceNotFoundFault) { @@ -161,7 +161,7 @@ func resourceCertificateSetState(d *schema.ResourceData, cert *dms.Certificate) d.SetId(aws.StringValue(cert.CertificateIdentifier)) d.Set("certificate_id", cert.CertificateIdentifier) - d.Set("certificate_arn", cert.CertificateArn) + d.Set(names.AttrCertificateARN, cert.CertificateArn) if aws.StringValue(cert.CertificatePem) != "" { d.Set("certificate_pem", cert.CertificatePem) diff --git a/internal/service/dms/certificate_data_source.go b/internal/service/dms/certificate_data_source.go index 7444d851954..470711f8a1a 100644 --- a/internal/service/dms/certificate_data_source.go +++ b/internal/service/dms/certificate_data_source.go @@ -24,7 +24,7 @@ func DataSourceCertificate() *schema.Resource { ReadWithoutTimeout: dataSourceCertificateRead, Schema: map[string]*schema.Schema{ - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Computed: true, }, @@ -92,7 +92,7 @@ func dataSourceCertificateRead(ctx context.Context, d *schema.ResourceData, meta d.SetId(aws.StringValue(out.CertificateIdentifier)) arn := aws.StringValue(out.CertificateArn) - d.Set("certificate_arn", arn) + d.Set(names.AttrCertificateARN, arn) d.Set("certificate_id", out.CertificateIdentifier) d.Set("certificate_pem", out.CertificatePem) if len(out.CertificateWallet) != 0 { diff --git a/internal/service/dms/certificate_test.go b/internal/service/dms/certificate_test.go index b462d701a6b..2ddd08d3b02 100644 --- a/internal/service/dms/certificate_test.go +++ b/internal/service/dms/certificate_test.go @@ -33,7 +33,7 @@ func TestAccDMSCertificate_basic(t *testing.T) { Config: testAccCertificateConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCertificateExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "certificate_arn"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificateARN), ), }, { diff --git a/internal/service/dms/endpoint.go b/internal/service/dms/endpoint.go index 50366913ec3..737b16c44b1 100644 --- a/internal/service/dms/endpoint.go +++ b/internal/service/dms/endpoint.go @@ -48,7 +48,7 @@ func ResourceEndpoint() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Computed: true, Optional: true, @@ -786,7 +786,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("certificate_arn"); ok { + if v, ok := d.GetOk(names.AttrCertificateARN); ok { input.CertificateArn = aws.String(v.(string)) } @@ -1075,8 +1075,8 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in EndpointArn: aws.String(endpointARN), } - if d.HasChange("certificate_arn") { - input.CertificateArn = aws.String(d.Get("certificate_arn").(string)) + if d.HasChange(names.AttrCertificateARN) { + input.CertificateArn = aws.String(d.Get(names.AttrCertificateARN).(string)) } if d.HasChange("endpoint_type") { @@ -1530,7 +1530,7 @@ func validateSSEKMSKey(settingsAttrName string, d *schema.ResourceDiff) error { func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) error { d.SetId(aws.StringValue(endpoint.EndpointIdentifier)) - d.Set("certificate_arn", endpoint.CertificateArn) + d.Set(names.AttrCertificateARN, endpoint.CertificateArn) d.Set("endpoint_arn", endpoint.EndpointArn) d.Set("endpoint_id", endpoint.EndpointIdentifier) // For some reason the AWS API only accepts lowercase type but returns it as uppercase diff --git a/internal/service/dms/endpoint_data_source.go b/internal/service/dms/endpoint_data_source.go index b1b51bee40b..a533b694be9 100644 --- a/internal/service/dms/endpoint_data_source.go +++ b/internal/service/dms/endpoint_data_source.go @@ -21,7 +21,7 @@ func DataSourceEndpoint() *schema.Resource { ReadWithoutTimeout: dataSourceEndpointRead, Schema: map[string]*schema.Schema{ - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/dms/replication_instance.go b/internal/service/dms/replication_instance.go index 705bf203400..76f861e6582 100644 --- a/internal/service/dms/replication_instance.go +++ b/internal/service/dms/replication_instance.go @@ -55,7 +55,7 @@ func ResourceReplicationInstance() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, }, @@ -99,7 +99,7 @@ func ResourceReplicationInstance() *schema.Resource { Computed: true, ValidateFunc: verify.ValidOnceAWeekWindowFormat, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -158,7 +158,7 @@ func resourceReplicationInstanceCreate(ctx context.Context, d *schema.ResourceDa replicationInstanceID := d.Get("replication_instance_id").(string) input := &dms.CreateReplicationInstanceInput{ AutoMinorVersionUpgrade: aws.Bool(d.Get(names.AttrAutoMinorVersionUpgrade).(bool)), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), MultiAZ: aws.Bool(d.Get("multi_az").(bool)), ReplicationInstanceClass: aws.String(d.Get("replication_instance_class").(string)), ReplicationInstanceIdentifier: aws.String(replicationInstanceID), @@ -233,7 +233,7 @@ func resourceReplicationInstanceRead(ctx context.Context, d *schema.ResourceData d.Set("multi_az", instance.MultiAZ) d.Set("network_type", instance.NetworkType) d.Set(names.AttrPreferredMaintenanceWindow, instance.PreferredMaintenanceWindow) - d.Set("publicly_accessible", instance.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, instance.PubliclyAccessible) d.Set("replication_instance_arn", instance.ReplicationInstanceArn) d.Set("replication_instance_class", instance.ReplicationInstanceClass) d.Set("replication_instance_id", instance.ReplicationInstanceIdentifier) @@ -257,7 +257,7 @@ func resourceReplicationInstanceUpdate(ctx context.Context, d *schema.ResourceDa // as it results in InvalidParameterCombination: No modifications were requested input := &dms.ModifyReplicationInstanceInput{ AllowMajorVersionUpgrade: aws.Bool(d.Get("allow_major_version_upgrade").(bool)), - ApplyImmediately: aws.Bool(d.Get("apply_immediately").(bool)), + ApplyImmediately: aws.Bool(d.Get(names.AttrApplyImmediately).(bool)), ReplicationInstanceArn: aws.String(d.Get("replication_instance_arn").(string)), } diff --git a/internal/service/dms/replication_instance_data_source.go b/internal/service/dms/replication_instance_data_source.go index dcf103fca2d..28bbcf9c5a2 100644 --- a/internal/service/dms/replication_instance_data_source.go +++ b/internal/service/dms/replication_instance_data_source.go @@ -55,7 +55,7 @@ func DataSourceReplicationInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Computed: true, }, @@ -118,7 +118,7 @@ func dataSourceReplicationInstanceRead(ctx context.Context, d *schema.ResourceDa d.Set("multi_az", instance.MultiAZ) d.Set("network_type", instance.NetworkType) d.Set(names.AttrPreferredMaintenanceWindow, instance.PreferredMaintenanceWindow) - d.Set("publicly_accessible", instance.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, instance.PubliclyAccessible) arn := aws.StringValue(instance.ReplicationInstanceArn) d.Set("replication_instance_arn", arn) d.Set("replication_instance_class", instance.ReplicationInstanceClass) diff --git a/internal/service/dms/replication_instance_test.go b/internal/service/dms/replication_instance_test.go index 7dfd9d37f84..80f29e35675 100644 --- a/internal/service/dms/replication_instance_test.go +++ b/internal/service/dms/replication_instance_test.go @@ -43,7 +43,7 @@ func TestAccDMSReplicationInstance_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "multi_az", "false"), resource.TestCheckResourceAttr(resourceName, "network_type", "IPV4"), resource.TestCheckResourceAttrSet(resourceName, names.AttrPreferredMaintenanceWindow), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttrSet(resourceName, "replication_instance_arn"), resource.TestCheckResourceAttr(resourceName, "replication_instance_class", replicationInstanceClass), resource.TestCheckResourceAttr(resourceName, "replication_instance_id", rName), @@ -58,7 +58,7 @@ func TestAccDMSReplicationInstance_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, }, }) @@ -111,7 +111,7 @@ func TestAccDMSReplicationInstance_allocatedStorage(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, { Config: testAccReplicationInstanceConfig_allocatedStorage(rName, 6), @@ -146,7 +146,7 @@ func TestAccDMSReplicationInstance_autoMinorVersionUpgrade(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, { Config: testAccReplicationInstanceConfig_autoMinorVersionUpgrade(rName, false), @@ -189,7 +189,7 @@ func TestAccDMSReplicationInstance_availabilityZone(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, }, }) @@ -217,7 +217,7 @@ func TestAccDMSReplicationInstance_engineVersion(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"allow_major_version_upgrade", "apply_immediately"}, + ImportStateVerifyIgnore: []string{"allow_major_version_upgrade", names.AttrApplyImmediately}, }, { Config: testAccReplicationInstanceConfig_engineVersion(rName, "3.5.1"), @@ -253,7 +253,7 @@ func TestAccDMSReplicationInstance_kmsKeyARN(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, }, }) @@ -281,7 +281,7 @@ func TestAccDMSReplicationInstance_multiAz(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, { Config: testAccReplicationInstanceConfig_multiAz(rName, false), @@ -323,7 +323,7 @@ func TestAccDMSReplicationInstance_networkType(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, { Config: testAccReplicationInstanceConfig_networkType(rName, "DUAL"), @@ -358,7 +358,7 @@ func TestAccDMSReplicationInstance_preferredMaintenanceWindow(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, { Config: testAccReplicationInstanceConfig_preferredMaintenanceWindow(rName, "mon:00:30-mon:02:30"), @@ -386,7 +386,7 @@ func TestAccDMSReplicationInstance_publiclyAccessible(t *testing.T) { Config: testAccReplicationInstanceConfig_publiclyAccessible(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckReplicationInstanceExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "true"), resource.TestCheckResourceAttr(resourceName, "replication_instance_public_ips.#", "1"), ), }, @@ -394,7 +394,7 @@ func TestAccDMSReplicationInstance_publiclyAccessible(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, }, }) @@ -425,7 +425,7 @@ func TestAccDMSReplicationInstance_replicationInstanceClass(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, { Config: testAccReplicationInstanceConfig_replicationInstanceClass(rName, replicationInstanceClass2), @@ -461,7 +461,7 @@ func TestAccDMSReplicationInstance_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, { Config: testAccReplicationInstanceConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), @@ -506,7 +506,7 @@ func TestAccDMSReplicationInstance_vpcSecurityGroupIDs(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, }, }) diff --git a/internal/service/dms/s3_endpoint.go b/internal/service/dms/s3_endpoint.go index 017c6577c34..2ecc0b4c414 100644 --- a/internal/service/dms/s3_endpoint.go +++ b/internal/service/dms/s3_endpoint.go @@ -46,7 +46,7 @@ func ResourceS3Endpoint() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Computed: true, Optional: true, @@ -336,7 +336,7 @@ func resourceS3EndpointCreate(ctx context.Context, d *schema.ResourceData, meta Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("certificate_arn"); ok { + if v, ok := d.GetOk(names.AttrCertificateARN); ok { input.CertificateArn = aws.String(v.(string)) } @@ -415,7 +415,7 @@ func resourceS3EndpointRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("endpoint_arn", endpoint.EndpointArn) - d.Set("certificate_arn", endpoint.CertificateArn) + d.Set(names.AttrCertificateARN, endpoint.CertificateArn) d.Set("endpoint_id", endpoint.EndpointIdentifier) d.Set("endpoint_type", strings.ToLower(*endpoint.EndpointType)) // For some reason the AWS API only accepts lowercase type but returns it as uppercase d.Set("engine_display_name", endpoint.EngineDisplayName) @@ -492,8 +492,8 @@ func resourceS3EndpointUpdate(ctx context.Context, d *schema.ResourceData, meta EndpointArn: aws.String(d.Get("endpoint_arn").(string)), } - if d.HasChange("certificate_arn") { - input.CertificateArn = aws.String(d.Get("certificate_arn").(string)) + if d.HasChange(names.AttrCertificateARN) { + input.CertificateArn = aws.String(d.Get(names.AttrCertificateARN).(string)) } if d.HasChange("endpoint_type") { @@ -507,7 +507,7 @@ func resourceS3EndpointUpdate(ctx context.Context, d *schema.ResourceData, meta } if d.HasChangesExcept( - "certificate_arn", + names.AttrCertificateARN, "endpoint_type", "ssl_mode", ) { diff --git a/internal/service/dms/service_package_gen.go b/internal/service/dms/service_package_gen.go index 897c40833bd..e9b41a00904 100644 --- a/internal/service/dms/service_package_gen.go +++ b/internal/service/dms/service_package_gen.go @@ -55,7 +55,7 @@ func (p *servicePackage) SDKResources(ctx context.Context) []*types.ServicePacka TypeName: "aws_dms_certificate", Name: "Certificate", Tags: &types.ServicePackageResourceTags{ - IdentifierAttribute: "certificate_arn", + IdentifierAttribute: names.AttrCertificateARN, }, }, { From 47ed7e2bec29c6d7c1f987f2c65f20ade77ec23a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:43 -0400 Subject: [PATCH 1344/1490] docdb: Use constants for strings --- internal/service/docdb/cluster.go | 4 +- internal/service/docdb/cluster_instance.go | 8 ++-- .../service/docdb/cluster_instance_test.go | 22 +++++------ internal/service/docdb/cluster_test.go | 38 +++++++++---------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/internal/service/docdb/cluster.go b/internal/service/docdb/cluster.go index 3ff6ccc78dd..790540a4e67 100644 --- a/internal/service/docdb/cluster.go +++ b/internal/service/docdb/cluster.go @@ -59,7 +59,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, }, @@ -537,7 +537,7 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll, "global_cluster_identifier", "skip_final_snapshot") { input := &docdb.ModifyDBClusterInput{ - ApplyImmediately: aws.Bool(d.Get("apply_immediately").(bool)), + ApplyImmediately: aws.Bool(d.Get(names.AttrApplyImmediately).(bool)), DBClusterIdentifier: aws.String(d.Id()), } diff --git a/internal/service/docdb/cluster_instance.go b/internal/service/docdb/cluster_instance.go index 40b19d0db97..e3a332ed80a 100644 --- a/internal/service/docdb/cluster_instance.go +++ b/internal/service/docdb/cluster_instance.go @@ -46,7 +46,7 @@ func ResourceClusterInstance() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, }, @@ -161,7 +161,7 @@ func ResourceClusterInstance() *schema.Resource { Default: 0, ValidateFunc: validation.IntBetween(0, 15), }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Computed: true, }, @@ -289,7 +289,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me d.Set("preferred_backup_window", db.PreferredBackupWindow) d.Set(names.AttrPreferredMaintenanceWindow, db.PreferredMaintenanceWindow) d.Set("promotion_tier", db.PromotionTier) - d.Set("publicly_accessible", db.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, db.PubliclyAccessible) d.Set("storage_encrypted", db.StorageEncrypted) if v := tfslices.Filter(dbc.DBClusterMembers, func(v *docdb.DBClusterMember) bool { return aws.StringValue(v.DBInstanceIdentifier) == d.Id() @@ -306,7 +306,7 @@ func resourceClusterInstanceUpdate(ctx context.Context, d *schema.ResourceData, if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll) { input := &docdb.ModifyDBInstanceInput{ - ApplyImmediately: aws.Bool(d.Get("apply_immediately").(bool)), + ApplyImmediately: aws.Bool(d.Get(names.AttrApplyImmediately).(bool)), DBInstanceIdentifier: aws.String(d.Id()), } diff --git a/internal/service/docdb/cluster_instance_test.go b/internal/service/docdb/cluster_instance_test.go index d4e5525910b..e726f70aaff 100644 --- a/internal/service/docdb/cluster_instance_test.go +++ b/internal/service/docdb/cluster_instance_test.go @@ -36,7 +36,7 @@ func TestAccDocDBClusterInstance_basic(t *testing.T) { Config: testAccClusterInstanceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - resource.TestCheckNoResourceAttr(resourceName, "apply_immediately"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrApplyImmediately), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "rds", regexache.MustCompile(fmt.Sprintf("db:%s", rName))), resource.TestCheckResourceAttr(resourceName, names.AttrAutoMinorVersionUpgrade, "true"), resource.TestCheckResourceAttrSet(resourceName, names.AttrAvailabilityZone), @@ -58,7 +58,7 @@ func TestAccDocDBClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "preferred_backup_window"), resource.TestCheckResourceAttrSet(resourceName, names.AttrPreferredMaintenanceWindow), resource.TestCheckResourceAttr(resourceName, "promotion_tier", "0"), - resource.TestCheckResourceAttrSet(resourceName, "publicly_accessible"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrPubliclyAccessible), resource.TestCheckResourceAttrSet(resourceName, "storage_encrypted"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "writer", "true"), @@ -69,14 +69,14 @@ func TestAccDocDBClusterInstance_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { Config: testAccClusterInstanceConfig_modified(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "apply_immediately", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrApplyImmediately, "true"), resource.TestCheckResourceAttr(resourceName, names.AttrAutoMinorVersionUpgrade, "false"), resource.TestCheckResourceAttr(resourceName, "promotion_tier", "3"), ), @@ -134,7 +134,7 @@ func TestAccDocDBClusterInstance_identifierGenerated(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -167,7 +167,7 @@ func TestAccDocDBClusterInstance_identifierPrefix(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -199,7 +199,7 @@ func TestAccDocDBClusterInstance_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -250,7 +250,7 @@ func TestAccDocDBClusterInstance_performanceInsights(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "enable_performance_insights", "performance_insights_kms_key_id", }, @@ -284,7 +284,7 @@ func TestAccDocDBClusterInstance_az(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -316,7 +316,7 @@ func TestAccDocDBClusterInstance_kmsKey(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -355,7 +355,7 @@ func TestAccDocDBClusterInstance_copyTagsToSnapshot(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, diff --git a/internal/service/docdb/cluster_test.go b/internal/service/docdb/cluster_test.go index e38ebe0b0d8..299f2cfb77d 100644 --- a/internal/service/docdb/cluster_test.go +++ b/internal/service/docdb/cluster_test.go @@ -50,7 +50,7 @@ func TestAccDocDBCluster_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster), resource.TestCheckNoResourceAttr(resourceName, "allow_major_version_upgrade"), - resource.TestCheckNoResourceAttr(resourceName, "apply_immediately"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrApplyImmediately), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "rds", regexache.MustCompile(fmt.Sprintf("cluster:%s", rName))), resource.TestCheckResourceAttr(resourceName, "availability_zones.#", "3"), resource.TestCheckResourceAttr(resourceName, "backup_retention_period", "1"), @@ -91,7 +91,7 @@ func TestAccDocDBCluster_basic(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -150,7 +150,7 @@ func TestAccDocDBCluster_identifierGenerated(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -185,7 +185,7 @@ func TestAccDocDBCluster_identifierPrefix(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -221,7 +221,7 @@ func TestAccDocDBCluster_tags(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -273,7 +273,7 @@ func TestAccDocDBCluster_takeFinalSnapshot(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -328,7 +328,7 @@ func TestAccDocDBCluster_updateCloudWatchLogsExports(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -372,7 +372,7 @@ func TestAccDocDBCluster_kmsKey(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -407,7 +407,7 @@ func TestAccDocDBCluster_encrypted(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -444,7 +444,7 @@ func TestAccDocDBCluster_backupsUpdate(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -488,7 +488,7 @@ func TestAccDocDBCluster_port(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -531,7 +531,7 @@ func TestAccDocDBCluster_deleteProtection(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -588,7 +588,7 @@ func TestAccDocDBCluster_GlobalClusterIdentifier(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -627,7 +627,7 @@ func TestAccDocDBCluster_GlobalClusterIdentifier_Add(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -667,7 +667,7 @@ func TestAccDocDBCluster_GlobalClusterIdentifier_Remove(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -711,7 +711,7 @@ func TestAccDocDBCluster_GlobalClusterIdentifier_Update(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -780,7 +780,7 @@ func TestAccDocDBCluster_updateEngineMajorVersion(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster), resource.TestCheckResourceAttr(resourceName, "allow_major_version_upgrade", "true"), - resource.TestCheckResourceAttr(resourceName, "apply_immediately", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrApplyImmediately, "true"), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "rds", regexache.MustCompile(fmt.Sprintf("cluster:%s", rName))), resource.TestCheckResourceAttr(resourceName, "availability_zones.#", "3"), resource.TestCheckResourceAttr(resourceName, "backup_retention_period", "1"), @@ -819,7 +819,7 @@ func TestAccDocDBCluster_updateEngineMajorVersion(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", @@ -863,7 +863,7 @@ func TestAccDocDBCluster_storageType(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "master_password", "skip_final_snapshot", From 126f4c1174aa3782405d557f638b4f907cc2c1ad Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:43 -0400 Subject: [PATCH 1345/1490] ec2: Use constants for strings --- internal/service/ec2/ec2_ami_data_source.go | 4 ++-- internal/service/ec2/ec2_ami_data_source_test.go | 6 +++--- internal/service/ec2/ec2_launch_template.go | 6 +++--- .../service/ec2/ec2_launch_template_data_source.go | 2 +- internal/service/ec2/ipam_pool_cidr_allocation.go | 4 ++-- .../ec2/transitgateway_attachment_data_source.go | 4 ++-- .../ec2/transitgateway_attachment_data_source_test.go | 4 ++-- .../ec2/transitgateway_policy_table_association.go | 4 ++-- .../transitgateway_policy_table_association_test.go | 2 +- .../ec2/transitgateway_route_table_association.go | 4 ++-- .../ec2/transitgateway_route_table_association_test.go | 4 ++-- .../ec2/transitgateway_route_table_propagation.go | 4 ++-- .../ec2/transitgateway_route_table_propagation_test.go | 2 +- internal/service/ec2/verifiedaccess_group.go | 4 ++-- internal/service/ec2/verifiedaccess_group_test.go | 10 +++++----- internal/service/ec2/verifiedaccess_instance.go | 4 ++-- internal/service/ec2/verifiedaccess_instance_test.go | 2 +- internal/service/ec2/vpc_network_insights_analysis.go | 6 +++--- internal/service/ec2/vpc_network_insights_path.go | 4 ++-- .../ec2/vpc_network_insights_path_data_source.go | 4 ++-- .../ec2/vpc_network_insights_path_data_source_test.go | 2 +- internal/service/ec2/vpc_network_insights_path_test.go | 4 ++-- internal/service/ec2/vpnsite_connection.go | 4 ++-- internal/service/ec2/vpnsite_customer_gateway.go | 6 +++--- .../ec2/vpnsite_customer_gateway_data_source.go | 4 ++-- .../ec2/vpnsite_customer_gateway_data_source_test.go | 4 ++-- internal/service/ec2/vpnsite_customer_gateway_test.go | 4 ++-- 27 files changed, 56 insertions(+), 56 deletions(-) diff --git a/internal/service/ec2/ec2_ami_data_source.go b/internal/service/ec2/ec2_ami_data_source.go index 42a8d469455..c3d40e25793 100644 --- a/internal/service/ec2/ec2_ami_data_source.go +++ b/internal/service/ec2/ec2_ami_data_source.go @@ -74,7 +74,7 @@ func DataSourceAMI() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -310,7 +310,7 @@ func dataSourceAMIRead(ctx context.Context, d *schema.ResourceData, meta interfa return sdkdiag.AppendErrorf(diags, "setting block_device_mappings: %s", err) } d.Set("boot_mode", image.BootMode) - d.Set("creation_date", image.CreationDate) + d.Set(names.AttrCreationDate, image.CreationDate) d.Set("deprecation_time", image.DeprecationTime) d.Set(names.AttrDescription, image.Description) d.Set("ena_support", image.EnaSupport) diff --git a/internal/service/ec2/ec2_ami_data_source_test.go b/internal/service/ec2/ec2_ami_data_source_test.go index 6d9ce1c1539..c5bad1cac92 100644 --- a/internal/service/ec2/ec2_ami_data_source_test.go +++ b/internal/service/ec2/ec2_ami_data_source_test.go @@ -35,7 +35,7 @@ func TestAccEC2AMIDataSource_natInstance(t *testing.T) { resource.TestCheckResourceAttr(datasourceName, "architecture", "x86_64"), acctest.MatchResourceAttrRegionalARNNoAccount(datasourceName, names.AttrARN, "ec2", regexache.MustCompile(`image/ami-.+`)), resource.TestCheckResourceAttr(datasourceName, "block_device_mappings.#", "1"), - resource.TestMatchResourceAttr(datasourceName, "creation_date", regexache.MustCompile("^20[0-9]{2}-")), + resource.TestMatchResourceAttr(datasourceName, names.AttrCreationDate, regexache.MustCompile("^20[0-9]{2}-")), resource.TestMatchResourceAttr(datasourceName, "deprecation_time", regexache.MustCompile("^20[0-9]{2}-")), resource.TestMatchResourceAttr(datasourceName, names.AttrDescription, regexache.MustCompile("^Amazon Linux AMI")), resource.TestCheckResourceAttr(datasourceName, "ena_support", "true"), @@ -81,7 +81,7 @@ func TestAccEC2AMIDataSource_windowsInstance(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(datasourceName, "architecture", "x86_64"), resource.TestCheckResourceAttr(datasourceName, "block_device_mappings.#", "27"), - resource.TestMatchResourceAttr(datasourceName, "creation_date", regexache.MustCompile("^20[0-9]{2}-")), + resource.TestMatchResourceAttr(datasourceName, names.AttrCreationDate, regexache.MustCompile("^20[0-9]{2}-")), resource.TestMatchResourceAttr(datasourceName, "deprecation_time", regexache.MustCompile("^20[0-9]{2}-")), resource.TestMatchResourceAttr(datasourceName, names.AttrDescription, regexache.MustCompile("^Microsoft Windows Server")), resource.TestCheckResourceAttr(datasourceName, "ena_support", "true"), @@ -128,7 +128,7 @@ func TestAccEC2AMIDataSource_instanceStore(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(datasourceName, "architecture", "x86_64"), resource.TestCheckResourceAttr(datasourceName, "block_device_mappings.#", "0"), - resource.TestMatchResourceAttr(datasourceName, "creation_date", regexache.MustCompile("^20[0-9]{2}-")), + resource.TestMatchResourceAttr(datasourceName, names.AttrCreationDate, regexache.MustCompile("^20[0-9]{2}-")), resource.TestMatchResourceAttr(datasourceName, "deprecation_time", regexache.MustCompile("^20[0-9]{2}-")), resource.TestCheckResourceAttr(datasourceName, "ena_support", "true"), resource.TestCheckResourceAttr(datasourceName, "hypervisor", "xen"), diff --git a/internal/service/ec2/ec2_launch_template.go b/internal/service/ec2/ec2_launch_template.go index fabf3e49350..d4b8eb16887 100644 --- a/internal/service/ec2/ec2_launch_template.go +++ b/internal/service/ec2/ec2_launch_template.go @@ -918,7 +918,7 @@ func ResourceLaunchTemplate() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice(ec2.ResourceType_Values(), false), @@ -2154,7 +2154,7 @@ func expandLaunchTemplateTagSpecificationRequest(ctx context.Context, tfMap map[ apiObject := &ec2.LaunchTemplateTagSpecificationRequest{} - if v, ok := tfMap["resource_type"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrResourceType].(string); ok && v != "" { apiObject.ResourceType = aws.String(v) } @@ -3148,7 +3148,7 @@ func flattenLaunchTemplateTagSpecification(ctx context.Context, apiObject *ec2.L tfMap := map[string]interface{}{} if v := apiObject.ResourceType; v != nil { - tfMap["resource_type"] = aws.StringValue(v) + tfMap[names.AttrResourceType] = aws.StringValue(v) } if v := apiObject.Tags; len(v) > 0 { diff --git a/internal/service/ec2/ec2_launch_template_data_source.go b/internal/service/ec2/ec2_launch_template_data_source.go index 084685df600..4d0412979a0 100644 --- a/internal/service/ec2/ec2_launch_template_data_source.go +++ b/internal/service/ec2/ec2_launch_template_data_source.go @@ -757,7 +757,7 @@ func DataSourceLaunchTemplate() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/ec2/ipam_pool_cidr_allocation.go b/internal/service/ec2/ipam_pool_cidr_allocation.go index a146538dd1c..5d27001f0a3 100644 --- a/internal/service/ec2/ipam_pool_cidr_allocation.go +++ b/internal/service/ec2/ipam_pool_cidr_allocation.go @@ -89,7 +89,7 @@ func ResourceIPAMPoolCIDRAllocation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, }, @@ -165,7 +165,7 @@ func resourceIPAMPoolCIDRAllocationRead(ctx context.Context, d *schema.ResourceD d.Set("ipam_pool_id", poolID) d.Set("resource_id", allocation.ResourceId) d.Set("resource_owner", allocation.ResourceOwner) - d.Set("resource_type", allocation.ResourceType) + d.Set(names.AttrResourceType, allocation.ResourceType) return diags } diff --git a/internal/service/ec2/transitgateway_attachment_data_source.go b/internal/service/ec2/transitgateway_attachment_data_source.go index 1d4cea56283..315bcfbc03a 100644 --- a/internal/service/ec2/transitgateway_attachment_data_source.go +++ b/internal/service/ec2/transitgateway_attachment_data_source.go @@ -46,7 +46,7 @@ func DataSourceTransitGatewayAttachment() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, }, @@ -119,7 +119,7 @@ func dataSourceTransitGatewayAttachmentRead(ctx context.Context, d *schema.Resou } d.Set("resource_id", transitGatewayAttachment.ResourceId) d.Set("resource_owner_id", resourceOwnerID) - d.Set("resource_type", transitGatewayAttachment.ResourceType) + d.Set(names.AttrResourceType, transitGatewayAttachment.ResourceType) d.Set(names.AttrState, transitGatewayAttachment.State) d.Set(names.AttrTransitGatewayAttachmentID, transitGatewayAttachmentID) d.Set(names.AttrTransitGatewayID, transitGatewayAttachment.TransitGatewayId) diff --git a/internal/service/ec2/transitgateway_attachment_data_source_test.go b/internal/service/ec2/transitgateway_attachment_data_source_test.go index cf02538ea5a..9a37228764d 100644 --- a/internal/service/ec2/transitgateway_attachment_data_source_test.go +++ b/internal/service/ec2/transitgateway_attachment_data_source_test.go @@ -35,7 +35,7 @@ func testAccTransitGatewayAttachmentDataSource_Filter(t *testing.T, semaphore tf resource.TestCheckResourceAttrSet(dataSourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrVPCID, dataSourceName, "resource_id"), acctest.CheckResourceAttrAccountID(dataSourceName, "resource_owner_id"), - resource.TestCheckResourceAttr(dataSourceName, "resource_type", "vpc"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrResourceType, "vpc"), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrState), resource.TestCheckResourceAttrPair(resourceName, "tags.%", dataSourceName, "tags.%"), resource.TestCheckResourceAttrPair(resourceName, names.AttrID, dataSourceName, names.AttrTransitGatewayAttachmentID), @@ -70,7 +70,7 @@ func testAccTransitGatewayAttachmentDataSource_ID(t *testing.T, semaphore tfsync resource.TestCheckResourceAttrSet(dataSourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrVPCID, dataSourceName, "resource_id"), acctest.CheckResourceAttrAccountID(dataSourceName, "resource_owner_id"), - resource.TestCheckResourceAttr(dataSourceName, "resource_type", "vpc"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrResourceType, "vpc"), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrState), resource.TestCheckResourceAttrPair(resourceName, "tags.%", dataSourceName, "tags.%"), resource.TestCheckResourceAttrPair(resourceName, names.AttrID, dataSourceName, names.AttrTransitGatewayAttachmentID), diff --git a/internal/service/ec2/transitgateway_policy_table_association.go b/internal/service/ec2/transitgateway_policy_table_association.go index 3700b104a97..f613b1b433a 100644 --- a/internal/service/ec2/transitgateway_policy_table_association.go +++ b/internal/service/ec2/transitgateway_policy_table_association.go @@ -37,7 +37,7 @@ func ResourceTransitGatewayPolicyTableAssociation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, }, @@ -133,7 +133,7 @@ func resourceTransitGatewayPolicyTableAssociationRead(ctx context.Context, d *sc } d.Set("resource_id", transitGatewayPolicyTableAssociation.ResourceId) - d.Set("resource_type", transitGatewayPolicyTableAssociation.ResourceType) + d.Set(names.AttrResourceType, transitGatewayPolicyTableAssociation.ResourceType) d.Set(names.AttrTransitGatewayAttachmentID, transitGatewayPolicyTableAssociation.TransitGatewayAttachmentId) d.Set("transit_gateway_policy_table_id", transitGatewayPolicyTableAssociation.TransitGatewayPolicyTableId) diff --git a/internal/service/ec2/transitgateway_policy_table_association_test.go b/internal/service/ec2/transitgateway_policy_table_association_test.go index 0864828ff37..83949d604e1 100644 --- a/internal/service/ec2/transitgateway_policy_table_association_test.go +++ b/internal/service/ec2/transitgateway_policy_table_association_test.go @@ -43,7 +43,7 @@ func testAccTransitGatewayPolicyTableAssociation_basic(t *testing.T, semaphore t Check: resource.ComposeTestCheckFunc( testAccCheckTransitGatewayPolicyTableAssociationExists(ctx, resourceName, &v), resource.TestCheckResourceAttrSet(resourceName, "resource_id"), - resource.TestCheckResourceAttrSet(resourceName, "resource_type"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceType), resource.TestCheckResourceAttrPair(resourceName, names.AttrTransitGatewayAttachmentID, transitGatewayPeeringResourceName, "transit_gateway_peering_attachment_id"), resource.TestCheckResourceAttrPair(resourceName, "transit_gateway_policy_table_id", transitGatewayPolicyTableResourceName, names.AttrID), ), diff --git a/internal/service/ec2/transitgateway_route_table_association.go b/internal/service/ec2/transitgateway_route_table_association.go index 47a5c358cdd..3e33ae20faa 100644 --- a/internal/service/ec2/transitgateway_route_table_association.go +++ b/internal/service/ec2/transitgateway_route_table_association.go @@ -43,7 +43,7 @@ func ResourceTransitGatewayRouteTableAssociation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, }, @@ -135,7 +135,7 @@ func resourceTransitGatewayRouteTableAssociationRead(ctx context.Context, d *sch } d.Set("resource_id", transitGatewayRouteTableAssociation.ResourceId) - d.Set("resource_type", transitGatewayRouteTableAssociation.ResourceType) + d.Set(names.AttrResourceType, transitGatewayRouteTableAssociation.ResourceType) d.Set(names.AttrTransitGatewayAttachmentID, transitGatewayRouteTableAssociation.TransitGatewayAttachmentId) d.Set("transit_gateway_route_table_id", transitGatewayRouteTableID) diff --git a/internal/service/ec2/transitgateway_route_table_association_test.go b/internal/service/ec2/transitgateway_route_table_association_test.go index 185a9b1de1d..d90a49110bb 100644 --- a/internal/service/ec2/transitgateway_route_table_association_test.go +++ b/internal/service/ec2/transitgateway_route_table_association_test.go @@ -44,7 +44,7 @@ func testAccTransitGatewayRouteTableAssociation_basic(t *testing.T, semaphore tf testAccCheckTransitGatewayRouteTableAssociationExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "replace_existing_association", "false"), resource.TestCheckResourceAttrSet(resourceName, "resource_id"), - resource.TestCheckResourceAttrSet(resourceName, "resource_type"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceType), resource.TestCheckResourceAttrPair(resourceName, names.AttrTransitGatewayAttachmentID, transitGatewayVpcAttachmentResourceName, names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "transit_gateway_route_table_id", transitGatewayRouteTableResourceName, names.AttrID), ), @@ -111,7 +111,7 @@ func testAccTransitGatewayRouteTableAssociation_replaceExistingAssociation(t *te testAccCheckTransitGatewayRouteTableAssociationExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "replace_existing_association", "true"), resource.TestCheckResourceAttrSet(resourceName, "resource_id"), - resource.TestCheckResourceAttrSet(resourceName, "resource_type"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceType), resource.TestCheckResourceAttrPair(resourceName, names.AttrTransitGatewayAttachmentID, transitGatewayVpcAttachmentResourceName, names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "transit_gateway_route_table_id", transitGatewayRouteTableResourceName, names.AttrID), resource.TestCheckResourceAttr(transitGatewayVpcAttachmentResourceName, "transit_gateway_default_route_table_association", "true"), diff --git a/internal/service/ec2/transitgateway_route_table_propagation.go b/internal/service/ec2/transitgateway_route_table_propagation.go index 8bf392738b7..e3b3485cd80 100644 --- a/internal/service/ec2/transitgateway_route_table_propagation.go +++ b/internal/service/ec2/transitgateway_route_table_propagation.go @@ -37,7 +37,7 @@ func ResourceTransitGatewayRouteTablePropagation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, }, @@ -107,7 +107,7 @@ func resourceTransitGatewayRouteTablePropagationRead(ctx context.Context, d *sch } d.Set("resource_id", transitGatewayPropagation.ResourceId) - d.Set("resource_type", transitGatewayPropagation.ResourceType) + d.Set(names.AttrResourceType, transitGatewayPropagation.ResourceType) d.Set(names.AttrTransitGatewayAttachmentID, transitGatewayPropagation.TransitGatewayAttachmentId) d.Set("transit_gateway_route_table_id", transitGatewayRouteTableID) diff --git a/internal/service/ec2/transitgateway_route_table_propagation_test.go b/internal/service/ec2/transitgateway_route_table_propagation_test.go index 7a415c686e4..24c520b7fbb 100644 --- a/internal/service/ec2/transitgateway_route_table_propagation_test.go +++ b/internal/service/ec2/transitgateway_route_table_propagation_test.go @@ -43,7 +43,7 @@ func testAccTransitGatewayRouteTablePropagation_basic(t *testing.T, semaphore tf Check: resource.ComposeTestCheckFunc( testAccCheckTransitGatewayRouteTablePropagationExists(ctx, resourceName, &v), resource.TestCheckResourceAttrSet(resourceName, "resource_id"), - resource.TestCheckResourceAttrSet(resourceName, "resource_type"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceType), resource.TestCheckResourceAttrPair(resourceName, names.AttrTransitGatewayAttachmentID, transitGatewayVpcAttachmentResourceName, names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "transit_gateway_route_table_id", transitGatewayRouteTableResourceName, names.AttrID), ), diff --git a/internal/service/ec2/verifiedaccess_group.go b/internal/service/ec2/verifiedaccess_group.go index 236b0957d9b..28d916077a3 100644 --- a/internal/service/ec2/verifiedaccess_group.go +++ b/internal/service/ec2/verifiedaccess_group.go @@ -36,7 +36,7 @@ func ResourceVerifiedAccessGroup() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -149,7 +149,7 @@ func resourceVerifiedAccessGroupRead(ctx context.Context, d *schema.ResourceData return sdkdiag.AppendErrorf(diags, "reading Verified Access Group (%s): %s", d.Id(), err) } - d.Set("creation_time", group.CreationTime) + d.Set(names.AttrCreationTime, group.CreationTime) d.Set("deletion_time", group.DeletionTime) d.Set(names.AttrDescription, group.Description) d.Set("last_updated_time", group.LastUpdatedTime) diff --git a/internal/service/ec2/verifiedaccess_group_test.go b/internal/service/ec2/verifiedaccess_group_test.go index 0648b4b763d..e5b3e9de056 100644 --- a/internal/service/ec2/verifiedaccess_group_test.go +++ b/internal/service/ec2/verifiedaccess_group_test.go @@ -40,7 +40,7 @@ func testAccVerifiedAccessGroup_basic(t *testing.T, semaphore tfsync.Semaphore) Config: testAccVerifiedAccessGroupConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVerifiedAccessGroupExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttr(resourceName, "deletion_time", ""), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttrSet(resourceName, "last_updated_time"), @@ -84,7 +84,7 @@ func testAccVerifiedAccessGroup_kms(t *testing.T, semaphore tfsync.Semaphore) { Config: testAccVerifiedAccessGroupConfig_kms(rName, policyDoc), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVerifiedAccessGroupExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttr(resourceName, "sse_configuration.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "sse_configuration.0.customer_managed_key_enabled"), resource.TestCheckResourceAttrSet(resourceName, "sse_configuration.0.kms_key_arn"), @@ -121,7 +121,7 @@ func testAccVerifiedAccessGroup_updateKMS(t *testing.T, semaphore tfsync.Semapho Config: testAccVerifiedAccessGroupConfig_policy(rName, description, policyDoc), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVerifiedAccessGroupExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttr(resourceName, "deletion_time", ""), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), resource.TestCheckResourceAttrSet(resourceName, "last_updated_time"), @@ -143,7 +143,7 @@ func testAccVerifiedAccessGroup_updateKMS(t *testing.T, semaphore tfsync.Semapho Config: testAccVerifiedAccessGroupConfig_kms(rName, policyDoc), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckVerifiedAccessGroupExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttr(resourceName, "sse_configuration.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "sse_configuration.0.customer_managed_key_enabled"), resource.TestCheckResourceAttr(resourceName, "sse_configuration.0.customer_managed_key_enabled", "true"), @@ -346,7 +346,7 @@ func testAccVerifiedAccessGroup_setPolicy(t *testing.T, semaphore tfsync.Semapho Config: testAccVerifiedAccessGroupConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckVerifiedAccessGroupExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttr(resourceName, "deletion_time", ""), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttrSet(resourceName, "last_updated_time"), diff --git a/internal/service/ec2/verifiedaccess_instance.go b/internal/service/ec2/verifiedaccess_instance.go index 2644ebea1ab..06ae3284f7a 100644 --- a/internal/service/ec2/verifiedaccess_instance.go +++ b/internal/service/ec2/verifiedaccess_instance.go @@ -36,7 +36,7 @@ func ResourceVerifiedAccessInstance() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -133,7 +133,7 @@ func resourceVerifiedAccessInstanceRead(ctx context.Context, d *schema.ResourceD return sdkdiag.AppendErrorf(diags, "reading Verified Access Instance (%s): %s", d.Id(), err) } - d.Set("creation_time", output.CreationTime) + d.Set(names.AttrCreationTime, output.CreationTime) d.Set(names.AttrDescription, output.Description) d.Set("fips_enabled", output.FipsEnabled) d.Set("last_updated_time", output.LastUpdatedTime) diff --git a/internal/service/ec2/verifiedaccess_instance_test.go b/internal/service/ec2/verifiedaccess_instance_test.go index 630052099b0..f4c0da2cc22 100644 --- a/internal/service/ec2/verifiedaccess_instance_test.go +++ b/internal/service/ec2/verifiedaccess_instance_test.go @@ -41,7 +41,7 @@ func testAccVerifiedAccessInstance_basic(t *testing.T, semaphore tfsync.Semaphor Config: testAccVerifiedAccessInstanceConfig_basic(), Check: resource.ComposeTestCheckFunc( testAccCheckVerifiedAccessInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, "last_updated_time"), resource.TestCheckResourceAttr(resourceName, "verified_access_trust_providers.#", "0"), ), diff --git a/internal/service/ec2/vpc_network_insights_analysis.go b/internal/service/ec2/vpc_network_insights_analysis.go index d2ed5c08c1a..c3cf5dcbeb3 100644 --- a/internal/service/ec2/vpc_network_insights_analysis.go +++ b/internal/service/ec2/vpc_network_insights_analysis.go @@ -532,7 +532,7 @@ var networkInsightsAnalysisPathComponentsSchema = &schema.Schema{ Type: schema.TypeString, Computed: true, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, }, @@ -1285,7 +1285,7 @@ var networkInsightsAnalysisExplanationsSchema = &schema.Schema{ Type: schema.TypeString, Computed: true, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, }, @@ -2173,7 +2173,7 @@ func flattenTransitGatewayRouteTableRoute(apiObject *ec2.TransitGatewayRouteTabl } if v := apiObject.ResourceType; v != nil { - tfMap["resource_type"] = aws.StringValue(v) + tfMap[names.AttrResourceType] = aws.StringValue(v) } if v := apiObject.RouteOrigin; v != nil { diff --git a/internal/service/ec2/vpc_network_insights_path.go b/internal/service/ec2/vpc_network_insights_path.go index f0a0c9d927a..c8cf0cb18b1 100644 --- a/internal/service/ec2/vpc_network_insights_path.go +++ b/internal/service/ec2/vpc_network_insights_path.go @@ -41,7 +41,7 @@ func ResourceNetworkInsightsPath() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Computed: true, }, @@ -145,7 +145,7 @@ func resourceNetworkInsightsPathRead(ctx context.Context, d *schema.ResourceData d.Set(names.AttrARN, nip.NetworkInsightsPathArn) d.Set(names.AttrDestination, nip.Destination) - d.Set("destination_arn", nip.DestinationArn) + d.Set(names.AttrDestinationARN, nip.DestinationArn) d.Set("destination_ip", nip.DestinationIp) d.Set("destination_port", nip.DestinationPort) d.Set(names.AttrProtocol, nip.Protocol) diff --git a/internal/service/ec2/vpc_network_insights_path_data_source.go b/internal/service/ec2/vpc_network_insights_path_data_source.go index b24b52fd497..464ba0fee48 100644 --- a/internal/service/ec2/vpc_network_insights_path_data_source.go +++ b/internal/service/ec2/vpc_network_insights_path_data_source.go @@ -31,7 +31,7 @@ func DataSourceNetworkInsightsPath() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Computed: true, }, @@ -101,7 +101,7 @@ func dataSourceNetworkInsightsPathRead(ctx context.Context, d *schema.ResourceDa d.SetId(networkInsightsPathID) d.Set(names.AttrARN, nip.NetworkInsightsPathArn) d.Set(names.AttrDestination, nip.Destination) - d.Set("destination_arn", nip.DestinationArn) + d.Set(names.AttrDestinationARN, nip.DestinationArn) d.Set("destination_ip", nip.DestinationIp) d.Set("destination_port", nip.DestinationPort) d.Set("network_insights_path_id", networkInsightsPathID) diff --git a/internal/service/ec2/vpc_network_insights_path_data_source_test.go b/internal/service/ec2/vpc_network_insights_path_data_source_test.go index 8af9a2ca9ce..85c49d102ae 100644 --- a/internal/service/ec2/vpc_network_insights_path_data_source_test.go +++ b/internal/service/ec2/vpc_network_insights_path_data_source_test.go @@ -29,7 +29,7 @@ func TestAccVPCNetworkInsightsPathDataSource_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(datasourceName, names.AttrDestination, resourceName, names.AttrDestination), - resource.TestCheckResourceAttrPair(datasourceName, "destination_arn", resourceName, "destination_arn"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrDestinationARN, resourceName, names.AttrDestinationARN), resource.TestCheckResourceAttrPair(datasourceName, "destination_ip", resourceName, "destination_ip"), resource.TestCheckResourceAttrPair(datasourceName, "destination_port", resourceName, "destination_port"), resource.TestCheckResourceAttrPair(datasourceName, "network_insights_path_id", resourceName, names.AttrID), diff --git a/internal/service/ec2/vpc_network_insights_path_test.go b/internal/service/ec2/vpc_network_insights_path_test.go index ccda5a52312..7ab8adcb6da 100644 --- a/internal/service/ec2/vpc_network_insights_path_test.go +++ b/internal/service/ec2/vpc_network_insights_path_test.go @@ -36,7 +36,7 @@ func TestAccVPCNetworkInsightsPath_basic(t *testing.T) { testAccCheckNetworkInsightsPathExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`network-insights-path/.+$`)), resource.TestCheckResourceAttrPair(resourceName, names.AttrDestination, "aws_network_interface.test.1", names.AttrID), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", "aws_network_interface.test.1", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, "aws_network_interface.test.1", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "destination_ip", ""), resource.TestCheckResourceAttr(resourceName, "destination_port", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrProtocol, "tcp"), @@ -139,7 +139,7 @@ func TestAccVPCNetworkInsightsPath_sourceAndDestinationARN(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckNetworkInsightsPathExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, names.AttrDestination, "aws_network_interface.test.1", names.AttrID), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", "aws_network_interface.test.1", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, "aws_network_interface.test.1", names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrSource, "aws_network_interface.test.0", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "source_arn", "aws_network_interface.test.0", names.AttrARN), ), diff --git a/internal/service/ec2/vpnsite_connection.go b/internal/service/ec2/vpnsite_connection.go index 3ab5d7a33b7..b1c2ac85b8c 100644 --- a/internal/service/ec2/vpnsite_connection.go +++ b/internal/service/ec2/vpnsite_connection.go @@ -597,7 +597,7 @@ func resourceVPNConnection() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Computed: true, }, @@ -1521,7 +1521,7 @@ func flattenVGWTelemetry(apiObject *ec2.VgwTelemetry) map[string]interface{} { } if v := apiObject.CertificateArn; v != nil { - tfMap["certificate_arn"] = aws.StringValue(v) + tfMap[names.AttrCertificateARN] = aws.StringValue(v) } if v := apiObject.LastStatusChange; v != nil { diff --git a/internal/service/ec2/vpnsite_customer_gateway.go b/internal/service/ec2/vpnsite_customer_gateway.go index 31acdbf29a2..eafcea47309 100644 --- a/internal/service/ec2/vpnsite_customer_gateway.go +++ b/internal/service/ec2/vpnsite_customer_gateway.go @@ -48,7 +48,7 @@ func resourceCustomerGateway() *schema.Resource { ForceNew: true, ValidateFunc: verify.Valid4ByteASN, }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -100,7 +100,7 @@ func resourceCustomerGatewayCreate(ctx context.Context, d *schema.ResourceData, input.BgpAsn = aws.Int64(v) } - if v, ok := d.GetOk("certificate_arn"); ok { + if v, ok := d.GetOk(names.AttrCertificateARN); ok { input.CertificateArn = aws.String(v.(string)) } @@ -153,7 +153,7 @@ func resourceCustomerGatewayRead(ctx context.Context, d *schema.ResourceData, me }.String() d.Set(names.AttrARN, arn) d.Set("bgp_asn", customerGateway.BgpAsn) - d.Set("certificate_arn", customerGateway.CertificateArn) + d.Set(names.AttrCertificateARN, customerGateway.CertificateArn) d.Set(names.AttrDeviceName, customerGateway.DeviceName) d.Set("ip_address", customerGateway.IpAddress) d.Set(names.AttrType, customerGateway.Type) diff --git a/internal/service/ec2/vpnsite_customer_gateway_data_source.go b/internal/service/ec2/vpnsite_customer_gateway_data_source.go index 41ef1c39578..5a2684ea766 100644 --- a/internal/service/ec2/vpnsite_customer_gateway_data_source.go +++ b/internal/service/ec2/vpnsite_customer_gateway_data_source.go @@ -39,7 +39,7 @@ func dataSourceCustomerGateway() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Computed: true, }, @@ -109,7 +109,7 @@ func dataSourceCustomerGatewayRead(ctx context.Context, d *schema.ResourceData, } else { d.Set("bgp_asn", nil) } - d.Set("certificate_arn", cgw.CertificateArn) + d.Set(names.AttrCertificateARN, cgw.CertificateArn) d.Set(names.AttrDeviceName, cgw.DeviceName) d.Set("ip_address", cgw.IpAddress) d.Set(names.AttrType, cgw.Type) diff --git a/internal/service/ec2/vpnsite_customer_gateway_data_source_test.go b/internal/service/ec2/vpnsite_customer_gateway_data_source_test.go index 3ff246e1224..20723c16ee0 100644 --- a/internal/service/ec2/vpnsite_customer_gateway_data_source_test.go +++ b/internal/service/ec2/vpnsite_customer_gateway_data_source_test.go @@ -32,7 +32,7 @@ func TestAccSiteVPNCustomerGatewayDataSource_filter(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(resourceName, names.AttrARN, dataSourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "bgp_asn", dataSourceName, "bgp_asn"), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", dataSourceName, "certificate_arn"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, dataSourceName, names.AttrCertificateARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrDeviceName, dataSourceName, names.AttrDeviceName), resource.TestCheckResourceAttrPair(resourceName, "ip_address", dataSourceName, "ip_address"), resource.TestCheckResourceAttrPair(resourceName, "tags.%", dataSourceName, "tags.%"), @@ -62,7 +62,7 @@ func TestAccSiteVPNCustomerGatewayDataSource_id(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(resourceName, names.AttrARN, dataSourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "bgp_asn", dataSourceName, "bgp_asn"), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", dataSourceName, "certificate_arn"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, dataSourceName, names.AttrCertificateARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrDeviceName, dataSourceName, names.AttrDeviceName), resource.TestCheckResourceAttrPair(resourceName, "ip_address", dataSourceName, "ip_address"), resource.TestCheckResourceAttrPair(resourceName, "tags.%", dataSourceName, "tags.%"), diff --git a/internal/service/ec2/vpnsite_customer_gateway_test.go b/internal/service/ec2/vpnsite_customer_gateway_test.go index 2d81963cd17..e8ef5737fbd 100644 --- a/internal/service/ec2/vpnsite_customer_gateway_test.go +++ b/internal/service/ec2/vpnsite_customer_gateway_test.go @@ -40,7 +40,7 @@ func TestAccSiteVPNCustomerGateway_basic(t *testing.T) { testAccCheckCustomerGatewayExists(ctx, resourceName, &gateway), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "ec2", regexache.MustCompile(`customer-gateway/cgw-.+`)), resource.TestCheckResourceAttr(resourceName, "bgp_asn", strconv.Itoa(rBgpAsn)), - resource.TestCheckResourceAttr(resourceName, "certificate_arn", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrCertificateARN, ""), resource.TestCheckResourceAttr(resourceName, names.AttrDeviceName, ""), resource.TestCheckResourceAttr(resourceName, "ip_address", "172.0.0.1"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -216,7 +216,7 @@ func TestAccSiteVPNCustomerGateway_certificate(t *testing.T) { Config: testAccSiteVPNCustomerGatewayConfig_certificate(rName, rBgpAsn, rootDomain, subDomain, domain), Check: resource.ComposeTestCheckFunc( testAccCheckCustomerGatewayExists(ctx, resourceName, &gateway), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", acmCertificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, acmCertificateResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "ip_address", ""), ), }, From 0aa1eaea65c44444f12f1a746b420bdb9f1276d3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:44 -0400 Subject: [PATCH 1346/1490] ecr: Use constants for strings --- internal/service/ecr/repository.go | 6 +++--- internal/service/ecr/repository_data_source.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/ecr/repository.go b/internal/service/ecr/repository.go index 78def25641b..32cb3f58e0a 100644 --- a/internal/service/ecr/repository.go +++ b/internal/service/ecr/repository.go @@ -48,7 +48,7 @@ func resourceRepository() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encryption_configuration": { + names.AttrEncryptionConfiguration: { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ @@ -120,7 +120,7 @@ func resourceRepositoryCreate(ctx context.Context, d *schema.ResourceData, meta name := d.Get(names.AttrName).(string) input := &ecr.CreateRepositoryInput{ - EncryptionConfiguration: expandRepositoryEncryptionConfiguration(d.Get("encryption_configuration").([]interface{})), + EncryptionConfiguration: expandRepositoryEncryptionConfiguration(d.Get(names.AttrEncryptionConfiguration).([]interface{})), ImageTagMutability: types.ImageTagMutability((d.Get("image_tag_mutability").(string))), RepositoryName: aws.String(name), Tags: getTagsIn(ctx), @@ -186,7 +186,7 @@ func resourceRepositoryRead(ctx context.Context, d *schema.ResourceData, meta in repository := outputRaw.(*types.Repository) d.Set(names.AttrARN, repository.RepositoryArn) - if err := d.Set("encryption_configuration", flattenRepositoryEncryptionConfiguration(repository.EncryptionConfiguration)); err != nil { + if err := d.Set(names.AttrEncryptionConfiguration, flattenRepositoryEncryptionConfiguration(repository.EncryptionConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting encryption_configuration: %s", err) } if err := d.Set("image_scanning_configuration", flattenImageScanningConfiguration(repository.ImageScanningConfiguration)); err != nil { diff --git a/internal/service/ecr/repository_data_source.go b/internal/service/ecr/repository_data_source.go index 0d37af57cbf..b2840b672a3 100644 --- a/internal/service/ecr/repository_data_source.go +++ b/internal/service/ecr/repository_data_source.go @@ -29,7 +29,7 @@ func dataSourceRepository() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encryption_configuration": { + names.AttrEncryptionConfiguration: { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ @@ -106,7 +106,7 @@ func dataSourceRepositoryRead(ctx context.Context, d *schema.ResourceData, meta d.SetId(aws.ToString(repository.RepositoryName)) arn := aws.ToString(repository.RepositoryArn) d.Set(names.AttrARN, arn) - if err := d.Set("encryption_configuration", flattenRepositoryEncryptionConfiguration(repository.EncryptionConfiguration)); err != nil { + if err := d.Set(names.AttrEncryptionConfiguration, flattenRepositoryEncryptionConfiguration(repository.EncryptionConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting encryption_configuration: %s", err) } if err := d.Set("image_scanning_configuration", flattenImageScanningConfiguration(repository.ImageScanningConfiguration)); err != nil { From f75477542a88d08e4fc36033ce138853179243ed Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:44 -0400 Subject: [PATCH 1347/1490] ecs: Use constants for strings --- internal/service/ecs/service.go | 10 +++++----- internal/service/ecs/task_definition.go | 6 +++--- internal/service/ecs/task_definition_data_source.go | 4 ++-- .../service/ecs/task_definition_data_source_test.go | 2 +- internal/service/ecs/task_execution_data_source.go | 8 ++++---- internal/service/ecs/task_set.go | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/ecs/service.go b/internal/service/ecs/service.go index 295c1b943c1..c94da446416 100644 --- a/internal/service/ecs/service.go +++ b/internal/service/ecs/service.go @@ -235,7 +235,7 @@ func ResourceService() *schema.Resource { Required: true, ForceNew: true, }, - "network_configuration": { + names.AttrNetworkConfiguration: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -543,7 +543,7 @@ func resourceServiceCreate(ctx context.Context, d *schema.ResourceData, meta int DeploymentController: deploymentController, EnableECSManagedTags: aws.Bool(d.Get("enable_ecs_managed_tags").(bool)), EnableExecuteCommand: aws.Bool(d.Get("enable_execute_command").(bool)), - NetworkConfiguration: expandNetworkConfiguration(d.Get("network_configuration").([]interface{})), + NetworkConfiguration: expandNetworkConfiguration(d.Get(names.AttrNetworkConfiguration).([]interface{})), SchedulingStrategy: aws.String(schedulingStrategy), ServiceName: aws.String(name), Tags: getTagsIn(ctx), @@ -811,7 +811,7 @@ func resourceServiceRead(ctx context.Context, d *schema.ResourceData, meta inter return sdkdiag.AppendErrorf(diags, "setting placement_constraints: %s", err) } - if err := d.Set("network_configuration", flattenNetworkConfiguration(service.NetworkConfiguration)); err != nil { + if err := d.Set(names.AttrNetworkConfiguration, flattenNetworkConfiguration(service.NetworkConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting network_configuration: %s", err) } @@ -908,8 +908,8 @@ func resourceServiceUpdate(ctx context.Context, d *schema.ResourceData, meta int } } - if d.HasChange("network_configuration") { - input.NetworkConfiguration = expandNetworkConfiguration(d.Get("network_configuration").([]interface{})) + if d.HasChange(names.AttrNetworkConfiguration) { + input.NetworkConfiguration = expandNetworkConfiguration(d.Get(names.AttrNetworkConfiguration).([]interface{})) } if d.HasChange("ordered_placement_strategy") { diff --git a/internal/service/ecs/task_definition.go b/internal/service/ecs/task_definition.go index 6adb59bca7b..479a3b4f021 100644 --- a/internal/service/ecs/task_definition.go +++ b/internal/service/ecs/task_definition.go @@ -119,7 +119,7 @@ func ResourceTaskDefinition() *schema.Resource { }, }, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -476,7 +476,7 @@ func resourceTaskDefinitionCreate(ctx context.Context, d *schema.ResourceData, m input.EphemeralStorage = expandTaskDefinitionEphemeralStorage(v.([]interface{})) } - if v, ok := d.GetOk("execution_role_arn"); ok { + if v, ok := d.GetOk(names.AttrExecutionRoleARN); ok { input.ExecutionRoleArn = aws.String(v.(string)) } @@ -628,7 +628,7 @@ func resourceTaskDefinitionRead(ctx context.Context, d *schema.ResourceData, met } d.Set("task_role_arn", taskDefinition.TaskRoleArn) - d.Set("execution_role_arn", taskDefinition.ExecutionRoleArn) + d.Set(names.AttrExecutionRoleARN, taskDefinition.ExecutionRoleArn) d.Set("cpu", taskDefinition.Cpu) d.Set("memory", taskDefinition.Memory) d.Set("network_mode", taskDefinition.NetworkMode) diff --git a/internal/service/ecs/task_definition_data_source.go b/internal/service/ecs/task_definition_data_source.go index 6a3636b146a..6cc4be4735d 100644 --- a/internal/service/ecs/task_definition_data_source.go +++ b/internal/service/ecs/task_definition_data_source.go @@ -34,7 +34,7 @@ func DataSourceTaskDefinition() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Computed: true, }, @@ -81,7 +81,7 @@ func dataSourceTaskDefinitionRead(ctx context.Context, d *schema.ResourceData, m d.SetId(aws.StringValue(taskDefinition.TaskDefinitionArn)) d.Set(names.AttrARN, taskDefinition.TaskDefinitionArn) d.Set("arn_without_revision", StripRevision(aws.StringValue(taskDefinition.TaskDefinitionArn))) - d.Set("execution_role_arn", taskDefinition.ExecutionRoleArn) + d.Set(names.AttrExecutionRoleARN, taskDefinition.ExecutionRoleArn) d.Set("family", taskDefinition.Family) d.Set("network_mode", taskDefinition.NetworkMode) d.Set("revision", taskDefinition.Revision) diff --git a/internal/service/ecs/task_definition_data_source_test.go b/internal/service/ecs/task_definition_data_source_test.go index 0358bdfacd7..c9e19e71c9a 100644 --- a/internal/service/ecs/task_definition_data_source_test.go +++ b/internal/service/ecs/task_definition_data_source_test.go @@ -28,7 +28,7 @@ func TestAccECSTaskDefinitionDataSource_ecsTaskDefinition(t *testing.T) { Config: testAccTaskDefinitionDataSourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, "aws_ecs_task_definition.test", names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "execution_role_arn", "aws_iam_role.execution", names.AttrARN), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrExecutionRoleARN, "aws_iam_role.execution", names.AttrARN), resource.TestCheckResourceAttr(dataSourceName, "family", rName), resource.TestCheckResourceAttr(dataSourceName, "network_mode", "bridge"), resource.TestMatchResourceAttr(dataSourceName, "revision", regexache.MustCompile("^[1-9][0-9]*$")), diff --git a/internal/service/ecs/task_execution_data_source.go b/internal/service/ecs/task_execution_data_source.go index 5491d841ee3..2b1d0acdce4 100644 --- a/internal/service/ecs/task_execution_data_source.go +++ b/internal/service/ecs/task_execution_data_source.go @@ -78,7 +78,7 @@ func DataSourceTaskExecution() *schema.Resource { Optional: true, ValidateFunc: validation.StringInSlice(ecs.LaunchType_Values(), false), }, - "network_configuration": { + names.AttrNetworkConfiguration: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -176,7 +176,7 @@ func DataSourceTaskExecution() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Optional: true, }, @@ -317,7 +317,7 @@ func dataSourceTaskExecutionRead(ctx context.Context, d *schema.ResourceData, me if v, ok := d.GetOk("launch_type"); ok { input.LaunchType = aws.String(v.(string)) } - if v, ok := d.GetOk("network_configuration"); ok { + if v, ok := d.GetOk(names.AttrNetworkConfiguration); ok { input.NetworkConfiguration = expandNetworkConfiguration(v.([]interface{})) } if v, ok := d.GetOk("overrides"); ok { @@ -381,7 +381,7 @@ func expandTaskOverride(tfList []interface{}) *ecs.TaskOverride { if v, ok := tfMap["memory"]; ok { apiObject.Memory = aws.String(v.(string)) } - if v, ok := tfMap["execution_role_arn"]; ok { + if v, ok := tfMap[names.AttrExecutionRoleARN]; ok { apiObject.ExecutionRoleArn = aws.String(v.(string)) } if v, ok := tfMap["task_role_arn"]; ok { diff --git a/internal/service/ecs/task_set.go b/internal/service/ecs/task_set.go index c26b4728a7d..c0845c61b57 100644 --- a/internal/service/ecs/task_set.go +++ b/internal/service/ecs/task_set.go @@ -128,7 +128,7 @@ func ResourceTaskSet() *schema.Resource { }, }, }, - "network_configuration": { + names.AttrNetworkConfiguration: { Type: schema.TypeList, MaxItems: 1, Optional: true, @@ -301,7 +301,7 @@ func resourceTaskSetCreate(ctx context.Context, d *schema.ResourceData, meta int input.LoadBalancers = expandTaskSetLoadBalancers(v.(*schema.Set).List()) } - if v, ok := d.GetOk("network_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrNetworkConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.NetworkConfiguration = expandNetworkConfiguration(v.([]interface{})) } @@ -425,7 +425,7 @@ func resourceTaskSetRead(ctx context.Context, d *schema.ResourceData, meta inter return sdkdiag.AppendErrorf(diags, "setting load_balancer: %s", err) } - if err := d.Set("network_configuration", flattenNetworkConfiguration(taskSet.NetworkConfiguration)); err != nil { + if err := d.Set(names.AttrNetworkConfiguration, flattenNetworkConfiguration(taskSet.NetworkConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting network_configuration: %s", err) } From f8fda2ac791a22894ffc613eda6bc453acc8a52b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:44 -0400 Subject: [PATCH 1348/1490] efs: Use constants for strings --- internal/service/efs/replication_configuration.go | 4 ++-- internal/service/efs/replication_configuration_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/efs/replication_configuration.go b/internal/service/efs/replication_configuration.go index 124f98f7caa..fe6f0e121ba 100644 --- a/internal/service/efs/replication_configuration.go +++ b/internal/service/efs/replication_configuration.go @@ -39,7 +39,7 @@ func ResourceReplicationConfiguration() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -159,7 +159,7 @@ func resourceReplicationConfigurationRead(ctx context.Context, d *schema.Resourc copy(0, names.AttrKMSKeyID) } - d.Set("creation_time", aws.TimeValue(replication.CreationTime).String()) + d.Set(names.AttrCreationTime, aws.TimeValue(replication.CreationTime).String()) if err := d.Set(names.AttrDestination, destinations); err != nil { return sdkdiag.AppendErrorf(diags, "setting destination: %s", err) } diff --git a/internal/service/efs/replication_configuration_test.go b/internal/service/efs/replication_configuration_test.go index 759a534b111..bf951d298b0 100644 --- a/internal/service/efs/replication_configuration_test.go +++ b/internal/service/efs/replication_configuration_test.go @@ -41,7 +41,7 @@ func TestAccEFSReplicationConfiguration_basic(t *testing.T) { Config: testAccReplicationConfigurationConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationConfigurationExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttr(resourceName, "destination.#", "1"), resource.TestMatchResourceAttr(resourceName, "destination.0.file_system_id", regexache.MustCompile(`fs-.+`)), resource.TestCheckResourceAttr(resourceName, "destination.0.region", acctest.AlternateRegion()), @@ -112,7 +112,7 @@ func TestAccEFSReplicationConfiguration_allAttributes(t *testing.T) { Config: testAccReplicationConfigurationConfig_full(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationConfigurationExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttr(resourceName, "destination.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "destination.0.availability_zone_name", "data.aws_availability_zones.available", "names.0"), resource.TestMatchResourceAttr(resourceName, "destination.0.file_system_id", regexache.MustCompile(`fs-.+`)), @@ -153,7 +153,7 @@ func TestAccEFSReplicationConfiguration_existingDestination(t *testing.T) { Config: testAccReplicationConfigurationConfig_existingDestination(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckReplicationConfigurationExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttr(resourceName, "destination.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "destination.0.file_system_id", destinationFsResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, "destination.0.status", efs.ReplicationStatusEnabled), From c10bb52041015c47c05536d8ca6d3532e0d98118 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:44 -0400 Subject: [PATCH 1349/1490] elasticache: Use constants for strings --- internal/service/elasticache/cluster.go | 4 +- internal/service/elasticache/cluster_test.go | 26 +++---- .../service/elasticache/replication_group.go | 4 +- .../elasticache/replication_group_migrate.go | 2 +- .../elasticache/replication_group_test.go | 76 +++++++++---------- 5 files changed, 56 insertions(+), 56 deletions(-) diff --git a/internal/service/elasticache/cluster.go b/internal/service/elasticache/cluster.go index 5cc117e45f1..a0795b5e506 100644 --- a/internal/service/elasticache/cluster.go +++ b/internal/service/elasticache/cluster.go @@ -53,7 +53,7 @@ func resourceCluster() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -567,7 +567,7 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll) { input := &elasticache.ModifyCacheClusterInput{ CacheClusterId: aws.String(d.Id()), - ApplyImmediately: aws.Bool(d.Get("apply_immediately").(bool)), + ApplyImmediately: aws.Bool(d.Get(names.AttrApplyImmediately).(bool)), } requestUpdate := false diff --git a/internal/service/elasticache/cluster_test.go b/internal/service/elasticache/cluster_test.go index 9d18bdff0df..93a279c2028 100644 --- a/internal/service/elasticache/cluster_test.go +++ b/internal/service/elasticache/cluster_test.go @@ -66,7 +66,7 @@ func TestAccElastiCacheCluster_Engine_memcached(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -110,7 +110,7 @@ func TestAccElastiCacheCluster_Engine_redis(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -176,7 +176,7 @@ func TestAccElastiCacheCluster_Engine_redis_v5(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -261,7 +261,7 @@ func TestAccElastiCacheCluster_ParameterGroupName_default(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -297,7 +297,7 @@ func TestAccElastiCacheCluster_ipDiscovery(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -337,7 +337,7 @@ func TestAccElastiCacheCluster_port(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -1028,7 +1028,7 @@ func TestAccElastiCacheCluster_Redis_autoMinorVersionUpgrade(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -1077,7 +1077,7 @@ func TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations(t *testing ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, { Config: testAccClusterConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson), @@ -1098,7 +1098,7 @@ func TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations(t *testing ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, { Config: testAccClusterConfig_dataSourceEngineRedisLogDeliveryConfigurations(rName, true, elasticache.DestinationTypeCloudwatchLogs, elasticache.LogFormatText, true, elasticache.DestinationTypeKinesisFirehose, elasticache.LogFormatJson), @@ -1164,7 +1164,7 @@ func TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations(t *testing ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, }, }, }) @@ -1200,7 +1200,7 @@ func TestAccElastiCacheCluster_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately"}, //not in the API + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately}, //not in the API }, { Config: testAccClusterConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), @@ -1339,7 +1339,7 @@ func TestAccElastiCacheCluster_outpost_memcached(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -1379,7 +1379,7 @@ func TestAccElastiCacheCluster_outpost_redis(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, diff --git a/internal/service/elasticache/replication_group.go b/internal/service/elasticache/replication_group.go index 8e9fb44b4fe..b48b1db4225 100644 --- a/internal/service/elasticache/replication_group.go +++ b/internal/service/elasticache/replication_group.go @@ -49,7 +49,7 @@ func resourceReplicationGroup() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -752,7 +752,7 @@ func resourceReplicationGroupUpdate(ctx context.Context, d *schema.ResourceData, requestUpdate := false input := &elasticache.ModifyReplicationGroupInput{ - ApplyImmediately: aws.Bool(d.Get("apply_immediately").(bool)), + ApplyImmediately: aws.Bool(d.Get(names.AttrApplyImmediately).(bool)), ReplicationGroupId: aws.String(d.Id()), } diff --git a/internal/service/elasticache/replication_group_migrate.go b/internal/service/elasticache/replication_group_migrate.go index 9aab5e124a5..8509be6bc0a 100644 --- a/internal/service/elasticache/replication_group_migrate.go +++ b/internal/service/elasticache/replication_group_migrate.go @@ -31,7 +31,7 @@ func resourceReplicationGroupConfigV1() *schema.Resource { //lintignore:R011 return &schema.Resource{ Schema: map[string]*schema.Schema{ - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Computed: true, diff --git a/internal/service/elasticache/replication_group_test.go b/internal/service/elasticache/replication_group_test.go index 3015ee314fb..688fc3405ea 100644 --- a/internal/service/elasticache/replication_group_test.go +++ b/internal/service/elasticache/replication_group_test.go @@ -64,7 +64,7 @@ func TestAccElastiCacheReplicationGroup_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, }, }) @@ -101,7 +101,7 @@ func TestAccElastiCacheReplicationGroup_basic_v5(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, }, }) @@ -134,7 +134,7 @@ func TestAccElastiCacheReplicationGroup_uppercase(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, }, }) @@ -169,7 +169,7 @@ func TestAccElastiCacheReplicationGroup_EngineVersion_v7(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, }, }) @@ -221,7 +221,7 @@ func TestAccElastiCacheReplicationGroup_EngineVersion_update(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_engineVersion(rName, "5.0.6"), @@ -349,7 +349,7 @@ func TestAccElastiCacheReplicationGroup_updateDescription(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_updatedDescription(rName), @@ -390,7 +390,7 @@ func TestAccElastiCacheReplicationGroup_updateMaintenanceWindow(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_updatedMaintenanceWindow(rName), @@ -433,7 +433,7 @@ func TestAccElastiCacheReplicationGroup_updateUserGroups(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_user(rName, userGroup, 1), @@ -475,7 +475,7 @@ func TestAccElastiCacheReplicationGroup_updateNodeSize(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_updatedNodeSize(rName), @@ -520,7 +520,7 @@ func TestAccElastiCacheReplicationGroup_updateParameterGroup(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "auth_token_update_strategy", names.AttrEngineVersion, // because we can't ignore the diff between `6.x` and `6.2` }, @@ -564,7 +564,7 @@ func TestAccElastiCacheReplicationGroup_authToken(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { // When adding an auth_token to a previously passwordless replication @@ -670,7 +670,7 @@ func TestAccElastiCacheReplicationGroup_vpc(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy", "preferred_cache_cluster_azs"}, }, }, }) @@ -708,7 +708,7 @@ func TestAccElastiCacheReplicationGroup_multiAzNotInVPC(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy", "preferred_cache_cluster_azs"}, }, }, }) @@ -748,7 +748,7 @@ func TestAccElastiCacheReplicationGroup_multiAzNotInVPC_repeated(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy", "preferred_cache_cluster_azs"}, }, }, }) @@ -793,7 +793,7 @@ func TestAccElastiCacheReplicationGroup_multiAzInVPC(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy", "preferred_cache_cluster_azs"}, }, }, }) @@ -838,7 +838,7 @@ func TestAccElastiCacheReplicationGroup_deprecatedAvailabilityZones_multiAzInVPC ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy", "preferred_cache_cluster_azs"}, }, }, }) @@ -897,7 +897,7 @@ func TestAccElastiCacheReplicationGroup_ipDiscovery(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy", "preferred_cache_cluster_azs"}, }, }, }) @@ -939,7 +939,7 @@ func TestAccElastiCacheReplicationGroup_networkType(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy", "preferred_cache_cluster_azs"}, }, }, }) @@ -981,7 +981,7 @@ func TestAccElastiCacheReplicationGroup_ClusterMode_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, }, }) @@ -1022,7 +1022,7 @@ func TestAccElastiCacheReplicationGroup_ClusterMode_nonClusteredParameterGroup(t ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "auth_token_update_strategy", names.AttrEngineVersion, // because we can't ignore the diff between `6.x` and `6.2` }, @@ -1304,7 +1304,7 @@ func TestAccElastiCacheReplicationGroup_ClusterMode_singleNode(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "auth_token_update_strategy", names.AttrEngineVersion, // because we can't ignore the diff between `6.x` and `6.2` }, @@ -1358,7 +1358,7 @@ func TestAccElastiCacheReplicationGroup_enableSnapshotting(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_enableSnapshotting(rName), @@ -1401,7 +1401,7 @@ func TestAccElastiCacheReplicationGroup_transitEncryptionWithAuthToken(t *testin ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, }, }, }) @@ -1435,7 +1435,7 @@ func TestAccElastiCacheReplicationGroup_transitEncryption5x(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, }, { // With Redis engine versions < 7.0.5, transit_encryption_enabled can only be set @@ -1479,7 +1479,7 @@ func TestAccElastiCacheReplicationGroup_transitEncryption7x(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token", "auth_token_update_strategy", "preferred_cache_cluster_azs"}, }, { // With Redis engine versions >= 7.0.5, transit_encryption_mode can be modified in-place. @@ -1541,7 +1541,7 @@ func TestAccElastiCacheReplicationGroup_enableAtRestEncryption(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, }, }) @@ -1607,7 +1607,7 @@ func TestAccElastiCacheReplicationGroup_NumberCacheClusters_basic(t *testing.T) ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_numberCacheClusters(rName, 4), @@ -1672,7 +1672,7 @@ func TestAccElastiCacheReplicationGroup_NumberCacheClustersFailover_autoFailover ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { PreConfig: func() { @@ -2057,7 +2057,7 @@ func TestAccElastiCacheReplicationGroup_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), @@ -2177,7 +2177,7 @@ func TestAccElastiCacheReplicationGroup_autoMinorVersionUpgrade(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_autoMinorVersionUpgrade(rName, true), @@ -2279,7 +2279,7 @@ func TestAccElastiCacheReplicationGroup_GlobalReplicationGroupID_basic(t *testin ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, }, }) @@ -2339,7 +2339,7 @@ func TestAccElastiCacheReplicationGroup_GlobalReplicationGroupID_full(t *testing ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_globalIDFull(rName, updatedNumCacheClusters), @@ -2430,7 +2430,7 @@ func TestAccElastiCacheReplicationGroup_GlobalReplicationGroupIDClusterMode_basi ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, { Config: testAccReplicationGroupConfig_globalIDClusterMode(rName, 1, 3), @@ -2508,7 +2508,7 @@ func TestAccElastiCacheReplicationGroup_dataTiering(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "auth_token_update_strategy"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "auth_token_update_strategy"}, }, }, }) @@ -2551,7 +2551,7 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "auth_token_update_strategy", names.AttrEngineVersion, // because we can't ignore the diff between `6.x` and `6.2` }, @@ -2608,7 +2608,7 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "auth_token_update_strategy", names.AttrEngineVersion, // because we can't ignore the diff between `6.x` and `6.2` }, @@ -2655,7 +2655,7 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "auth_token_update_strategy", names.AttrEngineVersion, // because we can't ignore the diff between `6.x` and `6.2` }, @@ -2715,7 +2715,7 @@ func TestAccElastiCacheReplicationGroup_Engine_Redis_LogDeliveryConfigurations_C ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "auth_token_update_strategy", names.AttrEngineVersion, // because we can't ignore the diff between `6.x` and `6.2` }, From 62482d90f7ffe83674e7bdbfea4bfc82077134a4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:45 -0400 Subject: [PATCH 1350/1490] elbv2: Use constants for strings --- internal/service/elbv2/listener.go | 8 +++--- .../service/elbv2/listener_certificate.go | 8 +++--- .../elbv2/listener_certificate_test.go | 26 +++++++++---------- .../service/elbv2/listener_data_source.go | 4 +-- .../elbv2/listener_data_source_test.go | 4 +-- internal/service/elbv2/listener_test.go | 18 ++++++------- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/internal/service/elbv2/listener.go b/internal/service/elbv2/listener.go index 86447a9bd1f..12f37066430 100644 --- a/internal/service/elbv2/listener.go +++ b/internal/service/elbv2/listener.go @@ -64,7 +64,7 @@ func ResourceListener() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, @@ -426,7 +426,7 @@ func resourceListenerCreate(ctx context.Context, d *schema.ResourceData, meta in input.AlpnPolicy = []string{v.(string)} } - if v, ok := d.GetOk("certificate_arn"); ok { + if v, ok := d.GetOk(names.AttrCertificateARN); ok { input.Certificates = []awstypes.Certificate{{ CertificateArn: aws.String(v.(string)), }} @@ -527,7 +527,7 @@ func resourceListenerRead(ctx context.Context, d *schema.ResourceData, meta inte } d.Set(names.AttrARN, listener.ListenerArn) if listener.Certificates != nil && len(listener.Certificates) == 1 { - d.Set("certificate_arn", listener.Certificates[0].CertificateArn) + d.Set(names.AttrCertificateARN, listener.Certificates[0].CertificateArn) } sort.Slice(listener.DefaultActions, func(i, j int) bool { return aws.ToInt32(listener.DefaultActions[i].Order) < aws.ToInt32(listener.DefaultActions[j].Order) @@ -559,7 +559,7 @@ func resourceListenerUpdate(ctx context.Context, d *schema.ResourceData, meta in input.AlpnPolicy = []string{v.(string)} } - if v, ok := d.GetOk("certificate_arn"); ok { + if v, ok := d.GetOk(names.AttrCertificateARN); ok { input.Certificates = []awstypes.Certificate{{ CertificateArn: aws.String(v.(string)), }} diff --git a/internal/service/elbv2/listener_certificate.go b/internal/service/elbv2/listener_certificate.go index 77de9555493..7cf9850ee0b 100644 --- a/internal/service/elbv2/listener_certificate.go +++ b/internal/service/elbv2/listener_certificate.go @@ -41,7 +41,7 @@ func ResourceListenerCertificate() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -61,7 +61,7 @@ func resourceListenerCertificateCreate(ctx context.Context, d *schema.ResourceDa conn := meta.(*conns.AWSClient).ELBV2Client(ctx) listenerArn := d.Get("listener_arn").(string) - certificateArn := d.Get("certificate_arn").(string) + certificateArn := d.Get(names.AttrCertificateARN).(string) params := &elasticloadbalancingv2.AddListenerCertificatesInput{ ListenerArn: aws.String(listenerArn), @@ -138,7 +138,7 @@ func resourceListenerCertificateRead(ctx context.Context, d *schema.ResourceData return create.AppendDiagError(diags, names.ELBV2, create.ErrActionReading, ResNameListenerCertificate, d.Id(), err) } - d.Set("certificate_arn", certificateArn) + d.Set(names.AttrCertificateARN, certificateArn) d.Set("listener_arn", listenerArn) return diags @@ -148,7 +148,7 @@ func resourceListenerCertificateDelete(ctx context.Context, d *schema.ResourceDa var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ELBV2Client(ctx) - certificateArn := d.Get("certificate_arn").(string) + certificateArn := d.Get(names.AttrCertificateARN).(string) listenerArn := d.Get("listener_arn").(string) log.Printf("[DEBUG] Deleting certificate: %s of listener: %s", certificateArn, listenerArn) diff --git a/internal/service/elbv2/listener_certificate_test.go b/internal/service/elbv2/listener_certificate_test.go index dcebe21cde4..81ba2c5e393 100644 --- a/internal/service/elbv2/listener_certificate_test.go +++ b/internal/service/elbv2/listener_certificate_test.go @@ -41,7 +41,7 @@ func TestAccELBV2ListenerCertificate_basic(t *testing.T) { Config: testAccListenerCertificateConfig_basic(rName, key, certificate), Check: resource.ComposeTestCheckFunc( testAccCheckListenerCertificateExists(resourceName), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", iamServerCertificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, iamServerCertificateResourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", lbListenerResourceName, names.AttrARN), ), }, @@ -74,7 +74,7 @@ func TestAccELBV2ListenerCertificate_CertificateARN_underscores(t *testing.T) { Config: testAccListenerCertificateConfig_arnUnderscores(rName, key, certificate), Check: resource.ComposeTestCheckFunc( testAccCheckListenerCertificateExists(resourceName), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", iamServerCertificateResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, iamServerCertificateResourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "listener_arn", lbListenerResourceName, names.AttrARN), ), }, @@ -112,11 +112,11 @@ func TestAccELBV2ListenerCertificate_multiple(t *testing.T) { testAccCheckListenerCertificateExists("aws_lb_listener_certificate.additional_1"), testAccCheckListenerCertificateExists("aws_lb_listener_certificate.additional_2"), resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.default", "listener_arn"), - resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.default", "certificate_arn"), + resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.default", names.AttrCertificateARN), resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_1", "listener_arn"), - resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_1", "certificate_arn"), + resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_1", names.AttrCertificateARN), resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_2", "listener_arn"), - resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_2", "certificate_arn"), + resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_2", names.AttrCertificateARN), ), }, { @@ -132,13 +132,13 @@ func TestAccELBV2ListenerCertificate_multiple(t *testing.T) { testAccCheckListenerCertificateExists("aws_lb_listener_certificate.additional_2"), testAccCheckListenerCertificateExists("aws_lb_listener_certificate.additional_3"), resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.default", "listener_arn"), - resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.default", "certificate_arn"), + resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.default", names.AttrCertificateARN), resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_1", "listener_arn"), - resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_1", "certificate_arn"), + resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_1", names.AttrCertificateARN), resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_2", "listener_arn"), - resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_2", "certificate_arn"), + resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_2", names.AttrCertificateARN), resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_3", "listener_arn"), - resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_3", "certificate_arn"), + resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_3", names.AttrCertificateARN), ), }, { @@ -149,11 +149,11 @@ func TestAccELBV2ListenerCertificate_multiple(t *testing.T) { testAccCheckListenerCertificateExists("aws_lb_listener_certificate.additional_2"), testAccCheckListenerCertificateNotExists("aws_lb_listener_certificate.additional_3"), resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.default", "listener_arn"), - resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.default", "certificate_arn"), + resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.default", names.AttrCertificateARN), resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_1", "listener_arn"), - resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_1", "certificate_arn"), + resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_1", names.AttrCertificateARN), resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_2", "listener_arn"), - resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_2", "certificate_arn"), + resource.TestCheckResourceAttrSet("aws_lb_listener_certificate.additional_2", names.AttrCertificateARN), ), }, }, @@ -239,7 +239,7 @@ func testAccCheckListenerCertificateDestroy(ctx context.Context) resource.TestCh continue } - if aws.ToString(cert.CertificateArn) == rs.Primary.Attributes["certificate_arn"] { + if aws.ToString(cert.CertificateArn) == rs.Primary.Attributes[names.AttrCertificateARN] { return errors.New("LB listener certificate not destroyed") } } diff --git a/internal/service/elbv2/listener_data_source.go b/internal/service/elbv2/listener_data_source.go index 0345fe57f93..33fe67f8dd2 100644 --- a/internal/service/elbv2/listener_data_source.go +++ b/internal/service/elbv2/listener_data_source.go @@ -44,7 +44,7 @@ func DataSourceListener() *schema.Resource { Computed: true, ConflictsWith: []string{"load_balancer_arn", names.AttrPort}, }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Computed: true, }, @@ -334,7 +334,7 @@ func dataSourceListenerRead(ctx context.Context, d *schema.ResourceData, meta in } d.Set(names.AttrARN, listener.ListenerArn) if listener.Certificates != nil && len(listener.Certificates) == 1 { - d.Set("certificate_arn", listener.Certificates[0].CertificateArn) + d.Set(names.AttrCertificateARN, listener.Certificates[0].CertificateArn) } sort.Slice(listener.DefaultActions, func(i, j int) bool { return aws.ToInt32(listener.DefaultActions[i].Order) < aws.ToInt32(listener.DefaultActions[j].Order) diff --git a/internal/service/elbv2/listener_data_source_test.go b/internal/service/elbv2/listener_data_source_test.go index ec07dc52f55..f88b1c13f0f 100644 --- a/internal/service/elbv2/listener_data_source_test.go +++ b/internal/service/elbv2/listener_data_source_test.go @@ -30,7 +30,7 @@ func TestAccELBV2ListenerDataSource_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "alpn_policy", resourceName, "alpn_policy"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "certificate_arn", resourceName, "certificate_arn"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrCertificateARN, resourceName, names.AttrCertificateARN), resource.TestCheckResourceAttrPair(dataSourceName, "default_action.#", resourceName, "default_action.#"), resource.TestCheckResourceAttrPair(dataSourceName, "load_balancer_arn", resourceName, "load_balancer_arn"), resource.TestCheckResourceAttrPair(dataSourceName, "mutual_authentication.#", resourceName, "mutual_authentication.#"), @@ -40,7 +40,7 @@ func TestAccELBV2ListenerDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "tags.%", resourceName, "tags.%"), resource.TestCheckResourceAttrPair(dataSourceName2, "alpn_policy", dataSourceName, "alpn_policy"), resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrARN, dataSourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName2, "certificate_arn", dataSourceName, "certificate_arn"), + resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrCertificateARN, dataSourceName, names.AttrCertificateARN), resource.TestCheckResourceAttrPair(dataSourceName2, "default_action.#", dataSourceName, "default_action.#"), resource.TestCheckResourceAttrPair(dataSourceName2, "load_balancer_arn", dataSourceName, "load_balancer_arn"), resource.TestCheckResourceAttrPair(dataSourceName2, "mutual_authentication.#", dataSourceName, "mutual_authentication.#"), diff --git a/internal/service/elbv2/listener_test.go b/internal/service/elbv2/listener_test.go index c7ac56ff934..9f512ef2872 100644 --- a/internal/service/elbv2/listener_test.go +++ b/internal/service/elbv2/listener_test.go @@ -45,7 +45,7 @@ func TestAccELBV2Listener_Application_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "load_balancer_arn", "aws_lb.test", names.AttrARN), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile("listener/.+$")), resource.TestCheckNoResourceAttr(resourceName, "alpn_policy"), - resource.TestCheckNoResourceAttr(resourceName, "certificate_arn"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrCertificateARN), resource.TestCheckResourceAttr(resourceName, "default_action.#", "1"), resource.TestCheckResourceAttr(resourceName, "default_action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "default_action.0.type", "forward"), @@ -96,7 +96,7 @@ func TestAccELBV2Listener_Network_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "load_balancer_arn", "aws_lb.test", names.AttrARN), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile("listener/.+$")), resource.TestCheckNoResourceAttr(resourceName, "alpn_policy"), - resource.TestCheckNoResourceAttr(resourceName, "certificate_arn"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrCertificateARN), resource.TestCheckResourceAttr(resourceName, "default_action.#", "1"), resource.TestCheckResourceAttr(resourceName, "default_action.0.order", "1"), resource.TestCheckResourceAttr(resourceName, "default_action.0.type", "forward"), @@ -147,7 +147,7 @@ func TestAccELBV2Listener_Gateway_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "load_balancer_arn", "aws_lb.test", names.AttrARN), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "elasticloadbalancing", regexache.MustCompile("listener/.+$")), resource.TestCheckNoResourceAttr(resourceName, "alpn_policy"), - resource.TestCheckNoResourceAttr(resourceName, "certificate_arn"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrCertificateARN), resource.TestCheckResourceAttr(resourceName, "default_action.#", "1"), resource.TestCheckResourceAttr(resourceName, "default_action.0.order", "0"), // A Gateway Listener can only have one action, so the API never returns a value resource.TestCheckResourceAttr(resourceName, "default_action.0.type", "forward"), @@ -1089,7 +1089,7 @@ func TestAccELBV2Listener_Protocol_https(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "default_action.0.target_group_arn", "aws_lb_target_group.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "default_action.0.redirect.#", "0"), resource.TestCheckResourceAttr(resourceName, "default_action.0.fixed_response.#", "0"), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", "aws_iam_server_certificate.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, "aws_iam_server_certificate.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "ssl_policy", "ELBSecurityPolicy-2016-08"), resource.TestCheckResourceAttr(resourceName, "mutual_authentication.#", "1"), resource.TestCheckResourceAttr(resourceName, "mutual_authentication.0.mode", tfelbv2.MutualAuthenticationOff), @@ -1140,7 +1140,7 @@ func TestAccELBV2Listener_mutualAuthentication(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "default_action.0.target_group_arn", "aws_lb_target_group.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "default_action.0.redirect.#", "0"), resource.TestCheckResourceAttr(resourceName, "default_action.0.fixed_response.#", "0"), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", "aws_iam_server_certificate.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, "aws_iam_server_certificate.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "ssl_policy", "ELBSecurityPolicy-2016-08"), ), }, @@ -1187,7 +1187,7 @@ func TestAccELBV2Listener_mutualAuthenticationPassthrough(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "default_action.0.target_group_arn", "aws_lb_target_group.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "default_action.0.redirect.#", "0"), resource.TestCheckResourceAttr(resourceName, "default_action.0.fixed_response.#", "0"), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", "aws_iam_server_certificate.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, "aws_iam_server_certificate.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "ssl_policy", "ELBSecurityPolicy-2016-08"), ), }, @@ -1258,7 +1258,7 @@ func TestAccELBV2Listener_Protocol_tls(t *testing.T) { testAccCheckListenerExists(ctx, resourceName, &listener1), resource.TestCheckResourceAttr(resourceName, names.AttrProtocol, "TLS"), resource.TestCheckResourceAttr(resourceName, "alpn_policy", tfelbv2.AlpnPolicyHTTP2Preferred), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", "aws_acm_certificate.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, "aws_acm_certificate.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "ssl_policy", "ELBSecurityPolicy-2016-08"), resource.TestCheckResourceAttr(resourceName, "mutual_authentication.#", "0"), ), @@ -1387,7 +1387,7 @@ func TestAccELBV2Listener_cognito(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "default_action.0.authenticate_cognito.0.authentication_request_extra_params.param", "test"), resource.TestCheckResourceAttr(resourceName, "default_action.1.type", "forward"), resource.TestCheckResourceAttrPair(resourceName, "default_action.1.target_group_arn", "aws_lb_target_group.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", "aws_iam_server_certificate.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, "aws_iam_server_certificate.test", names.AttrARN), ), }, { @@ -1436,7 +1436,7 @@ func TestAccELBV2Listener_oidc(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "default_action.0.authenticate_oidc.0.authentication_request_extra_params.param", "test"), resource.TestCheckResourceAttr(resourceName, "default_action.1.type", "forward"), resource.TestCheckResourceAttrPair(resourceName, "default_action.1.target_group_arn", "aws_lb_target_group.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", "aws_iam_server_certificate.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, "aws_iam_server_certificate.test", names.AttrARN), ), }, { From eab5553ff69ce8982b3b2febbb7c569b5e677dd7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:45 -0400 Subject: [PATCH 1351/1490] emr: Use constants for strings --- .../emr/block_public_access_configuration_test.go | 10 +++++----- internal/service/emr/security_configuration.go | 4 ++-- internal/service/emr/security_configuration_test.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/emr/block_public_access_configuration_test.go b/internal/service/emr/block_public_access_configuration_test.go index aedaaa5848a..4ea2230e391 100644 --- a/internal/service/emr/block_public_access_configuration_test.go +++ b/internal/service/emr/block_public_access_configuration_test.go @@ -45,7 +45,7 @@ func TestAccEMRBlockPublicAccessConfiguration_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, { Config: testAccBlockPublicAccessConfigurationConfig_basic(false), @@ -59,7 +59,7 @@ func TestAccEMRBlockPublicAccessConfiguration_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -91,7 +91,7 @@ func TestAccEMRBlockPublicAccessConfiguration_disappears(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -125,7 +125,7 @@ func TestAccEMRBlockPublicAccessConfiguration_default(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -161,7 +161,7 @@ func TestAccEMRBlockPublicAccessConfiguration_enabledMultiRange(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) diff --git a/internal/service/emr/security_configuration.go b/internal/service/emr/security_configuration.go index 4d57e373be9..db9e7b76164 100644 --- a/internal/service/emr/security_configuration.go +++ b/internal/service/emr/security_configuration.go @@ -41,7 +41,7 @@ func resourceSecurityConfiguration() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringIsJSON, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -107,7 +107,7 @@ func resourceSecurityConfigurationRead(ctx context.Context, d *schema.ResourceDa } d.Set(names.AttrConfiguration, output.SecurityConfiguration) - d.Set("creation_date", aws.TimeValue(output.CreationDateTime).Format(time.RFC3339)) + d.Set(names.AttrCreationDate, aws.TimeValue(output.CreationDateTime).Format(time.RFC3339)) d.Set(names.AttrName, output.Name) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.StringValue(output.Name))) diff --git a/internal/service/emr/security_configuration_test.go b/internal/service/emr/security_configuration_test.go index b92ff16a48e..572a09199ca 100644 --- a/internal/service/emr/security_configuration_test.go +++ b/internal/service/emr/security_configuration_test.go @@ -34,7 +34,7 @@ func TestAccEMRSecurityConfiguration_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckSecurityConfigurationExists(ctx, resourceName), resource.TestCheckResourceAttrSet(resourceName, names.AttrConfiguration), - acctest.CheckResourceAttrRFC3339(resourceName, "creation_date"), + acctest.CheckResourceAttrRFC3339(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, ""), ), From 6fa43b03d9ed4efe423a6d0ee5f7cb904883ac65 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:45 -0400 Subject: [PATCH 1352/1490] emrcontainers: Use constants for strings --- internal/service/emrcontainers/job_template.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/emrcontainers/job_template.go b/internal/service/emrcontainers/job_template.go index 0b79435b123..0e8bf1d2c94 100644 --- a/internal/service/emrcontainers/job_template.go +++ b/internal/service/emrcontainers/job_template.go @@ -156,7 +156,7 @@ func ResourceJobTemplate() *schema.Resource { }, }, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -362,7 +362,7 @@ func expandJobTemplateData(tfMap map[string]interface{}) *emrcontainers.JobTempl apiObject.ConfigurationOverrides = expandConfigurationOverrides(v[0].(map[string]interface{})) } - if v, ok := tfMap["execution_role_arn"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrExecutionRoleARN].(string); ok && v != "" { apiObject.ExecutionRoleArn = aws.String(v) } @@ -570,7 +570,7 @@ func flattenJobTemplateData(apiObject *emrcontainers.JobTemplateData) map[string } if v := apiObject.ExecutionRoleArn; v != nil { - tfMap["execution_role_arn"] = aws.StringValue(v) + tfMap[names.AttrExecutionRoleARN] = aws.StringValue(v) } if v := apiObject.JobDriver; v != nil { From 7d258a9740527870fb7be69382b4edbf597e1249 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:45 -0400 Subject: [PATCH 1353/1490] emrserverless: Use constants for strings --- internal/service/emrserverless/application.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/emrserverless/application.go b/internal/service/emrserverless/application.go index 596daf11c9f..0c2b1b2cb9b 100644 --- a/internal/service/emrserverless/application.go +++ b/internal/service/emrserverless/application.go @@ -185,7 +185,7 @@ func resourceApplication() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 64), }, - "network_configuration": { + names.AttrNetworkConfiguration: { Type: schema.TypeList, Optional: true, DiffSuppressFunc: verify.SuppressMissingOptionalConfigurationBlock, @@ -262,7 +262,7 @@ func resourceApplicationCreate(ctx context.Context, d *schema.ResourceData, meta input.MaximumCapacity = expandMaximumCapacity(v.([]interface{})[0].(map[string]interface{})) } - if v, ok := d.GetOk("network_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrNetworkConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.NetworkConfiguration = expandNetworkConfiguration(v.([]interface{})[0].(map[string]interface{})) } @@ -323,7 +323,7 @@ func resourceApplicationRead(ctx context.Context, d *schema.ResourceData, meta i return sdkdiag.AppendErrorf(diags, "setting maximum_capacity: %s", err) } - if err := d.Set("network_configuration", []interface{}{flattenNetworkConfiguration(application.NetworkConfiguration)}); err != nil { + if err := d.Set(names.AttrNetworkConfiguration, []interface{}{flattenNetworkConfiguration(application.NetworkConfiguration)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting network_configuration: %s", err) } @@ -366,7 +366,7 @@ func resourceApplicationUpdate(ctx context.Context, d *schema.ResourceData, meta input.MaximumCapacity = expandMaximumCapacity(v.([]interface{})[0].(map[string]interface{})) } - if v, ok := d.GetOk("network_configuration"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + if v, ok := d.GetOk(names.AttrNetworkConfiguration); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { input.NetworkConfiguration = expandNetworkConfiguration(v.([]interface{})[0].(map[string]interface{})) } From d6426353558d1ecaa2b2a3361a51fa919756f444 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:45 -0400 Subject: [PATCH 1354/1490] events: Use constants for strings --- internal/service/events/rule.go | 10 +++++----- internal/service/events/rule_migrate.go | 2 +- internal/service/events/rule_test.go | 14 +++++++------- internal/service/events/target.go | 6 +++--- internal/service/events/target_migrate.go | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/service/events/rule.go b/internal/service/events/rule.go index 3c833f5c62e..741d78e2866 100644 --- a/internal/service/events/rule.go +++ b/internal/service/events/rule.go @@ -74,7 +74,7 @@ func resourceRule() *schema.Resource { Type: schema.TypeString, Optional: true, ValidateFunc: validateEventPatternValue(), - AtLeastOneOf: []string{"schedule_expression", "event_pattern"}, + AtLeastOneOf: []string{names.AttrScheduleExpression, "event_pattern"}, StateFunc: func(v interface{}) string { json, _ := ruleEventPatternJSONDecoder(v.(string)) return json @@ -119,11 +119,11 @@ func resourceRule() *schema.Resource { Optional: true, ValidateFunc: verify.ValidARN, }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 256), - AtLeastOneOf: []string{"schedule_expression", "event_pattern"}, + AtLeastOneOf: []string{names.AttrScheduleExpression, "event_pattern"}, }, names.AttrState: { Type: schema.TypeString, @@ -241,7 +241,7 @@ func resourceRuleRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set(names.AttrName, output.Name) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.ToString(output.Name))) d.Set(names.AttrRoleARN, output.RoleArn) - d.Set("schedule_expression", output.ScheduleExpression) + d.Set(names.AttrScheduleExpression, output.ScheduleExpression) d.Set(names.AttrState, output.State) return diags @@ -441,7 +441,7 @@ func expandPutRuleInput(d *schema.ResourceData, name string) *eventbridge.PutRul apiObject.RoleArn = aws.String(v.(string)) } - if v, ok := d.GetOk("schedule_expression"); ok { + if v, ok := d.GetOk(names.AttrScheduleExpression); ok { apiObject.ScheduleExpression = aws.String(v.(string)) } diff --git a/internal/service/events/rule_migrate.go b/internal/service/events/rule_migrate.go index 44250257b3d..bd342f0b55c 100644 --- a/internal/service/events/rule_migrate.go +++ b/internal/service/events/rule_migrate.go @@ -60,7 +60,7 @@ func resourceRuleV0() *schema.Resource { Optional: true, ValidateFunc: verify.ValidARN, }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Optional: true, }, diff --git a/internal/service/events/rule_test.go b/internal/service/events/rule_test.go index 6fc58a09aa4..1a9b206526d 100644 --- a/internal/service/events/rule_test.go +++ b/internal/service/events/rule_test.go @@ -215,7 +215,7 @@ func TestAccEventsRule_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "events", regexache.MustCompile(fmt.Sprintf(`rule/%s$`, rName1))), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName1), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, ""), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", "rate(1 hour)"), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, "rate(1 hour)"), resource.TestCheckResourceAttr(resourceName, "event_bus_name", "default"), resource.TestCheckNoResourceAttr(resourceName, "event_pattern"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), @@ -247,7 +247,7 @@ func TestAccEventsRule_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "events", regexache.MustCompile(fmt.Sprintf(`rule/%s$`, rName2))), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName2), resource.TestCheckResourceAttr(resourceName, "event_bus_name", "default"), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", "rate(1 hour)"), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, "rate(1 hour)"), resource.TestCheckResourceAttr(resourceName, names.AttrRoleARN, ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "is_enabled", "true"), @@ -408,7 +408,7 @@ func TestAccEventsRule_pattern(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckRuleExists(ctx, resourceName, &v1), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, ""), acctest.CheckResourceAttrEquivalentJSON(resourceName, "event_pattern", "{\"source\":[\"aws.ec2\"]}"), ), }, @@ -447,7 +447,7 @@ func TestAccEventsRule_patternJSONEncoder(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckRuleExists(ctx, resourceName, &v1), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, ""), acctest.CheckResourceAttrEquivalentJSON(resourceName, "event_pattern", `{"detail":{"count":[{"numeric":[">",0,"<",5]}]}}`), ), }, @@ -472,7 +472,7 @@ func TestAccEventsRule_scheduleAndPattern(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckRuleExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", "rate(1 hour)"), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, "rate(1 hour)"), acctest.CheckResourceAttrEquivalentJSON(resourceName, "event_pattern", "{\"source\":[\"aws.ec2\"]}"), ), }, @@ -723,7 +723,7 @@ func TestAccEventsRule_partnerEventBus(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrState, "ENABLED"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrRoleARN, ""), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, @@ -762,7 +762,7 @@ func TestAccEventsRule_eventBusARN(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrState, "ENABLED"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrRoleARN, ""), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, diff --git a/internal/service/events/target.go b/internal/service/events/target.go index cd1e5a23427..25094dfcca0 100644 --- a/internal/service/events/target.go +++ b/internal/service/events/target.go @@ -162,7 +162,7 @@ func resourceTarget() *schema.Resource { Optional: true, ValidateDiagFunc: enum.Validate[types.LaunchType](), }, - "network_configuration": { + names.AttrNetworkConfiguration: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -947,7 +947,7 @@ func expandTargetECSParameters(ctx context.Context, tfList []interface{}) *types ecsParameters.LaunchType = types.LaunchType(v) } - if v, ok := tfMap["network_configuration"]; ok { + if v, ok := tfMap[names.AttrNetworkConfiguration]; ok { ecsParameters.NetworkConfiguration = expandTargetECSParametersNetworkConfiguration(v.([]interface{})) } @@ -1183,7 +1183,7 @@ func flattenTargetECSParameters(ctx context.Context, ecsParameters *types.EcsPar config["launch_type"] = ecsParameters.LaunchType - config["network_configuration"] = flattenTargetECSParametersNetworkConfiguration(ecsParameters.NetworkConfiguration) + config[names.AttrNetworkConfiguration] = flattenTargetECSParametersNetworkConfiguration(ecsParameters.NetworkConfiguration) if ecsParameters.PlatformVersion != nil { config["platform_version"] = aws.ToString(ecsParameters.PlatformVersion) } diff --git a/internal/service/events/target_migrate.go b/internal/service/events/target_migrate.go index 7198160cb7f..430ecfdc053 100644 --- a/internal/service/events/target_migrate.go +++ b/internal/service/events/target_migrate.go @@ -54,7 +54,7 @@ func resourceTargetV0() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "network_configuration": { + names.AttrNetworkConfiguration: { Type: schema.TypeList, Optional: true, Elem: &schema.Resource{ From 7b91fe67baa904796d7cd3fe7618c57f1fc3ff88 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:46 -0400 Subject: [PATCH 1355/1490] fis: Use constants for strings --- internal/service/fis/experiment_template.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/fis/experiment_template.go b/internal/service/fis/experiment_template.go index 65c3d792540..b8007e71423 100644 --- a/internal/service/fis/experiment_template.go +++ b/internal/service/fis/experiment_template.go @@ -261,7 +261,7 @@ func ResourceExperimentTemplate() *schema.Resource { }, }, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(0, 64), @@ -652,7 +652,7 @@ func expandExperimentTemplateTargets(l *schema.Set) (map[string]types.CreateExpe config.ResourceTags = expandExperimentTemplateTargetResourceTags(v) } - if v, ok := raw["resource_type"].(string); ok && v != "" { + if v, ok := raw[names.AttrResourceType].(string); ok && v != "" { config.ResourceType = aws.String(v) } @@ -702,7 +702,7 @@ func expandExperimentTemplateTargetsForUpdate(l *schema.Set) (map[string]types.U config.ResourceTags = expandExperimentTemplateTargetResourceTags(v) } - if v, ok := raw["resource_type"].(string); ok && v != "" { + if v, ok := raw[names.AttrResourceType].(string); ok && v != "" { config.ResourceType = aws.String(v) } @@ -862,7 +862,7 @@ func flattenExperimentTemplateTargets(configured map[string]types.ExperimentTemp item[names.AttrFilter] = flattenExperimentTemplateTargetFilters(v.Filters) item["resource_arns"] = v.ResourceArns item["resource_tag"] = flattenExperimentTemplateTargetResourceTags(v.ResourceTags) - item["resource_type"] = aws.ToString(v.ResourceType) + item[names.AttrResourceType] = aws.ToString(v.ResourceType) item["selection_mode"] = aws.ToString(v.SelectionMode) item[names.AttrParameters] = v.Parameters From 6c767dfeb369f31b58adb1223253fe02649e4ba1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:46 -0400 Subject: [PATCH 1356/1490] fms: Use constants for strings --- internal/service/fms/policy.go | 8 ++++---- internal/service/fms/policy_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/fms/policy.go b/internal/service/fms/policy.go index 6458c442cdf..dda3920ba24 100644 --- a/internal/service/fms/policy.go +++ b/internal/service/fms/policy.go @@ -127,7 +127,7 @@ func resourcePolicy() *schema.Resource { Optional: true, }, "resource_tags": tftags.TagsSchema(), - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Optional: true, Computed: true, @@ -142,7 +142,7 @@ func resourcePolicy() *schema.Resource { Type: schema.TypeString, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$`), "must match a supported resource type, such as AWS::EC2::VPC, see also: https://docs.aws.amazon.com/fms/2018-01-01/APIReference/API_Policy.html"), }, - ConflictsWith: []string{"resource_type"}, + ConflictsWith: []string{names.AttrResourceType}, }, "security_service_policy_data": { Type: schema.TypeList, @@ -273,7 +273,7 @@ func resourcePolicyRead(ctx context.Context, d *schema.ResourceData, meta interf if err := d.Set("resource_tags", flattenResourceTags(policy.ResourceTags)); err != nil { sdkdiag.AppendErrorf(diags, "setting resource_tags: %s", err) } - d.Set("resource_type", policy.ResourceType) + d.Set(names.AttrResourceType, policy.ResourceType) d.Set("resource_type_list", policy.ResourceTypeList) securityServicePolicy := []map[string]interface{}{{ names.AttrType: string(policy.SecurityServicePolicyData.Type), @@ -362,7 +362,7 @@ func findPolicyByID(ctx context.Context, conn *fms.Client, id string) (*fms.GetP func expandPolicy(d *schema.ResourceData) *awstypes.Policy { resourceType := aws.String("ResourceTypeList") - if v, ok := d.GetOk("resource_type"); ok { + if v, ok := d.GetOk(names.AttrResourceType); ok { resourceType = aws.String(v.(string)) } diff --git a/internal/service/fms/policy_test.go b/internal/service/fms/policy_test.go index e87e74609fd..de10e57437b 100644 --- a/internal/service/fms/policy_test.go +++ b/internal/service/fms/policy_test.go @@ -320,7 +320,7 @@ func testAccPolicy_alb(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPolicyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "resource_type", "ResourceTypeList"), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, "ResourceTypeList"), resource.TestCheckResourceAttr(resourceName, "resource_type_list.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "resource_type_list.*", "AWS::ElasticLoadBalancingV2::LoadBalancer"), resource.TestCheckResourceAttr(resourceName, "security_service_policy_data.#", "1"), @@ -354,7 +354,7 @@ func testAccPolicy_securityGroup(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPolicyExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "resource_type", "AWS::EC2::SecurityGroup"), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, "AWS::EC2::SecurityGroup"), resource.TestCheckResourceAttr(resourceName, "security_service_policy_data.#", "1"), resource.TestCheckResourceAttr(resourceName, "security_service_policy_data.0.type", "SECURITY_GROUPS_CONTENT_AUDIT"), acctest.CheckResourceAttrJMES(resourceName, "security_service_policy_data.0.managed_service_data", names.AttrType, "SECURITY_GROUPS_CONTENT_AUDIT"), From 8adc2d876a4672230f0ba5d89d808bfef8e13d80 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:46 -0400 Subject: [PATCH 1357/1490] fsx: Use constants for strings --- .../fsx/ontap_storage_virtual_machine_data_source.go | 4 ++-- internal/service/fsx/openzfs_snapshot.go | 4 ++-- internal/service/fsx/openzfs_snapshot_data_source.go | 4 ++-- internal/service/fsx/openzfs_snapshot_data_source_test.go | 8 ++++---- internal/service/fsx/openzfs_snapshot_test.go | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) 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 165bb0bd630..92da60a773c 100644 --- a/internal/service/fsx/ontap_storage_virtual_machine_data_source.go +++ b/internal/service/fsx/ontap_storage_virtual_machine_data_source.go @@ -70,7 +70,7 @@ func dataSourceONTAPStorageVirtualMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -224,7 +224,7 @@ func dataSourceONTAPStorageVirtualMachineRead(ctx context.Context, d *schema.Res return sdkdiag.AppendErrorf(diags, "setting active_directory_configuration: %s", err) } d.Set(names.AttrARN, svm.ResourceARN) - d.Set("creation_time", svm.CreationTime.Format(time.RFC3339)) + d.Set(names.AttrCreationTime, svm.CreationTime.Format(time.RFC3339)) if err := d.Set(names.AttrEndpoints, flattenSvmEndpoints(svm.Endpoints)); err != nil { return sdkdiag.AppendErrorf(diags, "setting endpoints: %s", err) } diff --git a/internal/service/fsx/openzfs_snapshot.go b/internal/service/fsx/openzfs_snapshot.go index 0d93cba7985..9c3d641adcc 100644 --- a/internal/service/fsx/openzfs_snapshot.go +++ b/internal/service/fsx/openzfs_snapshot.go @@ -52,7 +52,7 @@ func resourceOpenZFSSnapshot() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -120,7 +120,7 @@ func resourceOpenZFSSnapshotRead(ctx context.Context, d *schema.ResourceData, me } d.Set(names.AttrARN, snapshot.ResourceARN) - d.Set("creation_time", snapshot.CreationTime.Format(time.RFC3339)) + d.Set(names.AttrCreationTime, snapshot.CreationTime.Format(time.RFC3339)) d.Set(names.AttrName, snapshot.Name) d.Set("volume_id", snapshot.VolumeId) diff --git a/internal/service/fsx/openzfs_snapshot_data_source.go b/internal/service/fsx/openzfs_snapshot_data_source.go index 21c390051d6..9d44232994b 100644 --- a/internal/service/fsx/openzfs_snapshot_data_source.go +++ b/internal/service/fsx/openzfs_snapshot_data_source.go @@ -31,7 +31,7 @@ func dataSourceOpenzfsSnapshot() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -105,7 +105,7 @@ func dataSourceOpenZFSSnapshotRead(ctx context.Context, d *schema.ResourceData, snapshot := snapshots[0] d.SetId(aws.StringValue(snapshot.SnapshotId)) d.Set(names.AttrARN, snapshot.ResourceARN) - d.Set("creation_time", snapshot.CreationTime.Format(time.RFC3339)) + d.Set(names.AttrCreationTime, snapshot.CreationTime.Format(time.RFC3339)) d.Set(names.AttrName, snapshot.Name) d.Set("snapshot_id", snapshot.SnapshotId) d.Set("volume_id", snapshot.VolumeId) diff --git a/internal/service/fsx/openzfs_snapshot_data_source_test.go b/internal/service/fsx/openzfs_snapshot_data_source_test.go index a1f796ddd61..2f45ae5660c 100644 --- a/internal/service/fsx/openzfs_snapshot_data_source_test.go +++ b/internal/service/fsx/openzfs_snapshot_data_source_test.go @@ -32,7 +32,7 @@ func TestAccFSxOpenZFSSnapshotDataSource_basic(t *testing.T) { Config: testAccOpenZFSSnapshotDataSourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "creation_time", resourceName, "creation_time"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrCreationTime, resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, "tags.%", resourceName, "tags.%"), @@ -43,7 +43,7 @@ func TestAccFSxOpenZFSSnapshotDataSource_basic(t *testing.T) { Config: testAccOpenZFSSnapshotDataSourceConfig_filterFileSystemId(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "creation_time", resourceName, "creation_time"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrCreationTime, resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, "tags.%", resourceName, "tags.%"), @@ -54,7 +54,7 @@ func TestAccFSxOpenZFSSnapshotDataSource_basic(t *testing.T) { Config: testAccOpenZFSSnapshotDataSourceConfig_filterVolumeId(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "creation_time", resourceName, "creation_time"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrCreationTime, resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, "tags.%", resourceName, "tags.%"), @@ -65,7 +65,7 @@ func TestAccFSxOpenZFSSnapshotDataSource_basic(t *testing.T) { Config: testAccOpenZFSSnapshotDataSourceConfig_mostRecent(rName, rName2), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, mostRecentResourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "creation_time", mostRecentResourceName, "creation_time"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrCreationTime, mostRecentResourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, mostRecentResourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, mostRecentResourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, "tags.%", mostRecentResourceName, "tags.%"), diff --git a/internal/service/fsx/openzfs_snapshot_test.go b/internal/service/fsx/openzfs_snapshot_test.go index f8d1cc69506..2c2662f30df 100644 --- a/internal/service/fsx/openzfs_snapshot_test.go +++ b/internal/service/fsx/openzfs_snapshot_test.go @@ -40,7 +40,7 @@ func TestAccFSxOpenZFSSnapshot_basic(t *testing.T) { acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "fsx", regexache.MustCompile(`snapshot/.+`)), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrSet(resourceName, "volume_id"), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, From b75715327753de8ad6fe23a80f548808205fca66 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:46 -0400 Subject: [PATCH 1358/1490] glue: Use constants for strings --- internal/service/glue/partition.go | 4 ++-- internal/service/glue/partition_test.go | 2 +- internal/service/glue/security_configuration.go | 6 +++--- internal/service/glue/user_defined_function.go | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/glue/partition.go b/internal/service/glue/partition.go index 70dca5051a4..99f2e53b613 100644 --- a/internal/service/glue/partition.go +++ b/internal/service/glue/partition.go @@ -189,7 +189,7 @@ func ResourcePartition() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -260,7 +260,7 @@ func resourcePartitionRead(ctx context.Context, d *schema.ResourceData, meta int } if partition.CreationTime != nil { - d.Set("creation_time", partition.CreationTime.Format(time.RFC3339)) + d.Set(names.AttrCreationTime, partition.CreationTime.Format(time.RFC3339)) } if err := d.Set("storage_descriptor", flattenStorageDescriptor(partition.StorageDescriptor)); err != nil { diff --git a/internal/service/glue/partition_test.go b/internal/service/glue/partition_test.go index 4199e0c212e..e1ca35bb31c 100644 --- a/internal/service/glue/partition_test.go +++ b/internal/service/glue/partition_test.go @@ -40,7 +40,7 @@ func TestAccGluePartition_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "partition_values.#", "1"), resource.TestCheckResourceAttr(resourceName, "partition_values.0", parValue), resource.TestCheckResourceAttr(resourceName, "parameters.%", "0"), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), ), }, { diff --git a/internal/service/glue/security_configuration.go b/internal/service/glue/security_configuration.go index 2973f280015..a3fde69b805 100644 --- a/internal/service/glue/security_configuration.go +++ b/internal/service/glue/security_configuration.go @@ -29,7 +29,7 @@ func ResourceSecurityConfiguration() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "encryption_configuration": { + names.AttrEncryptionConfiguration: { Type: schema.TypeList, Required: true, ForceNew: true, @@ -131,7 +131,7 @@ func resourceSecurityConfigurationCreate(ctx context.Context, d *schema.Resource name := d.Get(names.AttrName).(string) input := &glue.CreateSecurityConfigurationInput{ - EncryptionConfiguration: expandEncryptionConfiguration(d.Get("encryption_configuration").([]interface{})), + EncryptionConfiguration: expandEncryptionConfiguration(d.Get(names.AttrEncryptionConfiguration).([]interface{})), Name: aws.String(name), } @@ -174,7 +174,7 @@ func resourceSecurityConfigurationRead(ctx context.Context, d *schema.ResourceDa return diags } - if err := d.Set("encryption_configuration", flattenEncryptionConfiguration(securityConfiguration.EncryptionConfiguration)); err != nil { + if err := d.Set(names.AttrEncryptionConfiguration, flattenEncryptionConfiguration(securityConfiguration.EncryptionConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting encryption_configuration: %s", err) } diff --git a/internal/service/glue/user_defined_function.go b/internal/service/glue/user_defined_function.go index d0819aa97dc..4ae35eac722 100644 --- a/internal/service/glue/user_defined_function.go +++ b/internal/service/glue/user_defined_function.go @@ -75,7 +75,7 @@ func ResourceUserDefinedFunction() *schema.Resource { MaxItems: 1000, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(glue.ResourceType_Values(), false), @@ -249,7 +249,7 @@ func expandUserDefinedFunctionResourceURI(conf *schema.Set) []*glue.ResourceUri } uri := &glue.ResourceUri{ - ResourceType: aws.String(uriRaw["resource_type"].(string)), + ResourceType: aws.String(uriRaw[names.AttrResourceType].(string)), Uri: aws.String(uriRaw["uri"].(string)), } @@ -264,7 +264,7 @@ func flattenUserDefinedFunctionResourceURI(uris []*glue.ResourceUri) []map[strin for _, i := range uris { l := map[string]interface{}{ - "resource_type": aws.StringValue(i.ResourceType), + names.AttrResourceType: aws.StringValue(i.ResourceType), "uri": aws.StringValue(i.Uri), } From 5a6311df0ed3b26482a230e1031b75a7e2f98b86 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:46 -0400 Subject: [PATCH 1359/1490] guardduty: Use constants for strings --- internal/service/guardduty/publishing_destination.go | 8 ++++---- internal/service/guardduty/publishing_destination_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/guardduty/publishing_destination.go b/internal/service/guardduty/publishing_destination.go index b45711e038a..b022edf8ff6 100644 --- a/internal/service/guardduty/publishing_destination.go +++ b/internal/service/guardduty/publishing_destination.go @@ -45,7 +45,7 @@ func ResourcePublishingDestination() *schema.Resource { Default: guardduty.DestinationTypeS3, ValidateFunc: validation.StringInSlice(guardduty.DestinationType_Values(), false), }, - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -67,7 +67,7 @@ func resourcePublishingDestinationCreate(ctx context.Context, d *schema.Resource input := guardduty.CreatePublishingDestinationInput{ DetectorId: aws.String(detectorID), DestinationProperties: &guardduty.DestinationProperties{ - DestinationArn: aws.String(d.Get("destination_arn").(string)), + DestinationArn: aws.String(d.Get(names.AttrDestinationARN).(string)), KmsKeyArn: aws.String(d.Get(names.AttrKMSKeyARN).(string)), }, DestinationType: aws.String(d.Get("destination_type").(string)), @@ -118,7 +118,7 @@ func resourcePublishingDestinationRead(ctx context.Context, d *schema.ResourceDa d.Set("detector_id", detectorId) d.Set("destination_type", gdo.DestinationType) d.Set(names.AttrKMSKeyARN, gdo.DestinationProperties.KmsKeyArn) - d.Set("destination_arn", gdo.DestinationProperties.DestinationArn) + d.Set(names.AttrDestinationARN, gdo.DestinationProperties.DestinationArn) return diags } @@ -136,7 +136,7 @@ func resourcePublishingDestinationUpdate(ctx context.Context, d *schema.Resource DestinationId: aws.String(destinationId), DetectorId: aws.String(detectorId), DestinationProperties: &guardduty.DestinationProperties{ - DestinationArn: aws.String(d.Get("destination_arn").(string)), + DestinationArn: aws.String(d.Get(names.AttrDestinationARN).(string)), KmsKeyArn: aws.String(d.Get(names.AttrKMSKeyARN).(string)), }, } diff --git a/internal/service/guardduty/publishing_destination_test.go b/internal/service/guardduty/publishing_destination_test.go index d84370ca97d..cacc26fb8aa 100644 --- a/internal/service/guardduty/publishing_destination_test.go +++ b/internal/service/guardduty/publishing_destination_test.go @@ -41,7 +41,7 @@ func testAccPublishingDestination_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckPublishingDestinationExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, "detector_id", detectorResourceName, names.AttrID), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", bucketResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, bucketResourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrKMSKeyARN, kmsKeyResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "destination_type", "S3")), }, From 77e190f8442120e040641aca4f3deda22fc1ffe4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:46 -0400 Subject: [PATCH 1360/1490] identitystore: Use constants for strings --- internal/service/identitystore/group.go | 10 +++++----- internal/service/identitystore/group_data_source.go | 6 +++--- .../service/identitystore/group_data_source_test.go | 6 +++--- internal/service/identitystore/group_test.go | 2 +- internal/service/identitystore/user.go | 8 ++++---- internal/service/identitystore/user_data_source.go | 6 +++--- .../service/identitystore/user_data_source_test.go | 2 +- internal/service/identitystore/user_test.go | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/internal/service/identitystore/group.go b/internal/service/identitystore/group.go index 8c636b32ad4..d57b6021464 100644 --- a/internal/service/identitystore/group.go +++ b/internal/service/identitystore/group.go @@ -43,7 +43,7 @@ func ResourceGroup() *schema.Resource { Optional: true, ValidateFunc: validation.StringLenBetween(1, 1024), }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -97,7 +97,7 @@ func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta inter input.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("display_name"); ok { + if v, ok := d.GetOk(names.AttrDisplayName); ok { input.DisplayName = aws.String(v.(string)) } @@ -138,7 +138,7 @@ func resourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interfa } d.Set(names.AttrDescription, out.Description) - d.Set("display_name", out.DisplayName) + d.Set(names.AttrDisplayName, out.DisplayName) if err := d.Set("external_ids", flattenExternalIds(out.ExternalIds)); err != nil { return create.AppendDiagError(diags, names.IdentityStore, create.ErrActionSetting, ResNameGroup, d.Id(), err) } @@ -166,10 +166,10 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter }) } - if d.HasChange("display_name") { + if d.HasChange(names.AttrDisplayName) { in.Operations = append(in.Operations, types.AttributeOperation{ AttributePath: aws.String("displayName"), - AttributeValue: document.NewLazyDocument(d.Get("display_name").(string)), + AttributeValue: document.NewLazyDocument(d.Get(names.AttrDisplayName).(string)), }) } diff --git a/internal/service/identitystore/group_data_source.go b/internal/service/identitystore/group_data_source.go index a3776edaa23..ef2b1efc405 100644 --- a/internal/service/identitystore/group_data_source.go +++ b/internal/service/identitystore/group_data_source.go @@ -76,7 +76,7 @@ func DataSourceGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Computed: true, }, @@ -187,7 +187,7 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter d.SetId(aws.ToString(group.GroupId)) d.Set(names.AttrDescription, group.Description) - d.Set("display_name", group.DisplayName) + d.Set(names.AttrDisplayName, group.DisplayName) d.Set("group_id", group.GroupId) if err := d.Set("external_ids", flattenExternalIds(group.ExternalIds)); err != nil { @@ -236,7 +236,7 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter d.SetId(aws.ToString(group.GroupId)) d.Set(names.AttrDescription, group.Description) - d.Set("display_name", group.DisplayName) + d.Set(names.AttrDisplayName, group.DisplayName) d.Set("group_id", group.GroupId) if err := d.Set("external_ids", flattenExternalIds(group.ExternalIds)); err != nil { diff --git a/internal/service/identitystore/group_data_source_test.go b/internal/service/identitystore/group_data_source_test.go index b6d531ccfca..48d0a9cafed 100644 --- a/internal/service/identitystore/group_data_source_test.go +++ b/internal/service/identitystore/group_data_source_test.go @@ -32,7 +32,7 @@ func TestAccIdentityStoreGroupDataSource_filterDisplayName(t *testing.T) { Config: testAccGroupDataSourceConfig_filterDisplayName(name), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(dataSourceName, "display_name", resourceName, "display_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDisplayName, resourceName, names.AttrDisplayName), resource.TestCheckResourceAttrPair(dataSourceName, "group_id", resourceName, "group_id"), resource.TestCheckResourceAttr(dataSourceName, "external_ids.#", "0"), ), @@ -60,7 +60,7 @@ func TestAccIdentityStoreGroupDataSource_uniqueAttributeDisplayName(t *testing.T Config: testAccGroupDataSourceConfig_uniqueAttributeDisplayName(name), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(dataSourceName, "display_name", resourceName, "display_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDisplayName, resourceName, names.AttrDisplayName), resource.TestCheckResourceAttrPair(dataSourceName, "group_id", resourceName, "group_id"), resource.TestCheckResourceAttr(dataSourceName, "external_ids.#", "0"), ), @@ -88,7 +88,7 @@ func TestAccIdentityStoreGroupDataSource_filterDisplayNameAndGroupID(t *testing. Config: testAccGroupDataSourceConfig_filterDisplayNameAndGroupID(name), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), - resource.TestCheckResourceAttrPair(dataSourceName, "display_name", resourceName, "display_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDisplayName, resourceName, names.AttrDisplayName), resource.TestCheckResourceAttrPair(dataSourceName, "group_id", resourceName, "group_id"), resource.TestCheckResourceAttr(dataSourceName, "external_ids.#", "0"), ), diff --git a/internal/service/identitystore/group_test.go b/internal/service/identitystore/group_test.go index 442a112da5b..a88352b1c8f 100644 --- a/internal/service/identitystore/group_test.go +++ b/internal/service/identitystore/group_test.go @@ -40,7 +40,7 @@ func TestAccIdentityStoreGroup_basic(t *testing.T) { Config: testAccGroupConfig_basic(displayName), Check: resource.ComposeTestCheckFunc( testAccCheckGroupExists(ctx, resourceName, &group), - resource.TestCheckResourceAttr(resourceName, "display_name", displayName), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, displayName), resource.TestCheckResourceAttrSet(resourceName, "identity_store_id"), resource.TestCheckResourceAttrSet(resourceName, "group_id"), ), diff --git a/internal/service/identitystore/user.go b/internal/service/identitystore/user.go index a9ca20b1a31..fa120b52018 100644 --- a/internal/service/identitystore/user.go +++ b/internal/service/identitystore/user.go @@ -87,7 +87,7 @@ func ResourceUser() *schema.Resource { }, }, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Required: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 1024)), @@ -259,7 +259,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf conn := meta.(*conns.AWSClient).IdentityStoreClient(ctx) in := &identitystore.CreateUserInput{ - DisplayName: aws.String(d.Get("display_name").(string)), + DisplayName: aws.String(d.Get(names.AttrDisplayName).(string)), IdentityStoreId: aws.String(d.Get("identity_store_id").(string)), UserName: aws.String(d.Get("user_name").(string)), } @@ -345,7 +345,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac return create.AppendDiagError(diags, names.IdentityStore, create.ErrActionReading, ResNameUser, d.Id(), err) } - d.Set("display_name", out.DisplayName) + d.Set(names.AttrDisplayName, out.DisplayName) d.Set("identity_store_id", out.IdentityStoreId) d.Set("locale", out.Locale) d.Set("nickname", out.NickName) @@ -419,7 +419,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf Expand func(interface{}) interface{} }{ { - Attribute: "display_name", + Attribute: names.AttrDisplayName, Field: "displayName", }, { diff --git a/internal/service/identitystore/user_data_source.go b/internal/service/identitystore/user_data_source.go index 0e7ef2180e5..9c3e8c6d963 100644 --- a/internal/service/identitystore/user_data_source.go +++ b/internal/service/identitystore/user_data_source.go @@ -113,7 +113,7 @@ func DataSourceUser() *schema.Resource { }, ConflictsWith: []string{names.AttrFilter, "user_id"}, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Computed: true, }, @@ -327,7 +327,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf user := results[0] d.SetId(aws.ToString(user.UserId)) - d.Set("display_name", user.DisplayName) + d.Set(names.AttrDisplayName, user.DisplayName) d.Set("identity_store_id", user.IdentityStoreId) d.Set("locale", user.Locale) d.Set("nickname", user.NickName) @@ -405,7 +405,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf d.SetId(aws.ToString(user.UserId)) - d.Set("display_name", user.DisplayName) + d.Set(names.AttrDisplayName, user.DisplayName) d.Set("identity_store_id", user.IdentityStoreId) d.Set("locale", user.Locale) d.Set("nickname", user.NickName) diff --git a/internal/service/identitystore/user_data_source_test.go b/internal/service/identitystore/user_data_source_test.go index eeb6e9ac7d7..ec9cd544378 100644 --- a/internal/service/identitystore/user_data_source_test.go +++ b/internal/service/identitystore/user_data_source_test.go @@ -32,7 +32,7 @@ func TestAccIdentityStoreUserDataSource_basic(t *testing.T) { { Config: testAccUserDataSourceConfig_basic(name, email), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(dataSourceName, "display_name", resourceName, "display_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDisplayName, resourceName, names.AttrDisplayName), resource.TestCheckResourceAttrPair(dataSourceName, "addresses.0", resourceName, "addresses.0"), resource.TestCheckResourceAttrPair(dataSourceName, "emails.0", resourceName, "emails.0"), resource.TestCheckResourceAttrPair(dataSourceName, "external_ids.#", resourceName, "external_ids.#"), diff --git a/internal/service/identitystore/user_test.go b/internal/service/identitystore/user_test.go index 91db0e815dc..82e90e5cb9a 100644 --- a/internal/service/identitystore/user_test.go +++ b/internal/service/identitystore/user_test.go @@ -42,7 +42,7 @@ func TestAccIdentityStoreUser_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &user), resource.TestCheckResourceAttr(resourceName, "addresses.#", "0"), - resource.TestCheckResourceAttr(resourceName, "display_name", "Acceptance Test"), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, "Acceptance Test"), resource.TestCheckResourceAttr(resourceName, "emails.#", "0"), resource.TestCheckResourceAttr(resourceName, "external_ids.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "identity_store_id"), From 76fcfe714e48a6c0819feea4421754702510a5b7 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:47 -0400 Subject: [PATCH 1361/1490] imagebuilder: Use constants for strings --- internal/service/imagebuilder/image_pipeline.go | 6 +++--- internal/service/imagebuilder/image_pipeline_data_source.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/imagebuilder/image_pipeline.go b/internal/service/imagebuilder/image_pipeline.go index 58bb8c9e569..c579dddfd32 100644 --- a/internal/service/imagebuilder/image_pipeline.go +++ b/internal/service/imagebuilder/image_pipeline.go @@ -169,7 +169,7 @@ func ResourceImagePipeline() *schema.Resource { Default: imagebuilder.PipelineExecutionStartConditionExpressionMatchAndDependencyUpdatesAvailable, ValidateFunc: validation.StringInSlice(imagebuilder.PipelineExecutionStartCondition_Values(), false), }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 1024), @@ -477,7 +477,7 @@ func expandPipelineSchedule(tfMap map[string]interface{}) *imagebuilder.Schedule apiObject.PipelineExecutionStartCondition = aws.String(v) } - if v, ok := tfMap["schedule_expression"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrScheduleExpression].(string); ok && v != "" { apiObject.ScheduleExpression = aws.String(v) } @@ -554,7 +554,7 @@ func flattenSchedule(apiObject *imagebuilder.Schedule) map[string]interface{} { } if v := apiObject.ScheduleExpression; v != nil { - tfMap["schedule_expression"] = aws.StringValue(v) + tfMap[names.AttrScheduleExpression] = aws.StringValue(v) } if v := apiObject.Timezone; v != nil { diff --git a/internal/service/imagebuilder/image_pipeline_data_source.go b/internal/service/imagebuilder/image_pipeline_data_source.go index 7c6c868de17..25305d6364d 100644 --- a/internal/service/imagebuilder/image_pipeline_data_source.go +++ b/internal/service/imagebuilder/image_pipeline_data_source.go @@ -132,7 +132,7 @@ func DataSourceImagePipeline() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Computed: true, }, From 342c36b6434976c27ae041cb7be26e5cf1fe3365 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:47 -0400 Subject: [PATCH 1362/1490] iot: Use constants for strings --- internal/service/iot/billing_group.go | 4 ++-- internal/service/iot/thing_group.go | 4 ++-- internal/service/iot/topic_rule.go | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/iot/billing_group.go b/internal/service/iot/billing_group.go index 81536b5f181..69c7b507311 100644 --- a/internal/service/iot/billing_group.go +++ b/internal/service/iot/billing_group.go @@ -46,7 +46,7 @@ func ResourceBillingGroup() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -240,7 +240,7 @@ func flattenBillingGroupMetadata(apiObject *iot.BillingGroupMetadata) map[string tfMap := map[string]interface{}{} if v := apiObject.CreationDate; v != nil { - tfMap["creation_date"] = aws.TimeValue(v).Format(time.RFC3339) + tfMap[names.AttrCreationDate] = aws.TimeValue(v).Format(time.RFC3339) } return tfMap diff --git a/internal/service/iot/thing_group.go b/internal/service/iot/thing_group.go index 88609cecbbb..65262e20a56 100644 --- a/internal/service/iot/thing_group.go +++ b/internal/service/iot/thing_group.go @@ -46,7 +46,7 @@ func ResourceThingGroup() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -306,7 +306,7 @@ func flattenThingGroupMetadata(apiObject *iot.ThingGroupMetadata) map[string]int tfMap := map[string]interface{}{} if v := apiObject.CreationDate; v != nil { - tfMap["creation_date"] = aws.TimeValue(v).Format(time.RFC3339) + tfMap[names.AttrCreationDate] = aws.TimeValue(v).Format(time.RFC3339) } if v := apiObject.ParentGroupName; v != nil { diff --git a/internal/service/iot/topic_rule.go b/internal/service/iot/topic_rule.go index 40d845d984e..b36d815d48f 100644 --- a/internal/service/iot/topic_rule.go +++ b/internal/service/iot/topic_rule.go @@ -568,7 +568,7 @@ func ResourceTopicRule() *schema.Resource { Required: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -940,7 +940,7 @@ func ResourceTopicRule() *schema.Resource { Required: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -1720,7 +1720,7 @@ func expandKafkaAction(tfList []interface{}) *iot.KafkaAction { apiObject.ClientProperties = flex.ExpandStringMap(v) } - if v, ok := tfMap["destination_arn"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDestinationARN].(string); ok && v != "" { apiObject.DestinationArn = aws.String(v) } @@ -2905,7 +2905,7 @@ func flattenKafkaAction(apiObject *iot.KafkaAction) []interface{} { } if v := apiObject.DestinationArn; v != nil { - tfMap["destination_arn"] = aws.StringValue(v) + tfMap[names.AttrDestinationARN] = aws.StringValue(v) } if v := apiObject.Headers; v != nil { From c6a54bfb2488a3db4588961776c6a5877946d29f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:47 -0400 Subject: [PATCH 1363/1490] kinesisvideo: Use constants for strings --- internal/service/kinesisvideo/stream.go | 4 ++-- internal/service/kinesisvideo/stream_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/kinesisvideo/stream.go b/internal/service/kinesisvideo/stream.go index 0524aa53de8..ea69855e21a 100644 --- a/internal/service/kinesisvideo/stream.go +++ b/internal/service/kinesisvideo/stream.go @@ -83,7 +83,7 @@ func ResourceStream() *schema.Resource { Optional: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -169,7 +169,7 @@ func resourceStreamRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrKMSKeyID, resp.StreamInfo.KmsKeyId) d.Set("media_type", resp.StreamInfo.MediaType) d.Set(names.AttrARN, resp.StreamInfo.StreamARN) - if err := d.Set("creation_time", resp.StreamInfo.CreationTime.Format(time.RFC3339)); err != nil { + if err := d.Set(names.AttrCreationTime, resp.StreamInfo.CreationTime.Format(time.RFC3339)); err != nil { return sdkdiag.AppendErrorf(diags, "setting creation_time: %s", err) } d.Set(names.AttrVersion, resp.StreamInfo.Version) diff --git a/internal/service/kinesisvideo/stream_test.go b/internal/service/kinesisvideo/stream_test.go index e387405c1af..831074c81fa 100644 --- a/internal/service/kinesisvideo/stream_test.go +++ b/internal/service/kinesisvideo/stream_test.go @@ -42,7 +42,7 @@ func TestAccKinesisVideoStream_basic(t *testing.T) { testAccCheckStreamExists(ctx, resourceName, &stream), resource.TestCheckResourceAttr(resourceName, names.AttrName, fmt.Sprintf("terraform-kinesis-video-stream-test-%d", rInt1)), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "kinesisvideo", regexache.MustCompile(fmt.Sprintf("stream/terraform-kinesis-video-stream-test-%d/.+", rInt1))), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(resourceName, names.AttrVersion), ), }, From ac800a38cde4a48563521e238ebed3a385340474 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:47 -0400 Subject: [PATCH 1364/1490] kms: Use constants for strings --- .../service/kms/custom_key_store_data_source.go | 4 ++-- internal/service/kms/key_data_source.go | 4 ++-- internal/service/kms/key_data_source_test.go | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/kms/custom_key_store_data_source.go b/internal/service/kms/custom_key_store_data_source.go index 98da552da83..da20f053723 100644 --- a/internal/service/kms/custom_key_store_data_source.go +++ b/internal/service/kms/custom_key_store_data_source.go @@ -31,7 +31,7 @@ func dataSourceCustomKeyStore() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -79,7 +79,7 @@ func dataSourceCustomKeyStoreRead(ctx context.Context, d *schema.ResourceData, m d.SetId(aws.ToString(keyStore.CustomKeyStoreId)) d.Set("cloud_hsm_cluster_id", keyStore.CloudHsmClusterId) d.Set("connection_state", keyStore.ConnectionState) - d.Set("creation_date", keyStore.CreationDate.Format(time.RFC3339)) + d.Set(names.AttrCreationDate, keyStore.CreationDate.Format(time.RFC3339)) d.Set("custom_key_store_id", keyStore.CustomKeyStoreId) d.Set("custom_key_store_name", keyStore.CustomKeyStoreName) d.Set("trust_anchor_certificate", keyStore.TrustAnchorCertificate) diff --git a/internal/service/kms/key_data_source.go b/internal/service/kms/key_data_source.go index c840a3c5a7e..7bbadeb6199 100644 --- a/internal/service/kms/key_data_source.go +++ b/internal/service/kms/key_data_source.go @@ -35,7 +35,7 @@ func dataSourceKey() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -188,7 +188,7 @@ func dataSourceKeyRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set(names.AttrARN, output.Arn) d.Set("aws_account_id", output.AWSAccountId) d.Set("cloud_hsm_cluster_id", output.CloudHsmClusterId) - d.Set("creation_date", aws.ToTime(output.CreationDate).Format(time.RFC3339)) + d.Set(names.AttrCreationDate, aws.ToTime(output.CreationDate).Format(time.RFC3339)) d.Set("customer_master_key_spec", output.CustomerMasterKeySpec) d.Set("custom_key_store_id", output.CustomKeyStoreId) if output.DeletionDate != nil { diff --git a/internal/service/kms/key_data_source_test.go b/internal/service/kms/key_data_source_test.go index 6fbcb31b132..a5cce26293f 100644 --- a/internal/service/kms/key_data_source_test.go +++ b/internal/service/kms/key_data_source_test.go @@ -29,7 +29,7 @@ func TestAccKMSKeyDataSource_byKeyARN(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_date"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), @@ -64,7 +64,7 @@ func TestAccKMSKeyDataSource_byKeyID(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_date"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), @@ -99,7 +99,7 @@ func TestAccKMSKeyDataSource_byAliasARN(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_date"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), @@ -135,7 +135,7 @@ func TestAccKMSKeyDataSource_byAliasID(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), resource.TestCheckResourceAttr(dataSourceName, "cloud_hsm_cluster_id", ""), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_date"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckResourceAttr(dataSourceName, "custom_key_store_id", ""), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), @@ -174,7 +174,7 @@ func TestAccKMSKeyDataSource_grantToken(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_date"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), @@ -209,7 +209,7 @@ func TestAccKMSKeyDataSource_multiRegionConfigurationByARN(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_date"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), @@ -249,7 +249,7 @@ func TestAccKMSKeyDataSource_multiRegionConfigurationByID(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), acctest.CheckResourceAttrAccountID(dataSourceName, "aws_account_id"), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_date"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(dataSourceName, "customer_master_key_spec", resourceName, "customer_master_key_spec"), resource.TestCheckNoResourceAttr(dataSourceName, "deletion_date"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDescription, resourceName, names.AttrDescription), From 2ace824932aa58695d4ed1a13b8469a066a7453f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:47 -0400 Subject: [PATCH 1365/1490] lakeformation: Use constants for strings --- internal/service/lakeformation/permissions.go | 6 +++--- internal/service/lakeformation/permissions_data_source.go | 2 +- internal/service/lakeformation/permissions_test.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/lakeformation/permissions.go b/internal/service/lakeformation/permissions.go index aecb6e0566b..56239f8348b 100644 --- a/internal/service/lakeformation/permissions.go +++ b/internal/service/lakeformation/permissions.go @@ -243,7 +243,7 @@ func ResourcePermissions() *schema.Resource { }, }, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -988,7 +988,7 @@ func ExpandLFTagPolicyResource(tfMap map[string]interface{}) *awstypes.LFTagPoli apiObject.Expression = ExpandLFTagExpression(v.List()) } - if v, ok := tfMap["resource_type"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrResourceType].(string); ok && v != "" { apiObject.ResourceType = awstypes.ResourceType(v) } @@ -1027,7 +1027,7 @@ func flattenLFTagPolicyResource(apiObject *awstypes.LFTagPolicyResource) map[str } if v := apiObject.ResourceType; v != "" { - tfMap["resource_type"] = string(v) + tfMap[names.AttrResourceType] = string(v) } return tfMap diff --git a/internal/service/lakeformation/permissions_data_source.go b/internal/service/lakeformation/permissions_data_source.go index e4b7c1d5be8..c49be58eaa0 100644 --- a/internal/service/lakeformation/permissions_data_source.go +++ b/internal/service/lakeformation/permissions_data_source.go @@ -171,7 +171,7 @@ func DataSourcePermissions() *schema.Resource { }, }, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[awstypes.ResourceType](), diff --git a/internal/service/lakeformation/permissions_test.go b/internal/service/lakeformation/permissions_test.go index 86b1781ada1..78dd45512fa 100644 --- a/internal/service/lakeformation/permissions_test.go +++ b/internal/service/lakeformation/permissions_test.go @@ -945,7 +945,7 @@ func permissionCountForResource(ctx context.Context, conn *lakeformation.Client, } if v := rs.Primary.Attributes["lf_tag_policy.0.resource_type"]; v != "" { - tfMap["resource_type"] = v + tfMap[names.AttrResourceType] = v } if expressionCount, err := strconv.Atoi(rs.Primary.Attributes["lf_tag_policy.0.expression.#"]); err == nil { From 2db7e6496d4bac2e02d8e8a4fe90b2847b4325b1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:48 -0400 Subject: [PATCH 1366/1490] lambda: Use constants for strings --- internal/service/lambda/event_source_mapping.go | 6 +++--- internal/service/lambda/function_url_data_source.go | 4 ++-- internal/service/lambda/function_url_data_source_test.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/lambda/event_source_mapping.go b/internal/service/lambda/event_source_mapping.go index 2a90179a06b..c32d3f32e34 100644 --- a/internal/service/lambda/event_source_mapping.go +++ b/internal/service/lambda/event_source_mapping.go @@ -113,7 +113,7 @@ func resourceEventSourceMapping() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -916,7 +916,7 @@ func expandOnFailure(tfMap map[string]interface{}) *awstypes.OnFailure { apiObject := &awstypes.OnFailure{} - if v, ok := tfMap["destination_arn"].(string); ok { + if v, ok := tfMap[names.AttrDestinationARN].(string); ok { apiObject.Destination = aws.String(v) } @@ -965,7 +965,7 @@ func flattenOnFailure(apiObject *awstypes.OnFailure) map[string]interface{} { tfMap := map[string]interface{}{} if v := apiObject.Destination; v != nil { - tfMap["destination_arn"] = aws.ToString(v) + tfMap[names.AttrDestinationARN] = aws.ToString(v) } return tfMap diff --git a/internal/service/lambda/function_url_data_source.go b/internal/service/lambda/function_url_data_source.go index 3bf1500d980..964dd31c2d9 100644 --- a/internal/service/lambda/function_url_data_source.go +++ b/internal/service/lambda/function_url_data_source.go @@ -61,7 +61,7 @@ func dataSourceFunctionURL() *schema.Resource { }, }, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -120,7 +120,7 @@ func dataSourceFunctionURLRead(ctx context.Context, d *schema.ResourceData, meta } else { d.Set("cors", nil) } - d.Set("creation_time", output.CreationTime) + d.Set(names.AttrCreationTime, output.CreationTime) d.Set("function_arn", output.FunctionArn) d.Set("function_name", name) d.Set("function_url", functionURL) diff --git a/internal/service/lambda/function_url_data_source_test.go b/internal/service/lambda/function_url_data_source_test.go index 2adc641b1bb..c9235c9fb61 100644 --- a/internal/service/lambda/function_url_data_source_test.go +++ b/internal/service/lambda/function_url_data_source_test.go @@ -35,7 +35,7 @@ func TestAccLambdaFunctionURLDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "cors.0.allow_origins.#", resourceName, "cors.0.allow_origins.#"), resource.TestCheckResourceAttrPair(dataSourceName, "cors.0.expose_headers.#", resourceName, "cors.0.expose_headers.#"), resource.TestCheckResourceAttrPair(dataSourceName, "cors.0.max_age", resourceName, "cors.0.max_age"), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_time"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(dataSourceName, "function_arn", resourceName, "function_arn"), resource.TestCheckResourceAttrPair(dataSourceName, "function_name", resourceName, "function_name"), resource.TestCheckResourceAttrPair(dataSourceName, "function_url", resourceName, "function_url"), From 2d28270df3d6e503404c865d80dfccfb64b19d37 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:48 -0400 Subject: [PATCH 1367/1490] lightsail: Use constants for strings --- .../service/lightsail/container_service.go | 4 +-- .../lightsail/container_service_test.go | 2 +- internal/service/lightsail/database.go | 20 +++++++------- internal/service/lightsail/database_test.go | 26 +++++++++---------- internal/service/lightsail/distribution.go | 8 +++--- .../service/lightsail/distribution_test.go | 2 +- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/internal/service/lightsail/container_service.go b/internal/service/lightsail/container_service.go index b81bd4ae071..489714b6b56 100644 --- a/internal/service/lightsail/container_service.go +++ b/internal/service/lightsail/container_service.go @@ -146,7 +146,7 @@ func ResourceContainerService() *schema.Resource { }, }, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, }, @@ -255,7 +255,7 @@ func resourceContainerServiceRead(ctx context.Context, d *schema.ResourceData, m d.Set("power_id", cs.PowerId) d.Set("principal_arn", cs.PrincipalArn) d.Set("private_domain_name", cs.PrivateDomainName) - d.Set("resource_type", cs.ResourceType) + d.Set(names.AttrResourceType, cs.ResourceType) d.Set(names.AttrState, cs.State) d.Set(names.AttrURL, cs.Url) diff --git a/internal/service/lightsail/container_service_test.go b/internal/service/lightsail/container_service_test.go index fe110ea4f38..86200d0ae2f 100644 --- a/internal/service/lightsail/container_service_test.go +++ b/internal/service/lightsail/container_service_test.go @@ -51,7 +51,7 @@ func TestAccLightsailContainerService_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "power_id"), resource.TestCheckResourceAttrSet(resourceName, "principal_arn"), resource.TestCheckResourceAttrSet(resourceName, "private_domain_name"), - resource.TestCheckResourceAttr(resourceName, "resource_type", "ContainerService"), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, "ContainerService"), resource.TestCheckResourceAttr(resourceName, names.AttrState, "READY"), resource.TestCheckResourceAttrSet(resourceName, names.AttrURL), ), diff --git a/internal/service/lightsail/database.go b/internal/service/lightsail/database.go index 5989b4358de..deb530f93c7 100644 --- a/internal/service/lightsail/database.go +++ b/internal/service/lightsail/database.go @@ -40,7 +40,7 @@ func ResourceDatabase() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -151,7 +151,7 @@ func ResourceDatabase() *schema.Resource { Computed: true, ValidateFunc: verify.ValidOnceAWeekWindowFormat, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Optional: true, Default: false, @@ -220,7 +220,7 @@ func resourceDatabaseCreate(ctx context.Context, d *schema.ResourceData, meta in input.PreferredMaintenanceWindow = aws.String(v.(string)) } - if v, ok := d.GetOk("publicly_accessible"); ok { + if v, ok := d.GetOk(names.AttrPubliclyAccessible); ok { input.PubliclyAccessible = aws.Bool(v.(bool)) } @@ -310,7 +310,7 @@ func resourceDatabaseRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("master_username", rd.MasterUsername) d.Set("preferred_backup_window", rd.PreferredBackupWindow) d.Set(names.AttrPreferredMaintenanceWindow, rd.PreferredMaintenanceWindow) - d.Set("publicly_accessible", rd.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, rd.PubliclyAccessible) d.Set("ram_size", rd.Hardware.RamSizeInGb) d.Set("relational_database_name", rd.Name) d.Set("secondary_availability_zone", rd.SecondaryAvailabilityZone) @@ -326,9 +326,9 @@ func resourceDatabaseUpdate(ctx context.Context, d *schema.ResourceData, meta in conn := meta.(*conns.AWSClient).LightsailClient(ctx) - if d.HasChangesExcept("apply_immediately", "final_snapshot_name", "skip_final_snapshot", names.AttrTags, names.AttrTagsAll) { + if d.HasChangesExcept(names.AttrApplyImmediately, "final_snapshot_name", "skip_final_snapshot", names.AttrTags, names.AttrTagsAll) { input := &lightsail.UpdateRelationalDatabaseInput{ - ApplyImmediately: aws.Bool(d.Get("apply_immediately").(bool)), + ApplyImmediately: aws.Bool(d.Get(names.AttrApplyImmediately).(bool)), RelationalDatabaseName: aws.String(d.Id()), } @@ -356,8 +356,8 @@ func resourceDatabaseUpdate(ctx context.Context, d *schema.ResourceData, meta in input.PreferredMaintenanceWindow = aws.String(d.Get(names.AttrPreferredMaintenanceWindow).(string)) } - if d.HasChange("publicly_accessible") { - input.PubliclyAccessible = aws.Bool(d.Get("publicly_accessible").(bool)) + if d.HasChange(names.AttrPubliclyAccessible) { + input.PubliclyAccessible = aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)) } output, err := conn.UpdateRelationalDatabase(ctx, input) @@ -378,8 +378,8 @@ func resourceDatabaseUpdate(ctx context.Context, d *schema.ResourceData, meta in } } - if d.HasChange("publicly_accessible") { - if err := waitDatabasePubliclyAccessibleModified(ctx, conn, aws.String(d.Id()), d.Get("publicly_accessible").(bool)); err != nil { + if d.HasChange(names.AttrPubliclyAccessible) { + if err := waitDatabasePubliclyAccessibleModified(ctx, conn, aws.String(d.Id()), d.Get(names.AttrPubliclyAccessible).(bool)); err != nil { return sdkdiag.AppendErrorf(diags, "waiting for Lightsail Relational Database (%s) publicly accessible update: %s", d.Id(), err) } } diff --git a/internal/service/lightsail/database_test.go b/internal/service/lightsail/database_test.go index 98fc9bbfa51..507de43e6f0 100644 --- a/internal/service/lightsail/database_test.go +++ b/internal/service/lightsail/database_test.go @@ -67,7 +67,7 @@ func TestAccLightsailDatabase_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", @@ -129,7 +129,7 @@ func TestAccLightsailDatabase_relationalDatabaseName(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", @@ -188,7 +188,7 @@ func TestAccLightsailDatabase_masterDatabaseName(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", @@ -259,7 +259,7 @@ func TestAccLightsailDatabase_masterUsername(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", @@ -362,7 +362,7 @@ func TestAccLightsailDatabase_preferredBackupWindow(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", @@ -421,7 +421,7 @@ func TestAccLightsailDatabase_preferredMaintenanceWindow(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", @@ -457,7 +457,7 @@ func TestAccLightsailDatabase_publiclyAccessible(t *testing.T) { Config: testAccDatabaseConfig_publiclyAccessible(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckDatabaseExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "true"), ), }, { @@ -465,7 +465,7 @@ func TestAccLightsailDatabase_publiclyAccessible(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", @@ -475,7 +475,7 @@ func TestAccLightsailDatabase_publiclyAccessible(t *testing.T) { Config: testAccDatabaseConfig_publiclyAccessible(rName, false), Check: resource.ComposeTestCheckFunc( testAccCheckDatabaseExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), ), }, }, @@ -509,7 +509,7 @@ func TestAccLightsailDatabase_backupRetentionEnabled(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", @@ -573,7 +573,7 @@ func TestAccLightsailDatabase_finalSnapshotName(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", @@ -611,7 +611,7 @@ func TestAccLightsailDatabase_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", @@ -667,7 +667,7 @@ func TestAccLightsailDatabase_ha(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "master_password", "skip_final_snapshot", "final_snapshot_name", diff --git a/internal/service/lightsail/distribution.go b/internal/service/lightsail/distribution.go index 38a0f3e30a6..2a52e7a43fb 100644 --- a/internal/service/lightsail/distribution.go +++ b/internal/service/lightsail/distribution.go @@ -286,7 +286,7 @@ func ResourceDistribution() *schema.Resource { ValidateFunc: verify.ValidRegionName, Description: "The AWS Region name of the origin resource.", }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, Description: "The resource type of the origin resource (e.g., Instance).", @@ -299,7 +299,7 @@ func ResourceDistribution() *schema.Resource { Computed: true, Description: "The public DNS of the origin.", }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, Description: "The Lightsail resource type (e.g., Distribution).", @@ -445,7 +445,7 @@ func resourceDistributionRead(ctx context.Context, d *schema.ResourceData, meta } d.Set(names.AttrName, out.Name) d.Set("origin_public_dns", out.OriginPublicDNS) - d.Set("resource_type", out.ResourceType) + d.Set(names.AttrResourceType, out.ResourceType) d.Set(names.AttrStatus, out.Status) d.Set("support_code", out.SupportCode) @@ -771,7 +771,7 @@ func flattenOrigin(apiObject *types.Origin) map[string]interface{} { } if v := apiObject.ResourceType; v != "" { - m["resource_type"] = v + m[names.AttrResourceType] = v } return m diff --git a/internal/service/lightsail/distribution_test.go b/internal/service/lightsail/distribution_test.go index 41ea0666ad8..7621c40d720 100644 --- a/internal/service/lightsail/distribution_test.go +++ b/internal/service/lightsail/distribution_test.go @@ -101,7 +101,7 @@ func testAccDistribution_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "origin.0.region_name"), resource.TestCheckResourceAttrSet(resourceName, "origin.0.resource_type"), resource.TestCheckResourceAttrSet(resourceName, "origin_public_dns"), - resource.TestCheckResourceAttrSet(resourceName, "resource_type"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceType), resource.TestCheckResourceAttrSet(resourceName, names.AttrStatus), resource.TestCheckResourceAttrSet(resourceName, "support_code"), ), From d747da471770963fa5839fead90c4332726219b8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:48 -0400 Subject: [PATCH 1368/1490] logs: Use constants for strings --- internal/service/logs/group_data_source.go | 4 ++-- internal/service/logs/group_data_source_test.go | 2 +- internal/service/logs/subscription_filter.go | 6 +++--- internal/service/logs/subscription_filter_test.go | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/logs/group_data_source.go b/internal/service/logs/group_data_source.go index 8ffd42b7a13..a77ec035c96 100644 --- a/internal/service/logs/group_data_source.go +++ b/internal/service/logs/group_data_source.go @@ -25,7 +25,7 @@ func dataSourceGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeInt, Computed: true, }, @@ -65,7 +65,7 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter d.SetId(name) d.Set(names.AttrARN, TrimLogGroupARNWildcardSuffix(aws.ToString(logGroup.Arn))) - d.Set("creation_time", logGroup.CreationTime) + d.Set(names.AttrCreationTime, logGroup.CreationTime) d.Set(names.AttrKMSKeyID, logGroup.KmsKeyId) d.Set("log_group_class", logGroup.LogGroupClass) d.Set("retention_in_days", logGroup.RetentionInDays) diff --git a/internal/service/logs/group_data_source_test.go b/internal/service/logs/group_data_source_test.go index 2e0abde70a3..3a63f607fa5 100644 --- a/internal/service/logs/group_data_source_test.go +++ b/internal/service/logs/group_data_source_test.go @@ -28,7 +28,7 @@ func TestAccLogsGroupDataSource_basic(t *testing.T) { Config: testAccGroupDataSourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_time"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrKMSKeyID, resourceName, names.AttrKMSKeyID), resource.TestCheckResourceAttrPair(dataSourceName, "log_group_class", resourceName, "log_group_class"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), diff --git a/internal/service/logs/subscription_filter.go b/internal/service/logs/subscription_filter.go index 5cfd854f208..5222e770165 100644 --- a/internal/service/logs/subscription_filter.go +++ b/internal/service/logs/subscription_filter.go @@ -41,7 +41,7 @@ func resourceSubscriptionFilter() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -87,7 +87,7 @@ func resourceSubscriptionFilterPut(ctx context.Context, d *schema.ResourceData, logGroupName := d.Get("log_group_name").(string) name := d.Get(names.AttrName).(string) input := &cloudwatchlogs.PutSubscriptionFilterInput{ - DestinationArn: aws.String(d.Get("destination_arn").(string)), + DestinationArn: aws.String(d.Get(names.AttrDestinationARN).(string)), FilterName: aws.String(name), FilterPattern: aws.String(d.Get("filter_pattern").(string)), LogGroupName: aws.String(logGroupName), @@ -147,7 +147,7 @@ func resourceSubscriptionFilterRead(ctx context.Context, d *schema.ResourceData, return sdkdiag.AppendErrorf(diags, "reading CloudWatch Logs Subscription Filter (%s): %s", d.Id(), err) } - d.Set("destination_arn", subscriptionFilter.DestinationArn) + d.Set(names.AttrDestinationARN, subscriptionFilter.DestinationArn) d.Set("distribution", subscriptionFilter.Distribution) d.Set("filter_pattern", subscriptionFilter.FilterPattern) d.Set("log_group_name", subscriptionFilter.LogGroupName) diff --git a/internal/service/logs/subscription_filter_test.go b/internal/service/logs/subscription_filter_test.go index d8d79fe419e..4babd638ec8 100644 --- a/internal/service/logs/subscription_filter_test.go +++ b/internal/service/logs/subscription_filter_test.go @@ -37,7 +37,7 @@ func TestAccLogsSubscriptionFilter_basic(t *testing.T) { Config: testAccSubscriptionFilterConfig_destinationARNLambda(rName), Check: resource.ComposeTestCheckFunc( testAccCheckSubscriptionFilterExists(ctx, resourceName, &filter), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", lambdaFunctionResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, lambdaFunctionResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "distribution", "ByLogStream"), resource.TestCheckResourceAttr(resourceName, "filter_pattern", "logtype test"), resource.TestCheckResourceAttrPair(resourceName, "log_group_name", logGroupResourceName, names.AttrName), @@ -139,7 +139,7 @@ func TestAccLogsSubscriptionFilter_DestinationARN_kinesisDataFirehose(t *testing Config: testAccSubscriptionFilterConfig_destinationARNKinesisDataFirehose(rName), Check: resource.ComposeTestCheckFunc( testAccCheckSubscriptionFilterExists(ctx, resourceName, &filter), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", firehoseResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, firehoseResourceName, names.AttrARN), ), }, { @@ -169,7 +169,7 @@ func TestAccLogsSubscriptionFilter_DestinationARN_kinesisStream(t *testing.T) { Config: testAccSubscriptionFilterConfig_destinationARNKinesisStream(rName), Check: resource.ComposeTestCheckFunc( testAccCheckSubscriptionFilterExists(ctx, resourceName, &filter), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", kinesisStream, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, kinesisStream, names.AttrARN), ), }, { From 07c82d4a19089592eabf39e8deb4421f8cfbe08c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:48 -0400 Subject: [PATCH 1369/1490] m2: Use constants for strings --- internal/service/m2/environment.go | 2 +- internal/service/m2/environment_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/m2/environment.go b/internal/service/m2/environment.go index 77f08462c51..79b640cc6f5 100644 --- a/internal/service/m2/environment.go +++ b/internal/service/m2/environment.go @@ -138,7 +138,7 @@ func (r *environmentResource) Schema(ctx context.Context, request resource.Schem stringplanmodifier.UseStateForUnknown(), }, }, - "publicly_accessible": schema.BoolAttribute{ + names.AttrPubliclyAccessible: schema.BoolAttribute{ Optional: true, Computed: true, PlanModifiers: []planmodifier.Bool{ diff --git a/internal/service/m2/environment_test.go b/internal/service/m2/environment_test.go index 17c7f0b737f..84e1ca43fb9 100644 --- a/internal/service/m2/environment_test.go +++ b/internal/service/m2/environment_test.go @@ -56,7 +56,7 @@ func TestAccM2Environment_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "load_balancer_arn"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrSet(resourceName, names.AttrPreferredMaintenanceWindow), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), acctest.CheckResourceAttrGreaterThanValue(resourceName, "security_group_ids.#", 0), resource.TestCheckResourceAttr(resourceName, "storage_configuration.#", "0"), acctest.CheckResourceAttrGreaterThanValue(resourceName, "subnet_ids.#", 0), @@ -185,7 +185,7 @@ func TestAccM2Environment_full(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "load_balancer_arn"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttrSet(resourceName, names.AttrPreferredMaintenanceWindow), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttr(resourceName, "security_group_ids.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_configuration.#", "0"), resource.TestCheckResourceAttr(resourceName, "subnet_ids.#", "2"), From 3e5b131a5c6aa653de59a8537110181fd54d314b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:48 -0400 Subject: [PATCH 1370/1490] mq: Use constants for strings --- internal/service/mq/broker.go | 10 ++--- internal/service/mq/broker_data_source.go | 4 +- .../service/mq/broker_data_source_test.go | 2 +- internal/service/mq/broker_test.go | 40 +++++++++---------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/internal/service/mq/broker.go b/internal/service/mq/broker.go index ca000d9854d..764a17a7cbf 100644 --- a/internal/service/mq/broker.go +++ b/internal/service/mq/broker.go @@ -58,7 +58,7 @@ func resourceBroker() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Default: false, @@ -295,7 +295,7 @@ func resourceBroker() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Optional: true, ForceNew: true, @@ -404,7 +404,7 @@ func resourceBrokerCreate(ctx context.Context, d *schema.ResourceData, meta inte EngineType: types.EngineType(engineType), EngineVersion: aws.String(d.Get(names.AttrEngineVersion).(string)), HostInstanceType: aws.String(d.Get("host_instance_type").(string)), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), Tags: getTagsIn(ctx), Users: expandUsers(d.Get("user").(*schema.Set).List()), } @@ -490,7 +490,7 @@ func resourceBrokerRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("host_instance_type", output.HostInstanceType) d.Set("instances", flattenBrokerInstances(output.BrokerInstances)) d.Set("pending_data_replication_mode", output.PendingDataReplicationMode) - d.Set("publicly_accessible", output.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, output.PubliclyAccessible) d.Set(names.AttrSecurityGroups, output.SecurityGroups) d.Set("storage_type", output.StorageType) d.Set(names.AttrSubnetIDs, output.SubnetIds) @@ -649,7 +649,7 @@ func resourceBrokerUpdate(ctx context.Context, d *schema.ResourceData, meta inte requiresReboot = true } - if d.Get("apply_immediately").(bool) && requiresReboot { + if d.Get(names.AttrApplyImmediately).(bool) && requiresReboot { _, err := conn.RebootBroker(ctx, &mq.RebootBrokerInput{ BrokerId: aws.String(d.Id()), }) diff --git a/internal/service/mq/broker_data_source.go b/internal/service/mq/broker_data_source.go index 6ed39208f7b..d2a85990d0e 100644 --- a/internal/service/mq/broker_data_source.go +++ b/internal/service/mq/broker_data_source.go @@ -208,7 +208,7 @@ func dataSourceBroker() *schema.Resource { }, }, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Computed: true, }, @@ -297,7 +297,7 @@ func dataSourceBrokerRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrEngineVersion, output.EngineVersion) d.Set("host_instance_type", output.HostInstanceType) d.Set("instances", flattenBrokerInstances(output.BrokerInstances)) - d.Set("publicly_accessible", output.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, output.PubliclyAccessible) d.Set(names.AttrSecurityGroups, output.SecurityGroups) d.Set("storage_type", output.StorageType) d.Set(names.AttrSubnetIDs, output.SubnetIds) diff --git a/internal/service/mq/broker_data_source_test.go b/internal/service/mq/broker_data_source_test.go index 8ede848d34f..40149313497 100644 --- a/internal/service/mq/broker_data_source_test.go +++ b/internal/service/mq/broker_data_source_test.go @@ -47,7 +47,7 @@ func TestAccMQBrokerDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceByIdName, "instances.#", resourceName, "instances.#"), resource.TestCheckResourceAttrPair(dataSourceByIdName, "logs.#", resourceName, "logs.#"), resource.TestCheckResourceAttrPair(dataSourceByIdName, "maintenance_window_start_time.#", resourceName, "maintenance_window_start_time.#"), - resource.TestCheckResourceAttrPair(dataSourceByIdName, "publicly_accessible", resourceName, "publicly_accessible"), + resource.TestCheckResourceAttrPair(dataSourceByIdName, names.AttrPubliclyAccessible, resourceName, names.AttrPubliclyAccessible), resource.TestCheckResourceAttrPair(dataSourceByIdName, "security_groups.#", resourceName, "security_groups.#"), resource.TestCheckResourceAttrPair(dataSourceByIdName, "storage_type", resourceName, "storage_type"), resource.TestCheckResourceAttrPair(dataSourceByIdName, "subnet_ids.#", resourceName, "subnet_ids.#"), diff --git a/internal/service/mq/broker_test.go b/internal/service/mq/broker_test.go index 4e3705ecb02..3611a2b0eb9 100644 --- a/internal/service/mq/broker_test.go +++ b/internal/service/mq/broker_test.go @@ -301,7 +301,7 @@ func TestAccMQBroker_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "logs.0.general", "true"), resource.TestCheckResourceAttr(resourceName, "logs.0.audit", "false"), resource.TestCheckResourceAttr(resourceName, "maintenance_window_start_time.0.time_zone", "UTC"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttr(resourceName, "security_groups.#", "1"), resource.TestCheckResourceAttr(resourceName, "storage_type", "efs"), resource.TestCheckResourceAttr(resourceName, "subnet_ids.#", "1"), @@ -319,7 +319,7 @@ func TestAccMQBroker_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -389,7 +389,7 @@ func TestAccMQBroker_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, { Config: testAccBrokerConfig_tags2(rName, testAccBrokerVersionNewer, "key1", "value1updated", "key2", "value2"), @@ -455,7 +455,7 @@ func TestAccMQBroker_throughputOptimized(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "logs.0.general", "true"), resource.TestCheckResourceAttr(resourceName, "logs.0.audit", "false"), resource.TestCheckResourceAttr(resourceName, "maintenance_window_start_time.0.time_zone", "UTC"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttr(resourceName, "security_groups.#", "1"), resource.TestCheckResourceAttr(resourceName, "subnet_ids.#", "1"), resource.TestCheckResourceAttr(resourceName, "user.#", "1"), @@ -537,7 +537,7 @@ func TestAccMQBroker_AllFields_defaultVPC(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "logs.#", "1"), resource.TestCheckResourceAttr(resourceName, "logs.0.general", "false"), resource.TestCheckResourceAttr(resourceName, "logs.0.audit", "false"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttr(resourceName, "security_groups.#", "2"), resource.TestCheckResourceAttr(resourceName, "subnet_ids.#", "2"), resource.TestCheckResourceAttr(resourceName, "user.#", "2"), @@ -584,7 +584,7 @@ func TestAccMQBroker_AllFields_defaultVPC(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, { // Update configuration in-place @@ -666,7 +666,7 @@ func TestAccMQBroker_AllFields_customVPC(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "logs.#", "1"), resource.TestCheckResourceAttr(resourceName, "logs.0.general", "true"), resource.TestCheckResourceAttr(resourceName, "logs.0.audit", "true"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "true"), resource.TestCheckResourceAttr(resourceName, "security_groups.#", "2"), resource.TestCheckResourceAttr(resourceName, "subnet_ids.#", "2"), resource.TestCheckResourceAttr(resourceName, "user.#", "2"), @@ -713,7 +713,7 @@ func TestAccMQBroker_AllFields_customVPC(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, { // Update configuration in-place @@ -779,7 +779,7 @@ func TestAccMQBroker_EncryptionOptions_kmsKeyID(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -817,7 +817,7 @@ func TestAccMQBroker_EncryptionOptions_managedKeyDisabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -855,7 +855,7 @@ func TestAccMQBroker_EncryptionOptions_managedKeyEnabled(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -898,7 +898,7 @@ func TestAccMQBroker_Update_users(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, // Adding new user + modify existing { @@ -970,7 +970,7 @@ func TestAccMQBroker_Update_securityGroup(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, { Config: testAccBrokerConfig_updateSecurityGroups(rName, testAccBrokerVersionNewer), @@ -1028,7 +1028,7 @@ func TestAccMQBroker_Update_engineVersion(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, { Config: testAccBrokerConfig_engineVersionUpdate(rName, testAccBrokerVersionNewer), @@ -1120,7 +1120,7 @@ func TestAccMQBroker_RabbitMQ_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -1168,7 +1168,7 @@ func TestAccMQBroker_RabbitMQ_config(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -1214,7 +1214,7 @@ func TestAccMQBroker_RabbitMQ_logs(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -1298,7 +1298,7 @@ func TestAccMQBroker_RabbitMQ_cluster(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "logs.0.general", "false"), resource.TestCheckResourceAttr(resourceName, "logs.0.audit", ""), resource.TestCheckResourceAttr(resourceName, "maintenance_window_start_time.0.time_zone", "UTC"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttr(resourceName, "security_groups.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "subnet_ids.#", "data.aws_subnets.default", "ids.#"), resource.TestCheckResourceAttr(resourceName, "user.#", "1"), @@ -1320,7 +1320,7 @@ func TestAccMQBroker_RabbitMQ_cluster(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user"}, }, }, }) @@ -1413,7 +1413,7 @@ func TestAccMQBroker_dataReplicationMode(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"apply_immediately", "user", "data_replication_primary_broker_arn"}, + ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user", "data_replication_primary_broker_arn"}, }, { // Preparation for destruction would require multiple configuration changes From dc987f1f4aac82d801f66e1b5cc4ff2c08994028 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:48 -0400 Subject: [PATCH 1371/1490] mwaa: Use constants for strings --- internal/service/mwaa/environment.go | 20 ++++++++++---------- internal/service/mwaa/environment_test.go | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/mwaa/environment.go b/internal/service/mwaa/environment.go index 2c99da6a572..dfb685dab04 100644 --- a/internal/service/mwaa/environment.go +++ b/internal/service/mwaa/environment.go @@ -92,7 +92,7 @@ func ResourceEnvironment() *schema.Resource { Optional: true, Computed: true, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -197,7 +197,7 @@ func ResourceEnvironment() *schema.Resource { Required: true, ForceNew: true, }, - "network_configuration": { + names.AttrNetworkConfiguration: { Type: schema.TypeList, Required: true, MaxItems: 1, @@ -317,9 +317,9 @@ func resourceEnvironmentCreate(ctx context.Context, d *schema.ResourceData, meta name := d.Get(names.AttrName).(string) input := &mwaa.CreateEnvironmentInput{ DagS3Path: aws.String(d.Get("dag_s3_path").(string)), - ExecutionRoleArn: aws.String(d.Get("execution_role_arn").(string)), + ExecutionRoleArn: aws.String(d.Get(names.AttrExecutionRoleARN).(string)), Name: aws.String(name), - NetworkConfiguration: expandEnvironmentNetworkConfigurationCreate(d.Get("network_configuration").([]interface{})), + NetworkConfiguration: expandEnvironmentNetworkConfigurationCreate(d.Get(names.AttrNetworkConfiguration).([]interface{})), SourceBucketArn: aws.String(d.Get("source_bucket_arn").(string)), Tags: getTagsIn(ctx), } @@ -441,7 +441,7 @@ func resourceEnvironmentRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("database_vpc_endpoint_service", environment.DatabaseVpcEndpointService) d.Set("endpoint_management", environment.EndpointManagement) d.Set("environment_class", environment.EnvironmentClass) - d.Set("execution_role_arn", environment.ExecutionRoleArn) + d.Set(names.AttrExecutionRoleARN, environment.ExecutionRoleArn) d.Set("kms_key", environment.KmsKey) if err := d.Set("last_updated", flattenLastUpdate(environment.LastUpdate)); err != nil { return sdkdiag.AppendErrorf(diags, "setting last_updated: %s", err) @@ -452,7 +452,7 @@ func resourceEnvironmentRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("max_workers", environment.MaxWorkers) d.Set("min_workers", environment.MinWorkers) d.Set(names.AttrName, environment.Name) - if err := d.Set("network_configuration", flattenNetworkConfiguration(environment.NetworkConfiguration)); err != nil { + if err := d.Set(names.AttrNetworkConfiguration, flattenNetworkConfiguration(environment.NetworkConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting network_configuration: %s", err) } d.Set("plugins_s3_object_version", environment.PluginsS3ObjectVersion) @@ -506,8 +506,8 @@ func resourceEnvironmentUpdate(ctx context.Context, d *schema.ResourceData, meta input.EnvironmentClass = aws.String(d.Get("environment_class").(string)) } - if d.HasChange("execution_role_arn") { - input.ExecutionRoleArn = aws.String(d.Get("execution_role_arn").(string)) + if d.HasChange(names.AttrExecutionRoleARN) { + input.ExecutionRoleArn = aws.String(d.Get(names.AttrExecutionRoleARN).(string)) } if d.HasChange("logging_configuration") { @@ -522,8 +522,8 @@ func resourceEnvironmentUpdate(ctx context.Context, d *schema.ResourceData, meta input.MinWorkers = aws.Int32(int32(d.Get("min_workers").(int))) } - if d.HasChange("network_configuration") { - input.NetworkConfiguration = expandEnvironmentNetworkConfigurationUpdate(d.Get("network_configuration").([]interface{})) + if d.HasChange(names.AttrNetworkConfiguration) { + input.NetworkConfiguration = expandEnvironmentNetworkConfigurationUpdate(d.Get(names.AttrNetworkConfiguration).([]interface{})) } if d.HasChange("plugins_s3_object_version") { diff --git a/internal/service/mwaa/environment_test.go b/internal/service/mwaa/environment_test.go index 061fafa8d39..a60c358c9df 100644 --- a/internal/service/mwaa/environment_test.go +++ b/internal/service/mwaa/environment_test.go @@ -44,7 +44,7 @@ func TestAccMWAAEnvironment_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "webserver_vpc_endpoint_service"), resource.TestCheckResourceAttr(resourceName, "dag_s3_path", "dags/"), resource.TestCheckResourceAttr(resourceName, "environment_class", "mw1.small"), - acctest.CheckResourceAttrGlobalARN(resourceName, "execution_role_arn", "iam", "role/service-role/"+rName), + acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrExecutionRoleARN, "iam", "role/service-role/"+rName), resource.TestCheckResourceAttr(resourceName, "logging_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "logging_configuration.0.dag_processing_logs.#", "1"), resource.TestCheckResourceAttr(resourceName, "logging_configuration.0.dag_processing_logs.0.enabled", "false"), @@ -266,7 +266,7 @@ func TestAccMWAAEnvironment_full(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrCreatedAt), resource.TestCheckResourceAttr(resourceName, "dag_s3_path", "dags/"), resource.TestCheckResourceAttr(resourceName, "environment_class", "mw1.medium"), - acctest.CheckResourceAttrGlobalARN(resourceName, "execution_role_arn", "iam", "role/service-role/"+rName), + acctest.CheckResourceAttrGlobalARN(resourceName, names.AttrExecutionRoleARN, "iam", "role/service-role/"+rName), resource.TestCheckResourceAttrSet(resourceName, "kms_key"), resource.TestCheckResourceAttr(resourceName, "logging_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "logging_configuration.0.dag_processing_logs.#", "1"), From 8d950f592d706a0f3c1ea7bb51cbd5855cd1c6a0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:49 -0400 Subject: [PATCH 1372/1490] neptune: Use constants for strings --- internal/service/neptune/cluster.go | 4 ++-- internal/service/neptune/cluster_instance.go | 10 +++++----- internal/service/neptune/cluster_instance_test.go | 2 +- internal/service/neptune/cluster_test.go | 4 ++-- internal/service/neptune/sweep.go | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/neptune/cluster.go b/internal/service/neptune/cluster.go index c7641f837c6..31bde3eeeff 100644 --- a/internal/service/neptune/cluster.go +++ b/internal/service/neptune/cluster.go @@ -68,7 +68,7 @@ func ResourceCluster() *schema.Resource { Optional: true, Computed: true, }, - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -588,7 +588,7 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int allowMajorVersionUpgrade := d.Get("allow_major_version_upgrade").(bool) input := &neptune.ModifyDBClusterInput{ AllowMajorVersionUpgrade: aws.Bool(allowMajorVersionUpgrade), - ApplyImmediately: aws.Bool(d.Get("apply_immediately").(bool)), + ApplyImmediately: aws.Bool(d.Get(names.AttrApplyImmediately).(bool)), DBClusterIdentifier: aws.String(d.Id()), } diff --git a/internal/service/neptune/cluster_instance.go b/internal/service/neptune/cluster_instance.go index 7ade25f143f..097463cd9f4 100644 --- a/internal/service/neptune/cluster_instance.go +++ b/internal/service/neptune/cluster_instance.go @@ -51,7 +51,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -160,7 +160,7 @@ func ResourceClusterInstance() *schema.Resource { Optional: true, Default: 0, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Optional: true, Default: false, @@ -206,7 +206,7 @@ func resourceClusterInstanceCreate(ctx context.Context, d *schema.ResourceData, DBInstanceIdentifier: aws.String(instanceID), Engine: aws.String(d.Get("engine").(string)), PromotionTier: aws.Int64(int64(d.Get("promotion_tier").(int))), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), Tags: getTagsIn(ctx), } @@ -288,7 +288,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me d.Set("preferred_backup_window", db.PreferredBackupWindow) d.Set(names.AttrPreferredMaintenanceWindow, db.PreferredMaintenanceWindow) d.Set("promotion_tier", db.PromotionTier) - d.Set("publicly_accessible", db.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, db.PubliclyAccessible) d.Set("storage_encrypted", db.StorageEncrypted) d.Set("storage_type", db.StorageType) @@ -318,7 +318,7 @@ func resourceClusterInstanceUpdate(ctx context.Context, d *schema.ResourceData, if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll) { input := &neptune.ModifyDBInstanceInput{ - ApplyImmediately: aws.Bool(d.Get("apply_immediately").(bool)), + ApplyImmediately: aws.Bool(d.Get(names.AttrApplyImmediately).(bool)), DBInstanceIdentifier: aws.String(d.Id()), } diff --git a/internal/service/neptune/cluster_instance_test.go b/internal/service/neptune/cluster_instance_test.go index a7fe3dc282f..337a2313765 100644 --- a/internal/service/neptune/cluster_instance_test.go +++ b/internal/service/neptune/cluster_instance_test.go @@ -58,7 +58,7 @@ func TestAccNeptuneClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "preferred_backup_window"), resource.TestCheckResourceAttrSet(resourceName, names.AttrPreferredMaintenanceWindow), resource.TestCheckResourceAttr(resourceName, "promotion_tier", "3"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttr(resourceName, "storage_encrypted", "false"), resource.TestCheckResourceAttr(resourceName, "storage_type", "standard"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), diff --git a/internal/service/neptune/cluster_test.go b/internal/service/neptune/cluster_test.go index 23c520a1709..59c082df4d0 100644 --- a/internal/service/neptune/cluster_test.go +++ b/internal/service/neptune/cluster_test.go @@ -29,7 +29,7 @@ func testAccClusterImportStep(n string) resource.TestStep { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "neptune_instance_parameter_group_name", "skip_final_snapshot", @@ -55,7 +55,7 @@ func TestAccNeptuneCluster_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &dbCluster), resource.TestCheckNoResourceAttr(resourceName, "allow_major_version_upgrade"), - resource.TestCheckNoResourceAttr(resourceName, "apply_immediately"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrApplyImmediately), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "rds", regexache.MustCompile(`cluster:.+`)), acctest.CheckResourceAttrGreaterThanValue(resourceName, "availability_zones.#", 0), resource.TestCheckResourceAttr(resourceName, "backup_retention_period", "1"), diff --git a/internal/service/neptune/sweep.go b/internal/service/neptune/sweep.go index 3fdc8d33c38..67e8892d735 100644 --- a/internal/service/neptune/sweep.go +++ b/internal/service/neptune/sweep.go @@ -143,7 +143,7 @@ func sweepClusters(region string) error { r := ResourceCluster() d := r.Data(nil) d.SetId(id) - d.Set("apply_immediately", true) + d.Set(names.AttrApplyImmediately, true) d.Set(names.AttrARN, arn) d.Set("deletion_protection", false) d.Set("skip_final_snapshot", true) @@ -304,7 +304,7 @@ func sweepClusterInstances(region string) error { r := ResourceClusterInstance() d := r.Data(nil) d.SetId(id) - d.Set("apply_immediately", true) + d.Set(names.AttrApplyImmediately, true) d.Set("skip_final_snapshot", true) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) From 5d2312ab6c4ef1387e9cf499ca57ffa375e4eacf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:49 -0400 Subject: [PATCH 1373/1490] networkfirewall: Use constants for strings --- internal/service/networkfirewall/firewall.go | 10 +++++----- .../service/networkfirewall/firewall_data_source.go | 4 ++-- internal/service/networkfirewall/firewall_policy.go | 10 +++++----- internal/service/networkfirewall/rule_group.go | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/service/networkfirewall/firewall.go b/internal/service/networkfirewall/firewall.go index d6a2eafaa02..f30d83817d3 100644 --- a/internal/service/networkfirewall/firewall.go +++ b/internal/service/networkfirewall/firewall.go @@ -67,7 +67,7 @@ func ResourceFirewall() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "encryption_configuration": encryptionConfigurationSchema(), + names.AttrEncryptionConfiguration: encryptionConfigurationSchema(), "firewall_policy_arn": { Type: schema.TypeString, Required: true, @@ -177,7 +177,7 @@ func resourceFirewallCreate(ctx context.Context, d *schema.ResourceData, meta in input.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("encryption_configuration"); ok { + if v, ok := d.GetOk(names.AttrEncryptionConfiguration); ok { input.EncryptionConfiguration = expandEncryptionConfiguration(v.([]interface{})) } @@ -225,7 +225,7 @@ func resourceFirewallRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrARN, firewall.FirewallArn) d.Set("delete_protection", firewall.DeleteProtection) d.Set(names.AttrDescription, firewall.Description) - if err := d.Set("encryption_configuration", flattenEncryptionConfiguration(firewall.EncryptionConfiguration)); err != nil { + if err := d.Set(names.AttrEncryptionConfiguration, flattenEncryptionConfiguration(firewall.EncryptionConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting encryption_configuration: %s", err) } d.Set("firewall_policy_arn", firewall.FirewallPolicyArn) @@ -284,9 +284,9 @@ func resourceFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta in updateToken = aws.StringValue(output.UpdateToken) } - if d.HasChange("encryption_configuration") { + if d.HasChange(names.AttrEncryptionConfiguration) { input := &networkfirewall.UpdateFirewallEncryptionConfigurationInput{ - EncryptionConfiguration: expandEncryptionConfiguration(d.Get("encryption_configuration").([]interface{})), + EncryptionConfiguration: expandEncryptionConfiguration(d.Get(names.AttrEncryptionConfiguration).([]interface{})), FirewallArn: aws.String(d.Id()), UpdateToken: aws.String(updateToken), } diff --git a/internal/service/networkfirewall/firewall_data_source.go b/internal/service/networkfirewall/firewall_data_source.go index c2255f768bd..350b6f67668 100644 --- a/internal/service/networkfirewall/firewall_data_source.go +++ b/internal/service/networkfirewall/firewall_data_source.go @@ -41,7 +41,7 @@ func DataSourceFirewall() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "encryption_configuration": { + names.AttrEncryptionConfiguration: { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ @@ -226,7 +226,7 @@ func dataSourceFirewallResourceRead(ctx context.Context, d *schema.ResourceData, d.Set("delete_protection", firewall.DeleteProtection) d.Set(names.AttrDescription, firewall.Description) d.Set(names.AttrName, firewall.FirewallName) - d.Set("encryption_configuration", flattenDataSourceEncryptionConfiguration(firewall.EncryptionConfiguration)) + d.Set(names.AttrEncryptionConfiguration, flattenDataSourceEncryptionConfiguration(firewall.EncryptionConfiguration)) d.Set("firewall_policy_arn", firewall.FirewallPolicyArn) d.Set("firewall_policy_change_protection", firewall.FirewallPolicyChangeProtection) d.Set("firewall_status", flattenDataSourceFirewallStatus(output.FirewallStatus)) diff --git a/internal/service/networkfirewall/firewall_policy.go b/internal/service/networkfirewall/firewall_policy.go index bb92d2d2702..20add02b7ff 100644 --- a/internal/service/networkfirewall/firewall_policy.go +++ b/internal/service/networkfirewall/firewall_policy.go @@ -48,7 +48,7 @@ func ResourceFirewallPolicy() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "encryption_configuration": encryptionConfigurationSchema(), + names.AttrEncryptionConfiguration: encryptionConfigurationSchema(), "firewall_policy": { Type: schema.TypeList, Required: true, @@ -227,7 +227,7 @@ func resourceFirewallPolicyCreate(ctx context.Context, d *schema.ResourceData, m if v, ok := d.GetOk(names.AttrDescription); ok { input.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("encryption_configuration"); ok { + if v, ok := d.GetOk(names.AttrEncryptionConfiguration); ok { input.EncryptionConfiguration = expandEncryptionConfiguration(v.([]interface{})) } @@ -262,7 +262,7 @@ func resourceFirewallPolicyRead(ctx context.Context, d *schema.ResourceData, met response := output.FirewallPolicyResponse d.Set(names.AttrARN, response.FirewallPolicyArn) d.Set(names.AttrDescription, response.Description) - d.Set("encryption_configuration", flattenEncryptionConfiguration(response.EncryptionConfiguration)) + d.Set(names.AttrEncryptionConfiguration, flattenEncryptionConfiguration(response.EncryptionConfiguration)) if err := d.Set("firewall_policy", flattenFirewallPolicy(output.FirewallPolicy)); err != nil { return sdkdiag.AppendErrorf(diags, "setting firewall_policy: %s", err) } @@ -279,9 +279,9 @@ func resourceFirewallPolicyUpdate(ctx context.Context, d *schema.ResourceData, m conn := meta.(*conns.AWSClient).NetworkFirewallConn(ctx) - if d.HasChanges(names.AttrDescription, "encryption_configuration", "firewall_policy") { + if d.HasChanges(names.AttrDescription, names.AttrEncryptionConfiguration, "firewall_policy") { input := &networkfirewall.UpdateFirewallPolicyInput{ - EncryptionConfiguration: expandEncryptionConfiguration(d.Get("encryption_configuration").([]interface{})), + EncryptionConfiguration: expandEncryptionConfiguration(d.Get(names.AttrEncryptionConfiguration).([]interface{})), FirewallPolicy: expandFirewallPolicy(d.Get("firewall_policy").([]interface{})), FirewallPolicyArn: aws.String(d.Id()), UpdateToken: aws.String(d.Get("update_token").(string)), diff --git a/internal/service/networkfirewall/rule_group.go b/internal/service/networkfirewall/rule_group.go index cd5df9cedc1..12ac50b51e5 100644 --- a/internal/service/networkfirewall/rule_group.go +++ b/internal/service/networkfirewall/rule_group.go @@ -53,7 +53,7 @@ func ResourceRuleGroup() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "encryption_configuration": encryptionConfigurationSchema(), + names.AttrEncryptionConfiguration: encryptionConfigurationSchema(), names.AttrName: { Type: schema.TypeString, Required: true, @@ -476,7 +476,7 @@ func resourceRuleGroupCreate(ctx context.Context, d *schema.ResourceData, meta i input.Description = aws.String(v.(string)) } - if v, ok := d.GetOk("encryption_configuration"); ok { + if v, ok := d.GetOk(names.AttrEncryptionConfiguration); ok { input.EncryptionConfiguration = expandEncryptionConfiguration(v.([]interface{})) } @@ -524,7 +524,7 @@ func resourceRuleGroupRead(ctx context.Context, d *schema.ResourceData, meta int d.Set(names.AttrARN, response.RuleGroupArn) d.Set("capacity", response.Capacity) d.Set(names.AttrDescription, response.Description) - d.Set("encryption_configuration", flattenEncryptionConfiguration(response.EncryptionConfiguration)) + d.Set(names.AttrEncryptionConfiguration, flattenEncryptionConfiguration(response.EncryptionConfiguration)) d.Set(names.AttrName, response.RuleGroupName) if err := d.Set("rule_group", flattenRuleGroup(output.RuleGroup)); err != nil { return sdkdiag.AppendErrorf(diags, "setting rule_group: %s", err) @@ -542,9 +542,9 @@ func resourceRuleGroupUpdate(ctx context.Context, d *schema.ResourceData, meta i conn := meta.(*conns.AWSClient).NetworkFirewallConn(ctx) - if d.HasChanges(names.AttrDescription, "encryption_configuration", "rule_group", "rules", names.AttrType) { + if d.HasChanges(names.AttrDescription, names.AttrEncryptionConfiguration, "rule_group", "rules", names.AttrType) { input := &networkfirewall.UpdateRuleGroupInput{ - EncryptionConfiguration: expandEncryptionConfiguration(d.Get("encryption_configuration").([]interface{})), + EncryptionConfiguration: expandEncryptionConfiguration(d.Get(names.AttrEncryptionConfiguration).([]interface{})), RuleGroupArn: aws.String(d.Id()), Type: aws.String(d.Get(names.AttrType).(string)), UpdateToken: aws.String(d.Get("update_token").(string)), From 5de2c3d747df26256cd60bb7ef742d0a2e4ccffc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:49 -0400 Subject: [PATCH 1374/1490] pipes: Use constants for strings --- internal/service/pipes/target_parameters.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/pipes/target_parameters.go b/internal/service/pipes/target_parameters.go index 70552dc8be8..be3bc17a731 100644 --- a/internal/service/pipes/target_parameters.go +++ b/internal/service/pipes/target_parameters.go @@ -251,7 +251,7 @@ func targetParametersSchema() *schema.Schema { Optional: true, ValidateDiagFunc: enum.Validate[types.LaunchType](), }, - "network_configuration": { + names.AttrNetworkConfiguration: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -404,7 +404,7 @@ func targetParametersSchema() *schema.Schema { }, }, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, @@ -1141,7 +1141,7 @@ func expandPipeTargetECSTaskParameters(tfMap map[string]interface{}) *types.Pipe apiObject.LaunchType = types.LaunchType(v) } - if v, ok := tfMap["network_configuration"].([]interface{}); ok && len(v) > 0 && v[0] != nil { + if v, ok := tfMap[names.AttrNetworkConfiguration].([]interface{}); ok && len(v) > 0 && v[0] != nil { apiObject.NetworkConfiguration = expandNetworkConfiguration(v[0].(map[string]interface{})) } @@ -1289,7 +1289,7 @@ func expandECSTaskOverride(tfMap map[string]interface{}) *types.EcsTaskOverride apiObject.EphemeralStorage = expandECSEphemeralStorage(v[0].(map[string]interface{})) } - if v, ok := tfMap["execution_role_arn"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrExecutionRoleARN].(string); ok && v != "" { apiObject.ExecutionRoleArn = aws.String(v) } @@ -2133,7 +2133,7 @@ func flattenPipeTargetECSTaskParameters(apiObject *types.PipeTargetEcsTaskParame } if v := apiObject.NetworkConfiguration; v != nil { - tfMap["network_configuration"] = []interface{}{flattenNetworkConfiguration(v)} + tfMap[names.AttrNetworkConfiguration] = []interface{}{flattenNetworkConfiguration(v)} } if v := apiObject.Overrides; v != nil { @@ -2228,7 +2228,7 @@ func flattenECSTaskOverride(apiObject *types.EcsTaskOverride) map[string]interfa } if v := apiObject.ExecutionRoleArn; v != nil { - tfMap["execution_role_arn"] = aws.ToString(v) + tfMap[names.AttrExecutionRoleARN] = aws.ToString(v) } if v := apiObject.InferenceAcceleratorOverrides; v != nil { From 03442e3d4416f353052a244df06c0f337aceb833 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:49 -0400 Subject: [PATCH 1375/1490] rbin: Use constants for strings --- internal/service/rbin/rule.go | 10 +++++----- internal/service/rbin/rule_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/rbin/rule.go b/internal/service/rbin/rule.go index 17dcb476e31..a553f212bf4 100644 --- a/internal/service/rbin/rule.go +++ b/internal/service/rbin/rule.go @@ -81,7 +81,7 @@ func ResourceRule() *schema.Resource { }, }, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -162,7 +162,7 @@ func resourceRuleCreate(ctx context.Context, d *schema.ResourceData, meta interf conn := meta.(*conns.AWSClient).RBinClient(ctx) in := &rbin.CreateRuleInput{ - ResourceType: types.ResourceType(d.Get("resource_type").(string)), + ResourceType: types.ResourceType(d.Get(names.AttrResourceType).(string)), RetentionPeriod: expandRetentionPeriod(d.Get("retention_period").([]interface{})), Tags: getTagsIn(ctx), } @@ -177,11 +177,11 @@ func resourceRuleCreate(ctx context.Context, d *schema.ResourceData, meta interf out, err := conn.CreateRule(ctx, in) if err != nil { - return create.DiagError(names.RBin, create.ErrActionCreating, ResNameRule, d.Get("resource_type").(string), err) + return create.DiagError(names.RBin, create.ErrActionCreating, ResNameRule, d.Get(names.AttrResourceType).(string), err) } if out == nil || out.Identifier == nil { - return create.DiagError(names.RBin, create.ErrActionCreating, ResNameRule, d.Get("resource_type").(string), errors.New("empty output")) + return create.DiagError(names.RBin, create.ErrActionCreating, ResNameRule, d.Get(names.AttrResourceType).(string), errors.New("empty output")) } d.SetId(aws.ToString(out.Identifier)) @@ -218,7 +218,7 @@ func resourceRuleRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set(names.AttrARN, ruleArn) d.Set(names.AttrDescription, out.Description) - d.Set("resource_type", string(out.ResourceType)) + d.Set(names.AttrResourceType, string(out.ResourceType)) d.Set(names.AttrStatus, string(out.Status)) if err := d.Set("resource_tags", flattenResourceTags(out.ResourceTags)); err != nil { diff --git a/internal/service/rbin/rule_test.go b/internal/service/rbin/rule_test.go index bdd6bacbc7a..568ecfd23a4 100644 --- a/internal/service/rbin/rule_test.go +++ b/internal/service/rbin/rule_test.go @@ -42,7 +42,7 @@ func TestAccRBinRule_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRuleExists(ctx, resourceName, &rule), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), - resource.TestCheckResourceAttr(resourceName, "resource_type", resourceType), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, resourceType), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "retention_period.*", map[string]string{ "retention_period_value": "10", "retention_period_unit": "DAYS", @@ -63,7 +63,7 @@ func TestAccRBinRule_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRuleExists(ctx, resourceName, &rule), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, description), - resource.TestCheckResourceAttr(resourceName, "resource_type", resourceType), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, resourceType), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "retention_period.*", map[string]string{ "retention_period_value": "10", "retention_period_unit": "DAYS", From 1f9daee8f4f5b168d9735a5a2d5a8a8cc1ff676a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:49 -0400 Subject: [PATCH 1376/1490] rds: Use constants for strings --- internal/service/rds/cluster.go | 6 +- internal/service/rds/cluster_instance.go | 14 +- internal/service/rds/cluster_instance_test.go | 48 +++---- internal/service/rds/cluster_migrate.go | 2 +- internal/service/rds/cluster_snapshot_test.go | 2 +- internal/service/rds/cluster_test.go | 4 +- internal/service/rds/instance.go | 24 ++-- internal/service/rds/instance_data_source.go | 4 +- internal/service/rds/instance_migrate.go | 8 +- internal/service/rds/instance_test.go | 134 +++++++++--------- internal/service/rds/sweep.go | 4 +- 11 files changed, 125 insertions(+), 125 deletions(-) diff --git a/internal/service/rds/cluster.go b/internal/service/rds/cluster.go index 132b6ce36ba..e727d09cb6a 100644 --- a/internal/service/rds/cluster.go +++ b/internal/service/rds/cluster.go @@ -77,7 +77,7 @@ func ResourceCluster() *schema.Resource { }, // apply_immediately is used to determine when the update modifications take place. // See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -1298,7 +1298,7 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int "skip_final_snapshot", names.AttrTags, names.AttrTagsAll) { input := &rds.ModifyDBClusterInput{ - ApplyImmediately: aws.Bool(d.Get("apply_immediately").(bool)), + ApplyImmediately: aws.Bool(d.Get(names.AttrApplyImmediately).(bool)), DBClusterIdentifier: aws.String(d.Id()), } @@ -1571,7 +1571,7 @@ func resourceClusterDelete(ctx context.Context, d *schema.ResourceData, meta int }, func(err error) (bool, error) { if tfawserr.ErrMessageContains(err, "InvalidParameterCombination", "disable deletion pro") { - if v, ok := d.GetOk("deletion_protection"); (!ok || !v.(bool)) && d.Get("apply_immediately").(bool) { + if v, ok := d.GetOk("deletion_protection"); (!ok || !v.(bool)) && d.Get(names.AttrApplyImmediately).(bool) { _, err := tfresource.RetryWhen(ctx, d.Timeout(schema.TimeoutDelete), func() (interface{}, error) { return conn.ModifyDBClusterWithContext(ctx, &rds.ModifyDBClusterInput{ diff --git a/internal/service/rds/cluster_instance.go b/internal/service/rds/cluster_instance.go index 0268561f151..8ca4f358f7a 100644 --- a/internal/service/rds/cluster_instance.go +++ b/internal/service/rds/cluster_instance.go @@ -48,7 +48,7 @@ func ResourceClusterInstance() *schema.Resource { Schema: map[string]*schema.Schema{ // apply_immediately is used to determine when the update modifications take place. // See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -216,7 +216,7 @@ func ResourceClusterInstance() *schema.Resource { Optional: true, Default: 0, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -255,7 +255,7 @@ func resourceClusterInstanceCreate(ctx context.Context, d *schema.ResourceData, DBInstanceIdentifier: aws.String(identifier), Engine: aws.String(d.Get("engine").(string)), PromotionTier: aws.Int64(int64(d.Get("promotion_tier").(int))), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), Tags: getTagsIn(ctx), } @@ -422,7 +422,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me d.Set("preferred_backup_window", db.PreferredBackupWindow) d.Set(names.AttrPreferredMaintenanceWindow, db.PreferredMaintenanceWindow) d.Set("promotion_tier", db.PromotionTier) - d.Set("publicly_accessible", db.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, db.PubliclyAccessible) d.Set("storage_encrypted", db.StorageEncrypted) clusterSetResourceDataEngineVersionFromClusterInstance(d, db) @@ -437,7 +437,7 @@ func resourceClusterInstanceUpdate(ctx context.Context, d *schema.ResourceData, if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll) { input := &rds.ModifyDBInstanceInput{ - ApplyImmediately: aws.Bool(d.Get("apply_immediately").(bool)), + ApplyImmediately: aws.Bool(d.Get(names.AttrApplyImmediately).(bool)), DBInstanceIdentifier: aws.String(d.Id()), } @@ -493,8 +493,8 @@ func resourceClusterInstanceUpdate(ctx context.Context, d *schema.ResourceData, input.PromotionTier = aws.Int64(int64(d.Get("promotion_tier").(int))) } - if d.HasChange("publicly_accessible") { - input.PubliclyAccessible = aws.Bool(d.Get("publicly_accessible").(bool)) + if d.HasChange(names.AttrPubliclyAccessible) { + input.PubliclyAccessible = aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)) } log.Printf("[DEBUG] Updating RDS Cluster Instance: %s", input) diff --git a/internal/service/rds/cluster_instance_test.go b/internal/service/rds/cluster_instance_test.go index e56a3fe84d5..76ccdf97263 100644 --- a/internal/service/rds/cluster_instance_test.go +++ b/internal/service/rds/cluster_instance_test.go @@ -63,7 +63,7 @@ func TestAccRDSClusterInstance_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -134,7 +134,7 @@ func TestAccRDSClusterInstance_identifierGenerated(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -170,7 +170,7 @@ func TestAccRDSClusterInstance_identifierPrefix(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -206,7 +206,7 @@ func TestAccRDSClusterInstance_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -301,7 +301,7 @@ func TestAccRDSClusterInstance_az(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -337,7 +337,7 @@ func TestAccRDSClusterInstance_kmsKey(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -364,7 +364,7 @@ func TestAccRDSClusterInstance_publiclyAccessible(t *testing.T) { Config: testAccClusterInstanceConfig_publiclyAccessible(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "true"), ), }, { @@ -372,14 +372,14 @@ func TestAccRDSClusterInstance_publiclyAccessible(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { Config: testAccClusterInstanceConfig_publiclyAccessible(rName, false), Check: resource.ComposeTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), ), }, { @@ -387,14 +387,14 @@ func TestAccRDSClusterInstance_publiclyAccessible(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { Config: testAccClusterInstanceConfig_publiclyAccessible(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "true"), ), }, }, @@ -429,7 +429,7 @@ func TestAccRDSClusterInstance_copyTagsToSnapshot(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -472,7 +472,7 @@ func TestAccRDSClusterInstance_caCertificateIdentifier(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -507,7 +507,7 @@ func TestAccRDSClusterInstance_monitoringInterval(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -564,7 +564,7 @@ func TestAccRDSClusterInstance_MonitoringRoleARN_enabledToDisabled(t *testing.T) ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -607,7 +607,7 @@ func TestAccRDSClusterInstance_MonitoringRoleARN_enabledToRemoved(t *testing.T) ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -648,7 +648,7 @@ func TestAccRDSClusterInstance_MonitoringRoleARN_removedToEnabled(t *testing.T) ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -691,7 +691,7 @@ func TestAccRDSClusterInstance_PerformanceInsightsEnabled_auroraMySQL1(t *testin ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -727,7 +727,7 @@ func TestAccRDSClusterInstance_PerformanceInsightsEnabled_auroraPostgresql(t *te ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -765,7 +765,7 @@ func TestAccRDSClusterInstance_PerformanceInsightsKMSKeyID_auroraMySQL1(t *testi ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -801,7 +801,7 @@ func TestAccRDSClusterInstance_PerformanceInsightsKMSKeyIDAuroraMySQL1_defaultKe ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -844,7 +844,7 @@ func TestAccRDSClusterInstance_performanceInsightsRetentionPeriod(t *testing.T) ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -898,7 +898,7 @@ func TestAccRDSClusterInstance_PerformanceInsightsKMSKeyID_auroraPostgresql(t *t ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -934,7 +934,7 @@ func TestAccRDSClusterInstance_PerformanceInsightsKMSKeyIDAuroraPostgresql_defau ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, }, }, { diff --git a/internal/service/rds/cluster_migrate.go b/internal/service/rds/cluster_migrate.go index c38dc206e88..24b83bf4f28 100644 --- a/internal/service/rds/cluster_migrate.go +++ b/internal/service/rds/cluster_migrate.go @@ -26,7 +26,7 @@ func resourceClusterResourceV0() *schema.Resource { }, // apply_immediately is used to determine when the update modifications take place. // See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Computed: true, diff --git a/internal/service/rds/cluster_snapshot_test.go b/internal/service/rds/cluster_snapshot_test.go index 551e822f867..7cf723ce974 100644 --- a/internal/service/rds/cluster_snapshot_test.go +++ b/internal/service/rds/cluster_snapshot_test.go @@ -86,7 +86,7 @@ func TestAccRDSClusterSnapshot_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "cluster_identifier_prefix", "master_password", "skip_final_snapshot", diff --git a/internal/service/rds/cluster_test.go b/internal/service/rds/cluster_test.go index 6ae55ff4f28..1bc60288945 100644 --- a/internal/service/rds/cluster_test.go +++ b/internal/service/rds/cluster_test.go @@ -36,7 +36,7 @@ func testAccClusterImportStep(n string) resource.TestStep { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "cluster_members", "db_instance_parameter_group_name", "enable_global_write_forwarding", @@ -407,7 +407,7 @@ func TestAccRDSCluster_onlyMajorVersion(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "cluster_identifier_prefix", "cluster_members", "db_instance_parameter_group_name", diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go index f64a1437dfe..c23d0e72898 100644 --- a/internal/service/rds/instance.go +++ b/internal/service/rds/instance.go @@ -121,7 +121,7 @@ func ResourceInstance() *schema.Resource { // apply_immediately is used to determine when the update modifications // take place. // See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Default: false, @@ -516,7 +516,7 @@ func ResourceInstance() *schema.Resource { Optional: true, Computed: true, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Optional: true, Default: false, @@ -750,7 +750,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in DBInstanceClass: aws.String(d.Get("instance_class").(string)), DBInstanceIdentifier: aws.String(identifier), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), SourceDBInstanceIdentifier: aws.String(sourceDBInstanceID), Tags: getTagsIn(ctx), } @@ -968,7 +968,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in Engine: aws.String(d.Get("engine").(string)), EngineVersion: aws.String(d.Get(names.AttrEngineVersion).(string)), MasterUsername: aws.String(d.Get(names.AttrUsername).(string)), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), S3BucketName: aws.String(tfMap[names.AttrBucketName].(string)), S3IngestionRoleArn: aws.String(tfMap["ingestion_role"].(string)), S3Prefix: aws.String(tfMap[names.AttrBucketPrefix].(string)), @@ -1116,7 +1116,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in DBInstanceIdentifier: aws.String(identifier), DBSnapshotIdentifier: aws.String(v.(string)), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), Tags: getTagsIn(ctx), } @@ -1367,7 +1367,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in CopyTagsToSnapshot: aws.Bool(d.Get("copy_tags_to_snapshot").(bool)), DBInstanceClass: aws.String(d.Get("instance_class").(string)), DeletionProtection: aws.Bool(d.Get("deletion_protection").(bool)), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), Tags: getTagsIn(ctx), TargetDBInstanceIdentifier: aws.String(identifier), } @@ -1573,7 +1573,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in Engine: aws.String(d.Get("engine").(string)), EngineVersion: aws.String(d.Get(names.AttrEngineVersion).(string)), MasterUsername: aws.String(d.Get(names.AttrUsername).(string)), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), StorageEncrypted: aws.Bool(d.Get("storage_encrypted").(bool)), Tags: getTagsIn(ctx), } @@ -1917,7 +1917,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("performance_insights_kms_key_id", v.PerformanceInsightsKMSKeyId) d.Set("performance_insights_retention_period", v.PerformanceInsightsRetentionPeriod) d.Set(names.AttrPort, v.DbInstancePort) - d.Set("publicly_accessible", v.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, v.PubliclyAccessible) d.Set("replica_mode", v.ReplicaMode) d.Set("replicas", aws.StringValueSlice(v.ReadReplicaDBInstanceIdentifiers)) d.Set("replicate_source_db", v.ReadReplicaSourceDBInstanceIdentifier) @@ -2153,7 +2153,7 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in oldID = o.(string) } - applyImmediately := d.Get("apply_immediately").(bool) + applyImmediately := d.Get(names.AttrApplyImmediately).(bool) input := &rds_sdkv2.ModifyDBInstanceInput{ ApplyImmediately: aws.Bool(applyImmediately), DBInstanceIdentifier: aws.String(oldID), @@ -2380,9 +2380,9 @@ func dbInstancePopulateModify(input *rds_sdkv2.ModifyDBInstanceInput, d *schema. input.DBPortNumber = aws.Int32(int32(d.Get(names.AttrPort).(int))) } - if d.HasChange("publicly_accessible") { + if d.HasChange(names.AttrPubliclyAccessible) { needsModify = true - input.PubliclyAccessible = aws.Bool(d.Get("publicly_accessible").(bool)) + input.PubliclyAccessible = aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)) } if d.HasChange("replica_mode") { @@ -2479,7 +2479,7 @@ func resourceInstanceDelete(ctx context.Context, d *schema.ResourceData, meta in _, err := conn.DeleteDBInstanceWithContext(ctx, input) if tfawserr.ErrMessageContains(err, errCodeInvalidParameterCombination, "disable deletion pro") { - if v, ok := d.GetOk("deletion_protection"); (!ok || !v.(bool)) && d.Get("apply_immediately").(bool) { + if v, ok := d.GetOk("deletion_protection"); (!ok || !v.(bool)) && d.Get(names.AttrApplyImmediately).(bool) { _, ierr := tfresource.RetryWhen(ctx, d.Timeout(schema.TimeoutUpdate), func() (interface{}, error) { return conn.ModifyDBInstanceWithContext(ctx, &rds.ModifyDBInstanceInput{ diff --git a/internal/service/rds/instance_data_source.go b/internal/service/rds/instance_data_source.go index 3eebbd68d8c..7114c4ce2f2 100644 --- a/internal/service/rds/instance_data_source.go +++ b/internal/service/rds/instance_data_source.go @@ -177,7 +177,7 @@ func DataSourceInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Computed: true, }, @@ -295,7 +295,7 @@ func dataSourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("option_group_memberships", optionGroupNames) d.Set("preferred_backup_window", instance.PreferredBackupWindow) d.Set(names.AttrPreferredMaintenanceWindow, instance.PreferredMaintenanceWindow) - d.Set("publicly_accessible", instance.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, instance.PubliclyAccessible) d.Set("replicate_source_db", instance.ReadReplicaSourceDBInstanceIdentifier) d.Set("resource_id", instance.DbiResourceId) d.Set("storage_encrypted", instance.StorageEncrypted) diff --git a/internal/service/rds/instance_migrate.go b/internal/service/rds/instance_migrate.go index 4d806f7e1e4..4b112f78be8 100644 --- a/internal/service/rds/instance_migrate.go +++ b/internal/service/rds/instance_migrate.go @@ -167,7 +167,7 @@ func resourceInstanceResourceV0() *schema.Resource { Computed: true, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Optional: true, Default: false, @@ -276,7 +276,7 @@ func resourceInstanceResourceV0() *schema.Resource { Computed: true, }, - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Computed: true, @@ -441,7 +441,7 @@ func resourceInstanceResourceV1() *schema.Resource { // apply_immediately is used to determine when the update modifications // take place. // See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Default: false, @@ -771,7 +771,7 @@ func resourceInstanceResourceV1() *schema.Resource { Optional: true, Computed: true, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Optional: true, Default: false, diff --git a/internal/service/rds/instance_test.go b/internal/service/rds/instance_test.go index e986933aeef..9b79ac80ab3 100644 --- a/internal/service/rds/instance_test.go +++ b/internal/service/rds/instance_test.go @@ -85,7 +85,7 @@ func TestAccRDSInstance_basic(t *testing.T) { resource.TestMatchResourceAttr(resourceName, "option_group_name", regexache.MustCompile(`^default:mysql-\d`)), resource.TestMatchResourceAttr(resourceName, "parameter_group_name", regexache.MustCompile(`^default\.mysql\d`)), resource.TestCheckResourceAttr(resourceName, names.AttrPort, "3306"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttr(resourceName, "replicas.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "resource_id"), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, "available"), @@ -101,7 +101,7 @@ func TestAccRDSInstance_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "manage_master_user_password", @@ -141,7 +141,7 @@ func TestAccRDSInstance_identifierPrefix(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -177,7 +177,7 @@ func TestAccRDSInstance_identifierGenerated(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -242,7 +242,7 @@ func TestAccRDSInstance_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -299,7 +299,7 @@ func TestAccRDSInstance_Versions_onlyMajor(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrEngineVersion, names.AttrPassword, }, @@ -338,7 +338,7 @@ func TestAccRDSInstance_kmsKey(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "delete_automated_backups", "final_snapshot_identifier", names.AttrPassword, @@ -536,7 +536,7 @@ func TestAccRDSInstance_Versions_allowMajor(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{ "allow_major_version_upgrade", - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -669,7 +669,7 @@ func TestAccRDSInstance_deletionProtection(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -875,7 +875,7 @@ func TestAccRDSInstance_password(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -921,7 +921,7 @@ func TestAccRDSInstance_ManageMasterPassword_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "manage_master_user_password", "skip_final_snapshot", @@ -959,7 +959,7 @@ func TestAccRDSInstance_ManageMasterPassword_kmsKey(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "manage_master_user_password", "master_user_secret_kms_key_id", @@ -998,7 +998,7 @@ func TestAccRDSInstance_ManageMasterPassword_convertToManaged(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -1062,7 +1062,7 @@ func TestAccRDSInstance_ReplicateSourceDB_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -1082,7 +1082,7 @@ func TestAccRDSInstance_ReplicateSourceDB_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -1121,7 +1121,7 @@ func TestAccRDSInstance_ReplicateSourceDB_namePrefix(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -1159,7 +1159,7 @@ func TestAccRDSInstance_ReplicateSourceDB_nameGenerated(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -2079,7 +2079,7 @@ func TestAccRDSInstance_ReplicateSourceDB_characterSet_Source(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "manage_master_user_password", @@ -2155,7 +2155,7 @@ func TestAccRDSInstance_ReplicateSourceDB_replicaMode(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "manage_master_user_password", @@ -2262,7 +2262,7 @@ func TestAccRDSInstance_ReplicateSourceDB_CrossRegion_parameterGroupNameEquivale ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -2305,7 +2305,7 @@ func TestAccRDSInstance_ReplicateSourceDB_CrossRegion_characterSet(t *testing.T) ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -2341,7 +2341,7 @@ func TestAccRDSInstance_s3Import(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -2432,7 +2432,7 @@ func TestAccRDSInstance_SnapshotIdentifier_ManageMasterPasswordKMSKey(t *testing ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", "manage_master_user_password", "master_user_secret_kms_key_id", @@ -2475,7 +2475,7 @@ func TestAccRDSInstance_SnapshotIdentifier_namePrefix(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, "snapshot_identifier", }, @@ -2514,7 +2514,7 @@ func TestAccRDSInstance_SnapshotIdentifier_nameGenerated(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, "snapshot_identifier", }, @@ -3304,7 +3304,7 @@ func TestAccRDSInstance_SnapshotIdentifier_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "snapshot_identifier", }, }, @@ -3347,7 +3347,7 @@ func TestAccRDSInstance_SnapshotIdentifier_tagsRemove(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "snapshot_identifier", }, }, @@ -3453,7 +3453,7 @@ func TestAccRDSInstance_monitoringInterval(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -3513,7 +3513,7 @@ func TestAccRDSInstance_MonitoringRoleARN_enabledToDisabled(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -3559,7 +3559,7 @@ func TestAccRDSInstance_MonitoringRoleARN_enabledToRemoved(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -3603,7 +3603,7 @@ func TestAccRDSInstance_MonitoringRoleARN_removedToEnabled(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -4007,7 +4007,7 @@ func TestAccRDSInstance_CloudWatchLogsExport_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -4050,7 +4050,7 @@ func TestAccRDSInstance_CloudWatchLogsExport_db2(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -4144,7 +4144,7 @@ func TestAccRDSInstance_CloudWatchLogsExport_msSQL(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -4182,7 +4182,7 @@ func TestAccRDSInstance_CloudWatchLogsExport_oracle(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -4221,7 +4221,7 @@ func TestAccRDSInstance_CloudWatchLogsExport_postgresql(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -4260,7 +4260,7 @@ func TestAccRDSInstance_dedicatedLogVolume_enableOnCreate(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -4303,7 +4303,7 @@ func TestAccRDSInstance_dedicatedLogVolume_enableOnUpdate(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -4319,7 +4319,7 @@ func TestAccRDSInstance_dedicatedLogVolume_enableOnUpdate(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, }, }, @@ -4386,7 +4386,7 @@ func TestAccRDSInstance_PerformanceInsights_disabledToEnabled(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", @@ -4434,7 +4434,7 @@ func TestAccRDSInstance_PerformanceInsights_enabledToDisabled(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", @@ -4484,7 +4484,7 @@ func TestAccRDSInstance_PerformanceInsights_kmsKeyID(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", @@ -4542,7 +4542,7 @@ func TestAccRDSInstance_PerformanceInsights_retentionPeriod(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", @@ -4701,7 +4701,7 @@ func TestAccRDSInstance_RestoreToPointInTime_sourceIdentifier(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "delete_automated_backups", "final_snapshot_identifier", "latest_restorable_time", // dynamic value of a DBInstance @@ -4743,7 +4743,7 @@ func TestAccRDSInstance_RestoreToPointInTime_sourceResourceID(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "delete_automated_backups", "final_snapshot_identifier", "latest_restorable_time", // dynamic value of a DBInstance @@ -4819,7 +4819,7 @@ func TestAccRDSInstance_RestoreToPointInTime_manageMasterPassword(t *testing.T) ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "delete_automated_backups", "final_snapshot_identifier", "latest_restorable_time", // dynamic value of a DBInstance @@ -4862,7 +4862,7 @@ func TestAccRDSInstance_Oracle_nationalCharacterSet(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -4902,7 +4902,7 @@ func TestAccRDSInstance_Oracle_noNationalCharacterSet(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -4962,7 +4962,7 @@ func TestAccRDSInstance_Outposts_coIPDisabledToEnabled(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", @@ -5003,7 +5003,7 @@ func TestAccRDSInstance_Outposts_coIPEnabledToDisabled(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, names.AttrPassword, "skip_final_snapshot", "final_snapshot_identifier", @@ -5046,7 +5046,7 @@ func TestAccRDSInstance_Outposts_coIPRestoreToPointInTime(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "delete_automated_backups", "final_snapshot_identifier", "latest_restorable_time", // dynamic value of a DBInstance @@ -5144,7 +5144,7 @@ func TestAccRDSInstance_license(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5200,7 +5200,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateEngineVersion(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5253,7 +5253,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateParameterGroup(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5305,7 +5305,7 @@ func TestAccRDSInstance_BlueGreenDeployment_tags(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5356,7 +5356,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateInstanceClass(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5409,7 +5409,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateAndPromoteReplica(t *testing.T ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "blue_green_update", "delete_automated_backups", "final_snapshot_identifier", @@ -5461,7 +5461,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateAndEnableBackups(t *testing.T) ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5503,7 +5503,7 @@ func TestAccRDSInstance_BlueGreenDeployment_deletionProtectionBypassesBlueGreen( ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5526,7 +5526,7 @@ func TestAccRDSInstance_BlueGreenDeployment_deletionProtectionBypassesBlueGreen( ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5604,7 +5604,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateWithDeletionProtection(t *test ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5628,7 +5628,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateWithDeletionProtection(t *test ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5795,7 +5795,7 @@ func TestAccRDSInstance_BlueGreenDeployment_outOfBand(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5839,7 +5839,7 @@ func TestAccRDSInstance_Storage_gp3MySQL(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5892,7 +5892,7 @@ func TestAccRDSInstance_Storage_gp3Postgres(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -5945,7 +5945,7 @@ func TestAccRDSInstance_Storage_gp3SQLServer(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", @@ -6154,7 +6154,7 @@ func TestAccRDSInstance_Storage_typePostgres(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "apply_immediately", + names.AttrApplyImmediately, "final_snapshot_identifier", names.AttrPassword, "skip_final_snapshot", diff --git a/internal/service/rds/sweep.go b/internal/service/rds/sweep.go index 71585a8605d..b8319589a9b 100644 --- a/internal/service/rds/sweep.go +++ b/internal/service/rds/sweep.go @@ -232,7 +232,7 @@ func sweepClusters(region string) error { r := ResourceCluster() d := r.Data(nil) d.SetId(id) - d.Set("apply_immediately", true) + d.Set(names.AttrApplyImmediately, true) d.Set(names.AttrARN, arn) d.Set("delete_automated_backups", true) d.Set("deletion_protection", false) @@ -382,7 +382,7 @@ func sweepInstances(region string) error { r := ResourceInstance() d := r.Data(nil) d.SetId(aws.StringValue(v.DbiResourceId)) - d.Set("apply_immediately", true) + d.Set(names.AttrApplyImmediately, true) d.Set("delete_automated_backups", true) d.Set("deletion_protection", false) d.Set("identifier", v.DBInstanceIdentifier) From e6549107fae0b8c0c43245567d69f1a5140ad708 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:50 -0400 Subject: [PATCH 1377/1490] redshift: Use constants for strings --- internal/service/redshift/cluster.go | 16 ++++---- .../service/redshift/cluster_data_source.go | 4 +- .../redshift/cluster_data_source_test.go | 2 +- internal/service/redshift/cluster_test.go | 40 +++++++++---------- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/internal/service/redshift/cluster.go b/internal/service/redshift/cluster.go index 2dc02dcd309..0805b4e46e2 100644 --- a/internal/service/redshift/cluster.go +++ b/internal/service/redshift/cluster.go @@ -55,7 +55,7 @@ func resourceCluster() *schema.Resource { Optional: true, Default: true, }, - "apply_immediately": { + names.AttrApplyImmediately: { Type: schema.TypeBool, Optional: true, Default: false, @@ -343,7 +343,7 @@ func resourceCluster() *schema.Resource { }, ValidateFunc: verify.ValidOnceAWeekWindowFormat, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Optional: true, Default: true, @@ -438,7 +438,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int ClusterIdentifier: aws.String(clusterID), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), NodeType: aws.String(d.Get("node_type").(string)), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), } inputC := &redshift.CreateClusterInput{ AllowVersionUpgrade: aws.Bool(d.Get("allow_version_upgrade").(bool)), @@ -449,7 +449,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int MasterUsername: aws.String(d.Get("master_username").(string)), NodeType: aws.String(d.Get("node_type").(string)), Port: aws.Int64(int64(d.Get(names.AttrPort).(int))), - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), Tags: getTagsIn(ctx), } @@ -711,7 +711,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("node_type", rsc.NodeType) d.Set("number_of_nodes", rsc.NumberOfNodes) d.Set(names.AttrPreferredMaintenanceWindow, rsc.PreferredMaintenanceWindow) - d.Set("publicly_accessible", rsc.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, rsc.PubliclyAccessible) if err := d.Set("snapshot_copy", flattenSnapshotCopy(rsc.ClusterSnapshotCopyStatus)); err != nil { return sdkdiag.AppendErrorf(diags, "setting snapshot_copy: %s", err) } @@ -817,8 +817,8 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int input.PreferredMaintenanceWindow = aws.String(d.Get(names.AttrPreferredMaintenanceWindow).(string)) } - if d.HasChange("publicly_accessible") { - input.PubliclyAccessible = aws.Bool(d.Get("publicly_accessible").(bool)) + if d.HasChange(names.AttrPubliclyAccessible) { + input.PubliclyAccessible = aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)) } if d.HasChange(names.AttrVPCSecurityGroupIDs) { @@ -875,7 +875,7 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int return sdkdiag.AppendErrorf(diags, "modifying Redshift Cluster (%s) Aqua Configuration: %s", d.Id(), err) } - if d.Get("apply_immediately").(bool) { + if d.Get(names.AttrApplyImmediately).(bool) { input := &redshift.RebootClusterInput{ ClusterIdentifier: aws.String(d.Id()), } diff --git a/internal/service/redshift/cluster_data_source.go b/internal/service/redshift/cluster_data_source.go index 3a8b0f4e1ad..3bb5ba3600e 100644 --- a/internal/service/redshift/cluster_data_source.go +++ b/internal/service/redshift/cluster_data_source.go @@ -175,7 +175,7 @@ func dataSourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Computed: true, }, @@ -280,7 +280,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("node_type", rsc.NodeType) d.Set("number_of_nodes", rsc.NumberOfNodes) d.Set(names.AttrPreferredMaintenanceWindow, rsc.PreferredMaintenanceWindow) - d.Set("publicly_accessible", rsc.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, rsc.PubliclyAccessible) d.Set(names.AttrVPCID, rsc.VpcId) d.Set(names.AttrVPCSecurityGroupIDs, tfslices.ApplyToAll(rsc.VpcSecurityGroups, func(v *redshift.VpcSecurityGroupMembership) string { return aws.StringValue(v.VpcSecurityGroupId) diff --git a/internal/service/redshift/cluster_data_source_test.go b/internal/service/redshift/cluster_data_source_test.go index 50431041101..253626453aa 100644 --- a/internal/service/redshift/cluster_data_source_test.go +++ b/internal/service/redshift/cluster_data_source_test.go @@ -51,7 +51,7 @@ func TestAccRedshiftClusterDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet(dataSourceName, "manual_snapshot_retention_period"), resource.TestCheckResourceAttrSet(dataSourceName, "maintenance_track_name"), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(dataSourceName, "publicly_accessible"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrPubliclyAccessible), resource.TestCheckResourceAttrPair(dataSourceName, "availability_zone_relocation_enabled", resourceName, "availability_zone_relocation_enabled"), resource.TestCheckResourceAttrPair(dataSourceName, "tags.%", resourceName, "tags.%"), ), diff --git a/internal/service/redshift/cluster_test.go b/internal/service/redshift/cluster_test.go index 7232ccf1c1d..e013d1a9f9a 100644 --- a/internal/service/redshift/cluster_test.go +++ b/internal/service/redshift/cluster_test.go @@ -42,7 +42,7 @@ func TestAccRedshiftCluster_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "cluster_nodes.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "cluster_nodes.0.public_ip_address"), resource.TestCheckResourceAttr(resourceName, "cluster_type", "single-node"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "true"), resource.TestMatchResourceAttr(resourceName, "dns_name", regexache.MustCompile(fmt.Sprintf("^%s.*\\.redshift\\..*", rName))), resource.TestCheckResourceAttr(resourceName, "availability_zone_relocation_enabled", "false"), resource.TestCheckResourceAttr(resourceName, "aqua_configuration_status", "auto"), @@ -61,7 +61,7 @@ func TestAccRedshiftCluster_basic(t *testing.T) { "final_snapshot_identifier", "master_password", "skip_final_snapshot", - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -95,7 +95,7 @@ func TestAccRedshiftCluster_aqua(t *testing.T) { "final_snapshot_identifier", "master_password", "skip_final_snapshot", - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -166,7 +166,7 @@ func TestAccRedshiftCluster_withFinalSnapshot(t *testing.T) { "final_snapshot_identifier", "master_password", "skip_final_snapshot", - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -191,7 +191,7 @@ func TestAccRedshiftCluster_kmsKey(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "cluster_type", "single-node"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "true"), resource.TestCheckResourceAttrPair(resourceName, names.AttrKMSKeyID, keyResourceName, names.AttrARN), ), }, @@ -203,7 +203,7 @@ func TestAccRedshiftCluster_kmsKey(t *testing.T) { "final_snapshot_identifier", "master_password", "skip_final_snapshot", - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -237,7 +237,7 @@ func TestAccRedshiftCluster_enhancedVPCRoutingEnabled(t *testing.T) { "final_snapshot_identifier", "master_password", "skip_final_snapshot", - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -280,7 +280,7 @@ func TestAccRedshiftCluster_loggingEnabled(t *testing.T) { "final_snapshot_identifier", "master_password", "skip_final_snapshot", - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -390,7 +390,7 @@ func TestAccRedshiftCluster_publiclyAccessible(t *testing.T) { Config: testAccClusterConfig_publiclyAccessible(rName, false), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), ), }, @@ -398,7 +398,7 @@ func TestAccRedshiftCluster_publiclyAccessible(t *testing.T) { Config: testAccClusterConfig_publiclyAccessible(rName, true), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "true"), ), }, }, @@ -495,7 +495,7 @@ func TestAccRedshiftCluster_tags(t *testing.T) { "final_snapshot_identifier", "master_password", "skip_final_snapshot", - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -568,7 +568,7 @@ func TestAccRedshiftCluster_changeAvailabilityZone(t *testing.T) { Config: testAccClusterConfig_updateAvailabilityZone(rName, 0), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &v1), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttr(resourceName, "availability_zone_relocation_enabled", "true"), resource.TestCheckResourceAttrPair(resourceName, names.AttrAvailabilityZone, "data.aws_availability_zones.available", "names.0"), ), @@ -601,7 +601,7 @@ func TestAccRedshiftCluster_changeAvailabilityZoneAndSetAvailabilityZoneRelocati Config: testAccClusterConfig_updateAvailabilityZoneAvailabilityZoneRelocationNotSet(rName, 0), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &v1), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttr(resourceName, "availability_zone_relocation_enabled", "false"), resource.TestCheckResourceAttrPair(resourceName, names.AttrAvailabilityZone, "data.aws_availability_zones.available", "names.0"), ), @@ -635,7 +635,7 @@ func TestAccRedshiftCluster_changeAvailabilityZone_availabilityZoneRelocationNot Config: testAccClusterConfig_updateAvailabilityZoneAvailabilityZoneRelocationNotSet(rName, 0), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), resource.TestCheckResourceAttr(resourceName, "availability_zone_relocation_enabled", "false"), resource.TestCheckResourceAttrPair(resourceName, names.AttrAvailabilityZone, "data.aws_availability_zones.available", "names.0"), ), @@ -737,7 +737,7 @@ func TestAccRedshiftCluster_availabilityZoneRelocation(t *testing.T) { "final_snapshot_identifier", "master_password", "skip_final_snapshot", - "apply_immediately", + names.AttrApplyImmediately, }, }, { @@ -768,7 +768,7 @@ func TestAccRedshiftCluster_availabilityZoneRelocation_publiclyAccessible(t *tes Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName, &v), resource.TestCheckResourceAttr(resourceName, "availability_zone_relocation_enabled", "true"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "true"), ), }, }, @@ -803,7 +803,7 @@ func TestAccRedshiftCluster_restoreFromSnapshot(t *testing.T) { "master_password", "skip_final_snapshot", "snapshot_identifier", - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -838,7 +838,7 @@ func TestAccRedshiftCluster_restoreFromSnapshotARN(t *testing.T) { "master_password", "skip_final_snapshot", "snapshot_arn", - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -874,7 +874,7 @@ func TestAccRedshiftCluster_manageMasterPassword(t *testing.T) { "final_snapshot_identifier", "manage_master_password", "skip_final_snapshot", - "apply_immediately", + names.AttrApplyImmediately, }, }, }, @@ -908,7 +908,7 @@ func TestAccRedshiftCluster_multiAZ(t *testing.T) { "final_snapshot_identifier", "master_password", "skip_final_snapshot", - "apply_immediately", + names.AttrApplyImmediately, }, }, { From 481967298de5a47bc7949cf39cb7df4d7fa9881e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:50 -0400 Subject: [PATCH 1378/1490] redshiftserverless: Use constants for strings --- internal/service/redshiftserverless/workgroup.go | 10 +++++----- .../redshiftserverless/workgroup_data_source.go | 4 ++-- .../redshiftserverless/workgroup_data_source_test.go | 2 +- internal/service/redshiftserverless/workgroup_test.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/redshiftserverless/workgroup.go b/internal/service/redshiftserverless/workgroup.go index 4cbc280a9c1..35fd8900f22 100644 --- a/internal/service/redshiftserverless/workgroup.go +++ b/internal/service/redshiftserverless/workgroup.go @@ -168,7 +168,7 @@ func resourceWorkgroup() *schema.Resource { Computed: true, Optional: true, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Optional: true, }, @@ -236,7 +236,7 @@ func resourceWorkgroupCreate(ctx context.Context, d *schema.ResourceData, meta i input.Port = aws.Int64(int64(v.(int))) } - if v, ok := d.GetOk("publicly_accessible"); ok { + if v, ok := d.GetOk(names.AttrPubliclyAccessible); ok { input.PubliclyAccessible = aws.Bool(v.(bool)) } @@ -292,7 +292,7 @@ func resourceWorkgroupRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("max_capacity", out.MaxCapacity) d.Set("namespace_name", out.NamespaceName) d.Set(names.AttrPort, flattenEndpoint(out.Endpoint)[names.AttrPort]) - d.Set("publicly_accessible", out.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, out.PubliclyAccessible) d.Set(names.AttrSecurityGroupIDs, flex.FlattenStringSet(out.SecurityGroupIds)) d.Set(names.AttrSubnetIDs, flex.FlattenStringSet(out.SubnetIds)) d.Set("workgroup_id", out.WorkgroupId) @@ -408,9 +408,9 @@ func resourceWorkgroupUpdate(ctx context.Context, d *schema.ResourceData, meta i } } - if d.HasChange("publicly_accessible") { + if d.HasChange(names.AttrPubliclyAccessible) { input := &redshiftserverless.UpdateWorkgroupInput{ - PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)), + PubliclyAccessible: aws.Bool(d.Get(names.AttrPubliclyAccessible).(bool)), WorkgroupName: aws.String(d.Id()), } diff --git a/internal/service/redshiftserverless/workgroup_data_source.go b/internal/service/redshiftserverless/workgroup_data_source.go index 553efab0bb9..ace28c804f9 100644 --- a/internal/service/redshiftserverless/workgroup_data_source.go +++ b/internal/service/redshiftserverless/workgroup_data_source.go @@ -87,7 +87,7 @@ func dataSourceWorkgroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "publicly_accessible": { + names.AttrPubliclyAccessible: { Type: schema.TypeBool, Computed: true, }, @@ -136,7 +136,7 @@ func dataSourceWorkgroupRead(ctx context.Context, d *schema.ResourceData, meta i } d.Set("enhanced_vpc_routing", resource.EnhancedVpcRouting) d.Set("namespace_name", resource.NamespaceName) - d.Set("publicly_accessible", resource.PubliclyAccessible) + d.Set(names.AttrPubliclyAccessible, resource.PubliclyAccessible) d.Set(names.AttrSecurityGroupIDs, resource.SecurityGroupIds) d.Set(names.AttrSubnetIDs, resource.SubnetIds) d.Set("workgroup_id", resource.WorkgroupId) diff --git a/internal/service/redshiftserverless/workgroup_data_source_test.go b/internal/service/redshiftserverless/workgroup_data_source_test.go index 87d8419ff79..17722f89cde 100644 --- a/internal/service/redshiftserverless/workgroup_data_source_test.go +++ b/internal/service/redshiftserverless/workgroup_data_source_test.go @@ -44,7 +44,7 @@ func TestAccRedshiftServerlessWorkgroupDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "enhanced_vpc_routing", resourceName, "enhanced_vpc_routing"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, "namespace_name", resourceName, "namespace_name"), - resource.TestCheckResourceAttrPair(dataSourceName, "publicly_accessible", resourceName, "publicly_accessible"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrPubliclyAccessible, resourceName, names.AttrPubliclyAccessible), resource.TestCheckResourceAttrPair(dataSourceName, "security_group_ids.#", resourceName, "security_group_ids.#"), resource.TestCheckResourceAttrPair(dataSourceName, "subnet_ids.#", resourceName, "subnet_ids.#"), resource.TestCheckResourceAttrPair(dataSourceName, "workgroup_id", resourceName, "workgroup_id"), diff --git a/internal/service/redshiftserverless/workgroup_test.go b/internal/service/redshiftserverless/workgroup_test.go index 971a6fac31d..77b35cdb8f6 100644 --- a/internal/service/redshiftserverless/workgroup_test.go +++ b/internal/service/redshiftserverless/workgroup_test.go @@ -97,7 +97,7 @@ func TestAccRedshiftServerlessWorkgroup_baseAndMaxCapacityAndPubliclyAccessible( Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "base_capacity", "512"), resource.TestCheckResourceAttr(resourceName, "max_capacity", "5632"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "false"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "false"), ), }, { @@ -105,7 +105,7 @@ func TestAccRedshiftServerlessWorkgroup_baseAndMaxCapacityAndPubliclyAccessible( Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "base_capacity", "128"), resource.TestCheckResourceAttr(resourceName, "max_capacity", "256"), - resource.TestCheckResourceAttr(resourceName, "publicly_accessible", "true"), + resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, "true"), ), }, { From e16baece20184e32868518189df1ed3fd5187dc5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:50 -0400 Subject: [PATCH 1379/1490] resourcegroups: Use constants for strings --- internal/service/resourcegroups/resource.go | 4 ++-- internal/service/resourcegroups/resource_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/resourcegroups/resource.go b/internal/service/resourcegroups/resource.go index 6386a7823cc..0a5ffec26fd 100644 --- a/internal/service/resourcegroups/resource.go +++ b/internal/service/resourcegroups/resource.go @@ -48,7 +48,7 @@ func resourceResource() *schema.Resource { Required: true, ForceNew: true, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Computed: true, }, @@ -102,7 +102,7 @@ func resourceResourceRead(ctx context.Context, d *schema.ResourceData, meta inte } d.Set(names.AttrResourceARN, output.Identifier.ResourceArn) - d.Set("resource_type", output.Identifier.ResourceType) + d.Set(names.AttrResourceType, output.Identifier.ResourceType) return nil } diff --git a/internal/service/resourcegroups/resource_test.go b/internal/service/resourcegroups/resource_test.go index 664465bbb47..9226a25443c 100644 --- a/internal/service/resourcegroups/resource_test.go +++ b/internal/service/resourcegroups/resource_test.go @@ -35,7 +35,7 @@ func TestAccResourceGroupsResource_basic(t *testing.T) { Config: testAccResourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckResourceExists(ctx, resourceName, &r), - resource.TestCheckResourceAttr(resourceName, "resource_type", "AWS::EC2::Host"), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, "AWS::EC2::Host"), resource.TestCheckResourceAttrSet(resourceName, "group_arn"), resource.TestCheckResourceAttrSet(resourceName, names.AttrResourceARN), ), From cfa84909ecd733ac06d521493a1fb94250905a09 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:50 -0400 Subject: [PATCH 1380/1490] route53domains: Use constants for strings --- internal/service/route53domains/registered_domain.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/route53domains/registered_domain.go b/internal/service/route53domains/registered_domain.go index 8ceade6506f..2b6cc73171e 100644 --- a/internal/service/route53domains/registered_domain.go +++ b/internal/service/route53domains/registered_domain.go @@ -170,7 +170,7 @@ func resourceRegisteredDomain() *schema.Resource { Optional: true, Default: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -380,9 +380,9 @@ func resourceRegisteredDomainRead(ctx context.Context, d *schema.ResourceData, m d.Set("admin_privacy", domainDetail.AdminPrivacy) d.Set("auto_renew", domainDetail.AutoRenew) if domainDetail.CreationDate != nil { - d.Set("creation_date", aws.ToTime(domainDetail.CreationDate).Format(time.RFC3339)) + d.Set(names.AttrCreationDate, aws.ToTime(domainDetail.CreationDate).Format(time.RFC3339)) } else { - d.Set("creation_date", nil) + d.Set(names.AttrCreationDate, nil) } if domainDetail.BillingContact != nil { if err := d.Set("billing_contact", []interface{}{flattenContactDetail(domainDetail.BillingContact)}); err != nil { From bf70a108e4392e542681a349003ed989991170e8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:50 -0400 Subject: [PATCH 1381/1490] route53resolver: Use constants for strings --- .../route53resolver/firewall_domain_list_data_source.go | 4 ++-- .../firewall_domain_list_data_source_test.go | 2 +- .../firewall_rule_group_association_data_source.go | 4 ++-- .../firewall_rule_group_association_data_source_test.go | 2 +- .../route53resolver/firewall_rule_group_data_source.go | 4 ++-- .../firewall_rule_group_data_source_test.go | 2 +- .../service/route53resolver/firewall_rules_data_source.go | 4 ++-- internal/service/route53resolver/query_log_config.go | 6 +++--- .../route53resolver/query_log_config_data_source.go | 4 ++-- .../route53resolver/query_log_config_data_source_test.go | 4 ++-- internal/service/route53resolver/query_log_config_test.go | 8 ++++---- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/internal/service/route53resolver/firewall_domain_list_data_source.go b/internal/service/route53resolver/firewall_domain_list_data_source.go index b4dca24a9f9..5240d90962e 100644 --- a/internal/service/route53resolver/firewall_domain_list_data_source.go +++ b/internal/service/route53resolver/firewall_domain_list_data_source.go @@ -23,7 +23,7 @@ func DataSourceFirewallDomainList() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -75,7 +75,7 @@ func dataSourceFirewallDomainListRead(ctx context.Context, d *schema.ResourceDat d.SetId(aws.StringValue(firewallDomainList.Id)) d.Set(names.AttrARN, firewallDomainList.Arn) - d.Set("creation_time", firewallDomainList.CreationTime) + d.Set(names.AttrCreationTime, firewallDomainList.CreationTime) d.Set("creator_request_id", firewallDomainList.CreatorRequestId) d.Set("domain_count", firewallDomainList.DomainCount) d.Set("firewall_domain_list_id", firewallDomainList.Id) diff --git a/internal/service/route53resolver/firewall_domain_list_data_source_test.go b/internal/service/route53resolver/firewall_domain_list_data_source_test.go index 4c1d3b61422..4651cc84152 100644 --- a/internal/service/route53resolver/firewall_domain_list_data_source_test.go +++ b/internal/service/route53resolver/firewall_domain_list_data_source_test.go @@ -28,7 +28,7 @@ func TestAccRoute53ResolverFirewallDomainListDataSource_basic(t *testing.T) { Config: testAccFirewallDomainListDataSourceConfig_basic(rName, domainName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_time"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(dataSourceName, "creator_request_id"), resource.TestCheckResourceAttrPair(dataSourceName, "firewall_domain_list_id", resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, "domain_count", resourceName, "domains.#"), diff --git a/internal/service/route53resolver/firewall_rule_group_association_data_source.go b/internal/service/route53resolver/firewall_rule_group_association_data_source.go index 019563a272f..7dfa2d8ac58 100644 --- a/internal/service/route53resolver/firewall_rule_group_association_data_source.go +++ b/internal/service/route53resolver/firewall_rule_group_association_data_source.go @@ -23,7 +23,7 @@ func DataSourceFirewallRuleGroupAssociation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -87,7 +87,7 @@ func dataSourceRuleGroupAssociationRead(ctx context.Context, d *schema.ResourceD d.SetId(aws.StringValue(ruleGroupAssociation.Id)) d.Set(names.AttrARN, ruleGroupAssociation.Arn) - d.Set("creation_time", ruleGroupAssociation.CreationTime) + d.Set(names.AttrCreationTime, ruleGroupAssociation.CreationTime) d.Set("creator_request_id", ruleGroupAssociation.CreatorRequestId) d.Set("firewall_rule_group_id", ruleGroupAssociation.FirewallRuleGroupId) d.Set("firewall_rule_group_association_id", ruleGroupAssociation.Id) diff --git a/internal/service/route53resolver/firewall_rule_group_association_data_source_test.go b/internal/service/route53resolver/firewall_rule_group_association_data_source_test.go index 5cf9e1c2c9e..113b5974512 100644 --- a/internal/service/route53resolver/firewall_rule_group_association_data_source_test.go +++ b/internal/service/route53resolver/firewall_rule_group_association_data_source_test.go @@ -27,7 +27,7 @@ func TestAccRoute53ResolverRuleGroupAssociationDataSource_basic(t *testing.T) { Config: testAccRuleGroupAssociationDataSourceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_time"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(dataSourceName, "creator_request_id"), resource.TestCheckResourceAttrPair(dataSourceName, "firewall_rule_group_id", resourceName, "firewall_rule_group_id"), resource.TestCheckResourceAttrPair(dataSourceName, "firewall_rule_group_association_id", resourceName, names.AttrID), diff --git a/internal/service/route53resolver/firewall_rule_group_data_source.go b/internal/service/route53resolver/firewall_rule_group_data_source.go index e679c98a726..319a6b5a983 100644 --- a/internal/service/route53resolver/firewall_rule_group_data_source.go +++ b/internal/service/route53resolver/firewall_rule_group_data_source.go @@ -23,7 +23,7 @@ func DataSourceFirewallRuleGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -79,7 +79,7 @@ func dataSourceFirewallRuleGroupRead(ctx context.Context, d *schema.ResourceData d.SetId(aws.StringValue(ruleGroup.Id)) d.Set(names.AttrARN, ruleGroup.Arn) - d.Set("creation_time", ruleGroup.CreationTime) + d.Set(names.AttrCreationTime, ruleGroup.CreationTime) d.Set("creator_request_id", ruleGroup.CreatorRequestId) d.Set("firewall_rule_group_id", ruleGroup.Id) d.Set("modification_time", ruleGroup.ModificationTime) diff --git a/internal/service/route53resolver/firewall_rule_group_data_source_test.go b/internal/service/route53resolver/firewall_rule_group_data_source_test.go index 93b288d8d94..f388857a588 100644 --- a/internal/service/route53resolver/firewall_rule_group_data_source_test.go +++ b/internal/service/route53resolver/firewall_rule_group_data_source_test.go @@ -27,7 +27,7 @@ func TestAccRoute53ResolverFirewallRuleGroupDataSource_basic(t *testing.T) { Config: testAccFirewallRuleGroupDataSourceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrSet(dataSourceName, "creation_time"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrCreationTime), resource.TestCheckResourceAttrSet(dataSourceName, "creator_request_id"), resource.TestCheckResourceAttrPair(dataSourceName, "firewall_rule_group_id", resourceName, names.AttrID), resource.TestCheckResourceAttrSet(dataSourceName, "modification_time"), diff --git a/internal/service/route53resolver/firewall_rules_data_source.go b/internal/service/route53resolver/firewall_rules_data_source.go index 442fe35685c..993c8f4836f 100644 --- a/internal/service/route53resolver/firewall_rules_data_source.go +++ b/internal/service/route53resolver/firewall_rules_data_source.go @@ -53,7 +53,7 @@ func DataSourceResolverFirewallRules() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -167,7 +167,7 @@ func flattenFirewallRule(apiObject *route53resolver.FirewallRule) map[string]int tfMap["block_response"] = aws.StringValue(apiObject.BlockResponse) } if apiObject.CreationTime != nil { - tfMap["creation_time"] = aws.StringValue(apiObject.CreationTime) + tfMap[names.AttrCreationTime] = aws.StringValue(apiObject.CreationTime) } if apiObject.CreatorRequestId != nil { tfMap["creator_request_id"] = aws.StringValue(apiObject.CreatorRequestId) diff --git a/internal/service/route53resolver/query_log_config.go b/internal/service/route53resolver/query_log_config.go index 95aab679db1..51502036a21 100644 --- a/internal/service/route53resolver/query_log_config.go +++ b/internal/service/route53resolver/query_log_config.go @@ -40,7 +40,7 @@ func ResourceQueryLogConfig() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -74,7 +74,7 @@ func resourceQueryLogConfigCreate(ctx context.Context, d *schema.ResourceData, m name := d.Get(names.AttrName).(string) input := &route53resolver.CreateResolverQueryLogConfigInput{ CreatorRequestId: aws.String(id.PrefixedUniqueId("tf-r53-resolver-query-log-config-")), - DestinationArn: aws.String(d.Get("destination_arn").(string)), + DestinationArn: aws.String(d.Get(names.AttrDestinationARN).(string)), Name: aws.String(name), Tags: getTagsIn(ctx), } @@ -111,7 +111,7 @@ func resourceQueryLogConfigRead(ctx context.Context, d *schema.ResourceData, met arn := aws.StringValue(queryLogConfig.Arn) d.Set(names.AttrARN, arn) - d.Set("destination_arn", queryLogConfig.DestinationArn) + d.Set(names.AttrDestinationARN, queryLogConfig.DestinationArn) d.Set(names.AttrName, queryLogConfig.Name) d.Set(names.AttrOwnerID, queryLogConfig.OwnerId) d.Set("share_status", queryLogConfig.ShareStatus) diff --git a/internal/service/route53resolver/query_log_config_data_source.go b/internal/service/route53resolver/query_log_config_data_source.go index d738b652712..8b60ed9e396 100644 --- a/internal/service/route53resolver/query_log_config_data_source.go +++ b/internal/service/route53resolver/query_log_config_data_source.go @@ -28,7 +28,7 @@ func DataSourceQueryLogConfig() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Computed: true, }, @@ -107,7 +107,7 @@ func dataSourceQueryLogConfigRead(ctx context.Context, d *schema.ResourceData, m d.SetId(aws.StringValue(config.Id)) arn := aws.StringValue(config.Arn) d.Set(names.AttrARN, arn) - d.Set("destination_arn", config.DestinationArn) + d.Set(names.AttrDestinationARN, config.DestinationArn) d.Set(names.AttrName, config.Name) d.Set(names.AttrOwnerID, config.OwnerId) d.Set("resolver_query_log_config_id", config.Id) diff --git a/internal/service/route53resolver/query_log_config_data_source_test.go b/internal/service/route53resolver/query_log_config_data_source_test.go index 9d8abebba8a..3686a3df32f 100644 --- a/internal/service/route53resolver/query_log_config_data_source_test.go +++ b/internal/service/route53resolver/query_log_config_data_source_test.go @@ -33,7 +33,7 @@ func TestAccRoute53ResolverQueryLogConfigDataSource_basic(t *testing.T) { Config: testAccQueryLogConfigDataSourceConfig_basic(rName, "key1", "value1"), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "destination_arn", resourceName, "destination_arn"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDestinationARN, resourceName, names.AttrDestinationARN), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrOwnerID, resourceName, names.AttrOwnerID), @@ -66,7 +66,7 @@ func TestAccRoute53ResolverQueryLogConfigDataSource_filter(t *testing.T) { Config: testAccQueryLogConfigDataSourceConfig_filter(rName, "key1", "value1"), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "destination_arn", resourceName, "destination_arn"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrDestinationARN, resourceName, names.AttrDestinationARN), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrID, resourceName, names.AttrID), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrOwnerID, resourceName, names.AttrOwnerID), diff --git a/internal/service/route53resolver/query_log_config_test.go b/internal/service/route53resolver/query_log_config_test.go index 37c0a9a7079..41dff50728b 100644 --- a/internal/service/route53resolver/query_log_config_test.go +++ b/internal/service/route53resolver/query_log_config_test.go @@ -36,7 +36,7 @@ func TestAccRoute53ResolverQueryLogConfig_basic(t *testing.T) { Config: testAccQueryLogConfigConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckQueryLogConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", s3BucketResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, s3BucketResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerID), resource.TestCheckResourceAttr(resourceName, "share_status", "NOT_SHARED"), @@ -93,7 +93,7 @@ func TestAccRoute53ResolverQueryLogConfig_tags(t *testing.T) { Config: testAccQueryLogConfigConfig_tags1(rName, "key1", "value1"), Check: resource.ComposeTestCheckFunc( testAccCheckQueryLogConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", cwLogGroupResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, cwLogGroupResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerID), resource.TestCheckResourceAttr(resourceName, "share_status", "NOT_SHARED"), @@ -110,7 +110,7 @@ func TestAccRoute53ResolverQueryLogConfig_tags(t *testing.T) { Config: testAccQueryLogConfigConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), Check: resource.ComposeTestCheckFunc( testAccCheckQueryLogConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", cwLogGroupResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, cwLogGroupResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerID), resource.TestCheckResourceAttr(resourceName, "share_status", "NOT_SHARED"), @@ -123,7 +123,7 @@ func TestAccRoute53ResolverQueryLogConfig_tags(t *testing.T) { Config: testAccQueryLogConfigConfig_tags1(rName, "key2", "value2"), Check: resource.ComposeTestCheckFunc( testAccCheckQueryLogConfigExists(ctx, resourceName, &v), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", cwLogGroupResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, cwLogGroupResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), acctest.CheckResourceAttrAccountID(resourceName, names.AttrOwnerID), resource.TestCheckResourceAttr(resourceName, "share_status", "NOT_SHARED"), From e62b2e78f898fb695e6530c3ebfde7375ac6be89 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:51 -0400 Subject: [PATCH 1382/1490] rum: Use constants for strings --- internal/service/rum/metrics_destination.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/rum/metrics_destination.go b/internal/service/rum/metrics_destination.go index d668632aa9d..4ac0a5e41f3 100644 --- a/internal/service/rum/metrics_destination.go +++ b/internal/service/rum/metrics_destination.go @@ -42,7 +42,7 @@ func ResourceMetricsDestination() *schema.Resource { Required: true, ValidateFunc: validation.StringInSlice(cloudwatchrum.MetricDestination_Values(), false), }, - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, @@ -65,7 +65,7 @@ func resourceMetricsDestinationPut(ctx context.Context, d *schema.ResourceData, Destination: aws.String(d.Get(names.AttrDestination).(string)), } - if v, ok := d.GetOk("destination_arn"); ok { + if v, ok := d.GetOk(names.AttrDestinationARN); ok { input.DestinationArn = aws.String(v.(string)) } @@ -103,7 +103,7 @@ func resourceMetricsDestinationRead(ctx context.Context, d *schema.ResourceData, d.Set("app_monitor_name", d.Id()) d.Set(names.AttrDestination, dest.Destination) - d.Set("destination_arn", dest.DestinationArn) + d.Set(names.AttrDestinationARN, dest.DestinationArn) d.Set("iam_role_arn", dest.IamRoleArn) return nil @@ -117,7 +117,7 @@ func resourceMetricsDestinationDelete(ctx context.Context, d *schema.ResourceDat Destination: aws.String(d.Get(names.AttrDestination).(string)), } - if v, ok := d.GetOk("destination_arn"); ok { + if v, ok := d.GetOk(names.AttrDestinationARN); ok { input.DestinationArn = aws.String(v.(string)) } From 92b49cf585efffbb98ff2188951653982ea90ce1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:51 -0400 Subject: [PATCH 1383/1490] s3: Use constants for strings --- internal/service/s3/bucket_acl.go | 10 +++++----- internal/service/s3/bucket_logging.go | 6 +++--- internal/service/s3/bucket_logging_test.go | 4 ++-- .../service/s3/bucket_replication_configuration.go | 6 +++--- internal/service/s3/canonical_user_id_data_source.go | 4 ++-- .../service/s3/canonical_user_id_data_source_test.go | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/s3/bucket_acl.go b/internal/service/s3/bucket_acl.go index 138cd6fd22f..cdda63ed05d 100644 --- a/internal/service/s3/bucket_acl.go +++ b/internal/service/s3/bucket_acl.go @@ -65,7 +65,7 @@ func resourceBucketACL() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Computed: true, }, @@ -99,7 +99,7 @@ func resourceBucketACL() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -379,7 +379,7 @@ func expandOwner(l []interface{}) *types.Owner { owner := &types.Owner{} - if v, ok := tfMap["display_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDisplayName].(string); ok && v != "" { owner.DisplayName = aws.String(v) } @@ -436,7 +436,7 @@ func flattenACLGrantee(grantee *types.Grantee) []interface{} { } if grantee.DisplayName != nil { - m["display_name"] = aws.ToString(grantee.DisplayName) + m[names.AttrDisplayName] = aws.ToString(grantee.DisplayName) } if grantee.EmailAddress != nil { @@ -462,7 +462,7 @@ func flattenOwner(owner *types.Owner) []interface{} { m := make(map[string]interface{}) if owner.DisplayName != nil { - m["display_name"] = aws.ToString(owner.DisplayName) + m[names.AttrDisplayName] = aws.ToString(owner.DisplayName) } if owner.ID != nil { diff --git a/internal/service/s3/bucket_logging.go b/internal/service/s3/bucket_logging.go index f059fbb9d28..348180399c5 100644 --- a/internal/service/s3/bucket_logging.go +++ b/internal/service/s3/bucket_logging.go @@ -63,7 +63,7 @@ func resourceBucketLogging() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Computed: true, }, @@ -363,7 +363,7 @@ func expandLoggingGrantee(l []interface{}) *types.Grantee { grantee := &types.Grantee{} - if v, ok := tfMap["display_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDisplayName].(string); ok && v != "" { grantee.DisplayName = aws.String(v) } @@ -414,7 +414,7 @@ func flattenLoggingGrantee(g *types.Grantee) []interface{} { } if g.DisplayName != nil { - m["display_name"] = aws.ToString(g.DisplayName) + m[names.AttrDisplayName] = aws.ToString(g.DisplayName) } if g.EmailAddress != nil { diff --git a/internal/service/s3/bucket_logging_test.go b/internal/service/s3/bucket_logging_test.go index d31aaf14134..96fada1ff2e 100644 --- a/internal/service/s3/bucket_logging_test.go +++ b/internal/service/s3/bucket_logging_test.go @@ -135,7 +135,7 @@ func TestAccS3BucketLogging_TargetGrantByID(t *testing.T) { "permission": string(types.BucketLogsPermissionFullControl), }), resource.TestCheckTypeSetElemAttrPair(resourceName, "target_grant.*.grantee.0.id", "data.aws_canonical_user_id.current", names.AttrID), - resource.TestCheckTypeSetElemAttrPair(resourceName, "target_grant.*.grantee.0.display_name", "data.aws_canonical_user_id.current", "display_name"), + resource.TestCheckTypeSetElemAttrPair(resourceName, "target_grant.*.grantee.0.display_name", "data.aws_canonical_user_id.current", names.AttrDisplayName), ), }, { @@ -153,7 +153,7 @@ func TestAccS3BucketLogging_TargetGrantByID(t *testing.T) { "grantee.0.type": string(types.TypeCanonicalUser), "permission": string(types.BucketLogsPermissionRead), }), - resource.TestCheckTypeSetElemAttrPair(resourceName, "target_grant.*.grantee.0.display_name", "data.aws_canonical_user_id.current", "display_name"), + resource.TestCheckTypeSetElemAttrPair(resourceName, "target_grant.*.grantee.0.display_name", "data.aws_canonical_user_id.current", names.AttrDisplayName), ), }, { diff --git a/internal/service/s3/bucket_replication_configuration.go b/internal/service/s3/bucket_replication_configuration.go index 197e5e8d060..5c1e40bf8f9 100644 --- a/internal/service/s3/bucket_replication_configuration.go +++ b/internal/service/s3/bucket_replication_configuration.go @@ -98,7 +98,7 @@ func resourceBucketReplicationConfiguration() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "encryption_configuration": { + names.AttrEncryptionConfiguration: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -569,7 +569,7 @@ func expandDestination(l []interface{}) *types.Destination { result.Bucket = aws.String(v) } - if v, ok := tfMap["encryption_configuration"].([]interface{}); ok && len(v) > 0 && v[0] != nil { + if v, ok := tfMap[names.AttrEncryptionConfiguration].([]interface{}); ok && len(v) > 0 && v[0] != nil { result.EncryptionConfiguration = expandEncryptionConfiguration(v) } @@ -948,7 +948,7 @@ func flattenDestination(dest *types.Destination) []interface{} { } if dest.EncryptionConfiguration != nil { - m["encryption_configuration"] = flattenEncryptionConfiguration(dest.EncryptionConfiguration) + m[names.AttrEncryptionConfiguration] = flattenEncryptionConfiguration(dest.EncryptionConfiguration) } if dest.Metrics != nil { diff --git a/internal/service/s3/canonical_user_id_data_source.go b/internal/service/s3/canonical_user_id_data_source.go index 89b1824ff1f..80bc631d0a1 100644 --- a/internal/service/s3/canonical_user_id_data_source.go +++ b/internal/service/s3/canonical_user_id_data_source.go @@ -20,7 +20,7 @@ func dataSourceCanonicalUserID() *schema.Resource { ReadWithoutTimeout: dataSourceCanonicalUserIDRead, Schema: map[string]*schema.Schema{ - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Computed: true, }, @@ -43,7 +43,7 @@ func dataSourceCanonicalUserIDRead(ctx context.Context, d *schema.ResourceData, } d.SetId(aws.ToString(output.Owner.ID)) - d.Set("display_name", output.Owner.DisplayName) + d.Set(names.AttrDisplayName, output.Owner.DisplayName) return diags } diff --git a/internal/service/s3/canonical_user_id_data_source_test.go b/internal/service/s3/canonical_user_id_data_source_test.go index 18955b6d56d..fd3bda18172 100644 --- a/internal/service/s3/canonical_user_id_data_source_test.go +++ b/internal/service/s3/canonical_user_id_data_source_test.go @@ -23,7 +23,7 @@ func TestAccS3CanonicalUserIDDataSource_basic(t *testing.T) { { Config: testAccCanonicalUserIDDataSourceConfig_basic, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrSet(dataSourceName, "display_name"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrDisplayName), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrID), ), }, From cb3aed2511eb940d55f79f2dfe49da0b8b1abe3c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:51 -0400 Subject: [PATCH 1384/1490] s3control: Use constants for strings --- internal/service/s3control/bucket.go | 4 ++-- internal/service/s3control/bucket_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/s3control/bucket.go b/internal/service/s3control/bucket.go index e065d79c39d..71d0db65263 100644 --- a/internal/service/s3control/bucket.go +++ b/internal/service/s3control/bucket.go @@ -61,7 +61,7 @@ func resourceBucket() *schema.Resource { validation.StringMatch(regexache.MustCompile(`[0-9a-z]$`), "must end with lowercase letter or number"), ), }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -140,7 +140,7 @@ func resourceBucketRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrARN, d.Id()) d.Set(names.AttrBucket, output.Bucket) if output.CreationDate != nil { - d.Set("creation_date", aws.ToTime(output.CreationDate).Format(time.RFC3339)) + d.Set(names.AttrCreationDate, aws.ToTime(output.CreationDate).Format(time.RFC3339)) } d.Set("outpost_id", arnResourceParts[1]) d.Set("public_access_block_enabled", output.PublicAccessBlockEnabled) diff --git a/internal/service/s3control/bucket_test.go b/internal/service/s3control/bucket_test.go index 3b8ced60efd..588face1fa7 100644 --- a/internal/service/s3control/bucket_test.go +++ b/internal/service/s3control/bucket_test.go @@ -37,7 +37,7 @@ func TestAccS3ControlBucket_basic(t *testing.T) { testAccCheckBucketExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "s3-outposts", regexache.MustCompile(fmt.Sprintf("outpost/[^/]+/bucket/%s", rName))), resource.TestCheckResourceAttr(resourceName, names.AttrBucket, rName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(resourceName, "outpost_id", "data.aws_outposts_outpost.test", names.AttrID), resource.TestCheckResourceAttr(resourceName, "public_access_block_enabled", "true"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), From 5f3d18728d8a194e483402d0a5cfcdfeb946d13d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:51 -0400 Subject: [PATCH 1385/1490] s3outposts: Use constants for strings --- internal/service/s3outposts/endpoint.go | 4 ++-- internal/service/s3outposts/endpoint_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/s3outposts/endpoint.go b/internal/service/s3outposts/endpoint.go index a79fb7dcdad..a53cb5bb33e 100644 --- a/internal/service/s3outposts/endpoint.go +++ b/internal/service/s3outposts/endpoint.go @@ -50,7 +50,7 @@ func ResourceEndpoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_time": { + names.AttrCreationTime: { Type: schema.TypeString, Computed: true, }, @@ -147,7 +147,7 @@ func resourceEndpointRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrARN, endpoint.EndpointArn) d.Set("cidr_block", endpoint.CidrBlock) if endpoint.CreationTime != nil { - d.Set("creation_time", aws.TimeValue(endpoint.CreationTime).Format(time.RFC3339)) + d.Set(names.AttrCreationTime, aws.TimeValue(endpoint.CreationTime).Format(time.RFC3339)) } d.Set("customer_owned_ipv4_pool", endpoint.CustomerOwnedIpv4Pool) if err := d.Set("network_interfaces", flattenNetworkInterfaces(endpoint.NetworkInterfaces)); err != nil { diff --git a/internal/service/s3outposts/endpoint_test.go b/internal/service/s3outposts/endpoint_test.go index 0c9558b5cb7..ae872d5a4da 100644 --- a/internal/service/s3outposts/endpoint_test.go +++ b/internal/service/s3outposts/endpoint_test.go @@ -36,7 +36,7 @@ func TestAccS3OutpostsEndpoint_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckEndpointExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "s3-outposts", regexache.MustCompile(`outpost/[^/]+/endpoint/[0-9a-z]+`)), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(resourceName, "cidr_block", "aws_vpc.test", "cidr_block"), resource.TestCheckResourceAttr(resourceName, "network_interfaces.#", "4"), resource.TestCheckResourceAttrPair(resourceName, "outpost_id", "data.aws_outposts_outpost.test", names.AttrID), @@ -72,7 +72,7 @@ func TestAccS3OutpostsEndpoint_private(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckEndpointExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "s3-outposts", regexache.MustCompile(`outpost/[^/]+/endpoint/[0-9a-z]+`)), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(resourceName, "cidr_block", "aws_vpc.test", "cidr_block"), resource.TestCheckResourceAttr(resourceName, "network_interfaces.#", "4"), resource.TestCheckResourceAttrPair(resourceName, "outpost_id", "data.aws_outposts_outpost.test", names.AttrID), @@ -108,7 +108,7 @@ func TestAccS3OutpostsEndpoint_customerOwnedIPv4Pool(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckEndpointExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "s3-outposts", regexache.MustCompile(`outpost/[^/]+/endpoint/[0-9a-z]+`)), - resource.TestCheckResourceAttrSet(resourceName, "creation_time"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationTime), resource.TestCheckResourceAttrPair(resourceName, "cidr_block", "aws_vpc.test", "cidr_block"), resource.TestCheckResourceAttr(resourceName, "network_interfaces.#", "4"), resource.TestCheckResourceAttrPair(resourceName, "outpost_id", "data.aws_outposts_outpost.test", names.AttrID), From cc5b5bf600c0b18cd0af0c74246a104d42b99ee3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:51 -0400 Subject: [PATCH 1386/1490] sagemaker: Use constants for strings --- internal/service/sagemaker/app_image_config.go | 6 +++--- internal/service/sagemaker/image.go | 10 +++++----- internal/service/sagemaker/image_test.go | 6 +++--- internal/service/sagemaker/model.go | 6 +++--- internal/service/sagemaker/model_test.go | 2 +- internal/service/sagemaker/monitoring_schedule.go | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/sagemaker/app_image_config.go b/internal/service/sagemaker/app_image_config.go index 2cc1158b39b..7631c80c08a 100644 --- a/internal/service/sagemaker/app_image_config.go +++ b/internal/service/sagemaker/app_image_config.go @@ -216,7 +216,7 @@ func ResourceAppImageConfig() *schema.Resource { MaxItems: 5, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(1, 1024), @@ -413,7 +413,7 @@ func expandKernelGatewayImageConfigKernelSpecs(tfList []interface{}) []*sagemake Name: aws.String(tfMap[names.AttrName].(string)), } - if v, ok := tfMap["display_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDisplayName].(string); ok && v != "" { kernelSpec.DisplayName = aws.String(v) } @@ -464,7 +464,7 @@ func flattenKernelGatewayImageConfigKernelSpecs(kernelSpecs []*sagemaker.KernelS kernelSpec[names.AttrName] = aws.StringValue(raw.Name) if raw.DisplayName != nil { - kernelSpec["display_name"] = aws.StringValue(raw.DisplayName) + kernelSpec[names.AttrDisplayName] = aws.StringValue(raw.DisplayName) } res = append(res, kernelSpec) diff --git a/internal/service/sagemaker/image.go b/internal/service/sagemaker/image.go index 94bce8b5a1d..6b43328b233 100644 --- a/internal/service/sagemaker/image.go +++ b/internal/service/sagemaker/image.go @@ -55,7 +55,7 @@ func ResourceImage() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(1, 128), @@ -84,7 +84,7 @@ func resourceImageCreate(ctx context.Context, d *schema.ResourceData, meta inter Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("display_name"); ok { + if v, ok := d.GetOk(names.AttrDisplayName); ok { input.DisplayName = aws.String(v.(string)) } @@ -126,7 +126,7 @@ func resourceImageRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set("image_name", image.ImageName) d.Set(names.AttrARN, arn) d.Set(names.AttrRoleARN, image.RoleArn) - d.Set("display_name", image.DisplayName) + d.Set(names.AttrDisplayName, image.DisplayName) d.Set(names.AttrDescription, image.Description) return diags @@ -153,8 +153,8 @@ func resourceImageUpdate(ctx context.Context, d *schema.ResourceData, meta inter needsUpdate = true } - if d.HasChange("display_name") { - if v, ok := d.GetOk("display_name"); ok { + if d.HasChange(names.AttrDisplayName) { + if v, ok := d.GetOk(names.AttrDisplayName); ok { input.DisplayName = aws.String(v.(string)) } else { deleteProperties = append(deleteProperties, aws.String("DisplayName")) diff --git a/internal/service/sagemaker/image_test.go b/internal/service/sagemaker/image_test.go index 7b2f13b7ba3..d9085e6c3c6 100644 --- a/internal/service/sagemaker/image_test.go +++ b/internal/service/sagemaker/image_test.go @@ -109,7 +109,7 @@ func TestAccSageMakerImage_displayName(t *testing.T) { Config: testAccImageConfig_displayName(rName), Check: resource.ComposeTestCheckFunc( testAccCheckImageExists(ctx, resourceName, &image), - resource.TestCheckResourceAttr(resourceName, "display_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, rName), ), }, { @@ -121,14 +121,14 @@ func TestAccSageMakerImage_displayName(t *testing.T) { Config: testAccImageConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckImageExists(ctx, resourceName, &image), - resource.TestCheckResourceAttr(resourceName, "display_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, ""), ), }, { Config: testAccImageConfig_displayName(rName), Check: resource.ComposeTestCheckFunc( testAccCheckImageExists(ctx, resourceName, &image), - resource.TestCheckResourceAttr(resourceName, "display_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, rName), ), }, }, diff --git a/internal/service/sagemaker/model.go b/internal/service/sagemaker/model.go index 84e369ffee0..bf69f55eb0a 100644 --- a/internal/service/sagemaker/model.go +++ b/internal/service/sagemaker/model.go @@ -159,7 +159,7 @@ func ResourceModel() *schema.Resource { Optional: true, ForceNew: true, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -355,7 +355,7 @@ func resourceModelCreate(ctx context.Context, d *schema.ResourceData, meta inter createOpts.Containers = expandContainers(v.([]interface{})) } - if v, ok := d.GetOk("execution_role_arn"); ok { + if v, ok := d.GetOk(names.AttrExecutionRoleARN); ok { createOpts.ExecutionRoleArn = aws.String(v.(string)) } @@ -418,7 +418,7 @@ func resourceModelRead(ctx context.Context, d *schema.ResourceData, meta interfa arn := aws.StringValue(model.ModelArn) d.Set(names.AttrARN, arn) d.Set(names.AttrName, model.ModelName) - d.Set("execution_role_arn", model.ExecutionRoleArn) + d.Set(names.AttrExecutionRoleARN, model.ExecutionRoleArn) d.Set("enable_network_isolation", model.EnableNetworkIsolation) if err := d.Set("primary_container", flattenContainer(model.PrimaryContainer)); err != nil { diff --git a/internal/service/sagemaker/model_test.go b/internal/service/sagemaker/model_test.go index 11ac82b9d2d..a71e6c5bcaa 100644 --- a/internal/service/sagemaker/model_test.go +++ b/internal/service/sagemaker/model_test.go @@ -40,7 +40,7 @@ func TestAccSageMakerModel_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "primary_container.0.image", "data.aws_sagemaker_prebuilt_ecr_image.test", "registry_path"), resource.TestCheckResourceAttr(resourceName, "primary_container.0.mode", "SingleModel"), resource.TestCheckResourceAttr(resourceName, "primary_container.0.environment.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "execution_role_arn", "aws_iam_role.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExecutionRoleARN, "aws_iam_role.test", names.AttrARN), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "sagemaker", fmt.Sprintf("model/%s", rName)), resource.TestCheckResourceAttr(resourceName, "enable_network_isolation", "false"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), diff --git a/internal/service/sagemaker/monitoring_schedule.go b/internal/service/sagemaker/monitoring_schedule.go index 31655bc0abc..8c09595ed51 100644 --- a/internal/service/sagemaker/monitoring_schedule.go +++ b/internal/service/sagemaker/monitoring_schedule.go @@ -72,7 +72,7 @@ func ResourceMonitoringSchedule() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -259,7 +259,7 @@ func expandScheduleConfig(configured []interface{}) *sagemaker.ScheduleConfig { c := &sagemaker.ScheduleConfig{} - if v, ok := m["schedule_expression"].(string); ok && v != "" { + if v, ok := m[names.AttrScheduleExpression].(string); ok && v != "" { c.ScheduleExpression = aws.String(v) } @@ -296,7 +296,7 @@ func flattenScheduleConfig(config *sagemaker.ScheduleConfig) []map[string]interf m := map[string]interface{}{} if config.ScheduleExpression != nil { - m["schedule_expression"] = aws.StringValue(config.ScheduleExpression) + m[names.AttrScheduleExpression] = aws.StringValue(config.ScheduleExpression) } return []map[string]interface{}{m} From 8745a2df747396328a327fb97f1d167c1de61847 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:52 -0400 Subject: [PATCH 1387/1490] scheduler: Use constants for strings --- internal/service/scheduler/flex.go | 4 ++-- internal/service/scheduler/schedule.go | 10 +++++----- internal/service/scheduler/schedule_group.go | 4 ++-- internal/service/scheduler/schedule_group_test.go | 2 +- internal/service/scheduler/schedule_test.go | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/scheduler/flex.go b/internal/service/scheduler/flex.go index 641c5b0d7e0..0a291b97981 100644 --- a/internal/service/scheduler/flex.go +++ b/internal/service/scheduler/flex.go @@ -107,7 +107,7 @@ func expandECSParameters(ctx context.Context, tfMap map[string]interface{}) *typ a.LaunchType = types.LaunchType(v) } - if v, ok := tfMap["network_configuration"].([]interface{}); ok && len(v) > 0 && v[0] != nil { + if v, ok := tfMap[names.AttrNetworkConfiguration].([]interface{}); ok && len(v) > 0 && v[0] != nil { a.NetworkConfiguration = expandNetworkConfiguration(v[0].(map[string]interface{})) } @@ -191,7 +191,7 @@ func flattenECSParameters(ctx context.Context, apiObject *types.EcsParameters) m } if v := apiObject.NetworkConfiguration; v != nil { - m["network_configuration"] = []interface{}{flattenNetworkConfiguration(v)} + m[names.AttrNetworkConfiguration] = []interface{}{flattenNetworkConfiguration(v)} } if v := apiObject.PlacementConstraints; len(v) > 0 { diff --git a/internal/service/scheduler/schedule.go b/internal/service/scheduler/schedule.go index 0e43c177bb8..967a917f4ed 100644 --- a/internal/service/scheduler/schedule.go +++ b/internal/service/scheduler/schedule.go @@ -114,7 +114,7 @@ func resourceSchedule() *schema.Resource { validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]+$`), `The name must consist of alphanumerics, hyphens, and underscores.`), )), }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Required: true, ValidateDiagFunc: validation.ToDiagFunc(validation.StringLenBetween(1, 256)), @@ -210,7 +210,7 @@ func resourceSchedule() *schema.Resource { Optional: true, ValidateDiagFunc: enum.Validate[types.LaunchType](), }, - "network_configuration": { + names.AttrNetworkConfiguration: { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -438,7 +438,7 @@ func resourceScheduleCreate(ctx context.Context, d *schema.ResourceData, meta in in := &scheduler.CreateScheduleInput{ Name: aws.String(name), - ScheduleExpression: aws.String(d.Get("schedule_expression").(string)), + ScheduleExpression: aws.String(d.Get(names.AttrScheduleExpression).(string)), } if v, ok := d.Get(names.AttrDescription).(string); ok && v != "" { @@ -547,7 +547,7 @@ func resourceScheduleRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set(names.AttrKMSKeyARN, out.KmsKeyArn) d.Set(names.AttrName, out.Name) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.ToString(out.Name))) - d.Set("schedule_expression", out.ScheduleExpression) + d.Set(names.AttrScheduleExpression, out.ScheduleExpression) d.Set("schedule_expression_timezone", out.ScheduleExpressionTimezone) if out.StartDate != nil { @@ -572,7 +572,7 @@ func resourceScheduleUpdate(ctx context.Context, d *schema.ResourceData, meta in FlexibleTimeWindow: expandFlexibleTimeWindow(d.Get("flexible_time_window").([]interface{})[0].(map[string]interface{})), GroupName: aws.String(d.Get("group_name").(string)), Name: aws.String(d.Get(names.AttrName).(string)), - ScheduleExpression: aws.String(d.Get("schedule_expression").(string)), + ScheduleExpression: aws.String(d.Get(names.AttrScheduleExpression).(string)), Target: expandTarget(ctx, d.Get(names.AttrTarget).([]interface{})[0].(map[string]interface{})), } diff --git a/internal/service/scheduler/schedule_group.go b/internal/service/scheduler/schedule_group.go index 680fe690b12..53509d022f0 100644 --- a/internal/service/scheduler/schedule_group.go +++ b/internal/service/scheduler/schedule_group.go @@ -50,7 +50,7 @@ func ResourceScheduleGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -138,7 +138,7 @@ func resourceScheduleGroupRead(ctx context.Context, d *schema.ResourceData, meta } d.Set(names.AttrARN, out.Arn) - d.Set("creation_date", aws.ToTime(out.CreationDate).Format(time.RFC3339)) + d.Set(names.AttrCreationDate, aws.ToTime(out.CreationDate).Format(time.RFC3339)) d.Set("last_modification_date", aws.ToTime(out.LastModificationDate).Format(time.RFC3339)) d.Set(names.AttrName, out.Name) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.ToString(out.Name))) diff --git a/internal/service/scheduler/schedule_group_test.go b/internal/service/scheduler/schedule_group_test.go index 5beda16b8a9..69641d97866 100644 --- a/internal/service/scheduler/schedule_group_test.go +++ b/internal/service/scheduler/schedule_group_test.go @@ -47,7 +47,7 @@ func TestAccSchedulerScheduleGroup_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckScheduleGroupExists(ctx, resourceName, &scheduleGroup), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "scheduler", regexache.MustCompile(regexp.QuoteMeta(`schedule-group/`+rName))), - resource.TestCheckResourceAttrWith(resourceName, "creation_date", func(actual string) error { + resource.TestCheckResourceAttrWith(resourceName, names.AttrCreationDate, func(actual string) error { expect := scheduleGroup.CreationDate.Format(time.RFC3339) if actual != expect { return fmt.Errorf("expected value to be a formatted date") diff --git a/internal/service/scheduler/schedule_test.go b/internal/service/scheduler/schedule_test.go index 6333743b809..e7bb6037bb7 100644 --- a/internal/service/scheduler/schedule_test.go +++ b/internal/service/scheduler/schedule_test.go @@ -211,7 +211,7 @@ func TestAccSchedulerSchedule_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrID, fmt.Sprintf("default/%s", name)), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyARN, ""), resource.TestCheckResourceAttr(resourceName, names.AttrName, name), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", "rate(1 hour)"), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, "rate(1 hour)"), resource.TestCheckResourceAttr(resourceName, "schedule_expression_timezone", "UTC"), resource.TestCheckResourceAttr(resourceName, "start_date", ""), resource.TestCheckResourceAttr(resourceName, names.AttrState, "ENABLED"), @@ -644,7 +644,7 @@ func TestAccSchedulerSchedule_scheduleExpression(t *testing.T) { Config: testAccScheduleConfig_scheduleExpression(name, "rate(1 hour)"), Check: resource.ComposeTestCheckFunc( testAccCheckScheduleExists(ctx, t, resourceName, &schedule), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", "rate(1 hour)"), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, "rate(1 hour)"), ), }, { @@ -656,7 +656,7 @@ func TestAccSchedulerSchedule_scheduleExpression(t *testing.T) { Config: testAccScheduleConfig_scheduleExpression(name, "rate(1 day)"), Check: resource.ComposeTestCheckFunc( testAccCheckScheduleExists(ctx, t, resourceName, &schedule), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", "rate(1 day)"), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, "rate(1 day)"), ), }, { From b116d3d19be37686f426e7f38adf0eda4bc0e379 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:52 -0400 Subject: [PATCH 1388/1490] secretsmanager: Use constants for strings --- internal/service/secretsmanager/secret_rotation.go | 6 +++--- .../service/secretsmanager/secret_rotation_data_source.go | 2 +- internal/service/secretsmanager/secret_rotation_migrate.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/secretsmanager/secret_rotation.go b/internal/service/secretsmanager/secret_rotation.go index 1faeb4e3b25..ecce9df6dec 100644 --- a/internal/service/secretsmanager/secret_rotation.go +++ b/internal/service/secretsmanager/secret_rotation.go @@ -76,7 +76,7 @@ func resourceSecretRotation() *schema.Resource { Optional: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`[0-9h]+`), ""), }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"rotation_rules.0.automatically_after_days"}, @@ -219,7 +219,7 @@ func expandRotationRules(l []interface{}) *types.RotationRulesType { rules.Duration = aws.String(v) } - if v, ok := tfMap["schedule_expression"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrScheduleExpression].(string); ok && v != "" { rules.ScheduleExpression = aws.String(v) } @@ -243,7 +243,7 @@ func flattenRotationRules(rules *types.RotationRulesType) []interface{} { } if v := rules.ScheduleExpression; v != nil { - m["schedule_expression"] = aws.ToString(v) + m[names.AttrScheduleExpression] = aws.ToString(v) } return []interface{}{m} diff --git a/internal/service/secretsmanager/secret_rotation_data_source.go b/internal/service/secretsmanager/secret_rotation_data_source.go index 05bd8551ff7..06e64615c03 100644 --- a/internal/service/secretsmanager/secret_rotation_data_source.go +++ b/internal/service/secretsmanager/secret_rotation_data_source.go @@ -40,7 +40,7 @@ func dataSourceSecretRotation() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/secretsmanager/secret_rotation_migrate.go b/internal/service/secretsmanager/secret_rotation_migrate.go index 7a498f12c8d..b247181d8c5 100644 --- a/internal/service/secretsmanager/secret_rotation_migrate.go +++ b/internal/service/secretsmanager/secret_rotation_migrate.go @@ -42,7 +42,7 @@ func secretRotationResourceV0() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Optional: true, }, From 2f58a2e3adab80d66e927678ebd861507fff1c2a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:52 -0400 Subject: [PATCH 1389/1490] securityhub: Use constants for strings --- internal/service/securityhub/automation_rule.go | 2 +- internal/service/securityhub/insight.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/securityhub/automation_rule.go b/internal/service/securityhub/automation_rule.go index d4ea4a919a7..4fa08fa15d9 100644 --- a/internal/service/securityhub/automation_rule.go +++ b/internal/service/securityhub/automation_rule.go @@ -227,7 +227,7 @@ func (r *automationRuleResource) Schema(ctx context.Context, request resource.Sc "resource_partition": stringFilterSchemaFramework(ctx), "resource_region": stringFilterSchemaFramework(ctx), "resource_tags": mapFilterSchemaFramework(ctx), - "resource_type": stringFilterSchemaFramework(ctx), + names.AttrResourceType: stringFilterSchemaFramework(ctx), "severity_label": stringFilterSchemaFramework(ctx), "source_url": stringFilterSchemaFramework(ctx), "title": stringFilterSchemaFramework(ctx), diff --git a/internal/service/securityhub/insight.go b/internal/service/securityhub/insight.go index e86d640ac99..784f517f6e7 100644 --- a/internal/service/securityhub/insight.go +++ b/internal/service/securityhub/insight.go @@ -118,7 +118,7 @@ func resourceInsight() *schema.Resource { "resource_partition": stringFilterSchema(), "resource_region": stringFilterSchema(), "resource_tags": mapFilterSchema(), - "resource_type": stringFilterSchema(), + names.AttrResourceType: stringFilterSchema(), "severity_label": stringFilterSchema(), "source_url": stringFilterSchema(), "threat_intel_indicator_category": stringFilterSchema(), @@ -798,7 +798,7 @@ func expandSecurityFindingFilters(l []interface{}) *types.AwsSecurityFindingFilt filters.ResourceTags = expandMapFilters(v.List()) } - if v, ok := tfMap["resource_type"].(*schema.Set); ok && v.Len() > 0 { + if v, ok := tfMap[names.AttrResourceType].(*schema.Set); ok && v.Len() > 0 { filters.ResourceType = expandStringFilters(v.List()) } @@ -1211,7 +1211,7 @@ func flattenSecurityFindingFilters(filters *types.AwsSecurityFindingFilters) []i "resource_partition": flattenStringFilters(filters.ResourcePartition), "resource_region": flattenStringFilters(filters.ResourceRegion), "resource_tags": flattenMapFilters(filters.ResourceTags), - "resource_type": flattenStringFilters(filters.ResourceType), + names.AttrResourceType: flattenStringFilters(filters.ResourceType), "severity_label": flattenStringFilters(filters.SeverityLabel), "source_url": flattenStringFilters(filters.ThreatIntelIndicatorSourceUrl), "threat_intel_indicator_category": flattenStringFilters(filters.ThreatIntelIndicatorCategory), From e05cc19c44ec85f293b45b53b4db00aa345c4651 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:52 -0400 Subject: [PATCH 1390/1490] securitylake: Use constants for strings --- internal/service/securitylake/data_lake.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/securitylake/data_lake.go b/internal/service/securitylake/data_lake.go index a98ac4c9a82..c62765c1012 100644 --- a/internal/service/securitylake/data_lake.go +++ b/internal/service/securitylake/data_lake.go @@ -87,7 +87,7 @@ func (r *dataLakeResource) Schema(ctx context.Context, request resource.SchemaRe }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "encryption_configuration": schema.ListAttribute{ + names.AttrEncryptionConfiguration: schema.ListAttribute{ CustomType: fwtypes.NewListNestedObjectTypeOf[dataLakeEncryptionConfigurationModel](ctx), Optional: true, Computed: true, From 447418a3f35829a4f66a4199799fc22bdfc06993 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:52 -0400 Subject: [PATCH 1391/1490] sesv2: Use constants for strings --- internal/service/sesv2/contact_list.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/sesv2/contact_list.go b/internal/service/sesv2/contact_list.go index 66d64f73aac..6ab5fc13b26 100644 --- a/internal/service/sesv2/contact_list.go +++ b/internal/service/sesv2/contact_list.go @@ -77,7 +77,7 @@ func ResourceContactList() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Required: true, }, @@ -270,7 +270,7 @@ func expandTopic(tfMap map[string]interface{}) *types.Topic { apiObject.Description = aws.String(v) } - if v, ok := tfMap["display_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrDisplayName].(string); ok && v != "" { apiObject.DisplayName = aws.String(v) } @@ -309,7 +309,7 @@ func flattenTopic(apiObject *types.Topic) map[string]interface{} { } if v := apiObject.DisplayName; v != nil { - tfMap["display_name"] = aws.ToString(v) + tfMap[names.AttrDisplayName] = aws.ToString(v) } if v := apiObject.TopicName; v != nil { From 7ff0cb8bcbde33224bd56a79a7578c8e8ed8b5c3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:52 -0400 Subject: [PATCH 1392/1490] sfn: Use constants for strings --- internal/service/sfn/activity.go | 4 ++-- internal/service/sfn/activity_data_source.go | 6 +++--- .../service/sfn/activity_data_source_test.go | 4 ++-- internal/service/sfn/activity_test.go | 2 +- internal/service/sfn/alias.go | 4 ++-- internal/service/sfn/alias_data_source.go | 4 ++-- internal/service/sfn/alias_data_source_test.go | 2 +- internal/service/sfn/alias_test.go | 2 +- internal/service/sfn/state_machine.go | 6 +++--- .../service/sfn/state_machine_data_source.go | 4 ++-- .../sfn/state_machine_data_source_test.go | 2 +- internal/service/sfn/state_machine_test.go | 16 ++++++++-------- 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/internal/service/sfn/activity.go b/internal/service/sfn/activity.go index 03af724b10a..9c19749d45b 100644 --- a/internal/service/sfn/activity.go +++ b/internal/service/sfn/activity.go @@ -36,7 +36,7 @@ func ResourceActivity() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -89,7 +89,7 @@ func resourceActivityRead(ctx context.Context, d *schema.ResourceData, meta inte return diag.Errorf("reading Step Functions Activity (%s): %s", d.Id(), err) } - d.Set("creation_date", output.CreationDate.Format(time.RFC3339)) + d.Set(names.AttrCreationDate, output.CreationDate.Format(time.RFC3339)) d.Set(names.AttrName, output.Name) return nil diff --git a/internal/service/sfn/activity_data_source.go b/internal/service/sfn/activity_data_source.go index 0bb62f63f92..d8b44815c6b 100644 --- a/internal/service/sfn/activity_data_source.go +++ b/internal/service/sfn/activity_data_source.go @@ -30,7 +30,7 @@ func DataSourceActivity() *schema.Resource { names.AttrName, }, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -83,7 +83,7 @@ func dataSourceActivityRead(ctx context.Context, d *schema.ResourceData, meta in arn := aws.StringValue(activity.ActivityArn) d.SetId(arn) d.Set(names.AttrARN, arn) - d.Set("creation_date", activity.CreationDate.Format(time.RFC3339)) + d.Set(names.AttrCreationDate, activity.CreationDate.Format(time.RFC3339)) d.Set(names.AttrName, activity.Name) } else if v, ok := d.GetOk(names.AttrARN); ok { arn := v.(string) @@ -96,7 +96,7 @@ func dataSourceActivityRead(ctx context.Context, d *schema.ResourceData, meta in arn = aws.StringValue(activity.ActivityArn) d.SetId(arn) d.Set(names.AttrARN, arn) - d.Set("creation_date", activity.CreationDate.Format(time.RFC3339)) + d.Set(names.AttrCreationDate, activity.CreationDate.Format(time.RFC3339)) d.Set(names.AttrName, activity.Name) } diff --git a/internal/service/sfn/activity_data_source_test.go b/internal/service/sfn/activity_data_source_test.go index 14894bc06ab..6091fcd5531 100644 --- a/internal/service/sfn/activity_data_source_test.go +++ b/internal/service/sfn/activity_data_source_test.go @@ -29,11 +29,11 @@ func TestAccSFNActivityDataSource_basic(t *testing.T) { Config: testAccActivityDataSourceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(resourceName, names.AttrID, dataSource1Name, names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "creation_date", dataSource1Name, "creation_date"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCreationDate, dataSource1Name, names.AttrCreationDate), resource.TestCheckResourceAttrPair(resourceName, names.AttrName, dataSource1Name, names.AttrName), resource.TestCheckResourceAttrPair(resourceName, names.AttrID, dataSource2Name, names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "creation_date", dataSource2Name, "creation_date"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCreationDate, dataSource2Name, names.AttrCreationDate), resource.TestCheckResourceAttrPair(resourceName, names.AttrName, dataSource2Name, names.AttrName), ), }, diff --git a/internal/service/sfn/activity_test.go b/internal/service/sfn/activity_test.go index a8d722f3ca4..743a876ee2a 100644 --- a/internal/service/sfn/activity_test.go +++ b/internal/service/sfn/activity_test.go @@ -35,7 +35,7 @@ func TestAccSFNActivity_basic(t *testing.T) { Config: testAccActivityConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckActivityExists(ctx, resourceName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), diff --git a/internal/service/sfn/alias.go b/internal/service/sfn/alias.go index 801c7f9ce59..631794e03e5 100644 --- a/internal/service/sfn/alias.go +++ b/internal/service/sfn/alias.go @@ -43,7 +43,7 @@ func ResourceAlias() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -125,7 +125,7 @@ func resourceAliasRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set(names.AttrARN, out.StateMachineAliasArn) d.Set(names.AttrName, out.Name) d.Set(names.AttrDescription, out.Description) - d.Set("creation_date", aws.TimeValue(out.CreationDate).Format(time.RFC3339)) + d.Set(names.AttrCreationDate, aws.TimeValue(out.CreationDate).Format(time.RFC3339)) d.SetId(aws.StringValue(out.StateMachineAliasArn)) if err := d.Set("routing_configuration", flattenAliasRoutingConfiguration(out.RoutingConfiguration)); err != nil { diff --git a/internal/service/sfn/alias_data_source.go b/internal/service/sfn/alias_data_source.go index 721f1acfd2f..214331c703e 100644 --- a/internal/service/sfn/alias_data_source.go +++ b/internal/service/sfn/alias_data_source.go @@ -27,7 +27,7 @@ func DataSourceAlias() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -105,7 +105,7 @@ func dataSourceAliasRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set(names.AttrARN, output.StateMachineAliasArn) d.Set(names.AttrName, output.Name) d.Set(names.AttrDescription, output.Description) - d.Set("creation_date", aws.TimeValue(output.CreationDate).Format(time.RFC3339)) + d.Set(names.AttrCreationDate, aws.TimeValue(output.CreationDate).Format(time.RFC3339)) if err := d.Set("routing_configuration", flattenAliasRoutingConfiguration(output.RoutingConfiguration)); err != nil { return create.DiagError(names.SFN, create.ErrActionSetting, ResNameAlias, d.Id(), err) diff --git a/internal/service/sfn/alias_data_source_test.go b/internal/service/sfn/alias_data_source_test.go index f67383ef5a2..16f12ae3f07 100644 --- a/internal/service/sfn/alias_data_source_test.go +++ b/internal/service/sfn/alias_data_source_test.go @@ -30,7 +30,7 @@ func TestAccSFNAliasDataSource_basic(t *testing.T) { Config: testAccAliasDataSourceConfig_basic(stateMachineName, aliasName, 10), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(resourceName, names.AttrID, dataSourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "creation_date", dataSourceName, "creation_date"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCreationDate, dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(resourceName, names.AttrDescription, dataSourceName, names.AttrDescription), resource.TestCheckResourceAttrPair(resourceName, names.AttrName, dataSourceName, names.AttrName), ), diff --git a/internal/service/sfn/alias_test.go b/internal/service/sfn/alias_test.go index cc2494a950c..b86b721a1ff 100644 --- a/internal/service/sfn/alias_test.go +++ b/internal/service/sfn/alias_test.go @@ -43,7 +43,7 @@ func TestAccSFNAlias_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckAliasExists(ctx, resourceName, &alias), testAccCheckAliasAttributes(&alias), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttr(resourceName, names.AttrName, aliasName), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "states", functionArnResourcePart), ), diff --git a/internal/service/sfn/state_machine.go b/internal/service/sfn/state_machine.go index 77796172e69..a97cfbc096c 100644 --- a/internal/service/sfn/state_machine.go +++ b/internal/service/sfn/state_machine.go @@ -50,7 +50,7 @@ func ResourceStateMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -221,9 +221,9 @@ func resourceStateMachineRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrARN, output.StateMachineArn) if output.CreationDate != nil { - d.Set("creation_date", aws.TimeValue(output.CreationDate).Format(time.RFC3339)) + d.Set(names.AttrCreationDate, aws.TimeValue(output.CreationDate).Format(time.RFC3339)) } else { - d.Set("creation_date", nil) + d.Set(names.AttrCreationDate, nil) } d.Set("definition", output.Definition) d.Set(names.AttrDescription, output.Description) diff --git a/internal/service/sfn/state_machine_data_source.go b/internal/service/sfn/state_machine_data_source.go index 4170fe55ad7..148a2bf21ac 100644 --- a/internal/service/sfn/state_machine_data_source.go +++ b/internal/service/sfn/state_machine_data_source.go @@ -25,7 +25,7 @@ func DataSourceStateMachine() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "creation_date": { + names.AttrCreationDate: { Type: schema.TypeString, Computed: true, }, @@ -96,7 +96,7 @@ func dataSourceStateMachineRead(ctx context.Context, d *schema.ResourceData, met d.SetId(arn) d.Set(names.AttrARN, output.StateMachineArn) - d.Set("creation_date", output.CreationDate.Format(time.RFC3339)) + d.Set(names.AttrCreationDate, output.CreationDate.Format(time.RFC3339)) d.Set(names.AttrDescription, output.Description) d.Set("definition", output.Definition) d.Set(names.AttrName, output.Name) diff --git a/internal/service/sfn/state_machine_data_source_test.go b/internal/service/sfn/state_machine_data_source_test.go index 26dee42159a..7cf06385434 100644 --- a/internal/service/sfn/state_machine_data_source_test.go +++ b/internal/service/sfn/state_machine_data_source_test.go @@ -27,7 +27,7 @@ func TestAccSFNStateMachineDataSource_basic(t *testing.T) { Config: testAccStateMachineDataSourceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(resourceName, names.AttrID, dataSourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "creation_date", dataSourceName, "creation_date"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCreationDate, dataSourceName, names.AttrCreationDate), resource.TestCheckResourceAttrPair(resourceName, "definition", dataSourceName, "definition"), resource.TestCheckResourceAttrPair(resourceName, names.AttrName, dataSourceName, names.AttrName), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, dataSourceName, names.AttrRoleARN), diff --git a/internal/service/sfn/state_machine_test.go b/internal/service/sfn/state_machine_test.go index 20a56a4e50e..19ccfca3380 100644 --- a/internal/service/sfn/state_machine_test.go +++ b/internal/service/sfn/state_machine_test.go @@ -43,7 +43,7 @@ func TestAccSFNStateMachine_createUpdate(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrStatus, sfn.StateMachineStatusActive), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, ""), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "definition"), resource.TestMatchResourceAttr(resourceName, "definition", regexache.MustCompile(`.*\"MaxAttempts\": 5.*`)), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, roleResourceName, names.AttrARN), @@ -72,7 +72,7 @@ func TestAccSFNStateMachine_createUpdate(t *testing.T) { acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "states", fmt.Sprintf("stateMachine:%s", rName)), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, sfn.StateMachineStatusActive), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestMatchResourceAttr(resourceName, "definition", regexache.MustCompile(`.*\"MaxAttempts\": 10.*`)), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, roleResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "logging_configuration.#", "1"), @@ -109,7 +109,7 @@ func TestAccSFNStateMachine_expressUpdate(t *testing.T) { testAccCheckExists(ctx, resourceName, &sm), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, sfn.StateMachineStatusActive), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "definition"), resource.TestMatchResourceAttr(resourceName, "definition", regexache.MustCompile(`.*\"MaxAttempts\": 5.*`)), resource.TestCheckResourceAttr(resourceName, "revision_id", ""), @@ -130,7 +130,7 @@ func TestAccSFNStateMachine_expressUpdate(t *testing.T) { testAccCheckExists(ctx, resourceName, &sm), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, sfn.StateMachineStatusActive), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestMatchResourceAttr(resourceName, "definition", regexache.MustCompile(`.*\"MaxAttempts\": 10.*`)), resource.TestCheckResourceAttrSet(resourceName, names.AttrRoleARN), resource.TestCheckResourceAttrWith(resourceName, "state_machine_version_arn", func(value string) error { @@ -165,7 +165,7 @@ func TestAccSFNStateMachine_standardUpdate(t *testing.T) { testAccCheckExists(ctx, resourceName, &sm), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, sfn.StateMachineStatusActive), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "definition"), resource.TestMatchResourceAttr(resourceName, "definition", regexache.MustCompile(`.*\"MaxAttempts\": 5.*`)), resource.TestCheckResourceAttr(resourceName, "publish", "true"), @@ -187,7 +187,7 @@ func TestAccSFNStateMachine_standardUpdate(t *testing.T) { testAccCheckExists(ctx, resourceName, &sm), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, sfn.StateMachineStatusActive), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestMatchResourceAttr(resourceName, "definition", regexache.MustCompile(`.*\"MaxAttempts\": 10.*`)), resource.TestCheckResourceAttr(resourceName, "publish", "true"), resource.TestCheckResourceAttrSet(resourceName, names.AttrRoleARN), @@ -418,7 +418,7 @@ func TestAccSFNStateMachine_expressLogging(t *testing.T) { testAccCheckExists(ctx, resourceName, &sm), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, sfn.StateMachineStatusActive), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestCheckResourceAttrSet(resourceName, "definition"), resource.TestMatchResourceAttr(resourceName, "definition", regexache.MustCompile(`.*\"MaxAttempts\": 5.*`)), resource.TestCheckResourceAttrSet(resourceName, names.AttrRoleARN), @@ -432,7 +432,7 @@ func TestAccSFNStateMachine_expressLogging(t *testing.T) { testAccCheckExists(ctx, resourceName, &sm), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, sfn.StateMachineStatusActive), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttrSet(resourceName, "creation_date"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCreationDate), resource.TestMatchResourceAttr(resourceName, "definition", regexache.MustCompile(`.*\"MaxAttempts\": 5.*`)), resource.TestCheckResourceAttrSet(resourceName, names.AttrRoleARN), resource.TestCheckResourceAttr(resourceName, "logging_configuration.#", "1"), From 0c19326f3691183e0d8230056861509758abc066 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:53 -0400 Subject: [PATCH 1393/1490] shield: Use constants for strings --- internal/service/shield/protection_group.go | 10 +++++----- internal/service/shield/protection_group_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/shield/protection_group.go b/internal/service/shield/protection_group.go index ebabfe21e0e..ea63e4f8d22 100644 --- a/internal/service/shield/protection_group.go +++ b/internal/service/shield/protection_group.go @@ -48,7 +48,7 @@ func ResourceProtectionGroup() *schema.Resource { Optional: true, MinItems: 0, MaxItems: 10000, - ConflictsWith: []string{"resource_type"}, + ConflictsWith: []string{names.AttrResourceType}, Elem: &schema.Schema{ Type: schema.TypeString, ValidateFunc: validation.All(verify.ValidARN, @@ -71,7 +71,7 @@ func ResourceProtectionGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"members"}, @@ -100,7 +100,7 @@ func resourceProtectionGroupCreate(ctx context.Context, d *schema.ResourceData, input.Members = flex.ExpandStringValueList(v.([]interface{})) } - if v, ok := d.GetOk("resource_type"); ok { + if v, ok := d.GetOk(names.AttrResourceType); ok { input.ResourceType = awstypes.ProtectedResourceType(v.(string)) } @@ -137,7 +137,7 @@ func resourceProtectionGroupRead(ctx context.Context, d *schema.ResourceData, me d.Set("protection_group_id", resp.ProtectionGroupId) d.Set("pattern", resp.Pattern) d.Set("members", resp.Members) - d.Set("resource_type", resp.ResourceType) + d.Set(names.AttrResourceType, resp.ResourceType) return diags } @@ -157,7 +157,7 @@ func resourceProtectionGroupUpdate(ctx context.Context, d *schema.ResourceData, input.Members = flex.ExpandStringValueList(v.([]interface{})) } - if v, ok := d.GetOk("resource_type"); ok { + if v, ok := d.GetOk(names.AttrResourceType); ok { input.ResourceType = awstypes.ProtectedResourceType(v.(string)) } diff --git a/internal/service/shield/protection_group_test.go b/internal/service/shield/protection_group_test.go index e3dbafd7676..e8683474996 100644 --- a/internal/service/shield/protection_group_test.go +++ b/internal/service/shield/protection_group_test.go @@ -224,7 +224,7 @@ func TestAccShieldProtectionGroup_resourceType(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckProtectionGroupExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "pattern", string(awstypes.ProtectionGroupPatternByResourceType)), - resource.TestCheckResourceAttr(resourceName, "resource_type", string(awstypes.ProtectedResourceTypeElasticIpAllocation)), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, string(awstypes.ProtectedResourceTypeElasticIpAllocation)), ), }, { @@ -237,7 +237,7 @@ func TestAccShieldProtectionGroup_resourceType(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckProtectionGroupExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "pattern", string(awstypes.ProtectionGroupPatternByResourceType)), - resource.TestCheckResourceAttr(resourceName, "resource_type", string(awstypes.ProtectedResourceTypeApplicationLoadBalancer)), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, string(awstypes.ProtectedResourceTypeApplicationLoadBalancer)), ), }, { From 5aa79796728f7c5308ce4d10646e35d76456782e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:53 -0400 Subject: [PATCH 1394/1490] signer: Use constants for strings --- internal/service/signer/signing_profile.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/signer/signing_profile.go b/internal/service/signer/signing_profile.go index 5be87c26429..2c295d53ef4 100644 --- a/internal/service/signer/signing_profile.go +++ b/internal/service/signer/signing_profile.go @@ -121,7 +121,7 @@ func ResourceSigningProfile() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -271,7 +271,7 @@ func expandSigningMaterial(in []interface{}) *types.SigningMaterial { m := in[0].(map[string]interface{}) var out types.SigningMaterial - if v, ok := m["certificate_arn"].(string); ok && v != "" { + if v, ok := m[names.AttrCertificateARN].(string); ok && v != "" { out.CertificateArn = aws.String(v) } @@ -284,7 +284,7 @@ func flattenSigningMaterial(apiObject *types.SigningMaterial) []interface{} { } m := map[string]interface{}{ - "certificate_arn": aws.ToString(apiObject.CertificateArn), + names.AttrCertificateARN: aws.ToString(apiObject.CertificateArn), } return []interface{}{m} From 83eabab5e770c0d61605288f324dbbbad829e2f3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:53 -0400 Subject: [PATCH 1395/1490] sns: Use constants for strings --- internal/service/sns/topic.go | 4 ++-- internal/service/sns/topic_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/sns/topic.go b/internal/service/sns/topic.go index b9a8e0b2f7f..e5fe8a46721 100644 --- a/internal/service/sns/topic.go +++ b/internal/service/sns/topic.go @@ -87,7 +87,7 @@ var ( return json }, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, }, @@ -216,7 +216,7 @@ var ( "beginning_archive_time": topicAttributeNameBeginningArchiveTime, "content_based_deduplication": topicAttributeNameContentBasedDeduplication, "delivery_policy": topicAttributeNameDeliveryPolicy, - "display_name": topicAttributeNameDisplayName, + names.AttrDisplayName: topicAttributeNameDisplayName, "fifo_topic": topicAttributeNameFIFOTopic, "firehose_failure_feedback_role_arn": topicAttributeNameFirehoseFailureFeedbackRoleARN, "firehose_success_feedback_role_arn": topicAttributeNameFirehoseSuccessFeedbackRoleARN, diff --git a/internal/service/sns/topic_test.go b/internal/service/sns/topic_test.go index c3e924a4d76..1630fd461a3 100644 --- a/internal/service/sns/topic_test.go +++ b/internal/service/sns/topic_test.go @@ -55,7 +55,7 @@ func TestAccSNSTopic_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "beginning_archive_time", ""), resource.TestCheckResourceAttr(resourceName, "content_based_deduplication", "false"), resource.TestCheckResourceAttr(resourceName, "delivery_policy", ""), - resource.TestCheckResourceAttr(resourceName, "display_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, ""), resource.TestCheckResourceAttr(resourceName, "fifo_topic", "false"), resource.TestCheckResourceAttr(resourceName, "firehose_failure_feedback_role_arn", ""), resource.TestCheckResourceAttr(resourceName, "firehose_success_feedback_role_arn", ""), From d8bcfee89a7d4e8274eff42aac6442cbaa786785 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:53 -0400 Subject: [PATCH 1396/1490] ssm: Use constants for strings --- internal/service/ssm/association.go | 8 ++++---- internal/service/ssm/association_test.go | 8 ++++---- internal/service/ssm/maintenance_window_target.go | 6 +++--- internal/service/ssm/maintenance_window_target_test.go | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/ssm/association.go b/internal/service/ssm/association.go index b82eeccaaf2..26cbe288556 100644 --- a/internal/service/ssm/association.go +++ b/internal/service/ssm/association.go @@ -127,7 +127,7 @@ func ResourceAssociation() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "schedule_expression": { + names.AttrScheduleExpression: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(1, 256), @@ -196,7 +196,7 @@ func resourceAssociationCreate(ctx context.Context, d *schema.ResourceData, meta associationInput.Parameters = expandDocumentParameters(v.(map[string]interface{})) } - if v, ok := d.GetOk("schedule_expression"); ok { + if v, ok := d.GetOk(names.AttrScheduleExpression); ok { associationInput.ScheduleExpression = aws.String(v.(string)) } @@ -279,7 +279,7 @@ func resourceAssociationRead(ctx context.Context, d *schema.ResourceData, meta i d.Set(names.AttrInstanceID, association.InstanceId) d.Set(names.AttrName, association.Name) d.Set("association_id", association.AssociationId) - d.Set("schedule_expression", association.ScheduleExpression) + d.Set(names.AttrScheduleExpression, association.ScheduleExpression) d.Set("sync_compliance", association.SyncCompliance) d.Set("document_version", association.DocumentVersion) d.Set("compliance_severity", association.ComplianceSeverity) @@ -325,7 +325,7 @@ func resourceAssociationUpdate(ctx context.Context, d *schema.ResourceData, meta associationInput.DocumentVersion = aws.String(v.(string)) } - if v, ok := d.GetOk("schedule_expression"); ok { + if v, ok := d.GetOk(names.AttrScheduleExpression); ok { associationInput.ScheduleExpression = aws.String(v.(string)) } diff --git a/internal/service/ssm/association_test.go b/internal/service/ssm/association_test.go index 701473cdf90..6675acfe6b8 100644 --- a/internal/service/ssm/association_test.go +++ b/internal/service/ssm/association_test.go @@ -296,7 +296,7 @@ func TestAccSSMAssociation_withAssociationNameAndScheduleExpression(t *testing.T Check: resource.ComposeTestCheckFunc( testAccCheckAssociationExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "association_name", assocName), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", scheduleExpression1), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, scheduleExpression1), ), }, { @@ -309,7 +309,7 @@ func TestAccSSMAssociation_withAssociationNameAndScheduleExpression(t *testing.T Check: resource.ComposeTestCheckFunc( testAccCheckAssociationExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "association_name", assocName), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", scheduleExpression2), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, scheduleExpression2), ), }, }, @@ -517,7 +517,7 @@ func TestAccSSMAssociation_withScheduleExpression(t *testing.T) { Config: testAccAssociationConfig_basicScheduleExpression(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAssociationExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", "cron(0 16 ? * TUE *)"), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, "cron(0 16 ? * TUE *)"), ), }, { @@ -529,7 +529,7 @@ func TestAccSSMAssociation_withScheduleExpression(t *testing.T) { Config: testAccAssociationConfig_basicScheduleExpressionUpdated(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAssociationExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "schedule_expression", "cron(0 16 ? * WED *)"), + resource.TestCheckResourceAttr(resourceName, names.AttrScheduleExpression, "cron(0 16 ? * WED *)"), ), }, }, diff --git a/internal/service/ssm/maintenance_window_target.go b/internal/service/ssm/maintenance_window_target.go index 41691054a06..ee4d551c442 100644 --- a/internal/service/ssm/maintenance_window_target.go +++ b/internal/service/ssm/maintenance_window_target.go @@ -47,7 +47,7 @@ func ResourceMaintenanceWindowTarget() *schema.Resource { ForceNew: true, }, - "resource_type": { + names.AttrResourceType: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -109,7 +109,7 @@ func resourceMaintenanceWindowTargetCreate(ctx context.Context, d *schema.Resour params := &ssm.RegisterTargetWithMaintenanceWindowInput{ WindowId: aws.String(d.Get("window_id").(string)), - ResourceType: aws.String(d.Get("resource_type").(string)), + ResourceType: aws.String(d.Get(names.AttrResourceType).(string)), Targets: expandTargets(d.Get("targets").([]interface{})), } @@ -167,7 +167,7 @@ func resourceMaintenanceWindowTargetRead(ctx context.Context, d *schema.Resource d.Set("owner_information", t.OwnerInformation) d.Set("window_id", t.WindowId) - d.Set("resource_type", t.ResourceType) + d.Set(names.AttrResourceType, t.ResourceType) d.Set(names.AttrName, t.Name) d.Set(names.AttrDescription, t.Description) diff --git a/internal/service/ssm/maintenance_window_target_test.go b/internal/service/ssm/maintenance_window_target_test.go index cc54a0342d9..1f33fed6738 100644 --- a/internal/service/ssm/maintenance_window_target_test.go +++ b/internal/service/ssm/maintenance_window_target_test.go @@ -45,7 +45,7 @@ func TestAccSSMMaintenanceWindowTarget_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "targets.1.values.1", "acceptance_test2"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "This resource is for test purpose only"), - resource.TestCheckResourceAttr(resourceName, "resource_type", ssm.MaintenanceWindowResourceTypeInstance), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, ssm.MaintenanceWindowResourceTypeInstance), ), }, { @@ -197,7 +197,7 @@ func TestAccSSMMaintenanceWindowTarget_resourceGroup(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "targets.1.values.0", "resource-group-name"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "This resource is for test purpose only"), - resource.TestCheckResourceAttr(resourceName, "resource_type", ssm.MaintenanceWindowResourceTypeResourceGroup), + resource.TestCheckResourceAttr(resourceName, names.AttrResourceType, ssm.MaintenanceWindowResourceTypeResourceGroup), ), }, { From 2152541a6a167706920f7e71fd1c55ae38ffb0e6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:54 -0400 Subject: [PATCH 1397/1490] ssmcontacts: Use constants for strings --- internal/service/ssmcontacts/contact.go | 8 ++++---- internal/service/ssmcontacts/contact_data_source.go | 2 +- internal/service/ssmcontacts/contact_data_source_test.go | 2 +- internal/service/ssmcontacts/contact_test.go | 4 ++-- internal/service/ssmcontacts/helper.go | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/ssmcontacts/contact.go b/internal/service/ssmcontacts/contact.go index 0b18d6cbd39..4dbe66c0701 100644 --- a/internal/service/ssmcontacts/contact.go +++ b/internal/service/ssmcontacts/contact.go @@ -44,7 +44,7 @@ func ResourceContact() *schema.Resource { Required: true, ForceNew: true, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, }, @@ -70,7 +70,7 @@ func resourceContactCreate(ctx context.Context, d *schema.ResourceData, meta int input := &ssmcontacts.CreateContactInput{ Alias: aws.String(d.Get("alias").(string)), - DisplayName: aws.String(d.Get("display_name").(string)), + DisplayName: aws.String(d.Get(names.AttrDisplayName).(string)), Plan: &types.Plan{Stages: []types.Stage{}}, Tags: getTagsIn(ctx), Type: types.ContactType(d.Get(names.AttrType).(string)), @@ -115,10 +115,10 @@ func resourceContactRead(ctx context.Context, d *schema.ResourceData, meta inter func resourceContactUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { conn := meta.(*conns.AWSClient).SSMContactsClient(ctx) - if d.HasChanges("display_name") { + if d.HasChanges(names.AttrDisplayName) { in := &ssmcontacts.UpdateContactInput{ ContactId: aws.String(d.Id()), - DisplayName: aws.String(d.Get("display_name").(string)), + DisplayName: aws.String(d.Get(names.AttrDisplayName).(string)), } _, err := conn.UpdateContact(ctx, in) diff --git a/internal/service/ssmcontacts/contact_data_source.go b/internal/service/ssmcontacts/contact_data_source.go index bbed2d24509..deafc90341d 100644 --- a/internal/service/ssmcontacts/contact_data_source.go +++ b/internal/service/ssmcontacts/contact_data_source.go @@ -29,7 +29,7 @@ func DataSourceContact() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/ssmcontacts/contact_data_source_test.go b/internal/service/ssmcontacts/contact_data_source_test.go index f08d8630be3..0f947bc3b84 100644 --- a/internal/service/ssmcontacts/contact_data_source_test.go +++ b/internal/service/ssmcontacts/contact_data_source_test.go @@ -37,7 +37,7 @@ func testContactDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, names.AttrARN, dataSourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "alias", dataSourceName, "alias"), resource.TestCheckResourceAttrPair(resourceName, names.AttrType, dataSourceName, names.AttrType), - resource.TestCheckResourceAttrPair(resourceName, "display_name", dataSourceName, "display_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDisplayName, dataSourceName, names.AttrDisplayName), resource.TestCheckResourceAttrPair(resourceName, "tags.%", dataSourceName, "tags.%"), resource.TestCheckResourceAttrPair(resourceName, "tags.key1", dataSourceName, "tags.key1"), resource.TestCheckResourceAttrPair(resourceName, "tags.key2", dataSourceName, "tags.key2"), diff --git a/internal/service/ssmcontacts/contact_test.go b/internal/service/ssmcontacts/contact_test.go index 178fa0af6dd..b6060318c0b 100644 --- a/internal/service/ssmcontacts/contact_test.go +++ b/internal/service/ssmcontacts/contact_test.go @@ -217,7 +217,7 @@ func testContact_updateDisplayName(t *testing.T) { Config: testAccContactConfig_displayName(rName, oldDisplayName), Check: resource.ComposeTestCheckFunc( testAccCheckContactExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "display_name", oldDisplayName), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, oldDisplayName), ), }, { @@ -229,7 +229,7 @@ func testContact_updateDisplayName(t *testing.T) { Config: testAccContactConfig_displayName(rName, newDisplayName), Check: resource.ComposeTestCheckFunc( testAccCheckContactExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "display_name", newDisplayName), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, newDisplayName), ), }, { diff --git a/internal/service/ssmcontacts/helper.go b/internal/service/ssmcontacts/helper.go index 68ea849d660..8357a38b1fe 100644 --- a/internal/service/ssmcontacts/helper.go +++ b/internal/service/ssmcontacts/helper.go @@ -15,7 +15,7 @@ func setContactResourceData(d *schema.ResourceData, getContactOutput *ssmcontact d.Set(names.AttrARN, getContactOutput.ContactArn) d.Set("alias", getContactOutput.Alias) d.Set(names.AttrType, getContactOutput.Type) - d.Set("display_name", getContactOutput.DisplayName) + d.Set(names.AttrDisplayName, getContactOutput.DisplayName) return nil } From bdc1ed51f27c1d3afc8ca7edae69ca3a5e6f40f9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:54 -0400 Subject: [PATCH 1398/1490] ssmincidents: Use constants for strings --- internal/service/ssmincidents/helper.go | 2 +- internal/service/ssmincidents/response_plan.go | 8 ++++---- .../service/ssmincidents/response_plan_data_source.go | 2 +- .../ssmincidents/response_plan_data_source_test.go | 2 +- internal/service/ssmincidents/response_plan_test.go | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/ssmincidents/helper.go b/internal/service/ssmincidents/helper.go index 1093eb0902a..2bc77c4755a 100644 --- a/internal/service/ssmincidents/helper.go +++ b/internal/service/ssmincidents/helper.go @@ -41,7 +41,7 @@ func setResponsePlanResourceData( if err := d.Set("chat_channel", flattenChatChannel(getResponsePlanOutput.ChatChannel)); err != nil { return d, err } - if err := d.Set("display_name", getResponsePlanOutput.DisplayName); err != nil { + if err := d.Set(names.AttrDisplayName, getResponsePlanOutput.DisplayName); err != nil { return d, err } if err := d.Set("engagements", flex.FlattenStringValueSet(getResponsePlanOutput.Engagements)); err != nil { diff --git a/internal/service/ssmincidents/response_plan.go b/internal/service/ssmincidents/response_plan.go index a1a2d5e17c2..4970b5f849b 100644 --- a/internal/service/ssmincidents/response_plan.go +++ b/internal/service/ssmincidents/response_plan.go @@ -101,7 +101,7 @@ func ResourceResponsePlan() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, }, @@ -199,7 +199,7 @@ func resourceResponsePlanCreate(ctx context.Context, d *schema.ResourceData, met input := &ssmincidents.CreateResponsePlanInput{ Actions: expandAction(d.Get(names.AttrAction).([]interface{})), ChatChannel: expandChatChannel(d.Get("chat_channel").(*schema.Set)), - DisplayName: aws.String(d.Get("display_name").(string)), + DisplayName: aws.String(d.Get(names.AttrDisplayName).(string)), Engagements: flex.ExpandStringValueSet(d.Get("engagements").(*schema.Set)), IncidentTemplate: expandIncidentTemplate(d.Get("incident_template").([]interface{})), Integrations: expandIntegration(d.Get("integration").([]interface{})), @@ -260,8 +260,8 @@ func resourceResponsePlanUpdate(ctx context.Context, d *schema.ResourceData, met input.ChatChannel = expandChatChannel(d.Get("chat_channel").(*schema.Set)) } - if d.HasChanges("display_name") { - input.DisplayName = aws.String(d.Get("display_name").(string)) + if d.HasChanges(names.AttrDisplayName) { + input.DisplayName = aws.String(d.Get(names.AttrDisplayName).(string)) } if d.HasChanges("engagements") { diff --git a/internal/service/ssmincidents/response_plan_data_source.go b/internal/service/ssmincidents/response_plan_data_source.go index eec06d1a0ec..d526e96541d 100644 --- a/internal/service/ssmincidents/response_plan_data_source.go +++ b/internal/service/ssmincidents/response_plan_data_source.go @@ -84,7 +84,7 @@ func DataSourceResponsePlan() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/ssmincidents/response_plan_data_source_test.go b/internal/service/ssmincidents/response_plan_data_source_test.go index def8edd9d4c..3d50ab9af42 100644 --- a/internal/service/ssmincidents/response_plan_data_source_test.go +++ b/internal/service/ssmincidents/response_plan_data_source_test.go @@ -55,7 +55,7 @@ func testResponsePlanDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "incident_template.0.incident_tags.b", dataSourceName, "incident_template.0.incident_tags.b"), resource.TestCheckTypeSetElemAttrPair(dataSourceName, "incident_template.0.notification_target.*.sns_topic_arn", snsTopic1, names.AttrARN), resource.TestCheckTypeSetElemAttrPair(dataSourceName, "incident_template.0.notification_target.*.sns_topic_arn", snsTopic2, names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "display_name", dataSourceName, "display_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDisplayName, dataSourceName, names.AttrDisplayName), resource.TestCheckTypeSetElemAttrPair(dataSourceName, "chat_channel.0", chatChannelTopic, names.AttrARN), resource.TestCheckTypeSetElemAttrPair( resourceName, diff --git a/internal/service/ssmincidents/response_plan_test.go b/internal/service/ssmincidents/response_plan_test.go index 61013d0a420..263a3530efb 100644 --- a/internal/service/ssmincidents/response_plan_test.go +++ b/internal/service/ssmincidents/response_plan_test.go @@ -448,7 +448,7 @@ func testResponsePlan_displayName(t *testing.T) { Config: testAccResponsePlanConfig_displayName(rName, oldDisplayName), Check: resource.ComposeTestCheckFunc( testAccCheckResponsePlanExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "display_name", oldDisplayName), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, oldDisplayName), ), }, { @@ -461,7 +461,7 @@ func testResponsePlan_displayName(t *testing.T) { Config: testAccResponsePlanConfig_displayName(rName, newDisplayName), Check: resource.ComposeTestCheckFunc( testAccCheckResponsePlanExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "display_name", newDisplayName), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, newDisplayName), ), }, { From 598452aad3ee0eb0efbbcc1358e83c39e5dc69fe Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:54 -0400 Subject: [PATCH 1399/1490] ssoadmin: Use constants for strings --- .../service/ssoadmin/application_providers_data_source.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/ssoadmin/application_providers_data_source.go b/internal/service/ssoadmin/application_providers_data_source.go index 06737ff5a39..21a8c86c4d1 100644 --- a/internal/service/ssoadmin/application_providers_data_source.go +++ b/internal/service/ssoadmin/application_providers_data_source.go @@ -57,7 +57,7 @@ func (d *dataSourceApplicationProviders) Schema(ctx context.Context, req datasou names.AttrDescription: schema.StringAttribute{ Computed: true, }, - "display_name": schema.StringAttribute{ + names.AttrDisplayName: schema.StringAttribute{ Computed: true, }, "icon_url": schema.StringAttribute{ @@ -121,7 +121,7 @@ var applicationProviderAttrTypes = map[string]attr.Type{ var displayDataAttrTypes = map[string]attr.Type{ names.AttrDescription: types.StringType, - "display_name": types.StringType, + names.AttrDisplayName: types.StringType, "icon_url": types.StringType, } @@ -165,7 +165,7 @@ func flattenDisplayData(ctx context.Context, apiObject *awstypes.DisplayData) (t obj := map[string]attr.Value{ names.AttrDescription: flex.StringToFramework(ctx, apiObject.Description), - "display_name": flex.StringToFramework(ctx, apiObject.DisplayName), + names.AttrDisplayName: flex.StringToFramework(ctx, apiObject.DisplayName), "icon_url": flex.StringToFramework(ctx, apiObject.IconUrl), } objVal, d := types.ObjectValue(displayDataAttrTypes, obj) From 37baa0c15057dd4dccc09770e2a4fff5e92b8098 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:54 -0400 Subject: [PATCH 1400/1490] synthetics: Use constants for strings --- internal/service/synthetics/canary.go | 10 +++++----- internal/service/synthetics/canary_test.go | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/service/synthetics/canary.go b/internal/service/synthetics/canary.go index 9e179aa592e..af2f369885f 100644 --- a/internal/service/synthetics/canary.go +++ b/internal/service/synthetics/canary.go @@ -94,7 +94,7 @@ func ResourceCanary() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "execution_role_arn": { + names.AttrExecutionRoleARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -279,7 +279,7 @@ func resourceCanaryCreate(ctx context.Context, d *schema.ResourceData, meta inte name := d.Get(names.AttrName).(string) input := &synthetics.CreateCanaryInput{ ArtifactS3Location: aws.String(d.Get("artifact_s3_location").(string)), - ExecutionRoleArn: aws.String(d.Get("execution_role_arn").(string)), + ExecutionRoleArn: aws.String(d.Get(names.AttrExecutionRoleARN).(string)), Name: aws.String(name), RuntimeVersion: aws.String(d.Get("runtime_version").(string)), Tags: getTagsIn(ctx), @@ -385,7 +385,7 @@ func resourceCanaryRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set(names.AttrARN, canaryArn) d.Set("artifact_s3_location", canary.ArtifactS3Location) d.Set("engine_arn", canary.EngineArn) - d.Set("execution_role_arn", canary.ExecutionRoleArn) + d.Set(names.AttrExecutionRoleARN, canary.ExecutionRoleArn) d.Set("failure_retention_period", canary.FailureRetentionPeriodInDays) d.Set("handler", canary.Code.Handler) d.Set(names.AttrName, canary.Name) @@ -475,8 +475,8 @@ func resourceCanaryUpdate(ctx context.Context, d *schema.ResourceData, meta inte input.FailureRetentionPeriodInDays = aws.Int32(int32(n.(int))) } - if d.HasChange("execution_role_arn") { - _, n := d.GetChange("execution_role_arn") + if d.HasChange(names.AttrExecutionRoleARN) { + _, n := d.GetChange(names.AttrExecutionRoleARN) input.ExecutionRoleArn = aws.String(n.(string)) } diff --git a/internal/service/synthetics/canary_test.go b/internal/service/synthetics/canary_test.go index bf3819ac63f..cfc22ca0014 100644 --- a/internal/service/synthetics/canary_test.go +++ b/internal/service/synthetics/canary_test.go @@ -50,7 +50,7 @@ func TestAccSyntheticsCanary_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "schedule.0.expression", "rate(0 hour)"), acctest.MatchResourceAttrRegionalARN(resourceName, "engine_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`function:cwsyn-%s.+`, rName))), acctest.MatchResourceAttrRegionalARN(resourceName, "source_location_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`layer:cwsyn-%s.+`, rName))), - resource.TestCheckResourceAttrPair(resourceName, "execution_role_arn", "aws_iam_role.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExecutionRoleARN, "aws_iam_role.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "artifact_s3_location", fmt.Sprintf("%s/", rName)), resource.TestCheckResourceAttr(resourceName, "timeline.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "timeline.0.created"), @@ -82,7 +82,7 @@ func TestAccSyntheticsCanary_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "schedule.0.expression", "rate(0 hour)"), acctest.MatchResourceAttrRegionalARN(resourceName, "engine_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`function:cwsyn-%s.+`, rName))), acctest.MatchResourceAttrRegionalARN(resourceName, "source_location_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`layer:cwsyn-%s.+`, rName))), - resource.TestCheckResourceAttrPair(resourceName, "execution_role_arn", "aws_iam_role.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExecutionRoleARN, "aws_iam_role.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "artifact_s3_location", fmt.Sprintf("%s/test/", rName)), resource.TestCheckResourceAttr(resourceName, "timeline.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "timeline.0.created"), @@ -294,7 +294,7 @@ func TestAccSyntheticsCanary_s3(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "schedule.0.expression", "rate(0 hour)"), acctest.MatchResourceAttrRegionalARN(resourceName, "engine_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`function:cwsyn-%s.+`, rName))), acctest.MatchResourceAttrRegionalARN(resourceName, "source_location_arn", "lambda", regexache.MustCompile(fmt.Sprintf(`layer:cwsyn-%s.+`, rName))), - resource.TestCheckResourceAttrPair(resourceName, "execution_role_arn", "aws_iam_role.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrExecutionRoleARN, "aws_iam_role.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "artifact_s3_location", fmt.Sprintf("%s/", rName)), ), }, From 853762faee4781ec2187f8e96d68779a50ec4769 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:54 -0400 Subject: [PATCH 1401/1490] vpclattice: Use constants for strings --- internal/service/vpclattice/access_log_subscription.go | 8 ++++---- .../service/vpclattice/access_log_subscription_test.go | 6 +++--- internal/service/vpclattice/service.go | 10 +++++----- internal/service/vpclattice/service_data_source.go | 4 ++-- .../service/vpclattice/service_data_source_test.go | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/service/vpclattice/access_log_subscription.go b/internal/service/vpclattice/access_log_subscription.go index f7776bf4705..750c0f04904 100644 --- a/internal/service/vpclattice/access_log_subscription.go +++ b/internal/service/vpclattice/access_log_subscription.go @@ -42,7 +42,7 @@ func resourceAccessLogSubscription() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "destination_arn": { + names.AttrDestinationARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -76,7 +76,7 @@ func resourceAccessLogSubscriptionCreate(ctx context.Context, d *schema.Resource in := &vpclattice.CreateAccessLogSubscriptionInput{ ClientToken: aws.String(id.UniqueId()), - DestinationArn: aws.String(d.Get("destination_arn").(string)), + DestinationArn: aws.String(d.Get(names.AttrDestinationARN).(string)), ResourceIdentifier: aws.String(d.Get("resource_identifier").(string)), Tags: getTagsIn(ctx), } @@ -84,7 +84,7 @@ func resourceAccessLogSubscriptionCreate(ctx context.Context, d *schema.Resource out, err := conn.CreateAccessLogSubscription(ctx, in) if err != nil { - return create.DiagError(names.VPCLattice, create.ErrActionCreating, ResNameAccessLogSubscription, d.Get("destination_arn").(string), err) + return create.DiagError(names.VPCLattice, create.ErrActionCreating, ResNameAccessLogSubscription, d.Get(names.AttrDestinationARN).(string), err) } d.SetId(aws.ToString(out.Id)) @@ -108,7 +108,7 @@ func resourceAccessLogSubscriptionRead(ctx context.Context, d *schema.ResourceDa } d.Set(names.AttrARN, out.Arn) - d.Set("destination_arn", out.DestinationArn) + d.Set(names.AttrDestinationARN, out.DestinationArn) d.Set(names.AttrResourceARN, out.ResourceArn) d.Set("resource_identifier", out.ResourceId) diff --git a/internal/service/vpclattice/access_log_subscription_test.go b/internal/service/vpclattice/access_log_subscription_test.go index 0efcf5e3006..0fb7c9a2dba 100644 --- a/internal/service/vpclattice/access_log_subscription_test.go +++ b/internal/service/vpclattice/access_log_subscription_test.go @@ -92,7 +92,7 @@ func TestAccVPCLatticeAccessLogSubscription_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAccessLogSubscriptionExists(ctx, resourceName, &accesslogsubscription), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, names.VPCLatticeEndpointID, regexache.MustCompile(`accesslogsubscription/.+$`)), - resource.TestCheckResourceAttrPair(resourceName, "destination_arn", s3BucketResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, s3BucketResourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrResourceARN, serviceNetworkResourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "resource_identifier", serviceNetworkResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -240,7 +240,7 @@ func TestAccVPCLatticeAccessLogSubscription_cloudwatchNoWildcard(t *testing.T) { Config: testAccAccessLogSubscriptionConfig_cloudwatchNoWildcard(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckAccessLogSubscriptionExists(ctx, resourceName, &accesslogsubscription), - resource.TestCheckResourceAttrWith(resourceName, "destination_arn", func(value string) error { + resource.TestCheckResourceAttrWith(resourceName, names.AttrDestinationARN, func(value string) error { if !strings.HasSuffix(value, ":*") { return fmt.Errorf("%s is not a wildcard ARN", value) } @@ -275,7 +275,7 @@ func TestAccVPCLatticeAccessLogSubscription_cloudwatchWildcard(t *testing.T) { Config: testAccAccessLogSubscriptionConfig_cloudwatchWildcard(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAccessLogSubscriptionExists(ctx, resourceName, &accesslogsubscription), - resource.TestCheckResourceAttrWith(resourceName, "destination_arn", func(value string) error { + resource.TestCheckResourceAttrWith(resourceName, names.AttrDestinationARN, func(value string) error { if !strings.HasSuffix(value, ":*") { return fmt.Errorf("%s is not a wildcard ARN", value) } diff --git a/internal/service/vpclattice/service.go b/internal/service/vpclattice/service.go index eff2f8945dd..0d525b9dc8f 100644 --- a/internal/service/vpclattice/service.go +++ b/internal/service/vpclattice/service.go @@ -57,7 +57,7 @@ func resourceService() *schema.Resource { Computed: true, ValidateDiagFunc: enum.Validate[types.AuthType](), }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, @@ -119,7 +119,7 @@ func resourceServiceCreate(ctx context.Context, d *schema.ResourceData, meta int in.AuthType = types.AuthType(v.(string)) } - if v, ok := d.GetOk("certificate_arn"); ok { + if v, ok := d.GetOk(names.AttrCertificateARN); ok { in.CertificateArn = aws.String(v.(string)) } @@ -159,7 +159,7 @@ func resourceServiceRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set(names.AttrARN, out.Arn) d.Set("auth_type", out.AuthType) - d.Set("certificate_arn", out.CertificateArn) + d.Set(names.AttrCertificateARN, out.CertificateArn) d.Set("custom_domain_name", out.CustomDomainName) if out.DnsEntry != nil { if err := d.Set("dns_entry", []interface{}{flattenDNSEntry(out.DnsEntry)}); err != nil { @@ -186,8 +186,8 @@ func resourceServiceUpdate(ctx context.Context, d *schema.ResourceData, meta int in.AuthType = types.AuthType(d.Get("auth_type").(string)) } - if d.HasChanges("certificate_arn") { - in.CertificateArn = aws.String(d.Get("certificate_arn").(string)) + if d.HasChanges(names.AttrCertificateARN) { + in.CertificateArn = aws.String(d.Get(names.AttrCertificateARN).(string)) } _, err := conn.UpdateService(ctx, in) diff --git a/internal/service/vpclattice/service_data_source.go b/internal/service/vpclattice/service_data_source.go index 2a5230000a0..a6a9605dfc2 100644 --- a/internal/service/vpclattice/service_data_source.go +++ b/internal/service/vpclattice/service_data_source.go @@ -33,7 +33,7 @@ func dataSourceService() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate_arn": { + names.AttrCertificateARN: { Type: schema.TypeString, Computed: true, }, @@ -115,7 +115,7 @@ func dataSourceServiceRead(ctx context.Context, d *schema.ResourceData, meta int serviceARN := aws.ToString(out.Arn) d.Set(names.AttrARN, serviceARN) d.Set("auth_type", out.AuthType) - d.Set("certificate_arn", out.CertificateArn) + d.Set(names.AttrCertificateARN, out.CertificateArn) d.Set("custom_domain_name", out.CustomDomainName) if out.DnsEntry != nil { if err := d.Set("dns_entry", []interface{}{flattenDNSEntry(out.DnsEntry)}); err != nil { diff --git a/internal/service/vpclattice/service_data_source_test.go b/internal/service/vpclattice/service_data_source_test.go index f0c30cda8f1..0cee875c2f7 100644 --- a/internal/service/vpclattice/service_data_source_test.go +++ b/internal/service/vpclattice/service_data_source_test.go @@ -33,7 +33,7 @@ func TestAccVPCLatticeServiceDataSource_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(resourceName, names.AttrARN, dataSourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "auth_type", dataSourceName, "auth_type"), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", dataSourceName, "certificate_arn"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, dataSourceName, names.AttrCertificateARN), resource.TestCheckResourceAttrPair(resourceName, "custom_domain_name", dataSourceName, "custom_domain_name"), resource.TestCheckResourceAttrPair(resourceName, "dns_entry.#", dataSourceName, "dns_entry.#"), resource.TestCheckResourceAttrPair(resourceName, names.AttrName, dataSourceName, names.AttrName), @@ -65,7 +65,7 @@ func TestAccVPCLatticeServiceDataSource_byName(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(resourceName, names.AttrARN, dataSourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "auth_type", dataSourceName, "auth_type"), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", dataSourceName, "certificate_arn"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, dataSourceName, names.AttrCertificateARN), resource.TestCheckResourceAttrPair(resourceName, "custom_domain_name", dataSourceName, "custom_domain_name"), resource.TestCheckResourceAttrPair(resourceName, "dns_entry.#", dataSourceName, "dns_entry.#"), resource.TestCheckResourceAttrPair(resourceName, names.AttrName, dataSourceName, names.AttrName), @@ -99,7 +99,7 @@ func TestAccVPCLatticeServiceDataSource_shared(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(resourceName, names.AttrARN, dataSourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "auth_type", dataSourceName, "auth_type"), - resource.TestCheckResourceAttrPair(resourceName, "certificate_arn", dataSourceName, "certificate_arn"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificateARN, dataSourceName, names.AttrCertificateARN), resource.TestCheckResourceAttrPair(resourceName, "custom_domain_name", dataSourceName, "custom_domain_name"), resource.TestCheckResourceAttrPair(resourceName, "dns_entry.#", dataSourceName, "dns_entry.#"), resource.TestCheckResourceAttrPair(resourceName, names.AttrName, dataSourceName, names.AttrName), From b04851195c3861e447039aad02b7a585aad8ce45 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:55 -0400 Subject: [PATCH 1402/1490] worklink: Use constants for strings --- internal/service/worklink/fleet.go | 10 +++++----- internal/service/worklink/fleet_test.go | 4 ++-- .../website_certificate_authority_association.go | 6 +++--- .../website_certificate_authority_association_test.go | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/worklink/fleet.go b/internal/service/worklink/fleet.go index 184bd233946..db8bd2c8bc3 100644 --- a/internal/service/worklink/fleet.go +++ b/internal/service/worklink/fleet.go @@ -50,7 +50,7 @@ func ResourceFleet() *schema.Resource { validation.StringLenBetween(1, 48), ), }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 100), @@ -144,7 +144,7 @@ func resourceFleetCreate(ctx context.Context, d *schema.ResourceData, meta inter OptimizeForEndUserLocation: aws.Bool(d.Get("optimize_for_end_user_location").(bool)), } - if v, ok := d.GetOk("display_name"); ok { + if v, ok := d.GetOk(names.AttrDisplayName); ok { input.DisplayName = aws.String(v.(string)) } @@ -192,7 +192,7 @@ func resourceFleetRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set(names.AttrARN, d.Id()) d.Set(names.AttrName, resp.FleetName) - d.Set("display_name", resp.DisplayName) + d.Set(names.AttrDisplayName, resp.DisplayName) d.Set("optimize_for_end_user_location", resp.OptimizeForEndUserLocation) d.Set("company_code", resp.CompanyCode) d.Set("created_time", resp.CreatedTime.Format(time.RFC3339)) @@ -247,11 +247,11 @@ func resourceFleetUpdate(ctx context.Context, d *schema.ResourceData, meta inter OptimizeForEndUserLocation: aws.Bool(d.Get("optimize_for_end_user_location").(bool)), } - if v, ok := d.GetOk("display_name"); ok { + if v, ok := d.GetOk(names.AttrDisplayName); ok { input.DisplayName = aws.String(v.(string)) } - if d.HasChanges("display_name", "optimize_for_end_user_location") { + if d.HasChanges(names.AttrDisplayName, "optimize_for_end_user_location") { _, err := conn.UpdateFleetMetadataWithContext(ctx, input) if err != nil { return sdkdiag.AppendErrorf(diags, "updating WorkLink Fleet (%s): %s", d.Id(), err) diff --git a/internal/service/worklink/fleet_test.go b/internal/service/worklink/fleet_test.go index 79ed61573c7..beca5a198e8 100644 --- a/internal/service/worklink/fleet_test.go +++ b/internal/service/worklink/fleet_test.go @@ -67,14 +67,14 @@ func TestAccWorkLinkFleet_displayName(t *testing.T) { Config: testAccFleetConfig_displayName(suffix, "display1"), Check: resource.ComposeTestCheckFunc( testAccCheckFleetExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "display_name", "display1"), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, "display1"), ), }, { Config: testAccFleetConfig_displayName(suffix, "display2"), Check: resource.ComposeTestCheckFunc( testAccCheckFleetExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "display_name", "display2"), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, "display2"), ), }, { diff --git a/internal/service/worklink/website_certificate_authority_association.go b/internal/service/worklink/website_certificate_authority_association.go index 98f80d3a66d..4459406f671 100644 --- a/internal/service/worklink/website_certificate_authority_association.go +++ b/internal/service/worklink/website_certificate_authority_association.go @@ -42,7 +42,7 @@ func ResourceWebsiteCertificateAuthorityAssociation() *schema.Resource { Required: true, ForceNew: true, }, - "display_name": { + names.AttrDisplayName: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -65,7 +65,7 @@ func resourceWebsiteCertificateAuthorityAssociationCreate(ctx context.Context, d Certificate: aws.String(d.Get("certificate").(string)), } - if v, ok := d.GetOk("display_name"); ok { + if v, ok := d.GetOk(names.AttrDisplayName); ok { input.DisplayName = aws.String(v.(string)) } @@ -106,7 +106,7 @@ func resourceWebsiteCertificateAuthorityAssociationRead(ctx context.Context, d * d.Set("website_ca_id", websiteCaID) d.Set("fleet_arn", fleetArn) d.Set("certificate", resp.Certificate) - d.Set("display_name", resp.DisplayName) + d.Set(names.AttrDisplayName, resp.DisplayName) return diags } diff --git a/internal/service/worklink/website_certificate_authority_association_test.go b/internal/service/worklink/website_certificate_authority_association_test.go index bce80428470..49e2787b9e8 100644 --- a/internal/service/worklink/website_certificate_authority_association_test.go +++ b/internal/service/worklink/website_certificate_authority_association_test.go @@ -69,14 +69,14 @@ func TestAccWorkLinkWebsiteCertificateAuthorityAssociation_displayName(t *testin Config: testAccWebsiteCertificateAuthorityAssociationConfig_displayName(suffix, displayName1), Check: resource.ComposeTestCheckFunc( testAccCheckWebsiteCertificateAuthorityAssociationExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "display_name", displayName1), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, displayName1), ), }, { Config: testAccWebsiteCertificateAuthorityAssociationConfig_displayName(suffix, displayName2), Check: resource.ComposeTestCheckFunc( testAccCheckWebsiteCertificateAuthorityAssociationExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "display_name", displayName2), + resource.TestCheckResourceAttr(resourceName, names.AttrDisplayName, displayName2), ), }, { From 54aac88bc65df18d48725b93094a7b30fc4fe645 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 19:41:55 -0400 Subject: [PATCH 1403/1490] names: Use constants for strings --- names/attr_constants.csv | 32 ++++++++++++++++++++++---------- names/attr_consts_gen.go | 24 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/names/attr_constants.csv b/names/attr_constants.csv index 99d6ad93b2a..080b3ff8066 100644 --- a/names/attr_constants.csv +++ b/names/attr_constants.csv @@ -1,31 +1,39 @@ -arn,ARN -arns,ARNs access_key,AccessKey account_id,AccountID action,Action address,Address +apply_immediately,ApplyImmediately +arn,ARN +arns,ARNs auto_minor_version_upgrade,AutoMinorVersionUpgrade availability_zone,AvailabilityZone availability_zones,AvailabilityZones -bucket,Bucket bucket_name,BucketName bucket_prefix,BucketPrefix +bucket,Bucket catalog_id,CatalogID +certificate_arn,CertificateARN cluster_identifier,ClusterIdentifier configuration,Configuration created_at,CreatedAt created_date,CreatedDate +creation_date,CreationDate +creation_time,CreationTime database_name,DatabaseName delete_on_termination,DeleteOnTermination description,Description +destination_arn,DestinationARN destination,Destination device_name,DeviceName +display_name,DisplayName domain_name,DomainName enabled,Enabled encrypted,Encrypted +encryption_configuration,EncryptionConfiguration endpoint,Endpoint endpoints,Endpoints engine_version,EngineVersion +execution_role_arn,ExecutionRoleARN file_system_id,FileSystemID filter,Filter force_destroy,ForceDestroy @@ -34,15 +42,16 @@ hosted_zone_id,HostedZoneID id,ID instance_id,InstanceID instance_type,InstanceType +key,Key kms_key_arn,KMSKeyARN kms_key_id,KMSKeyID -key,Key last_updated_date,LastUpdatedDate max,Max min,Min mode,Mode -name,Name name_prefix,NamePrefix +name,Name +network_configuration,NetworkConfiguration network_interface_id,NetworkInterfaceID owner_id,OwnerID parameter,Parameter @@ -56,9 +65,12 @@ prefix,Prefix priority,Priority profile,Profile protocol,Protocol +publicly_accessible,PubliclyAccessible region,Region resource_arn,ResourceARN +resource_type,ResourceType role_arn,RoleARN +schedule_expression,ScheduleExpression secret_key,SecretKey security_group_ids,SecurityGroupIDs security_groups,SecurityGroups @@ -71,18 +83,18 @@ state,State status,Status subnet_id,SubnetID subnet_ids,SubnetIDs -tags,Tags tags_all,TagsAll +tags,Tags target,Target timeouts,Timeouts transit_gateway_attachment_id,TransitGatewayAttachmentID transit_gateway_id,TransitGatewayID type,Type -url,URL unit,Unit +url,URL username,Username -vpc_id,VPCID -vpc_security_group_ids,VPCSecurityGroupIDs value,Value values,Values -version,Version \ No newline at end of file +version,Version +vpc_id,VPCID +vpc_security_group_ids,VPCSecurityGroupIDs \ No newline at end of file diff --git a/names/attr_consts_gen.go b/names/attr_consts_gen.go index 1d9e2d4d934..81ad17d8f90 100644 --- a/names/attr_consts_gen.go +++ b/names/attr_consts_gen.go @@ -15,6 +15,7 @@ const ( AttrAccountID = "account_id" AttrAction = "action" AttrAddress = "address" + AttrApplyImmediately = "apply_immediately" AttrAutoMinorVersionUpgrade = "auto_minor_version_upgrade" AttrAvailabilityZone = "availability_zone" AttrAvailabilityZones = "availability_zones" @@ -22,21 +23,28 @@ const ( AttrBucketName = "bucket_name" AttrBucketPrefix = "bucket_prefix" AttrCatalogID = "catalog_id" + AttrCertificateARN = "certificate_arn" AttrClusterIdentifier = "cluster_identifier" AttrConfiguration = "configuration" AttrCreatedAt = "created_at" AttrCreatedDate = "created_date" + AttrCreationDate = "creation_date" + AttrCreationTime = "creation_time" AttrDatabaseName = "database_name" AttrDeleteOnTermination = "delete_on_termination" AttrDescription = "description" AttrDestination = "destination" + AttrDestinationARN = "destination_arn" AttrDeviceName = "device_name" + AttrDisplayName = "display_name" AttrDomainName = "domain_name" AttrEnabled = "enabled" AttrEncrypted = "encrypted" + AttrEncryptionConfiguration = "encryption_configuration" AttrEndpoint = "endpoint" AttrEndpoints = "endpoints" AttrEngineVersion = "engine_version" + AttrExecutionRoleARN = "execution_role_arn" AttrFileSystemID = "file_system_id" AttrFilter = "filter" AttrForceDestroy = "force_destroy" @@ -54,6 +62,7 @@ const ( AttrMode = "mode" AttrName = "name" AttrNamePrefix = "name_prefix" + AttrNetworkConfiguration = "network_configuration" AttrNetworkInterfaceID = "network_interface_id" AttrOwnerID = "owner_id" AttrParameter = "parameter" @@ -67,9 +76,12 @@ const ( AttrPriority = "priority" AttrProfile = "profile" AttrProtocol = "protocol" + AttrPubliclyAccessible = "publicly_accessible" AttrRegion = "region" AttrResourceARN = "resource_arn" + AttrResourceType = "resource_type" AttrRoleARN = "role_arn" + AttrScheduleExpression = "schedule_expression" AttrSecretKey = "secret_key" AttrSecurityGroupIDs = "security_group_ids" AttrSecurityGroups = "security_groups" @@ -110,6 +122,7 @@ func ConstOrQuote(constant string) string { "account_id": "AttrAccountID", "action": "AttrAction", "address": "AttrAddress", + "apply_immediately": "AttrApplyImmediately", "auto_minor_version_upgrade": "AttrAutoMinorVersionUpgrade", "availability_zone": "AttrAvailabilityZone", "availability_zones": "AttrAvailabilityZones", @@ -117,21 +130,28 @@ func ConstOrQuote(constant string) string { "bucket_name": "AttrBucketName", "bucket_prefix": "AttrBucketPrefix", "catalog_id": "AttrCatalogID", + "certificate_arn": "AttrCertificateARN", "cluster_identifier": "AttrClusterIdentifier", "configuration": "AttrConfiguration", "created_at": "AttrCreatedAt", "created_date": "AttrCreatedDate", + "creation_date": "AttrCreationDate", + "creation_time": "AttrCreationTime", "database_name": "AttrDatabaseName", "delete_on_termination": "AttrDeleteOnTermination", "description": "AttrDescription", "destination": "AttrDestination", + "destination_arn": "AttrDestinationARN", "device_name": "AttrDeviceName", + "display_name": "AttrDisplayName", "domain_name": "AttrDomainName", "enabled": "AttrEnabled", "encrypted": "AttrEncrypted", + "encryption_configuration": "AttrEncryptionConfiguration", "endpoint": "AttrEndpoint", "endpoints": "AttrEndpoints", "engine_version": "AttrEngineVersion", + "execution_role_arn": "AttrExecutionRoleARN", "file_system_id": "AttrFileSystemID", "filter": "AttrFilter", "force_destroy": "AttrForceDestroy", @@ -149,6 +169,7 @@ func ConstOrQuote(constant string) string { "mode": "AttrMode", "name": "AttrName", "name_prefix": "AttrNamePrefix", + "network_configuration": "AttrNetworkConfiguration", "network_interface_id": "AttrNetworkInterfaceID", "owner_id": "AttrOwnerID", "parameter": "AttrParameter", @@ -162,9 +183,12 @@ func ConstOrQuote(constant string) string { "priority": "AttrPriority", "profile": "AttrProfile", "protocol": "AttrProtocol", + "publicly_accessible": "AttrPubliclyAccessible", "region": "AttrRegion", "resource_arn": "AttrResourceARN", + "resource_type": "AttrResourceType", "role_arn": "AttrRoleARN", + "schedule_expression": "AttrScheduleExpression", "secret_key": "AttrSecretKey", "security_group_ids": "AttrSecurityGroupIDs", "security_groups": "AttrSecurityGroups", From d6b0d3fc858fad2be5e04af410a499dc0e358c7a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 21:29:04 -0400 Subject: [PATCH 1404/1490] Format after replacement --- internal/service/acm/certificate_validation.go | 1 + internal/service/apigateway/stage.go | 2 +- internal/service/apigatewayv2/stage.go | 2 +- internal/service/appintegrations/data_integration.go | 6 +++--- internal/service/athena/workgroup.go | 2 +- internal/service/backup/plan.go | 4 ++-- internal/service/backup/plan_test.go | 4 ++-- internal/service/bedrock/custom_models_data_source.go | 4 ++-- internal/service/cognitoidp/user_pool_ui_customization.go | 1 + internal/service/dlm/lifecycle_policy.go | 4 ++-- internal/service/glue/user_defined_function.go | 2 +- internal/service/kms/custom_key_store_data_source.go | 1 + internal/service/lambda/function_url_data_source.go | 1 + internal/service/s3/canonical_user_id_data_source.go | 1 + internal/service/secretsmanager/secret_rotation.go | 1 + .../service/secretsmanager/secret_rotation_data_source.go | 1 + internal/service/secretsmanager/secret_rotation_migrate.go | 1 + internal/service/securityhub/automation_rule.go | 2 +- internal/service/securityhub/insight.go | 4 ++-- internal/service/sns/topic.go | 2 +- .../service/ssoadmin/application_providers_data_source.go | 4 ++-- .../worklink/website_certificate_authority_association.go | 1 + 22 files changed, 30 insertions(+), 21 deletions(-) diff --git a/internal/service/acm/certificate_validation.go b/internal/service/acm/certificate_validation.go index 3722f9e25fa..0801236e177 100644 --- a/internal/service/acm/certificate_validation.go +++ b/internal/service/acm/certificate_validation.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/enum" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_acm_certificate_validation") diff --git a/internal/service/apigateway/stage.go b/internal/service/apigateway/stage.go index 18fbb413287..2e09b379fc8 100644 --- a/internal/service/apigateway/stage.go +++ b/internal/service/apigateway/stage.go @@ -554,7 +554,7 @@ func flattenAccessLogSettings(accessLogSettings *types.AccessLogSettings) []map[ if accessLogSettings != nil { result = append(result, map[string]interface{}{ names.AttrDestinationARN: aws.ToString(accessLogSettings.DestinationArn), - names.AttrFormat: aws.ToString(accessLogSettings.Format), + names.AttrFormat: aws.ToString(accessLogSettings.Format), }) } return result diff --git a/internal/service/apigatewayv2/stage.go b/internal/service/apigatewayv2/stage.go index cbaf774cc8b..12fbacdff90 100644 --- a/internal/service/apigatewayv2/stage.go +++ b/internal/service/apigatewayv2/stage.go @@ -494,7 +494,7 @@ func flattenAccessLogSettings(settings *awstypes.AccessLogSettings) []interface{ return []interface{}{map[string]interface{}{ names.AttrDestinationARN: aws.ToString(settings.DestinationArn), - names.AttrFormat: aws.ToString(settings.Format), + names.AttrFormat: aws.ToString(settings.Format), }} } diff --git a/internal/service/appintegrations/data_integration.go b/internal/service/appintegrations/data_integration.go index a8a67b97602..a65a6c0631c 100644 --- a/internal/service/appintegrations/data_integration.go +++ b/internal/service/appintegrations/data_integration.go @@ -232,9 +232,9 @@ func flattenScheduleConfig(scheduleConfig *awstypes.ScheduleConfiguration) []int } values := map[string]interface{}{ - "first_execution_from": aws.ToString(scheduleConfig.FirstExecutionFrom), - "object": aws.ToString(scheduleConfig.Object), - names.AttrScheduleExpression: aws.ToString(scheduleConfig.ScheduleExpression), + "first_execution_from": aws.ToString(scheduleConfig.FirstExecutionFrom), + "object": aws.ToString(scheduleConfig.Object), + names.AttrScheduleExpression: aws.ToString(scheduleConfig.ScheduleExpression), } return []interface{}{values} diff --git a/internal/service/athena/workgroup.go b/internal/service/athena/workgroup.go index 13f84230367..d9e4db1bb9d 100644 --- a/internal/service/athena/workgroup.go +++ b/internal/service/athena/workgroup.go @@ -555,7 +555,7 @@ func flattenWorkGroupResultConfiguration(resultConfiguration *types.ResultConfig m := map[string]interface{}{ names.AttrEncryptionConfiguration: flattenWorkGroupEncryptionConfiguration(resultConfiguration.EncryptionConfiguration), - "output_location": aws.ToString(resultConfiguration.OutputLocation), + "output_location": aws.ToString(resultConfiguration.OutputLocation), } if resultConfiguration.ExpectedBucketOwner != nil { diff --git a/internal/service/backup/plan.go b/internal/service/backup/plan.go index dd4522fb8bf..b3c196a86ce 100644 --- a/internal/service/backup/plan.go +++ b/internal/service/backup/plan.go @@ -461,8 +461,8 @@ func flattenPlanAdvancedSettings(advancedBackupSettings []*backup.AdvancedBackup for _, advancedBackupSetting := range advancedBackupSettings { mAdvancedBackupSetting := map[string]interface{}{ - "backup_options": aws.StringValueMap(advancedBackupSetting.BackupOptions), - names.AttrResourceType: aws.StringValue(advancedBackupSetting.ResourceType), + "backup_options": aws.StringValueMap(advancedBackupSetting.BackupOptions), + names.AttrResourceType: aws.StringValue(advancedBackupSetting.ResourceType), } vAdvancedBackupSettings = append(vAdvancedBackupSettings, mAdvancedBackupSetting) diff --git a/internal/service/backup/plan_test.go b/internal/service/backup/plan_test.go index deeb2ef09ba..d510ae3c9ae 100644 --- a/internal/service/backup/plan_test.go +++ b/internal/service/backup/plan_test.go @@ -585,7 +585,7 @@ func TestAccBackupPlan_advancedBackupSetting(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "advanced_backup_setting.*", map[string]string{ "backup_options.%": "1", "backup_options.WindowsVSS": names.AttrEnabled, - names.AttrResourceType: "EC2", + names.AttrResourceType: "EC2", }), ), }, @@ -603,7 +603,7 @@ func TestAccBackupPlan_advancedBackupSetting(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "advanced_backup_setting.*", map[string]string{ "backup_options.%": "1", "backup_options.WindowsVSS": "disabled", - names.AttrResourceType: "EC2", + names.AttrResourceType: "EC2", }), ), }, diff --git a/internal/service/bedrock/custom_models_data_source.go b/internal/service/bedrock/custom_models_data_source.go index 24ecc5fdc6c..50e2c03a4d4 100644 --- a/internal/service/bedrock/custom_models_data_source.go +++ b/internal/service/bedrock/custom_models_data_source.go @@ -41,8 +41,8 @@ func (d *customModelsDataSource) Schema(ctx context.Context, request datasource. ElementType: types.ObjectType{ AttrTypes: map[string]attr.Type{ names.AttrCreationTime: timetypes.RFC3339Type{}, - "model_arn": types.StringType, - "model_name": types.StringType, + "model_arn": types.StringType, + "model_name": types.StringType, }, }, }, diff --git a/internal/service/cognitoidp/user_pool_ui_customization.go b/internal/service/cognitoidp/user_pool_ui_customization.go index 3dcdde87856..76a698a7781 100644 --- a/internal/service/cognitoidp/user_pool_ui_customization.go +++ b/internal/service/cognitoidp/user_pool_ui_customization.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/flex" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" itypes "github.com/hashicorp/terraform-provider-aws/internal/types" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_cognito_user_pool_ui_customization", name="User Pool UI Customization") diff --git a/internal/service/dlm/lifecycle_policy.go b/internal/service/dlm/lifecycle_policy.go index 278af960de9..9ea28b7bcf8 100644 --- a/internal/service/dlm/lifecycle_policy.go +++ b/internal/service/dlm/lifecycle_policy.go @@ -812,8 +812,8 @@ func flattenActionCrossRegionCopyRules(rules []*dlm.CrossRegionCopyAction) []int m := map[string]interface{}{ names.AttrEncryptionConfiguration: flattenActionCrossRegionCopyRuleEncryptionConfiguration(rule.EncryptionConfiguration), - "retain_rule": flattenCrossRegionCopyRuleRetainRule(rule.RetainRule), - names.AttrTarget: aws.StringValue(rule.Target), + "retain_rule": flattenCrossRegionCopyRuleRetainRule(rule.RetainRule), + names.AttrTarget: aws.StringValue(rule.Target), } result = append(result, m) diff --git a/internal/service/glue/user_defined_function.go b/internal/service/glue/user_defined_function.go index 4ae35eac722..00442c340e7 100644 --- a/internal/service/glue/user_defined_function.go +++ b/internal/service/glue/user_defined_function.go @@ -265,7 +265,7 @@ func flattenUserDefinedFunctionResourceURI(uris []*glue.ResourceUri) []map[strin for _, i := range uris { l := map[string]interface{}{ names.AttrResourceType: aws.StringValue(i.ResourceType), - "uri": aws.StringValue(i.Uri), + "uri": aws.StringValue(i.Uri), } result = append(result, l) diff --git a/internal/service/kms/custom_key_store_data_source.go b/internal/service/kms/custom_key_store_data_source.go index da20f053723..f151c383da4 100644 --- a/internal/service/kms/custom_key_store_data_source.go +++ b/internal/service/kms/custom_key_store_data_source.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_kms_custom_key_store", name="Custom Key Store") diff --git a/internal/service/lambda/function_url_data_source.go b/internal/service/lambda/function_url_data_source.go index 964dd31c2d9..e776000ed21 100644 --- a/internal/service/lambda/function_url_data_source.go +++ b/internal/service/lambda/function_url_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_lambda_function_url", name="Function URL") diff --git a/internal/service/s3/canonical_user_id_data_source.go b/internal/service/s3/canonical_user_id_data_source.go index 80bc631d0a1..3df5dae8d17 100644 --- a/internal/service/s3/canonical_user_id_data_source.go +++ b/internal/service/s3/canonical_user_id_data_source.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_canonical_user_id", name="Canonical User ID") diff --git a/internal/service/secretsmanager/secret_rotation.go b/internal/service/secretsmanager/secret_rotation.go index ecce9df6dec..3164c4d41a2 100644 --- a/internal/service/secretsmanager/secret_rotation.go +++ b/internal/service/secretsmanager/secret_rotation.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_secretsmanager_secret_rotation", name="Secret Rotation") diff --git a/internal/service/secretsmanager/secret_rotation_data_source.go b/internal/service/secretsmanager/secret_rotation_data_source.go index 06e64615c03..a0046413932 100644 --- a/internal/service/secretsmanager/secret_rotation_data_source.go +++ b/internal/service/secretsmanager/secret_rotation_data_source.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_secretsmanager_secret_rotation", name="Secret Rotation") diff --git a/internal/service/secretsmanager/secret_rotation_migrate.go b/internal/service/secretsmanager/secret_rotation_migrate.go index b247181d8c5..1d081d1915b 100644 --- a/internal/service/secretsmanager/secret_rotation_migrate.go +++ b/internal/service/secretsmanager/secret_rotation_migrate.go @@ -7,6 +7,7 @@ import ( "context" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-aws/names" ) func secretRotationStateUpgradeV0(ctx context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { diff --git a/internal/service/securityhub/automation_rule.go b/internal/service/securityhub/automation_rule.go index 4fa08fa15d9..37731c5ee19 100644 --- a/internal/service/securityhub/automation_rule.go +++ b/internal/service/securityhub/automation_rule.go @@ -227,7 +227,7 @@ func (r *automationRuleResource) Schema(ctx context.Context, request resource.Sc "resource_partition": stringFilterSchemaFramework(ctx), "resource_region": stringFilterSchemaFramework(ctx), "resource_tags": mapFilterSchemaFramework(ctx), - names.AttrResourceType: stringFilterSchemaFramework(ctx), + names.AttrResourceType: stringFilterSchemaFramework(ctx), "severity_label": stringFilterSchemaFramework(ctx), "source_url": stringFilterSchemaFramework(ctx), "title": stringFilterSchemaFramework(ctx), diff --git a/internal/service/securityhub/insight.go b/internal/service/securityhub/insight.go index 784f517f6e7..f13807f7319 100644 --- a/internal/service/securityhub/insight.go +++ b/internal/service/securityhub/insight.go @@ -118,7 +118,7 @@ func resourceInsight() *schema.Resource { "resource_partition": stringFilterSchema(), "resource_region": stringFilterSchema(), "resource_tags": mapFilterSchema(), - names.AttrResourceType: stringFilterSchema(), + names.AttrResourceType: stringFilterSchema(), "severity_label": stringFilterSchema(), "source_url": stringFilterSchema(), "threat_intel_indicator_category": stringFilterSchema(), @@ -1211,7 +1211,7 @@ func flattenSecurityFindingFilters(filters *types.AwsSecurityFindingFilters) []i "resource_partition": flattenStringFilters(filters.ResourcePartition), "resource_region": flattenStringFilters(filters.ResourceRegion), "resource_tags": flattenMapFilters(filters.ResourceTags), - names.AttrResourceType: flattenStringFilters(filters.ResourceType), + names.AttrResourceType: flattenStringFilters(filters.ResourceType), "severity_label": flattenStringFilters(filters.SeverityLabel), "source_url": flattenStringFilters(filters.ThreatIntelIndicatorSourceUrl), "threat_intel_indicator_category": flattenStringFilters(filters.ThreatIntelIndicatorCategory), diff --git a/internal/service/sns/topic.go b/internal/service/sns/topic.go index e5fe8a46721..fc27b88659b 100644 --- a/internal/service/sns/topic.go +++ b/internal/service/sns/topic.go @@ -216,7 +216,7 @@ var ( "beginning_archive_time": topicAttributeNameBeginningArchiveTime, "content_based_deduplication": topicAttributeNameContentBasedDeduplication, "delivery_policy": topicAttributeNameDeliveryPolicy, - names.AttrDisplayName: topicAttributeNameDisplayName, + names.AttrDisplayName: topicAttributeNameDisplayName, "fifo_topic": topicAttributeNameFIFOTopic, "firehose_failure_feedback_role_arn": topicAttributeNameFirehoseFailureFeedbackRoleARN, "firehose_success_feedback_role_arn": topicAttributeNameFirehoseSuccessFeedbackRoleARN, diff --git a/internal/service/ssoadmin/application_providers_data_source.go b/internal/service/ssoadmin/application_providers_data_source.go index 21a8c86c4d1..3c9ed351bba 100644 --- a/internal/service/ssoadmin/application_providers_data_source.go +++ b/internal/service/ssoadmin/application_providers_data_source.go @@ -121,7 +121,7 @@ var applicationProviderAttrTypes = map[string]attr.Type{ var displayDataAttrTypes = map[string]attr.Type{ names.AttrDescription: types.StringType, - names.AttrDisplayName: types.StringType, + names.AttrDisplayName: types.StringType, "icon_url": types.StringType, } @@ -165,7 +165,7 @@ func flattenDisplayData(ctx context.Context, apiObject *awstypes.DisplayData) (t obj := map[string]attr.Value{ names.AttrDescription: flex.StringToFramework(ctx, apiObject.Description), - names.AttrDisplayName: flex.StringToFramework(ctx, apiObject.DisplayName), + names.AttrDisplayName: flex.StringToFramework(ctx, apiObject.DisplayName), "icon_url": flex.StringToFramework(ctx, apiObject.IconUrl), } objVal, d := types.ObjectValue(displayDataAttrTypes, obj) diff --git a/internal/service/worklink/website_certificate_authority_association.go b/internal/service/worklink/website_certificate_authority_association.go index 4459406f671..22fd4c51323 100644 --- a/internal/service/worklink/website_certificate_authority_association.go +++ b/internal/service/worklink/website_certificate_authority_association.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_worklink_website_certificate_authority_association") From 84589e804928acdcd0146556433f9efbe7a1b13b Mon Sep 17 00:00:00 2001 From: changelogbot Date: Sat, 11 May 2024 01:56:55 +0000 Subject: [PATCH 1405/1490] Update CHANGELOG.md for #37444 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00a9de6e2c0..fd0f7e5f3a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ENHANCEMENTS: * data-source/aws_instance: Add `launch_time` attribute ([#37002](https://github.com/hashicorp/terraform-provider-aws/issues/37002)) * resource/aws_budgets_budget: Add `tags` argument ([#37361](https://github.com/hashicorp/terraform-provider-aws/issues/37361)) * resource/aws_budgets_budget_action: Add `tags` argument ([#37361](https://github.com/hashicorp/terraform-provider-aws/issues/37361)) +* resource/aws_ecs_account_setting_default: Add support for `fargateTaskRetirementWaitPeriod` value in `Name` argument ([#37018](https://github.com/hashicorp/terraform-provider-aws/issues/37018)) BUG FIXES: From 268648c096435bd57b64d939d8cf349477fdf9cf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:17 -0400 Subject: [PATCH 1406/1490] ci: Prefer constant for string literals --- .ci/.semgrep-constants.yml | 110 +++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/.ci/.semgrep-constants.yml b/.ci/.semgrep-constants.yml index b140cad2367..0b69a712e66 100644 --- a/.ci/.semgrep-constants.yml +++ b/.ci/.semgrep-constants.yml @@ -140,6 +140,16 @@ rules: - pattern: '"catalog_id"' severity: ERROR fix: "names.AttrCatalogID" + - id: literal-certificate-string-constant + languages: [go] + message: Use the constant `names.AttrCertificate` for the string literal "certificate" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"certificate"' + severity: ERROR + fix: "names.AttrCertificate" - id: literal-certificate_arn-string-constant languages: [go] message: Use the constant `names.AttrCertificateARN` for the string literal "certificate_arn" @@ -170,6 +180,16 @@ rules: - pattern: '"configuration"' severity: ERROR fix: "names.AttrConfiguration" + - id: literal-content_type-string-constant + languages: [go] + message: Use the constant `names.AttrContentType` for the string literal "content_type" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"content_type"' + severity: ERROR + fix: "names.AttrContentType" - id: literal-created_at-string-constant languages: [go] message: Use the constant `names.AttrCreatedAt` for the string literal "created_at" @@ -330,6 +350,16 @@ rules: - pattern: '"endpoint"' severity: ERROR fix: "names.AttrEndpoint" + - id: literal-endpoint_type-string-constant + languages: [go] + message: Use the constant `names.AttrEndpointType` for the string literal "endpoint_type" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"endpoint_type"' + severity: ERROR + fix: "names.AttrEndpointType" - id: literal-endpoints-string-constant languages: [go] message: Use the constant `names.AttrEndpoints` for the string literal "endpoints" @@ -420,6 +450,16 @@ rules: - pattern: '"id"' severity: ERROR fix: "names.AttrID" + - id: literal-identifier-string-constant + languages: [go] + message: Use the constant `names.AttrIdentifier` for the string literal "identifier" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"identifier"' + severity: ERROR + fix: "names.AttrIdentifier" - id: literal-instance_id-string-constant languages: [go] message: Use the constant `names.AttrInstanceID` for the string literal "instance_id" @@ -480,6 +520,16 @@ rules: - pattern: '"last_updated_date"' severity: ERROR fix: "names.AttrLastUpdatedDate" + - id: literal-log_group_name-string-constant + languages: [go] + message: Use the constant `names.AttrLogGroupName` for the string literal "log_group_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"log_group_name"' + severity: ERROR + fix: "names.AttrLogGroupName" - id: literal-max-string-constant languages: [go] message: Use the constant `names.AttrMax` for the string literal "max" @@ -530,6 +580,16 @@ rules: - pattern: '"name_prefix"' severity: ERROR fix: "names.AttrNamePrefix" + - id: literal-namespace-string-constant + languages: [go] + message: Use the constant `names.AttrNamespace` for the string literal "namespace" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"namespace"' + severity: ERROR + fix: "names.AttrNamespace" - id: literal-network_configuration-string-constant languages: [go] message: Use the constant `names.AttrNetworkConfiguration` for the string literal "network_configuration" @@ -720,6 +780,26 @@ rules: - pattern: '"role_arn"' severity: ERROR fix: "names.AttrRoleARN" + - id: literal-s3_bucket_name-string-constant + languages: [go] + message: Use the constant `names.AttrS3BucketName` for the string literal "s3_bucket_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"s3_bucket_name"' + severity: ERROR + fix: "names.AttrS3BucketName" + - id: literal-sns_topic_arn-string-constant + languages: [go] + message: Use the constant `names.AttrSNSTopicARN` for the string literal "sns_topic_arn" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"sns_topic_arn"' + severity: ERROR + fix: "names.AttrSNSTopicARN" - id: literal-schedule_expression-string-constant languages: [go] message: Use the constant `names.AttrScheduleExpression` for the string literal "schedule_expression" @@ -760,6 +840,16 @@ rules: - pattern: '"security_groups"' severity: ERROR fix: "names.AttrSecurityGroups" + - id: literal-service_name-string-constant + languages: [go] + message: Use the constant `names.AttrServiceName` for the string literal "service_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"service_name"' + severity: ERROR + fix: "names.AttrServiceName" - id: literal-session-string-constant languages: [go] message: Use the constant `names.AttrSession` for the string literal "session" @@ -850,6 +940,16 @@ rules: - pattern: '"subnet_ids"' severity: ERROR fix: "names.AttrSubnetIDs" + - id: literal-table_name-string-constant + languages: [go] + message: Use the constant `names.AttrTableName` for the string literal "table_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"table_name"' + severity: ERROR + fix: "names.AttrTableName" - id: literal-tags-string-constant languages: [go] message: Use the constant `names.AttrTags` for the string literal "tags" @@ -940,6 +1040,16 @@ rules: - pattern: '"unit"' severity: ERROR fix: "names.AttrUnit" + - id: literal-user_name-string-constant + languages: [go] + message: Use the constant `names.AttrUserName` for the string literal "user_name" + paths: + include: + - "internal/service/**/*.go" + patterns: + - pattern: '"user_name"' + severity: ERROR + fix: "names.AttrUserName" - id: literal-username-string-constant languages: [go] message: Use the constant `names.AttrUsername` for the string literal "username" From 42b2ede1b266379061b4f9f6a9817a4498aed196 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:17 -0400 Subject: [PATCH 1407/1490] names: Add constant for string literals --- names/attr_consts_gen.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/names/attr_consts_gen.go b/names/attr_consts_gen.go index 81ad17d8f90..1b8d880c57f 100644 --- a/names/attr_consts_gen.go +++ b/names/attr_consts_gen.go @@ -23,9 +23,11 @@ const ( AttrBucketName = "bucket_name" AttrBucketPrefix = "bucket_prefix" AttrCatalogID = "catalog_id" + AttrCertificate = "certificate" AttrCertificateARN = "certificate_arn" AttrClusterIdentifier = "cluster_identifier" AttrConfiguration = "configuration" + AttrContentType = "content_type" AttrCreatedAt = "created_at" AttrCreatedDate = "created_date" AttrCreationDate = "creation_date" @@ -42,6 +44,7 @@ const ( AttrEncrypted = "encrypted" AttrEncryptionConfiguration = "encryption_configuration" AttrEndpoint = "endpoint" + AttrEndpointType = "endpoint_type" AttrEndpoints = "endpoints" AttrEngineVersion = "engine_version" AttrExecutionRoleARN = "execution_role_arn" @@ -51,17 +54,20 @@ const ( AttrFormat = "format" AttrHostedZoneID = "hosted_zone_id" AttrID = "id" + AttrIdentifier = "identifier" AttrInstanceID = "instance_id" AttrInstanceType = "instance_type" AttrKMSKeyARN = "kms_key_arn" AttrKMSKeyID = "kms_key_id" AttrKey = "key" AttrLastUpdatedDate = "last_updated_date" + AttrLogGroupName = "log_group_name" AttrMax = "max" AttrMin = "min" AttrMode = "mode" AttrName = "name" AttrNamePrefix = "name_prefix" + AttrNamespace = "namespace" AttrNetworkConfiguration = "network_configuration" AttrNetworkInterfaceID = "network_interface_id" AttrOwnerID = "owner_id" @@ -81,10 +87,13 @@ const ( AttrResourceARN = "resource_arn" AttrResourceType = "resource_type" AttrRoleARN = "role_arn" + AttrS3BucketName = "s3_bucket_name" + AttrSNSTopicARN = "sns_topic_arn" AttrScheduleExpression = "schedule_expression" AttrSecretKey = "secret_key" AttrSecurityGroupIDs = "security_group_ids" AttrSecurityGroups = "security_groups" + AttrServiceName = "service_name" AttrSession = "session" AttrSharedConfigFiles = "shared_config_files" AttrSkipCredentialsValidation = "skip_credentials_validation" @@ -94,6 +103,7 @@ const ( AttrStatus = "status" AttrSubnetID = "subnet_id" AttrSubnetIDs = "subnet_ids" + AttrTableName = "table_name" AttrTags = "tags" AttrTagsAll = "tags_all" AttrTarget = "target" @@ -103,6 +113,7 @@ const ( AttrType = "type" AttrURL = "url" AttrUnit = "unit" + AttrUserName = "user_name" AttrUsername = "username" AttrVPCID = "vpc_id" AttrVPCSecurityGroupIDs = "vpc_security_group_ids" @@ -130,9 +141,11 @@ func ConstOrQuote(constant string) string { "bucket_name": "AttrBucketName", "bucket_prefix": "AttrBucketPrefix", "catalog_id": "AttrCatalogID", + "certificate": "AttrCertificate", "certificate_arn": "AttrCertificateARN", "cluster_identifier": "AttrClusterIdentifier", "configuration": "AttrConfiguration", + "content_type": "AttrContentType", "created_at": "AttrCreatedAt", "created_date": "AttrCreatedDate", "creation_date": "AttrCreationDate", @@ -149,6 +162,7 @@ func ConstOrQuote(constant string) string { "encrypted": "AttrEncrypted", "encryption_configuration": "AttrEncryptionConfiguration", "endpoint": "AttrEndpoint", + "endpoint_type": "AttrEndpointType", "endpoints": "AttrEndpoints", "engine_version": "AttrEngineVersion", "execution_role_arn": "AttrExecutionRoleARN", @@ -158,17 +172,20 @@ func ConstOrQuote(constant string) string { "format": "AttrFormat", "hosted_zone_id": "AttrHostedZoneID", "id": "AttrID", + "identifier": "AttrIdentifier", "instance_id": "AttrInstanceID", "instance_type": "AttrInstanceType", "kms_key_arn": "AttrKMSKeyARN", "kms_key_id": "AttrKMSKeyID", "key": "AttrKey", "last_updated_date": "AttrLastUpdatedDate", + "log_group_name": "AttrLogGroupName", "max": "AttrMax", "min": "AttrMin", "mode": "AttrMode", "name": "AttrName", "name_prefix": "AttrNamePrefix", + "namespace": "AttrNamespace", "network_configuration": "AttrNetworkConfiguration", "network_interface_id": "AttrNetworkInterfaceID", "owner_id": "AttrOwnerID", @@ -188,10 +205,13 @@ func ConstOrQuote(constant string) string { "resource_arn": "AttrResourceARN", "resource_type": "AttrResourceType", "role_arn": "AttrRoleARN", + "s3_bucket_name": "AttrS3BucketName", + "sns_topic_arn": "AttrSNSTopicARN", "schedule_expression": "AttrScheduleExpression", "secret_key": "AttrSecretKey", "security_group_ids": "AttrSecurityGroupIDs", "security_groups": "AttrSecurityGroups", + "service_name": "AttrServiceName", "session": "AttrSession", "shared_config_files": "AttrSharedConfigFiles", "skip_credentials_validation": "AttrSkipCredentialsValidation", @@ -201,6 +221,7 @@ func ConstOrQuote(constant string) string { "status": "AttrStatus", "subnet_id": "AttrSubnetID", "subnet_ids": "AttrSubnetIDs", + "table_name": "AttrTableName", "tags": "AttrTags", "tags_all": "AttrTagsAll", "target": "AttrTarget", @@ -210,6 +231,7 @@ func ConstOrQuote(constant string) string { "type": "AttrType", "url": "AttrURL", "unit": "AttrUnit", + "user_name": "AttrUserName", "username": "AttrUsername", "vpc_id": "AttrVPCID", "vpc_security_group_ids": "AttrVPCSecurityGroupIDs", From cfcaf82605fd12bdcf63a903cce6bb65a7c364ba Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:18 -0400 Subject: [PATCH 1408/1490] acm: Use constants for strings --- internal/service/acm/certificate_data_source.go | 6 +++--- internal/service/acm/certificate_data_source_test.go | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/acm/certificate_data_source.go b/internal/service/acm/certificate_data_source.go index af6aec50fdb..4437d5b873c 100644 --- a/internal/service/acm/certificate_data_source.go +++ b/internal/service/acm/certificate_data_source.go @@ -30,7 +30,7 @@ func dataSourceCertificate() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Computed: true, }, @@ -207,10 +207,10 @@ func dataSourceCertificateRead(ctx context.Context, d *schema.ResourceData, meta } } if output != nil { - d.Set("certificate", output.Certificate) + d.Set(names.AttrCertificate, output.Certificate) d.Set("certificate_chain", output.CertificateChain) } else { - d.Set("certificate", nil) + d.Set(names.AttrCertificate, nil) d.Set("certificate_chain", nil) } diff --git a/internal/service/acm/certificate_data_source_test.go b/internal/service/acm/certificate_data_source_test.go index ae997d92164..bd615ba3d5c 100644 --- a/internal/service/acm/certificate_data_source_test.go +++ b/internal/service/acm/certificate_data_source_test.go @@ -53,7 +53,7 @@ func TestAccACMCertificateDataSource_singleIssued(t *testing.T) { //lintignore:AWSAT001 resource.TestMatchResourceAttr(resourceName, names.AttrARN, arnRe), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, string(awstypes.CertificateStatusIssued)), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttrSet(resourceName, "certificate_chain"), ), }, @@ -63,7 +63,7 @@ func TestAccACMCertificateDataSource_singleIssued(t *testing.T) { //lintignore:AWSAT001 resource.TestMatchResourceAttr(resourceName, names.AttrARN, arnRe), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, string(awstypes.CertificateStatusIssued)), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttrSet(resourceName, "certificate_chain"), ), }, @@ -72,7 +72,7 @@ func TestAccACMCertificateDataSource_singleIssued(t *testing.T) { Check: resource.ComposeTestCheckFunc( //lintignore:AWSAT001 resource.TestMatchResourceAttr(resourceName, names.AttrARN, arnRe), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttrSet(resourceName, "certificate_chain"), ), }, @@ -81,7 +81,7 @@ func TestAccACMCertificateDataSource_singleIssued(t *testing.T) { Check: resource.ComposeTestCheckFunc( //lintignore:AWSAT001 resource.TestMatchResourceAttr(resourceName, names.AttrARN, arnRe), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttrSet(resourceName, "certificate_chain"), ), }, @@ -90,7 +90,7 @@ func TestAccACMCertificateDataSource_singleIssued(t *testing.T) { Check: resource.ComposeTestCheckFunc( //lintignore:AWSAT001 resource.TestMatchResourceAttr(resourceName, names.AttrARN, arnRe), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttrSet(resourceName, "certificate_chain"), ), }, @@ -99,7 +99,7 @@ func TestAccACMCertificateDataSource_singleIssued(t *testing.T) { Check: resource.ComposeTestCheckFunc( //lintignore:AWSAT001 resource.TestMatchResourceAttr(resourceName, names.AttrARN, arnRe), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttrSet(resourceName, "certificate_chain"), ), }, From ffcb2ca5e3e1289ba0142ba138415b96e479b9dd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:18 -0400 Subject: [PATCH 1409/1490] acmpca: Use constants for strings --- internal/service/acmpca/certificate.go | 6 +++--- .../service/acmpca/certificate_authority.go | 20 +++++++++---------- .../certificate_authority_certificate.go | 7 ++++--- .../certificate_authority_certificate_test.go | 8 ++++---- .../certificate_authority_data_source.go | 8 ++++---- .../certificate_authority_data_source_test.go | 4 ++-- .../acmpca/certificate_authority_test.go | 4 ++-- .../service/acmpca/certificate_data_source.go | 4 ++-- .../acmpca/certificate_data_source_test.go | 2 +- internal/service/acmpca/certificate_test.go | 14 ++++++------- 10 files changed, 39 insertions(+), 38 deletions(-) diff --git a/internal/service/acmpca/certificate.go b/internal/service/acmpca/certificate.go index 977befc9c4c..86d88731fb6 100644 --- a/internal/service/acmpca/certificate.go +++ b/internal/service/acmpca/certificate.go @@ -76,7 +76,7 @@ func resourceCertificate() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Computed: true, }, @@ -206,7 +206,7 @@ func resourceCertificateRead(ctx context.Context, d *schema.ResourceData, meta i } d.Set(names.AttrARN, d.Id()) - d.Set("certificate", output.Certificate) + d.Set(names.AttrCertificate, output.Certificate) d.Set("certificate_authority_arn", d.Get("certificate_authority_arn").(string)) d.Set("certificate_chain", output.CertificateChain) @@ -217,7 +217,7 @@ func resourceCertificateRevoke(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ACMPCAClient(ctx) - block, _ := pem.Decode([]byte(d.Get("certificate").(string))) + block, _ := pem.Decode([]byte(d.Get(names.AttrCertificate).(string))) if block == nil { log.Printf("[WARN] Failed to parse ACM PCA Certificate (%s)", d.Id()) return diags diff --git a/internal/service/acmpca/certificate_authority.go b/internal/service/acmpca/certificate_authority.go index 636fb65038b..be46bcdfd5f 100644 --- a/internal/service/acmpca/certificate_authority.go +++ b/internal/service/acmpca/certificate_authority.go @@ -64,7 +64,7 @@ func resourceCertificateAuthority() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Computed: true, }, @@ -260,7 +260,7 @@ func resourceCertificateAuthority() *schema.Resource { return true }, }, - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(3, 255), @@ -421,10 +421,10 @@ func resourceCertificateAuthorityRead(ctx context.Context, d *schema.ResourceDat return sdkdiag.AppendErrorf(diags, "reading ACM PCA Certificate Authority (%s) Certificate: %s", d.Id(), err) } - d.Set("certificate", "") + d.Set(names.AttrCertificate, "") d.Set("certificate_chain", "") if outputGCACert != nil { - d.Set("certificate", outputGCACert.Certificate) + d.Set(names.AttrCertificate, outputGCACert.Certificate) d.Set("certificate_chain", outputGCACert.CertificateChain) } @@ -701,7 +701,7 @@ func expandCrlConfiguration(l []interface{}) *types.CrlConfiguration { if v, ok := m["expiration_in_days"]; ok && v.(int) > 0 { config.ExpirationInDays = aws.Int32(int32(v.(int))) } - if v, ok := m["s3_bucket_name"]; ok && v.(string) != "" { + if v, ok := m[names.AttrS3BucketName]; ok && v.(string) != "" { config.S3BucketName = aws.String(v.(string)) } if v, ok := m["s3_object_acl"]; ok && v.(string) != "" { @@ -789,11 +789,11 @@ func flattenCrlConfiguration(config *types.CrlConfiguration) []interface{} { } m := map[string]interface{}{ - "custom_cname": aws.ToString(config.CustomCname), - names.AttrEnabled: aws.ToBool(config.Enabled), - "expiration_in_days": int(aws.ToInt32(config.ExpirationInDays)), - "s3_bucket_name": aws.ToString(config.S3BucketName), - "s3_object_acl": string(config.S3ObjectAcl), + "custom_cname": aws.ToString(config.CustomCname), + names.AttrEnabled: aws.ToBool(config.Enabled), + "expiration_in_days": int(aws.ToInt32(config.ExpirationInDays)), + names.AttrS3BucketName: aws.ToString(config.S3BucketName), + "s3_object_acl": string(config.S3ObjectAcl), } return []interface{}{m} diff --git a/internal/service/acmpca/certificate_authority_certificate.go b/internal/service/acmpca/certificate_authority_certificate.go index d23e83a85ee..8d3313defd6 100644 --- a/internal/service/acmpca/certificate_authority_certificate.go +++ b/internal/service/acmpca/certificate_authority_certificate.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_acmpca_certificate_authority_certificate", name="Certificate Authority Certificate") @@ -33,7 +34,7 @@ func resourceCertificateAuthorityCertificate() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -61,7 +62,7 @@ func resourceCertificateAuthorityCertificateCreate(ctx context.Context, d *schem certificateAuthorityARN := d.Get("certificate_authority_arn").(string) input := &acmpca.ImportCertificateAuthorityCertificateInput{ - Certificate: []byte(d.Get("certificate").(string)), + Certificate: []byte(d.Get(names.AttrCertificate).(string)), CertificateAuthorityArn: aws.String(certificateAuthorityARN), } @@ -96,7 +97,7 @@ func resourceCertificateAuthorityCertificateRead(ctx context.Context, d *schema. } d.Set("certificate_authority_arn", d.Id()) - d.Set("certificate", output.Certificate) + d.Set(names.AttrCertificate, output.Certificate) d.Set("certificate_chain", output.CertificateChain) return diags diff --git a/internal/service/acmpca/certificate_authority_certificate_test.go b/internal/service/acmpca/certificate_authority_certificate_test.go index 67f0aecef5b..cfd06d286e1 100644 --- a/internal/service/acmpca/certificate_authority_certificate_test.go +++ b/internal/service/acmpca/certificate_authority_certificate_test.go @@ -34,7 +34,7 @@ func TestAccACMPCACertificateAuthorityCertificate_rootCA(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateAuthorityCertificateExists(ctx, resourceName, &v), resource.TestCheckResourceAttrPair(resourceName, "certificate_authority_arn", "aws_acmpca_certificate_authority.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "certificate", "aws_acmpca_certificate.test", "certificate"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificate, "aws_acmpca_certificate.test", names.AttrCertificate), resource.TestCheckResourceAttrPair(resourceName, "certificate_chain", "aws_acmpca_certificate.test", "certificate_chain"), ), }, @@ -65,7 +65,7 @@ func TestAccACMPCACertificateAuthorityCertificate_updateRootCA(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateAuthorityCertificateExists(ctx, resourceName, &v), resource.TestCheckResourceAttrPair(resourceName, "certificate_authority_arn", "aws_acmpca_certificate_authority.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "certificate", "aws_acmpca_certificate.test", "certificate"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificate, "aws_acmpca_certificate.test", names.AttrCertificate), resource.TestCheckResourceAttrPair(resourceName, "certificate_chain", "aws_acmpca_certificate.test", "certificate_chain"), ), }, @@ -74,7 +74,7 @@ func TestAccACMPCACertificateAuthorityCertificate_updateRootCA(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateAuthorityCertificateExists(ctx, updatedResourceName, &v), resource.TestCheckResourceAttrPair(updatedResourceName, "certificate_authority_arn", "aws_acmpca_certificate_authority.test", names.AttrARN), - resource.TestCheckResourceAttrPair(updatedResourceName, "certificate", "aws_acmpca_certificate.updated", "certificate"), + resource.TestCheckResourceAttrPair(updatedResourceName, names.AttrCertificate, "aws_acmpca_certificate.updated", names.AttrCertificate), resource.TestCheckResourceAttrPair(updatedResourceName, "certificate_chain", "aws_acmpca_certificate.updated", "certificate_chain"), ), }, @@ -99,7 +99,7 @@ func TestAccACMPCACertificateAuthorityCertificate_subordinateCA(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateAuthorityCertificateExists(ctx, resourceName, &v), resource.TestCheckResourceAttrPair(resourceName, "certificate_authority_arn", "aws_acmpca_certificate_authority.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "certificate", "aws_acmpca_certificate.test", "certificate"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificate, "aws_acmpca_certificate.test", names.AttrCertificate), resource.TestCheckResourceAttrPair(resourceName, "certificate_chain", "aws_acmpca_certificate.test", "certificate_chain"), ), }, diff --git a/internal/service/acmpca/certificate_authority_data_source.go b/internal/service/acmpca/certificate_authority_data_source.go index 97515650e88..14991efcdec 100644 --- a/internal/service/acmpca/certificate_authority_data_source.go +++ b/internal/service/acmpca/certificate_authority_data_source.go @@ -31,7 +31,7 @@ func dataSourceCertificateAuthority() *schema.Resource { Type: schema.TypeString, Required: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Computed: true, }, @@ -79,7 +79,7 @@ func dataSourceCertificateAuthority() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Computed: true, }, @@ -169,10 +169,10 @@ func dataSourceCertificateAuthorityRead(ctx context.Context, d *schema.ResourceD return sdkdiag.AppendErrorf(diags, "reading ACM PCA Certificate Authority (%s) Certificate: %s", d.Id(), err) } - d.Set("certificate", "") + d.Set(names.AttrCertificate, "") d.Set("certificate_chain", "") if outputGCACert != nil { - d.Set("certificate", outputGCACert.Certificate) + d.Set(names.AttrCertificate, outputGCACert.Certificate) d.Set("certificate_chain", outputGCACert.CertificateChain) } diff --git a/internal/service/acmpca/certificate_authority_data_source_test.go b/internal/service/acmpca/certificate_authority_data_source_test.go index dc644eb6927..e957fc08ec1 100644 --- a/internal/service/acmpca/certificate_authority_data_source_test.go +++ b/internal/service/acmpca/certificate_authority_data_source_test.go @@ -33,7 +33,7 @@ func TestAccACMPCACertificateAuthorityDataSource_basic(t *testing.T) { Config: testAccCertificateAuthorityDataSourceConfig_arn(commonName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(datasourceName, "certificate", resourceName, "certificate"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrCertificate, resourceName, names.AttrCertificate), resource.TestCheckResourceAttrPair(datasourceName, "certificate_chain", resourceName, "certificate_chain"), resource.TestCheckResourceAttrPair(datasourceName, "certificate_signing_request", resourceName, "certificate_signing_request"), resource.TestCheckResourceAttrPair(datasourceName, "key_storage_security_standard", resourceName, "key_storage_security_standard"), @@ -72,7 +72,7 @@ func TestAccACMPCACertificateAuthorityDataSource_s3ObjectACL(t *testing.T) { Config: testAccCertificateAuthorityDataSourceConfig_s3ObjectACLARN(commonName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(datasourceName, "certificate", resourceName, "certificate"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrCertificate, resourceName, names.AttrCertificate), resource.TestCheckResourceAttrPair(datasourceName, "certificate_chain", resourceName, "certificate_chain"), resource.TestCheckResourceAttrPair(datasourceName, "certificate_signing_request", resourceName, "certificate_signing_request"), resource.TestCheckResourceAttrPair(datasourceName, "key_storage_security_standard", resourceName, "key_storage_security_standard"), diff --git a/internal/service/acmpca/certificate_authority_test.go b/internal/service/acmpca/certificate_authority_test.go index 530ed3ad26b..7347fc9b9ad 100644 --- a/internal/service/acmpca/certificate_authority_test.go +++ b/internal/service/acmpca/certificate_authority_test.go @@ -46,7 +46,7 @@ func TestAccACMPCACertificateAuthority_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "certificate_authority_configuration.0.signing_algorithm", "SHA512WITHRSA"), resource.TestCheckResourceAttr(resourceName, "certificate_authority_configuration.0.subject.#", "1"), resource.TestCheckResourceAttr(resourceName, "certificate_authority_configuration.0.subject.0.common_name", commonName), - resource.TestCheckResourceAttr(resourceName, "certificate", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrCertificate, ""), resource.TestCheckResourceAttr(resourceName, "certificate_chain", ""), resource.TestCheckResourceAttrSet(resourceName, "certificate_signing_request"), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "true"), @@ -256,7 +256,7 @@ func TestAccACMPCACertificateAuthority_RevocationConfiguration_empty(t *testing. resource.TestCheckResourceAttr(resourceName, "certificate_authority_configuration.0.signing_algorithm", "SHA512WITHRSA"), resource.TestCheckResourceAttr(resourceName, "certificate_authority_configuration.0.subject.#", "1"), resource.TestCheckResourceAttr(resourceName, "certificate_authority_configuration.0.subject.0.common_name", commonName), - resource.TestCheckResourceAttr(resourceName, "certificate", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrCertificate, ""), resource.TestCheckResourceAttr(resourceName, "certificate_chain", ""), resource.TestCheckResourceAttrSet(resourceName, "certificate_signing_request"), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "true"), diff --git a/internal/service/acmpca/certificate_data_source.go b/internal/service/acmpca/certificate_data_source.go index 84350c0ae84..5ddf144aaa3 100644 --- a/internal/service/acmpca/certificate_data_source.go +++ b/internal/service/acmpca/certificate_data_source.go @@ -25,7 +25,7 @@ func dataSourceCertificate() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Computed: true, }, @@ -54,7 +54,7 @@ func dataSourceCertificateRead(ctx context.Context, d *schema.ResourceData, meta } d.SetId(certificateARN) - d.Set("certificate", output.Certificate) + d.Set(names.AttrCertificate, output.Certificate) d.Set("certificate_chain", output.CertificateChain) return diags diff --git a/internal/service/acmpca/certificate_data_source_test.go b/internal/service/acmpca/certificate_data_source_test.go index 672f4140d5e..2c568c585b8 100644 --- a/internal/service/acmpca/certificate_data_source_test.go +++ b/internal/service/acmpca/certificate_data_source_test.go @@ -33,7 +33,7 @@ func TestAccACMPCACertificateDataSource_basic(t *testing.T) { Config: testAccCertificateDataSourceConfig_arn(domain), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(dataSourceName, "certificate", resourceName, "certificate"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrCertificate, resourceName, names.AttrCertificate), resource.TestCheckResourceAttrPair(dataSourceName, "certificate_chain", resourceName, "certificate_chain"), resource.TestCheckResourceAttrPair(dataSourceName, "certificate_authority_arn", resourceName, "certificate_authority_arn"), ), diff --git a/internal/service/acmpca/certificate_test.go b/internal/service/acmpca/certificate_test.go index 1b22c4a9567..73aea30a013 100644 --- a/internal/service/acmpca/certificate_test.go +++ b/internal/service/acmpca/certificate_test.go @@ -41,7 +41,7 @@ func TestAccACMPCACertificate_rootCertificate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "acm-pca", regexache.MustCompile(`certificate-authority/.+/certificate/.+$`)), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttr(resourceName, "certificate_chain", ""), resource.TestCheckResourceAttrPair(resourceName, "certificate_authority_arn", certificateAuthorityResourceName, names.AttrARN), resource.TestCheckResourceAttrSet(resourceName, "certificate_signing_request"), @@ -86,7 +86,7 @@ func TestAccACMPCACertificate_rootCertificateWithAPIPassthrough(t *testing.T) { testAccCheckCertificateExists(ctx, resourceName), testAccCheckCertificateExtension(resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "acm-pca", regexache.MustCompile(`certificate-authority/.+/certificate/.+$`)), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttr(resourceName, "certificate_chain", ""), resource.TestCheckResourceAttrPair(resourceName, "certificate_authority_arn", certificateAuthorityResourceName, names.AttrARN), resource.TestCheckResourceAttrSet(resourceName, "certificate_signing_request"), @@ -130,7 +130,7 @@ func TestAccACMPCACertificate_subordinateCertificate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "acm-pca", regexache.MustCompile(`certificate-authority/.+/certificate/.+$`)), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttrSet(resourceName, "certificate_chain"), resource.TestCheckResourceAttrPair(resourceName, "certificate_authority_arn", rootCertificateAuthorityResourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "certificate_signing_request", subordinateCertificateAuthorityResourceName, "certificate_signing_request"), @@ -174,7 +174,7 @@ func TestAccACMPCACertificate_endEntityCertificate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "acm-pca", regexache.MustCompile(`certificate-authority/.+/certificate/.+$`)), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttrSet(resourceName, "certificate_chain"), resource.TestCheckResourceAttr(resourceName, "certificate_signing_request", csr), resource.TestCheckResourceAttr(resourceName, "validity.0.value", "1"), @@ -218,7 +218,7 @@ func TestAccACMPCACertificate_Validity_endDate(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "acm-pca", regexache.MustCompile(`certificate-authority/.+/certificate/.+$`)), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttrSet(resourceName, "certificate_chain"), resource.TestCheckResourceAttr(resourceName, "certificate_signing_request", csr), resource.TestCheckResourceAttr(resourceName, "validity.0.value", later), @@ -262,7 +262,7 @@ func TestAccACMPCACertificate_Validity_absolute(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCertificateExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "acm-pca", regexache.MustCompile(`certificate-authority/.+/certificate/.+$`)), - resource.TestCheckResourceAttrSet(resourceName, "certificate"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrCertificate), resource.TestCheckResourceAttrSet(resourceName, "certificate_chain"), resource.TestCheckResourceAttr(resourceName, "certificate_signing_request", csr), resource.TestCheckResourceAttr(resourceName, "validity.0.value", strconv.FormatInt(later, 10)), @@ -340,7 +340,7 @@ func testAccCheckCertificateExtension(resourceName string) resource.TestCheckFun return fmt.Errorf("Not found: %s", resourceName) } - block, _ := pem.Decode([]byte(rs.Primary.Attributes["certificate"])) + block, _ := pem.Decode([]byte(rs.Primary.Attributes[names.AttrCertificate])) cert, err := x509.ParseCertificate(block.Bytes) if err != nil { return fmt.Errorf("Failed to parse certificate: %w", err) From 6255f525c427fdf3afa3ab1f783343ae143751ee Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:19 -0400 Subject: [PATCH 1410/1490] apigateway: Use constants for strings --- internal/service/apigateway/export_data_source.go | 4 ++-- internal/service/apigateway/export_data_source_test.go | 2 +- internal/service/apigateway/model.go | 6 +++--- internal/service/apigateway/model_test.go | 2 +- internal/service/apigateway/sdk_data_source.go | 4 ++-- internal/service/apigateway/sdk_data_source_test.go | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/service/apigateway/export_data_source.go b/internal/service/apigateway/export_data_source.go index 8c48416e0fd..f55794d6895 100644 --- a/internal/service/apigateway/export_data_source.go +++ b/internal/service/apigateway/export_data_source.go @@ -32,7 +32,7 @@ func dataSourceExport() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Computed: true, }, @@ -93,7 +93,7 @@ func dataSourceExportRead(ctx context.Context, d *schema.ResourceData, meta inte d.SetId(id) d.Set("body", string(export.Body)) d.Set("content_disposition", export.ContentDisposition) - d.Set("content_type", export.ContentType) + d.Set(names.AttrContentType, export.ContentType) return diags } diff --git a/internal/service/apigateway/export_data_source_test.go b/internal/service/apigateway/export_data_source_test.go index e7d40c924d6..25026c4e685 100644 --- a/internal/service/apigateway/export_data_source_test.go +++ b/internal/service/apigateway/export_data_source_test.go @@ -28,7 +28,7 @@ func TestAccAPIGatewayExportDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair("aws_api_gateway_stage.test", "rest_api_id", dataSourceName, "rest_api_id"), resource.TestCheckResourceAttrPair("aws_api_gateway_stage.test", "stage_name", dataSourceName, "stage_name"), resource.TestCheckResourceAttrSet(dataSourceName, "body"), - resource.TestCheckResourceAttrSet(dataSourceName, "content_type"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrContentType), resource.TestCheckResourceAttrSet(dataSourceName, "content_disposition"), ), }, diff --git a/internal/service/apigateway/model.go b/internal/service/apigateway/model.go index ce499cd6b35..20dc4813da2 100644 --- a/internal/service/apigateway/model.go +++ b/internal/service/apigateway/model.go @@ -59,7 +59,7 @@ func resourceModel() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -98,7 +98,7 @@ func resourceModelCreate(ctx context.Context, d *schema.ResourceData, meta inter name := d.Get(names.AttrName).(string) input := &apigateway.CreateModelInput{ - ContentType: aws.String(d.Get("content_type").(string)), + ContentType: aws.String(d.Get(names.AttrContentType).(string)), Name: aws.String(name), RestApiId: aws.String(d.Get("rest_api_id").(string)), } @@ -138,7 +138,7 @@ func resourceModelRead(ctx context.Context, d *schema.ResourceData, meta interfa return sdkdiag.AppendErrorf(diags, "reading API Gateway Model (%s): %s", d.Id(), err) } - d.Set("content_type", model.ContentType) + d.Set(names.AttrContentType, model.ContentType) d.Set(names.AttrDescription, model.Description) d.Set("schema", model.Schema) diff --git a/internal/service/apigateway/model_test.go b/internal/service/apigateway/model_test.go index b023f4e0752..08538c3c4e5 100644 --- a/internal/service/apigateway/model_test.go +++ b/internal/service/apigateway/model_test.go @@ -36,7 +36,7 @@ func TestAccAPIGatewayModel_basic(t *testing.T) { Config: testAccModelConfig_basic(rName, modelName), Check: resource.ComposeTestCheckFunc( testAccCheckModelExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/json"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/json"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "a test schema"), resource.TestCheckResourceAttr(resourceName, names.AttrName, modelName), ), diff --git a/internal/service/apigateway/sdk_data_source.go b/internal/service/apigateway/sdk_data_source.go index 26120dd7948..7bd042faaac 100644 --- a/internal/service/apigateway/sdk_data_source.go +++ b/internal/service/apigateway/sdk_data_source.go @@ -27,7 +27,7 @@ func dataSourceSDK() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Computed: true, }, @@ -85,7 +85,7 @@ func dataSourceSDKRead(ctx context.Context, d *schema.ResourceData, meta interfa d.SetId(id) d.Set("body", string(sdk.Body)) d.Set("content_disposition", sdk.ContentDisposition) - d.Set("content_type", sdk.ContentType) + d.Set(names.AttrContentType, sdk.ContentType) return diags } diff --git a/internal/service/apigateway/sdk_data_source_test.go b/internal/service/apigateway/sdk_data_source_test.go index 57bfbac48bf..0830c55520f 100644 --- a/internal/service/apigateway/sdk_data_source_test.go +++ b/internal/service/apigateway/sdk_data_source_test.go @@ -28,7 +28,7 @@ func TestAccAPIGatewaySDKDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair("aws_api_gateway_stage.test", "rest_api_id", dataSourceName, "rest_api_id"), resource.TestCheckResourceAttrPair("aws_api_gateway_stage.test", "stage_name", dataSourceName, "stage_name"), resource.TestCheckResourceAttrSet(dataSourceName, "body"), - resource.TestCheckResourceAttrSet(dataSourceName, "content_type"), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrContentType), resource.TestCheckResourceAttrSet(dataSourceName, "content_disposition"), ), }, From a84a87c100c1eb749d012bf26e994e5f56ad2f94 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:19 -0400 Subject: [PATCH 1411/1490] apigatewayv2: Use constants for strings --- internal/service/apigatewayv2/domain_name.go | 6 +++--- internal/service/apigatewayv2/model.go | 10 +++++----- internal/service/apigatewayv2/model_test.go | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/apigatewayv2/domain_name.go b/internal/service/apigatewayv2/domain_name.go index db39bcf393d..3b0c49dcf65 100644 --- a/internal/service/apigatewayv2/domain_name.go +++ b/internal/service/apigatewayv2/domain_name.go @@ -72,7 +72,7 @@ func resourceDomainName() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(enum.Slice(awstypes.EndpointTypeRegional), true), @@ -320,7 +320,7 @@ func expandDomainNameConfiguration(tfMap map[string]interface{}) awstypes.Domain apiObject.CertificateArn = aws.String(v) } - if v, ok := tfMap["endpoint_type"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrEndpointType].(string); ok && v != "" { apiObject.EndpointType = awstypes.EndpointType(v) } @@ -363,7 +363,7 @@ func flattenDomainNameConfiguration(apiObject awstypes.DomainNameConfiguration) tfMap[names.AttrCertificateARN] = aws.ToString(v) } - tfMap["endpoint_type"] = string(apiObject.EndpointType) + tfMap[names.AttrEndpointType] = string(apiObject.EndpointType) if v := apiObject.HostedZoneId; v != nil { tfMap[names.AttrHostedZoneID] = aws.ToString(v) diff --git a/internal/service/apigatewayv2/model.go b/internal/service/apigatewayv2/model.go index a47c854d210..148e075b72e 100644 --- a/internal/service/apigatewayv2/model.go +++ b/internal/service/apigatewayv2/model.go @@ -44,7 +44,7 @@ func resourceModel() *schema.Resource { Required: true, ForceNew: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 256), @@ -87,7 +87,7 @@ func resourceModelCreate(ctx context.Context, d *schema.ResourceData, meta inter name := d.Get(names.AttrName).(string) input := &apigatewayv2.CreateModelInput{ ApiId: aws.String(d.Get("api_id").(string)), - ContentType: aws.String(d.Get("content_type").(string)), + ContentType: aws.String(d.Get(names.AttrContentType).(string)), Name: aws.String(name), Schema: aws.String(d.Get("schema").(string)), } @@ -123,7 +123,7 @@ func resourceModelRead(ctx context.Context, d *schema.ResourceData, meta interfa return sdkdiag.AppendErrorf(diags, "reading API Gateway v2 Model (%s): %s", d.Id(), err) } - d.Set("content_type", output.ContentType) + d.Set(names.AttrContentType, output.ContentType) d.Set(names.AttrDescription, output.Description) d.Set(names.AttrName, output.Name) d.Set("schema", output.Schema) @@ -140,8 +140,8 @@ func resourceModelUpdate(ctx context.Context, d *schema.ResourceData, meta inter ModelId: aws.String(d.Id()), } - if d.HasChange("content_type") { - input.ContentType = aws.String(d.Get("content_type").(string)) + if d.HasChange(names.AttrContentType) { + input.ContentType = aws.String(d.Get(names.AttrContentType).(string)) } if d.HasChange(names.AttrDescription) { diff --git a/internal/service/apigatewayv2/model_test.go b/internal/service/apigatewayv2/model_test.go index 4c166ed0a79..b115aa6ebd9 100644 --- a/internal/service/apigatewayv2/model_test.go +++ b/internal/service/apigatewayv2/model_test.go @@ -50,7 +50,7 @@ func TestAccAPIGatewayV2Model_basic(t *testing.T) { Config: testAccModelConfig_basic(rName, schema), Check: resource.ComposeTestCheckFunc( testAccCheckModelExists(ctx, resourceName, &apiId, &v), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/json"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/json"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), acctest.CheckResourceAttrEquivalentJSON(resourceName, "schema", schema), @@ -149,7 +149,7 @@ func TestAccAPIGatewayV2Model_allAttributes(t *testing.T) { Config: testAccModelConfig_allAttributes(rName, schema1), Check: resource.ComposeTestCheckFunc( testAccCheckModelExists(ctx, resourceName, &apiId, &v), - resource.TestCheckResourceAttr(resourceName, "content_type", "text/x-json"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "text/x-json"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "test"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), acctest.CheckResourceAttrEquivalentJSON(resourceName, "schema", schema1), @@ -159,7 +159,7 @@ func TestAccAPIGatewayV2Model_allAttributes(t *testing.T) { Config: testAccModelConfig_basic(rName, schema2), Check: resource.ComposeTestCheckFunc( testAccCheckModelExists(ctx, resourceName, &apiId, &v), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/json"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/json"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), acctest.CheckResourceAttrEquivalentJSON(resourceName, "schema", schema2), @@ -169,7 +169,7 @@ func TestAccAPIGatewayV2Model_allAttributes(t *testing.T) { Config: testAccModelConfig_allAttributes(rName, schema1), Check: resource.ComposeTestCheckFunc( testAccCheckModelExists(ctx, resourceName, &apiId, &v), - resource.TestCheckResourceAttr(resourceName, "content_type", "text/x-json"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "text/x-json"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "test"), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), acctest.CheckResourceAttrEquivalentJSON(resourceName, "schema", schema1), From 64ab3fb8ab88206232bd4dc189ea03ef2b4ccf9f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:19 -0400 Subject: [PATCH 1412/1490] appautoscaling: Use constants for strings --- internal/service/appautoscaling/policy.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/appautoscaling/policy.go b/internal/service/appautoscaling/policy.go index ea3394f3b47..dfbe4fff78c 100644 --- a/internal/service/appautoscaling/policy.go +++ b/internal/service/appautoscaling/policy.go @@ -209,7 +209,7 @@ func resourcePolicy() *schema.Resource { Type: schema.TypeString, Required: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, }, @@ -236,7 +236,7 @@ func resourcePolicy() *schema.Resource { }, }, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"target_tracking_scaling_policy_configuration.0.customized_metric_specification.0.metrics"}, @@ -552,7 +552,7 @@ func expandCustomizedMetricSpecification(configured []interface{}) *applicationa spec.MetricName = aws.String(v.(string)) } - if v, ok := data["namespace"]; ok { + if v, ok := data[names.AttrNamespace]; ok { spec.Namespace = aws.String(v.(string)) } @@ -596,7 +596,7 @@ func expandTargetTrackingMetricDataQueries(metricDataQuerySlices []interface{}) metricSpec := metricStatSpec["metric"].([]interface{})[0].(map[string]interface{}) metric := &applicationautoscaling.TargetTrackingMetric{ MetricName: aws.String(metricSpec["metric_name"].(string)), - Namespace: aws.String(metricSpec["namespace"].(string)), + Namespace: aws.String(metricSpec[names.AttrNamespace].(string)), } if v, ok := metricSpec["dimensions"]; ok { dims := v.(*schema.Set).List() @@ -851,7 +851,7 @@ func flattenCustomizedMetricSpecification(cfg *applicationautoscaling.Customized } if v := cfg.Namespace; v != nil { - m["namespace"] = aws.StringValue(v) + m[names.AttrNamespace] = aws.StringValue(v) } if v := cfg.Statistic; v != nil { @@ -895,7 +895,7 @@ func flattenTargetTrackingMetricDataQueries(metricDataQueries []*applicationauto metricSpec["dimensions"] = dimSpec } metricSpec["metric_name"] = aws.StringValue(rawMetric.MetricName) - metricSpec["namespace"] = aws.StringValue(rawMetric.Namespace) + metricSpec[names.AttrNamespace] = aws.StringValue(rawMetric.Namespace) metricStatSpec["metric"] = []map[string]interface{}{metricSpec} metricStatSpec["stat"] = aws.StringValue(rawMetricStat.Stat) if rawMetricStat.Unit != nil { From d17db0eeae781eae20d724af4c0784a7b0182bcb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:19 -0400 Subject: [PATCH 1413/1490] appconfig: Use constants for strings --- internal/service/appconfig/hosted_configuration_version.go | 6 +++--- .../service/appconfig/hosted_configuration_version_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/appconfig/hosted_configuration_version.go b/internal/service/appconfig/hosted_configuration_version.go index 823d89790ca..89caed767d5 100644 --- a/internal/service/appconfig/hosted_configuration_version.go +++ b/internal/service/appconfig/hosted_configuration_version.go @@ -57,7 +57,7 @@ func ResourceHostedConfigurationVersion() *schema.Resource { ForceNew: true, Sensitive: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -88,7 +88,7 @@ func resourceHostedConfigurationVersionCreate(ctx context.Context, d *schema.Res ApplicationId: aws.String(appID), ConfigurationProfileId: aws.String(profileID), Content: []byte(d.Get("content").(string)), - ContentType: aws.String(d.Get("content_type").(string)), + ContentType: aws.String(d.Get(names.AttrContentType).(string)), } if v, ok := d.GetOk(names.AttrDescription); ok { @@ -141,7 +141,7 @@ func resourceHostedConfigurationVersionRead(ctx context.Context, d *schema.Resou d.Set("application_id", output.ApplicationId) d.Set("configuration_profile_id", output.ConfigurationProfileId) d.Set("content", string(output.Content)) - d.Set("content_type", output.ContentType) + d.Set(names.AttrContentType, output.ContentType) d.Set(names.AttrDescription, output.Description) d.Set("version_number", output.VersionNumber) diff --git a/internal/service/appconfig/hosted_configuration_version_test.go b/internal/service/appconfig/hosted_configuration_version_test.go index f0558181f3e..cbbccb92af4 100644 --- a/internal/service/appconfig/hosted_configuration_version_test.go +++ b/internal/service/appconfig/hosted_configuration_version_test.go @@ -41,7 +41,7 @@ func TestAccAppConfigHostedConfigurationVersion_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "application_id", "aws_appconfig_application.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "configuration_profile_id", "aws_appconfig_configuration_profile.test", "configuration_profile_id"), resource.TestCheckResourceAttr(resourceName, "content", "{\"foo\":\"bar\"}"), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/json"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/json"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, rName), resource.TestCheckResourceAttr(resourceName, "version_number", "1"), ), From 4d16e3662f3c3a6e490d7452eddd61bdf3f4b144 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:20 -0400 Subject: [PATCH 1414/1490] appmesh: Use constants for strings --- internal/service/appmesh/flex.go | 26 ++++++++++----------- internal/service/appmesh/gateway_route.go | 6 ++--- internal/service/appmesh/route.go | 2 +- internal/service/appmesh/virtual_gateway.go | 12 +++++----- internal/service/appmesh/virtual_node.go | 6 ++--- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/internal/service/appmesh/flex.go b/internal/service/appmesh/flex.go index dcc1f6e0e80..f85a7c36868 100644 --- a/internal/service/appmesh/flex.go +++ b/internal/service/appmesh/flex.go @@ -25,7 +25,7 @@ func expandClientPolicy(vClientPolicy []interface{}) *appmesh.ClientPolicy { mTls := vTls[0].(map[string]interface{}) - if vCertificate, ok := mTls["certificate"].([]interface{}); ok && len(vCertificate) > 0 && vCertificate[0] != nil { + if vCertificate, ok := mTls[names.AttrCertificate].([]interface{}); ok && len(vCertificate) > 0 && vCertificate[0] != nil { certificate := &appmesh.ClientTlsCertificate{} mCertificate := vCertificate[0].(map[string]interface{}) @@ -217,7 +217,7 @@ func expandGRPCRoute(vGrpcRoute []interface{}) *appmesh.GrpcRoute { if vMethodName, ok := mGrpcRouteMatch["method_name"].(string); ok && vMethodName != "" { grpcRouteMatch.MethodName = aws.String(vMethodName) } - if vServiceName, ok := mGrpcRouteMatch["service_name"].(string); ok && vServiceName != "" { + if vServiceName, ok := mGrpcRouteMatch[names.AttrServiceName].(string); ok && vServiceName != "" { grpcRouteMatch.ServiceName = aws.String(vServiceName) } @@ -902,7 +902,7 @@ func expandVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec { tls.Mode = aws.String(vMode) } - if vCertificate, ok := mTls["certificate"].([]interface{}); ok && len(vCertificate) > 0 && vCertificate[0] != nil { + if vCertificate, ok := mTls[names.AttrCertificate].([]interface{}); ok && len(vCertificate) > 0 && vCertificate[0] != nil { certificate := &appmesh.ListenerTlsCertificate{} mCertificate := vCertificate[0].(map[string]interface{}) @@ -1095,7 +1095,7 @@ func expandVirtualNodeSpec(vSpec []interface{}) *appmesh.VirtualNodeSpec { if vNamespaceName, ok := mAwsCloudMap["namespace_name"].(string); ok && vNamespaceName != "" { awsCloudMap.NamespaceName = aws.String(vNamespaceName) } - if vServiceName, ok := mAwsCloudMap["service_name"].(string); ok && vServiceName != "" { + if vServiceName, ok := mAwsCloudMap[names.AttrServiceName].(string); ok && vServiceName != "" { awsCloudMap.ServiceName = aws.String(vServiceName) } @@ -1236,7 +1236,7 @@ func flattenClientPolicy(clientPolicy *appmesh.ClientPolicy) []interface{} { mCertificate["sds"] = []interface{}{mSds} } - mTls["certificate"] = []interface{}{mCertificate} + mTls[names.AttrCertificate] = []interface{}{mCertificate} } if validation := tls.Validation; validation != nil { @@ -1371,10 +1371,10 @@ func flattenGRPCRoute(grpcRoute *appmesh.GrpcRoute) []interface{} { mGrpcRoute["match"] = []interface{}{ map[string]interface{}{ - "metadata": vGrpcRouteMetadatas, - "method_name": aws.StringValue(grpcRouteMatch.MethodName), - "service_name": aws.StringValue(grpcRouteMatch.ServiceName), - names.AttrPort: int(aws.Int64Value(grpcRouteMatch.Port)), + "metadata": vGrpcRouteMetadatas, + "method_name": aws.StringValue(grpcRouteMatch.MethodName), + names.AttrServiceName: aws.StringValue(grpcRouteMatch.ServiceName), + names.AttrPort: int(aws.Int64Value(grpcRouteMatch.Port)), }, } } @@ -1788,7 +1788,7 @@ func flattenVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} { mCertificate["sds"] = []interface{}{mSds} } - mTls["certificate"] = []interface{}{mCertificate} + mTls[names.AttrCertificate] = []interface{}{mCertificate} } if validation := tls.Validation; validation != nil { @@ -1897,9 +1897,9 @@ func flattenVirtualNodeSpec(spec *appmesh.VirtualNodeSpec) []interface{} { mServiceDiscovery["aws_cloud_map"] = []interface{}{ map[string]interface{}{ - "attributes": vAttributes, - "namespace_name": aws.StringValue(awsCloudMap.NamespaceName), - "service_name": aws.StringValue(awsCloudMap.ServiceName), + "attributes": vAttributes, + "namespace_name": aws.StringValue(awsCloudMap.NamespaceName), + names.AttrServiceName: aws.StringValue(awsCloudMap.ServiceName), }, } } diff --git a/internal/service/appmesh/gateway_route.go b/internal/service/appmesh/gateway_route.go index bed450dd7cc..df3a2b2051f 100644 --- a/internal/service/appmesh/gateway_route.go +++ b/internal/service/appmesh/gateway_route.go @@ -478,7 +478,7 @@ func resourceGatewayRouteSpecSchema() *schema.Schema { Optional: true, ValidateFunc: validation.IsPortNumber, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Required: true, }, @@ -777,7 +777,7 @@ func expandGRPCGatewayRoute(vGrpcRoute []interface{}) *appmesh.GrpcGatewayRoute mRouteMatch := vRouteMatch[0].(map[string]interface{}) - if vServiceName, ok := mRouteMatch["service_name"].(string); ok && vServiceName != "" { + if vServiceName, ok := mRouteMatch[names.AttrServiceName].(string); ok && vServiceName != "" { routeMatch.ServiceName = aws.String(vServiceName) } @@ -1046,7 +1046,7 @@ func flattenGRPCGatewayRoute(grpcRoute *appmesh.GrpcGatewayRoute) []interface{} if routeMatch := grpcRoute.Match; routeMatch != nil { mRouteMatch := map[string]interface{}{ - "service_name": aws.StringValue(routeMatch.ServiceName), + names.AttrServiceName: aws.StringValue(routeMatch.ServiceName), } if routeMatch.Port != nil { mRouteMatch[names.AttrPort] = int(aws.Int64Value(routeMatch.Port)) diff --git a/internal/service/appmesh/route.go b/internal/service/appmesh/route.go index bfa706eb65d..ec13d218751 100644 --- a/internal/service/appmesh/route.go +++ b/internal/service/appmesh/route.go @@ -521,7 +521,7 @@ func resourceRouteSpecSchema() *schema.Schema { Optional: true, ValidateFunc: validation.StringLenBetween(0, 50), }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Optional: true, }, diff --git a/internal/service/appmesh/virtual_gateway.go b/internal/service/appmesh/virtual_gateway.go index 8b743f97f0b..4e6ac67608d 100644 --- a/internal/service/appmesh/virtual_gateway.go +++ b/internal/service/appmesh/virtual_gateway.go @@ -115,7 +115,7 @@ func resourceVirtualGatewaySpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate": { + names.AttrCertificate: { Type: schema.TypeList, Optional: true, MinItems: 0, @@ -435,7 +435,7 @@ func resourceVirtualGatewaySpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate": { + names.AttrCertificate: { Type: schema.TypeList, Required: true, MinItems: 1, @@ -967,7 +967,7 @@ func expandVirtualGatewaySpec(vSpec []interface{}) *appmesh.VirtualGatewaySpec { tls.Mode = aws.String(vMode) } - if vCertificate, ok := mTls["certificate"].([]interface{}); ok && len(vCertificate) > 0 && vCertificate[0] != nil { + if vCertificate, ok := mTls[names.AttrCertificate].([]interface{}); ok && len(vCertificate) > 0 && vCertificate[0] != nil { certificate := &appmesh.VirtualGatewayListenerTlsCertificate{} mCertificate := vCertificate[0].(map[string]interface{}) @@ -1152,7 +1152,7 @@ func expandVirtualGatewayClientPolicy(vClientPolicy []interface{}) *appmesh.Virt mTls := vTls[0].(map[string]interface{}) - if vCertificate, ok := mTls["certificate"].([]interface{}); ok && len(vCertificate) > 0 && vCertificate[0] != nil { + if vCertificate, ok := mTls[names.AttrCertificate].([]interface{}); ok && len(vCertificate) > 0 && vCertificate[0] != nil { certificate := &appmesh.VirtualGatewayClientTlsCertificate{} mCertificate := vCertificate[0].(map[string]interface{}) @@ -1375,7 +1375,7 @@ func flattenVirtualGatewaySpec(spec *appmesh.VirtualGatewaySpec) []interface{} { mCertificate["sds"] = []interface{}{mSds} } - mTls["certificate"] = []interface{}{mCertificate} + mTls[names.AttrCertificate] = []interface{}{mCertificate} } if validation := tls.Validation; validation != nil { @@ -1508,7 +1508,7 @@ func flattenVirtualGatewayClientPolicy(clientPolicy *appmesh.VirtualGatewayClien mCertificate["sds"] = []interface{}{mSds} } - mTls["certificate"] = []interface{}{mCertificate} + mTls[names.AttrCertificate] = []interface{}{mCertificate} } if validation := tls.Validation; validation != nil { diff --git a/internal/service/appmesh/virtual_node.go b/internal/service/appmesh/virtual_node.go index 81fbdff1d21..22a3c8d57a7 100644 --- a/internal/service/appmesh/virtual_node.go +++ b/internal/service/appmesh/virtual_node.go @@ -105,7 +105,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate": { + names.AttrCertificate: { Type: schema.TypeList, Optional: true, MinItems: 0, @@ -690,7 +690,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate": { + names.AttrCertificate: { Type: schema.TypeList, Required: true, MinItems: 1, @@ -928,7 +928,7 @@ func resourceVirtualNodeSpecSchema() *schema.Schema { Required: true, ValidateFunc: validation.StringLenBetween(1, 1024), }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 1024), From 1e701945b63d5e623b20d41cf99dc1bbb467824e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:20 -0400 Subject: [PATCH 1415/1490] apprunner: Use constants for strings --- internal/service/apprunner/service.go | 6 +++--- internal/service/apprunner/service_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/apprunner/service.go b/internal/service/apprunner/service.go index 24c0d938317..f083c2f39a4 100644 --- a/internal/service/apprunner/service.go +++ b/internal/service/apprunner/service.go @@ -221,7 +221,7 @@ func resourceService() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -436,7 +436,7 @@ func resourceServiceCreate(ctx context.Context, d *schema.ResourceData, meta int conn := meta.(*conns.AWSClient).AppRunnerClient(ctx) - name := d.Get("service_name").(string) + name := d.Get(names.AttrServiceName).(string) input := &apprunner.CreateServiceInput{ ServiceName: aws.String(name), SourceConfiguration: expandServiceSourceConfiguration(d.Get("source_configuration").([]interface{})), @@ -540,7 +540,7 @@ func resourceServiceRead(ctx context.Context, d *schema.ResourceData, meta inter return sdkdiag.AppendErrorf(diags, "setting observability_configuration: %s", err) } d.Set("service_id", service.ServiceId) - d.Set("service_name", service.ServiceName) + d.Set(names.AttrServiceName, service.ServiceName) d.Set("service_url", serviceURL) if err := d.Set("source_configuration", flattenServiceSourceConfiguration(service.SourceConfiguration)); err != nil { return sdkdiag.AppendErrorf(diags, "setting source_configuration: %s", err) diff --git a/internal/service/apprunner/service_test.go b/internal/service/apprunner/service_test.go index e1bf1183bf6..2bc397db88f 100644 --- a/internal/service/apprunner/service_test.go +++ b/internal/service/apprunner/service_test.go @@ -36,7 +36,7 @@ func TestAccAppRunnerService_ImageRepository_basic(t *testing.T) { Config: testAccServiceConfig_imageRepository(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckServiceExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "service_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrServiceName, rName), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "apprunner", regexache.MustCompile(fmt.Sprintf(`service/%s/.+`, rName))), acctest.MatchResourceAttrRegionalARN(resourceName, "auto_scaling_configuration_arn", "apprunner", regexache.MustCompile(`autoscalingconfiguration/DefaultConfiguration/1/.+`)), resource.TestCheckResourceAttr(resourceName, "encryption_configuration.#", "0"), From a5d053ee574a8fa04c631e52845cde0e35ef4da1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:20 -0400 Subject: [PATCH 1416/1490] appstream: Use constants for strings --- internal/service/appstream/image_builder.go | 2 +- internal/service/appstream/stack.go | 6 +++--- internal/service/appstream/user.go | 6 +++--- internal/service/appstream/user_stack_association.go | 9 +++++---- .../service/appstream/user_stack_association_test.go | 2 +- internal/service/appstream/user_test.go | 8 ++++---- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/internal/service/appstream/image_builder.go b/internal/service/appstream/image_builder.go index 6d3e72c162a..ed52557dfd4 100644 --- a/internal/service/appstream/image_builder.go +++ b/internal/service/appstream/image_builder.go @@ -45,7 +45,7 @@ func ResourceImageBuilder() *schema.Resource { MaxItems: 4, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appstream.AccessEndpointType_Values(), false), diff --git a/internal/service/appstream/stack.go b/internal/service/appstream/stack.go index 0ff81d32a9b..85b1d279950 100644 --- a/internal/service/appstream/stack.go +++ b/internal/service/appstream/stack.go @@ -54,7 +54,7 @@ func ResourceStack() *schema.Resource { MaxItems: 4, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(appstream.AccessEndpointType_Values(), false), @@ -478,7 +478,7 @@ func expandAccessEndpoint(tfMap map[string]interface{}) *appstream.AccessEndpoin } apiObject := &appstream.AccessEndpoint{ - EndpointType: aws.String(tfMap["endpoint_type"].(string)), + EndpointType: aws.String(tfMap[names.AttrEndpointType].(string)), } if v, ok := tfMap["vpce_id"]; ok { apiObject.VpceId = aws.String(v.(string)) @@ -515,7 +515,7 @@ func flattenAccessEndpoint(apiObject *appstream.AccessEndpoint) map[string]inter } tfMap := map[string]interface{}{} - tfMap["endpoint_type"] = aws.StringValue(apiObject.EndpointType) + tfMap[names.AttrEndpointType] = aws.StringValue(apiObject.EndpointType) tfMap["vpce_id"] = aws.StringValue(apiObject.VpceId) return tfMap diff --git a/internal/service/appstream/user.go b/internal/service/appstream/user.go index 0331fd387bf..4cacd3ba066 100644 --- a/internal/service/appstream/user.go +++ b/internal/service/appstream/user.go @@ -69,7 +69,7 @@ func ResourceUser() *schema.Resource { Optional: true, Default: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -84,7 +84,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf conn := meta.(*conns.AWSClient).AppStreamConn(ctx) - userName := d.Get("user_name").(string) + userName := d.Get(names.AttrUserName).(string) authType := d.Get("authentication_type").(string) input := &appstream.CreateUserInput{ @@ -161,7 +161,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set("first_name", user.FirstName) d.Set("last_name", user.LastName) - d.Set("user_name", user.UserName) + d.Set(names.AttrUserName, user.UserName) return diags } diff --git a/internal/service/appstream/user_stack_association.go b/internal/service/appstream/user_stack_association.go index 09328ec177c..3d9372a6156 100644 --- a/internal/service/appstream/user_stack_association.go +++ b/internal/service/appstream/user_stack_association.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_appstream_user_stack_association") @@ -47,7 +48,7 @@ func ResourceUserStackAssociation() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 128), }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -64,14 +65,14 @@ func resourceUserStackAssociationCreate(ctx context.Context, d *schema.ResourceD input := &appstream.UserStackAssociation{ AuthenticationType: aws.String(d.Get("authentication_type").(string)), StackName: aws.String(d.Get("stack_name").(string)), - UserName: aws.String(d.Get("user_name").(string)), + UserName: aws.String(d.Get(names.AttrUserName).(string)), } if v, ok := d.GetOk("send_email_notification"); ok { input.SendEmailNotification = aws.Bool(v.(bool)) } - id := EncodeUserStackAssociationID(d.Get("user_name").(string), d.Get("authentication_type").(string), d.Get("stack_name").(string)) + id := EncodeUserStackAssociationID(d.Get(names.AttrUserName).(string), d.Get("authentication_type").(string), d.Get("stack_name").(string)) output, err := conn.BatchAssociateUserStackWithContext(ctx, &appstream.BatchAssociateUserStackInput{ UserStackAssociations: []*appstream.UserStackAssociation{input}, @@ -135,7 +136,7 @@ func resourceUserStackAssociationRead(ctx context.Context, d *schema.ResourceDat d.Set("authentication_type", association.AuthenticationType) d.Set("stack_name", association.StackName) - d.Set("user_name", association.UserName) + d.Set(names.AttrUserName, association.UserName) return diags } diff --git a/internal/service/appstream/user_stack_association_test.go b/internal/service/appstream/user_stack_association_test.go index 67931d7d3ae..b0f79240e52 100644 --- a/internal/service/appstream/user_stack_association_test.go +++ b/internal/service/appstream/user_stack_association_test.go @@ -42,7 +42,7 @@ func TestAccAppStreamUserStackAssociation_basic(t *testing.T) { testAccCheckUserStackAssociationExists(ctx, resourceName), resource.TestCheckResourceAttr(resourceName, "authentication_type", authType), resource.TestCheckResourceAttr(resourceName, "stack_name", rName), - resource.TestCheckResourceAttr(resourceName, "user_name", rEmail), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, rEmail), ), }, { diff --git a/internal/service/appstream/user_test.go b/internal/service/appstream/user_test.go index 8c46cde658e..231afaabbc4 100644 --- a/internal/service/appstream/user_test.go +++ b/internal/service/appstream/user_test.go @@ -41,7 +41,7 @@ func TestAccAppStreamUser_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &userOutput), resource.TestCheckResourceAttr(resourceName, "authentication_type", authType), - resource.TestCheckResourceAttr(resourceName, "user_name", rEmail), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, rEmail), acctest.CheckResourceAttrRFC3339(resourceName, "created_time"), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "true"), ), @@ -107,7 +107,7 @@ func TestAccAppStreamUser_complete(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &userOutput), resource.TestCheckResourceAttr(resourceName, "authentication_type", authType), - resource.TestCheckResourceAttr(resourceName, "user_name", rEmail), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, rEmail), acctest.CheckResourceAttrRFC3339(resourceName, "created_time"), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "false"), ), @@ -123,7 +123,7 @@ func TestAccAppStreamUser_complete(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &userOutput), resource.TestCheckResourceAttr(resourceName, "authentication_type", authType), - resource.TestCheckResourceAttr(resourceName, "user_name", rEmail), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, rEmail), acctest.CheckResourceAttrRFC3339(resourceName, "created_time"), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "true"), ), @@ -133,7 +133,7 @@ func TestAccAppStreamUser_complete(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &userOutput), resource.TestCheckResourceAttr(resourceName, "authentication_type", authType), - resource.TestCheckResourceAttr(resourceName, "user_name", rEmail), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, rEmail), acctest.CheckResourceAttrRFC3339(resourceName, "created_time"), resource.TestCheckResourceAttr(resourceName, names.AttrEnabled, "false"), ), From 6e38127a8bb413e4b96e53a2709ebeba08c85cc6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:21 -0400 Subject: [PATCH 1417/1490] appsync: Use constants for strings --- internal/service/appsync/datasource.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/appsync/datasource.go b/internal/service/appsync/datasource.go index df54fec4c4c..93e89a5a1c4 100644 --- a/internal/service/appsync/datasource.go +++ b/internal/service/appsync/datasource.go @@ -81,7 +81,7 @@ func ResourceDataSource() *schema.Resource { Optional: true, Computed: true, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -521,7 +521,7 @@ func expandDynamoDBDataSourceConfig(l []interface{}, currentRegion string) *apps result := &appsync.DynamodbDataSourceConfig{ AwsRegion: aws.String(currentRegion), - TableName: aws.String(configured["table_name"].(string)), + TableName: aws.String(configured[names.AttrTableName].(string)), } if v, ok := configured[names.AttrRegion]; ok && v.(string) != "" { @@ -573,8 +573,8 @@ func flattenDynamoDBDataSourceConfig(config *appsync.DynamodbDataSourceConfig) [ } result := map[string]interface{}{ - names.AttrRegion: aws.StringValue(config.AwsRegion), - "table_name": aws.StringValue(config.TableName), + names.AttrRegion: aws.StringValue(config.AwsRegion), + names.AttrTableName: aws.StringValue(config.TableName), } if config.UseCallerCredentials != nil { From 45b97c8f29a98c535cfea07ab8822340fb475574 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:21 -0400 Subject: [PATCH 1418/1490] auditmanager: Use constants for strings --- internal/service/auditmanager/assessment.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/auditmanager/assessment.go b/internal/service/auditmanager/assessment.go index dcb9282324d..930943f1345 100644 --- a/internal/service/auditmanager/assessment.go +++ b/internal/service/auditmanager/assessment.go @@ -142,7 +142,7 @@ func (r *resourceAssessment) Schema(ctx context.Context, req resource.SchemaRequ }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "service_name": schema.StringAttribute{ + names.AttrServiceName: schema.StringAttribute{ Required: true, }, }, @@ -418,7 +418,7 @@ var ( } assessmentScopeAWSServicesAttrTypes = map[string]attr.Type{ // nosemgrep:ci.aws-in-var-name - "service_name": types.StringType, + names.AttrServiceName: types.StringType, } ) @@ -664,7 +664,7 @@ func flattenAssessmentScopeAWSServices(ctx context.Context, apiObject []awstypes elems := []attr.Value{} for _, service := range apiObject { obj := map[string]attr.Value{ - "service_name": flex.StringToFramework(ctx, service.ServiceName), + names.AttrServiceName: flex.StringToFramework(ctx, service.ServiceName), } objVal, d := types.ObjectValue(assessmentScopeAWSServicesAttrTypes, obj) diags.Append(d...) From 449501006666585aa28cbdcf64ebf88877ae557b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:21 -0400 Subject: [PATCH 1419/1490] autoscaling: Use constants for strings --- internal/service/autoscaling/group.go | 6 +++--- .../service/autoscaling/group_data_source.go | 2 +- internal/service/autoscaling/group_migrate.go | 2 +- internal/service/autoscaling/policy.go | 18 +++++++++--------- .../autoscaling/traffic_source_attachment.go | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/service/autoscaling/group.go b/internal/service/autoscaling/group.go index b29d1eb6acb..99b52011f09 100644 --- a/internal/service/autoscaling/group.go +++ b/internal/service/autoscaling/group.go @@ -866,7 +866,7 @@ func resourceGroup() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 2048), @@ -3393,7 +3393,7 @@ func expandVPCZoneIdentifiers(tfList []interface{}) *string { func expandTrafficSourceIdentifier(tfMap map[string]interface{}) awstypes.TrafficSourceIdentifier { apiObject := awstypes.TrafficSourceIdentifier{} - if v, ok := tfMap["identifier"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrIdentifier].(string); ok && v != "" { apiObject.Identifier = aws.String(v) } @@ -3861,7 +3861,7 @@ func flattenTrafficSourceIdentifier(apiObject awstypes.TrafficSourceIdentifier) tfMap := map[string]interface{}{} if v := apiObject.Identifier; v != nil { - tfMap["identifier"] = aws.ToString(v) + tfMap[names.AttrIdentifier] = aws.ToString(v) } if v := apiObject.Type; v != nil { diff --git a/internal/service/autoscaling/group_data_source.go b/internal/service/autoscaling/group_data_source.go index 528e815d022..a84b1fb4ed5 100644 --- a/internal/service/autoscaling/group_data_source.go +++ b/internal/service/autoscaling/group_data_source.go @@ -505,7 +505,7 @@ func dataSourceGroup() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/autoscaling/group_migrate.go b/internal/service/autoscaling/group_migrate.go index 7901baea287..b88a27ac462 100644 --- a/internal/service/autoscaling/group_migrate.go +++ b/internal/service/autoscaling/group_migrate.go @@ -670,7 +670,7 @@ func resourceGroupV0() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, }, diff --git a/internal/service/autoscaling/policy.go b/internal/service/autoscaling/policy.go index babfadf18cc..b6d4c5904fa 100644 --- a/internal/service/autoscaling/policy.go +++ b/internal/service/autoscaling/policy.go @@ -97,7 +97,7 @@ func resourcePolicy() *schema.Resource { Type: schema.TypeString, Required: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, }, @@ -424,7 +424,7 @@ func resourcePolicy() *schema.Resource { Type: schema.TypeString, Required: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, }, @@ -451,7 +451,7 @@ func resourcePolicy() *schema.Resource { }, }, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"target_tracking_configuration.0.customized_metric_specification.0.metrics"}, @@ -801,7 +801,7 @@ func expandTargetTrackingConfiguration(configs []interface{}) *awstypes.TargetTr if val, ok := spec["metrics"].(*schema.Set); ok && val.Len() > 0 { customSpec.Metrics = expandTargetTrackingMetricDataQueries(val.List()) } else { - customSpec.Namespace = aws.String(spec["namespace"].(string)) + customSpec.Namespace = aws.String(spec[names.AttrNamespace].(string)) customSpec.MetricName = aws.String(spec["metric_name"].(string)) customSpec.Statistic = awstypes.MetricStatistic(spec["statistic"].(string)) if val, ok := spec[names.AttrUnit]; ok && len(val.(string)) > 0 { @@ -842,7 +842,7 @@ func expandTargetTrackingMetricDataQueries(metricDataQuerySlices []interface{}) metricSpec := metricStatSpec["metric"].([]interface{})[0].(map[string]interface{}) metric := &awstypes.Metric{ MetricName: aws.String(metricSpec["metric_name"].(string)), - Namespace: aws.String(metricSpec["namespace"].(string)), + Namespace: aws.String(metricSpec[names.AttrNamespace].(string)), } if v, ok := metricSpec["dimensions"]; ok { dims := v.(*schema.Set).List() @@ -1007,7 +1007,7 @@ func expandMetricDataQueries(metricDataQuerySlices []interface{}) []awstypes.Met metricSpec := metricStatSpec["metric"].([]interface{})[0].(map[string]interface{}) metric := &awstypes.Metric{ MetricName: aws.String(metricSpec["metric_name"].(string)), - Namespace: aws.String(metricSpec["namespace"].(string)), + Namespace: aws.String(metricSpec[names.AttrNamespace].(string)), } if v, ok := metricSpec["dimensions"]; ok { dims := v.(*schema.Set).List() @@ -1067,7 +1067,7 @@ func flattenTargetTrackingConfiguration(config *awstypes.TargetTrackingConfigura spec["metrics"] = flattenTargetTrackingMetricDataQueries(config.CustomizedMetricSpecification.Metrics) } else { spec["metric_name"] = aws.ToString(config.CustomizedMetricSpecification.MetricName) - spec["namespace"] = aws.ToString(config.CustomizedMetricSpecification.Namespace) + spec[names.AttrNamespace] = aws.ToString(config.CustomizedMetricSpecification.Namespace) spec["statistic"] = string(config.CustomizedMetricSpecification.Statistic) if config.CustomizedMetricSpecification.Unit != nil { spec[names.AttrUnit] = aws.ToString(config.CustomizedMetricSpecification.Unit) @@ -1118,7 +1118,7 @@ func flattenTargetTrackingMetricDataQueries(metricDataQueries []awstypes.TargetT metricSpec["dimensions"] = dimSpec } metricSpec["metric_name"] = aws.ToString(rawMetric.MetricName) - metricSpec["namespace"] = aws.ToString(rawMetric.Namespace) + metricSpec[names.AttrNamespace] = aws.ToString(rawMetric.Namespace) metricStatSpec["metric"] = []map[string]interface{}{metricSpec} metricStatSpec["stat"] = aws.ToString(rawMetricStat.Stat) if rawMetricStat.Unit != nil { @@ -1269,7 +1269,7 @@ func flattenMetricDataQueries(metricDataQueries []awstypes.MetricDataQuery) []in metricSpec["dimensions"] = dimSpec } metricSpec["metric_name"] = aws.ToString(rawMetric.MetricName) - metricSpec["namespace"] = aws.ToString(rawMetric.Namespace) + metricSpec[names.AttrNamespace] = aws.ToString(rawMetric.Namespace) metricStatSpec["metric"] = []map[string]interface{}{metricSpec} metricStatSpec["stat"] = aws.ToString(rawMetricStat.Stat) if rawMetricStat.Unit != nil { diff --git a/internal/service/autoscaling/traffic_source_attachment.go b/internal/service/autoscaling/traffic_source_attachment.go index 6325a97f901..886bf6ddd05 100644 --- a/internal/service/autoscaling/traffic_source_attachment.go +++ b/internal/service/autoscaling/traffic_source_attachment.go @@ -50,7 +50,7 @@ func resourceTrafficSourceAttachment() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ForceNew: true, From d1468849b64d8dca2ea50e41ae55e1bb0eeb38b4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:21 -0400 Subject: [PATCH 1420/1490] autoscalingplans: Use constants for strings --- .../service/autoscalingplans/scaling_plan.go | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/autoscalingplans/scaling_plan.go b/internal/service/autoscalingplans/scaling_plan.go index 1e74a497f41..3c8336a2da0 100644 --- a/internal/service/autoscalingplans/scaling_plan.go +++ b/internal/service/autoscalingplans/scaling_plan.go @@ -112,7 +112,7 @@ func ResourceScalingPlan() *schema.Resource { Required: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, }, @@ -244,7 +244,7 @@ func ResourceScalingPlan() *schema.Resource { Required: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, }, @@ -611,7 +611,7 @@ func expandScalingInstructions(vScalingInstructions *schema.Set) []awstypes.Scal if v, ok := mCustomizedLoadMetricSpecification["metric_name"].(string); ok && v != "" { customizedLoadMetricSpecification.MetricName = aws.String(v) } - if v, ok := mCustomizedLoadMetricSpecification["namespace"].(string); ok && v != "" { + if v, ok := mCustomizedLoadMetricSpecification[names.AttrNamespace].(string); ok && v != "" { customizedLoadMetricSpecification.Namespace = aws.String(v) } if v, ok := mCustomizedLoadMetricSpecification["statistic"].(string); ok && v != "" { @@ -685,7 +685,7 @@ func expandScalingInstructions(vScalingInstructions *schema.Set) []awstypes.Scal if v, ok := mCustomizedScalingMetricSpecification["metric_name"].(string); ok && v != "" { customizedScalingMetricSpecification.MetricName = aws.String(v) } - if v, ok := mCustomizedScalingMetricSpecification["namespace"].(string); ok && v != "" { + if v, ok := mCustomizedScalingMetricSpecification[names.AttrNamespace].(string); ok && v != "" { customizedScalingMetricSpecification.Namespace = aws.String(v) } if v, ok := mCustomizedScalingMetricSpecification["statistic"].(string); ok && v != "" { @@ -751,11 +751,11 @@ func flattenScalingInstructions(scalingInstructions []awstypes.ScalingInstructio mScalingInstruction["customized_load_metric_specification"] = []interface{}{ map[string]interface{}{ - "dimensions": mDimensions, - "metric_name": aws.ToString(customizedLoadMetricSpecification.MetricName), - "namespace": aws.ToString(customizedLoadMetricSpecification.Namespace), - "statistic": string(customizedLoadMetricSpecification.Statistic), - names.AttrUnit: aws.ToString(customizedLoadMetricSpecification.Unit), + "dimensions": mDimensions, + "metric_name": aws.ToString(customizedLoadMetricSpecification.MetricName), + names.AttrNamespace: aws.ToString(customizedLoadMetricSpecification.Namespace), + "statistic": string(customizedLoadMetricSpecification.Statistic), + names.AttrUnit: aws.ToString(customizedLoadMetricSpecification.Unit), }, } } @@ -789,11 +789,11 @@ func flattenScalingInstructions(scalingInstructions []awstypes.ScalingInstructio mTargetTrackingConfiguration["customized_scaling_metric_specification"] = []interface{}{ map[string]interface{}{ - "dimensions": mDimensions, - "metric_name": aws.ToString(customizedScalingMetricSpecification.MetricName), - "namespace": aws.ToString(customizedScalingMetricSpecification.Namespace), - "statistic": string(customizedScalingMetricSpecification.Statistic), - names.AttrUnit: aws.ToString(customizedScalingMetricSpecification.Unit), + "dimensions": mDimensions, + "metric_name": aws.ToString(customizedScalingMetricSpecification.MetricName), + names.AttrNamespace: aws.ToString(customizedScalingMetricSpecification.Namespace), + "statistic": string(customizedScalingMetricSpecification.Statistic), + names.AttrUnit: aws.ToString(customizedScalingMetricSpecification.Unit), }, } } From 23f83d5bd5cee42dc2ef72f0b28bf5a2f76a132c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:22 -0400 Subject: [PATCH 1421/1490] backup: Use constants for strings --- internal/service/backup/report_plan.go | 6 +++--- internal/service/backup/report_plan_data_source.go | 2 +- internal/service/backup/vault_notifications.go | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/service/backup/report_plan.go b/internal/service/backup/report_plan.go index 9d7b755a027..690300f8bd0 100644 --- a/internal/service/backup/report_plan.go +++ b/internal/service/backup/report_plan.go @@ -76,7 +76,7 @@ func ResourceReportPlan() *schema.Resource { ValidateFunc: validation.StringInSlice(reportDeliveryChannelFormat_Values(), false), }, }, - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Required: true, }, @@ -268,7 +268,7 @@ func expandReportDeliveryChannel(reportDeliveryChannel []interface{}) *backup.Re } result := &backup.ReportDeliveryChannel{ - S3BucketName: aws.String(tfMap["s3_bucket_name"].(string)), + S3BucketName: aws.String(tfMap[names.AttrS3BucketName].(string)), } if v, ok := tfMap["formats"]; ok && v.(*schema.Set).Len() > 0 { @@ -325,7 +325,7 @@ func flattenReportDeliveryChannel(reportDeliveryChannel *backup.ReportDeliveryCh } values := map[string]interface{}{ - "s3_bucket_name": aws.StringValue(reportDeliveryChannel.S3BucketName), + names.AttrS3BucketName: aws.StringValue(reportDeliveryChannel.S3BucketName), } if reportDeliveryChannel.Formats != nil && len(reportDeliveryChannel.Formats) > 0 { diff --git a/internal/service/backup/report_plan_data_source.go b/internal/service/backup/report_plan_data_source.go index 8a57a51a85e..c2a6c161b33 100644 --- a/internal/service/backup/report_plan_data_source.go +++ b/internal/service/backup/report_plan_data_source.go @@ -54,7 +54,7 @@ func DataSourceReportPlan() *schema.Resource { Type: schema.TypeString, }, }, - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/backup/vault_notifications.go b/internal/service/backup/vault_notifications.go index 1d2d10bd31c..d21d3603519 100644 --- a/internal/service/backup/vault_notifications.go +++ b/internal/service/backup/vault_notifications.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_backup_vault_notifications") @@ -37,7 +38,7 @@ func ResourceVaultNotifications() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_.-]{1,50}$`), "must consist of lowercase letters, numbers, and hyphens."), }, - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -66,7 +67,7 @@ func resourceVaultNotificationsCreate(ctx context.Context, d *schema.ResourceDat input := &backup.PutBackupVaultNotificationsInput{ BackupVaultName: aws.String(d.Get("backup_vault_name").(string)), - SNSTopicArn: aws.String(d.Get("sns_topic_arn").(string)), + SNSTopicArn: aws.String(d.Get(names.AttrSNSTopicARN).(string)), BackupVaultEvents: flex.ExpandStringSet(d.Get("backup_vault_events").(*schema.Set)), } @@ -99,7 +100,7 @@ func resourceVaultNotificationsRead(ctx context.Context, d *schema.ResourceData, return sdkdiag.AppendErrorf(diags, "reading Backup Vault Notifications (%s): %s", d.Id(), err) } d.Set("backup_vault_name", resp.BackupVaultName) - d.Set("sns_topic_arn", resp.SNSTopicArn) + d.Set(names.AttrSNSTopicARN, resp.SNSTopicArn) d.Set("backup_vault_arn", resp.BackupVaultArn) if err := d.Set("backup_vault_events", flex.FlattenStringSet(resp.BackupVaultEvents)); err != nil { return sdkdiag.AppendErrorf(diags, "setting backup_vault_events: %s", err) From 73055aea1f1e74504cd54b9f29391170895d20b0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:22 -0400 Subject: [PATCH 1422/1490] bedrock: Use constants for strings --- .../service/bedrock/model_invocation_logging_configuration.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/bedrock/model_invocation_logging_configuration.go b/internal/service/bedrock/model_invocation_logging_configuration.go index 4b928110b36..45e485fbc17 100644 --- a/internal/service/bedrock/model_invocation_logging_configuration.go +++ b/internal/service/bedrock/model_invocation_logging_configuration.go @@ -63,7 +63,7 @@ func (r *resourceModelInvocationLoggingConfiguration) Schema(ctx context.Context "cloudwatch_config": schema.SingleNestedBlock{ CustomType: fwtypes.NewObjectTypeOf[cloudWatchConfigModel](ctx), Attributes: map[string]schema.Attribute{ - "log_group_name": schema.StringAttribute{ + names.AttrLogGroupName: schema.StringAttribute{ // Required: true, Optional: true, }, From ecb1139122ff4bac548dc63a38b2520ee8031156 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:22 -0400 Subject: [PATCH 1423/1490] bedrockagent: Use constants for strings --- internal/service/bedrockagent/agent_action_group.go | 2 +- internal/service/bedrockagent/knowledge_base.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/bedrockagent/agent_action_group.go b/internal/service/bedrockagent/agent_action_group.go index faead0af8a9..62a40042e55 100644 --- a/internal/service/bedrockagent/agent_action_group.go +++ b/internal/service/bedrockagent/agent_action_group.go @@ -138,7 +138,7 @@ func (r *agentActionGroupResource) Schema(ctx context.Context, request resource. }, NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "s3_bucket_name": schema.StringAttribute{ + names.AttrS3BucketName: schema.StringAttribute{ Optional: true, }, "s3_object_key": schema.StringAttribute{ diff --git a/internal/service/bedrockagent/knowledge_base.go b/internal/service/bedrockagent/knowledge_base.go index 47f166f4090..4c026280edb 100644 --- a/internal/service/bedrockagent/knowledge_base.go +++ b/internal/service/bedrockagent/knowledge_base.go @@ -156,7 +156,7 @@ func (r *knowledgeBaseResource) Schema(ctx context.Context, request resource.Sch CustomType: fwtypes.ARNType, Required: true, }, - "namespace": schema.StringAttribute{ + names.AttrNamespace: schema.StringAttribute{ Optional: true, }, }, @@ -198,7 +198,7 @@ func (r *knowledgeBaseResource) Schema(ctx context.Context, request resource.Sch CustomType: fwtypes.ARNType, Required: true, }, - "table_name": schema.StringAttribute{ + names.AttrTableName: schema.StringAttribute{ Required: true, }, }, From bed47b54cfd06ec996599e7c4e5ad5d6f327c555 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:23 -0400 Subject: [PATCH 1424/1490] cleanrooms: Use constants for strings --- internal/service/cleanrooms/configured_table.go | 6 +++--- internal/service/cleanrooms/configured_table_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/cleanrooms/configured_table.go b/internal/service/cleanrooms/configured_table.go index c256d70ca99..2f8d778142c 100644 --- a/internal/service/cleanrooms/configured_table.go +++ b/internal/service/cleanrooms/configured_table.go @@ -87,7 +87,7 @@ func ResourceConfiguredTable() *schema.Resource { Required: true, ForceNew: true, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -260,7 +260,7 @@ func expandTableReference(data []interface{}) types.TableReference { return &types.TableReferenceMemberGlue{ Value: types.GlueTableReference{ DatabaseName: aws.String(tableReference[names.AttrDatabaseName].(string)), - TableName: aws.String(tableReference["table_name"].(string)), + TableName: aws.String(tableReference[names.AttrTableName].(string)), }, } } @@ -270,7 +270,7 @@ func flattenTableReference(tableReference types.TableReference) []interface{} { case *types.TableReferenceMemberGlue: m := map[string]interface{}{ names.AttrDatabaseName: v.Value.DatabaseName, - "table_name": v.Value.TableName, + names.AttrTableName: v.Value.TableName, } return []interface{}{m} default: diff --git a/internal/service/cleanrooms/configured_table_test.go b/internal/service/cleanrooms/configured_table_test.go index a42f885cf44..378725fdb74 100644 --- a/internal/service/cleanrooms/configured_table_test.go +++ b/internal/service/cleanrooms/configured_table_test.go @@ -46,7 +46,7 @@ func TestAccCleanRoomsConfiguredTable_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "allowed_columns.1", "my_column_2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "table_reference.*", map[string]string{ names.AttrDatabaseName: rName, - "table_name": rName, + names.AttrTableName: rName, }), resource.TestCheckResourceAttr(resourceName, "tags.Project", TEST_TAG), ), @@ -173,7 +173,7 @@ func TestAccCleanRoomsConfiguredTable_updateTableReference(t *testing.T) { testAccCheckConfiguredTableRecreated(resourceName, &configuredTable), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "table_reference.*", map[string]string{ names.AttrDatabaseName: secondDatabaseName, - "table_name": TEST_SECOND_ADDITIONAL_TABLE_NAME, + names.AttrTableName: TEST_SECOND_ADDITIONAL_TABLE_NAME, }), ), }, @@ -208,7 +208,7 @@ func TestAccCleanRoomsConfiguredTable_updateTableReference_onlyDatabase(t *testi testAccCheckConfiguredTableRecreated(resourceName, &configuredTable), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "table_reference.*", map[string]string{ names.AttrDatabaseName: secondDatabaseName, - "table_name": TEST_FIRST_ADDITIONAL_TABLE_NAME, + names.AttrTableName: TEST_FIRST_ADDITIONAL_TABLE_NAME, }), ), }, @@ -243,7 +243,7 @@ func TestAccCleanRoomsConfiguredTable_updateTableReference_onlyTable(t *testing. testAccCheckConfiguredTableRecreated(resourceName, &configuredTable), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "table_reference.*", map[string]string{ names.AttrDatabaseName: firstDatabaseName, - "table_name": TEST_SECOND_ADDITIONAL_TABLE_NAME, + names.AttrTableName: TEST_SECOND_ADDITIONAL_TABLE_NAME, }), ), }, From 1953b3742b4ac9b542b7fd81452151a941b9ea07 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:23 -0400 Subject: [PATCH 1425/1490] cloudcontrol: Use constants for strings --- internal/service/cloudcontrol/resource_data_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/cloudcontrol/resource_data_source.go b/internal/service/cloudcontrol/resource_data_source.go index 9d043893803..dedac6350db 100644 --- a/internal/service/cloudcontrol/resource_data_source.go +++ b/internal/service/cloudcontrol/resource_data_source.go @@ -22,7 +22,7 @@ func dataSourceResource() *schema.Resource { ReadWithoutTimeout: dataSourceResourceRead, Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, }, @@ -52,7 +52,7 @@ func dataSourceResourceRead(ctx context.Context, d *schema.ResourceData, meta in conn := meta.(*conns.AWSClient).CloudControlClient(ctx) - identifier := d.Get("identifier").(string) + identifier := d.Get(names.AttrIdentifier).(string) typeName := d.Get("type_name").(string) resourceDescription, err := findResource(ctx, conn, identifier, From 35ffdc1521e3f27778b015c56060276c21f881ce Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:23 -0400 Subject: [PATCH 1426/1490] cloudformation: Use constants for strings --- internal/service/cloudformation/type.go | 6 +++--- internal/service/cloudformation/type_data_source.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/cloudformation/type.go b/internal/service/cloudformation/type.go index e4bca7b9c79..fb77be8be82 100644 --- a/internal/service/cloudformation/type.go +++ b/internal/service/cloudformation/type.go @@ -72,7 +72,7 @@ func resourceType() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -412,7 +412,7 @@ func expandLoggingConfig(tfMap map[string]interface{}) *awstypes.LoggingConfig { apiObject := &awstypes.LoggingConfig{} - if v, ok := tfMap["log_group_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrLogGroupName].(string); ok && v != "" { apiObject.LogGroupName = aws.String(v) } @@ -472,7 +472,7 @@ func flattenLoggingConfig(apiObject *awstypes.LoggingConfig) map[string]interfac tfMap := map[string]interface{}{} if v := apiObject.LogGroupName; v != nil { - tfMap["log_group_name"] = aws.ToString(v) + tfMap[names.AttrLogGroupName] = aws.ToString(v) } if v := apiObject.LogRoleArn; v != nil { diff --git a/internal/service/cloudformation/type_data_source.go b/internal/service/cloudformation/type_data_source.go index be834953351..3b5e789654d 100644 --- a/internal/service/cloudformation/type_data_source.go +++ b/internal/service/cloudformation/type_data_source.go @@ -59,7 +59,7 @@ func dataSourceType() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Computed: true, }, From 021ec097a325be650ebe51f88eb9e779d2f0e2b5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:23 -0400 Subject: [PATCH 1427/1490] cloudfront: Use constants for strings --- .../service/cloudfront/field_level_encryption_config.go | 6 +++--- .../cloudfront/field_level_encryption_config_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/cloudfront/field_level_encryption_config.go b/internal/service/cloudfront/field_level_encryption_config.go index 73d32754525..da6d6737af9 100644 --- a/internal/service/cloudfront/field_level_encryption_config.go +++ b/internal/service/cloudfront/field_level_encryption_config.go @@ -60,7 +60,7 @@ func resourceFieldLevelEncryptionConfig() *schema.Resource { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Required: true, }, @@ -327,7 +327,7 @@ func expandContentTypeProfile(tfMap map[string]interface{}) *awstypes.ContentTyp apiObject := &awstypes.ContentTypeProfile{} - if v, ok := tfMap["content_type"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrContentType].(string); ok && v != "" { apiObject.ContentType = aws.String(v) } @@ -488,7 +488,7 @@ func flattenContentTypeProfile(apiObject *awstypes.ContentTypeProfile) map[strin } if v := apiObject.ContentType; v != nil { - tfMap["content_type"] = aws.ToString(v) + tfMap[names.AttrContentType] = aws.ToString(v) } if v := apiObject.ProfileId; v != nil { diff --git a/internal/service/cloudfront/field_level_encryption_config_test.go b/internal/service/cloudfront/field_level_encryption_config_test.go index 00c98d70f27..8251782eda8 100644 --- a/internal/service/cloudfront/field_level_encryption_config_test.go +++ b/internal/service/cloudfront/field_level_encryption_config_test.go @@ -40,8 +40,8 @@ func TestAccCloudFrontFieldLevelEncryptionConfig_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_type_profile_config.0.content_type_profiles.#", "1"), resource.TestCheckResourceAttr(resourceName, "content_type_profile_config.0.content_type_profiles.0.items.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "content_type_profile_config.0.content_type_profiles.0.items.*", map[string]string{ - "content_type": "application/x-www-form-urlencoded", - names.AttrFormat: "URLEncoded", + names.AttrContentType: "application/x-www-form-urlencoded", + names.AttrFormat: "URLEncoded", }), resource.TestCheckResourceAttr(resourceName, "content_type_profile_config.0.forward_when_content_type_is_unknown", "true"), resource.TestCheckResourceAttr(resourceName, "query_arg_profile_config.#", "1"), @@ -64,8 +64,8 @@ func TestAccCloudFrontFieldLevelEncryptionConfig_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_type_profile_config.0.content_type_profiles.#", "1"), resource.TestCheckResourceAttr(resourceName, "content_type_profile_config.0.content_type_profiles.0.items.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "content_type_profile_config.0.content_type_profiles.0.items.*", map[string]string{ - "content_type": "application/x-www-form-urlencoded", - names.AttrFormat: "URLEncoded", + names.AttrContentType: "application/x-www-form-urlencoded", + names.AttrFormat: "URLEncoded", }), resource.TestCheckResourceAttr(resourceName, "query_arg_profile_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "query_arg_profile_config.0.forward_when_query_arg_profile_is_unknown", "false"), From cd3c0d73222995009e47c38af18f43416ad80f20 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:24 -0400 Subject: [PATCH 1428/1490] cloudtrail: Use constants for strings --- internal/service/cloudtrail/cloudtrail.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/cloudtrail/cloudtrail.go b/internal/service/cloudtrail/cloudtrail.go index a5c8bbbbba3..2764da29f71 100644 --- a/internal/service/cloudtrail/cloudtrail.go +++ b/internal/service/cloudtrail/cloudtrail.go @@ -244,7 +244,7 @@ func resourceTrail() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(3, 128), }, - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Required: true, }, @@ -273,7 +273,7 @@ func resourceTrailCreate(ctx context.Context, d *schema.ResourceData, meta inter input := &cloudtrail.CreateTrailInput{ IncludeGlobalServiceEvents: aws.Bool(d.Get("include_global_service_events").(bool)), Name: aws.String(name), - S3BucketName: aws.String(d.Get("s3_bucket_name").(string)), + S3BucketName: aws.String(d.Get(names.AttrS3BucketName).(string)), TagsList: getTagsIn(ctx), } @@ -387,7 +387,7 @@ func resourceTrailRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set("is_organization_trail", trail.IsOrganizationTrail) d.Set(names.AttrKMSKeyID, trail.KmsKeyId) d.Set(names.AttrName, trail.Name) - d.Set("s3_bucket_name", trail.S3BucketName) + d.Set(names.AttrS3BucketName, trail.S3BucketName) d.Set("s3_key_prefix", trail.S3KeyPrefix) d.Set("sns_topic_name", trail.SnsTopicName) @@ -473,8 +473,8 @@ func resourceTrailUpdate(ctx context.Context, d *schema.ResourceData, meta inter input.KmsKeyId = aws.String(d.Get(names.AttrKMSKeyID).(string)) } - if d.HasChange("s3_bucket_name") { - input.S3BucketName = aws.String(d.Get("s3_bucket_name").(string)) + if d.HasChange(names.AttrS3BucketName) { + input.S3BucketName = aws.String(d.Get(names.AttrS3BucketName).(string)) } if d.HasChange("s3_key_prefix") { @@ -1077,7 +1077,7 @@ func resourceTrailV0() *schema.Resource { Required: true, ForceNew: true, }, - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Required: true, }, From 98f68c9b97b1a81f2c3691b2921505cd9f49698b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:24 -0400 Subject: [PATCH 1429/1490] cloudwatch: Use constants for strings --- internal/service/cloudwatch/metric_alarm.go | 12 ++++++------ internal/service/cloudwatch/metric_alarm_test.go | 2 +- internal/service/cloudwatch/metric_stream.go | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/service/cloudwatch/metric_alarm.go b/internal/service/cloudwatch/metric_alarm.go index 155fd5f3ca9..1808541abc5 100644 --- a/internal/service/cloudwatch/metric_alarm.go +++ b/internal/service/cloudwatch/metric_alarm.go @@ -168,7 +168,7 @@ func resourceMetricAlarm() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.All( @@ -226,7 +226,7 @@ func resourceMetricAlarm() *schema.Resource { }, }, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, ConflictsWith: []string{"metric_query"}, @@ -399,7 +399,7 @@ func resourceMetricAlarmRead(ctx context.Context, d *schema.ResourceData, meta i return sdkdiag.AppendErrorf(diags, "setting metric_query: %s", err) } } - d.Set("namespace", alarm.Namespace) + d.Set(names.AttrNamespace, alarm.Namespace) d.Set("ok_actions", alarm.OKActions) d.Set("period", alarm.Period) d.Set("statistic", alarm.Statistic) @@ -520,7 +520,7 @@ func expandPutMetricAlarmInput(ctx context.Context, d *schema.ResourceData) *clo apiObject.Metrics = expandMetricAlarmMetrics(v.(*schema.Set).List()) } - if v, ok := d.GetOk("namespace"); ok { + if v, ok := d.GetOk(names.AttrNamespace); ok { apiObject.Namespace = aws.String(v.(string)) } @@ -603,7 +603,7 @@ func flattenMetricAlarmMetricsMetricStat(apiObject *types.MetricStat) map[string if v := apiObject.Metric; v != nil { tfMap["dimensions"] = flattenMetricAlarmDimensions(v.Dimensions) tfMap["metric_name"] = aws.ToString(v.MetricName) - tfMap["namespace"] = aws.ToString(v.Namespace) + tfMap[names.AttrNamespace] = aws.ToString(v.Namespace) } return tfMap @@ -677,7 +677,7 @@ func expandMetricAlarmMetricsMetric(tfMap map[string]interface{}) *types.MetricS apiObject.Metric.Dimensions = expandMetricAlarmDimensions(v) } - if v, ok := tfMap["namespace"]; ok && v.(string) != "" { + if v, ok := tfMap[names.AttrNamespace]; ok && v.(string) != "" { apiObject.Metric.Namespace = aws.String(v.(string)) } diff --git a/internal/service/cloudwatch/metric_alarm_test.go b/internal/service/cloudwatch/metric_alarm_test.go index 973c19e62e8..17c2f25e1ed 100755 --- a/internal/service/cloudwatch/metric_alarm_test.go +++ b/internal/service/cloudwatch/metric_alarm_test.go @@ -43,7 +43,7 @@ func TestAccCloudWatchMetricAlarm_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "alarm_description", "This metric monitors ec2 cpu utilization"), resource.TestCheckResourceAttr(resourceName, "threshold", "80"), resource.TestCheckResourceAttr(resourceName, "period", "120"), - resource.TestCheckResourceAttr(resourceName, "namespace", "AWS/EC2"), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, "AWS/EC2"), resource.TestCheckResourceAttr(resourceName, "alarm_name", rName), resource.TestCheckResourceAttr(resourceName, "comparison_operator", "GreaterThanOrEqualToThreshold"), resource.TestCheckResourceAttr(resourceName, "datapoints_to_alarm", "0"), diff --git a/internal/service/cloudwatch/metric_stream.go b/internal/service/cloudwatch/metric_stream.go index 24a500b4c04..494b12c7f1b 100644 --- a/internal/service/cloudwatch/metric_stream.go +++ b/internal/service/cloudwatch/metric_stream.go @@ -71,7 +71,7 @@ func resourceMetricStream() *schema.Resource { ValidateFunc: validation.StringLenBetween(1, 255), }, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 255), @@ -98,7 +98,7 @@ func resourceMetricStream() *schema.Resource { ValidateFunc: validation.StringLenBetween(1, 255), }, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 255), @@ -183,7 +183,7 @@ func resourceMetricStream() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 255), @@ -468,7 +468,7 @@ func expandMetricStreamFilters(tfList []interface{}) []types.MetricStreamFilter apiObject.MetricNames = flex.ExpandStringValueSet(v) } - if v, ok := tfMap["namespace"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrNamespace].(string); ok && v != "" { apiObject.Namespace = aws.String(v) } @@ -496,7 +496,7 @@ func flattenMetricStreamFilters(apiObjects []types.MetricStreamFilter) []interfa } if v := apiObject.Namespace; v != nil { - tfMap["namespace"] = aws.ToString(v) + tfMap[names.AttrNamespace] = aws.ToString(v) } tfList = append(tfList, tfMap) @@ -550,7 +550,7 @@ func expandMetricStreamStatisticsConfigurationsIncludeMetrics(tfList []interface apiObject.MetricName = aws.String(v) } - if v, ok := tfMap["namespace"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrNamespace].(string); ok && v != "" { apiObject.Namespace = aws.String(v) } @@ -603,7 +603,7 @@ func flattenMetricStreamStatisticsConfigurationsIncludeMetrics(apiObjects []type } if v := apiObject.Namespace; v != nil { - tfMap["namespace"] = aws.ToString(v) + tfMap[names.AttrNamespace] = aws.ToString(v) } tfList = append(tfList, tfMap) From 8191e1f8e4f9e913c318ee6c24aed4a0e9d77016 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:24 -0400 Subject: [PATCH 1430/1490] codebuild: Use constants for strings --- internal/service/codebuild/project.go | 14 +++++++------- internal/service/codebuild/source_credential.go | 4 ++-- .../service/codebuild/source_credential_test.go | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/codebuild/project.go b/internal/service/codebuild/project.go index 7bd173325a2..fb8192ef0bf 100644 --- a/internal/service/codebuild/project.go +++ b/internal/service/codebuild/project.go @@ -241,7 +241,7 @@ func resourceProject() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`\.(pem|zip)$`), "must end in .pem or .zip"), @@ -319,7 +319,7 @@ func resourceProject() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Optional: true, }, @@ -1195,8 +1195,8 @@ func expandProjectFileSystemLocation(tfMap map[string]interface{}) *types.Projec Type: types.FileSystemType(tfMap[names.AttrType].(string)), } - if tfMap["identifier"].(string) != "" { - apiObject.Identifier = aws.String(tfMap["identifier"].(string)) + if tfMap[names.AttrIdentifier].(string) != "" { + apiObject.Identifier = aws.String(tfMap[names.AttrIdentifier].(string)) } if tfMap["location"].(string) != "" { @@ -1322,7 +1322,7 @@ func expandProjectEnvironment(tfMap map[string]interface{}) *types.ProjectEnviro PrivilegedMode: aws.Bool(tfMap["privileged_mode"].(bool)), } - if v, ok := tfMap["certificate"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrCertificate].(string); ok && v != "" { apiObject.Certificate = aws.String(v) } @@ -1625,7 +1625,7 @@ func flattenProjectFileSystemLocation(apiObject types.ProjectFileSystemLocation) } if v := apiObject.Identifier; v != nil { - tfMap["identifier"] = aws.ToString(v) + tfMap[names.AttrIdentifier] = aws.ToString(v) } if v := apiObject.Location; v != nil { @@ -1798,7 +1798,7 @@ func flattenProjectEnvironment(apiObject *types.ProjectEnvironment) []interface{ } tfMap["image"] = aws.ToString(apiObject.Image) - tfMap["certificate"] = aws.ToString(apiObject.Certificate) + tfMap[names.AttrCertificate] = aws.ToString(apiObject.Certificate) tfMap["privileged_mode"] = aws.ToBool(apiObject.PrivilegedMode) tfMap["registry_credential"] = flattenRegistryCredential(apiObject.RegistryCredential) diff --git a/internal/service/codebuild/source_credential.go b/internal/service/codebuild/source_credential.go index d777b7fd1c0..f0550f764f7 100644 --- a/internal/service/codebuild/source_credential.go +++ b/internal/service/codebuild/source_credential.go @@ -55,7 +55,7 @@ func resourceSourceCredential() *schema.Resource { ForceNew: true, Sensitive: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -75,7 +75,7 @@ func resourceSourceCredentialCreate(ctx context.Context, d *schema.ResourceData, Token: aws.String(d.Get("token").(string)), } - if attr, ok := d.GetOk("user_name"); ok && authType == types.AuthTypeBasicAuth { + if attr, ok := d.GetOk(names.AttrUserName); ok && authType == types.AuthTypeBasicAuth { input.Username = aws.String(attr.(string)) } diff --git a/internal/service/codebuild/source_credential_test.go b/internal/service/codebuild/source_credential_test.go index 1c8701af499..b821aaa8798 100644 --- a/internal/service/codebuild/source_credential_test.go +++ b/internal/service/codebuild/source_credential_test.go @@ -55,7 +55,7 @@ func TestAccCodeBuildSourceCredential_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"token", "user_name"}, + ImportStateVerifyIgnore: []string{"token", names.AttrUserName}, }, }, }) @@ -78,7 +78,7 @@ func TestAccCodeBuildSourceCredential_basicAuth(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckSourceCredentialExists(ctx, resourceName, &sourceCredentialsInfo), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "codebuild", regexache.MustCompile(`token/bitbucket`)), - resource.TestCheckResourceAttr(resourceName, "user_name", "user1"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "user1"), resource.TestCheckResourceAttr(resourceName, "server_type", "BITBUCKET"), resource.TestCheckResourceAttr(resourceName, "auth_type", "BASIC_AUTH"), ), @@ -87,14 +87,14 @@ func TestAccCodeBuildSourceCredential_basicAuth(t *testing.T) { Config: testAccSourceCredentialConfig_basicAuth(token, "user2"), Check: resource.ComposeTestCheckFunc( testAccCheckSourceCredentialExists(ctx, resourceName, &sourceCredentialsInfo), - resource.TestCheckResourceAttr(resourceName, "user_name", "user2"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "user2"), ), }, { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"token", "user_name"}, + ImportStateVerifyIgnore: []string{"token", names.AttrUserName}, }, }, }) From c66b0cf1a65921267f3996a7766d5547fc72d762 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:24 -0400 Subject: [PATCH 1431/1490] codepipeline: Use constants for strings --- internal/service/codepipeline/codepipeline.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/codepipeline/codepipeline.go b/internal/service/codepipeline/codepipeline.go index a2eb8b51d04..a7fcda86ed1 100644 --- a/internal/service/codepipeline/codepipeline.go +++ b/internal/service/codepipeline/codepipeline.go @@ -159,7 +159,7 @@ func resourcePipeline() *schema.Resource { validation.StringMatch(regexache.MustCompile(`[0-9A-Za-z_.@-]+`), ""), ), }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.All( @@ -847,7 +847,7 @@ func expandActionDeclaration(tfMap map[string]interface{}) *types.ActionDeclarat apiObject.Name = aws.String(v) } - if v, ok := tfMap["namespace"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrNamespace].(string); ok && v != "" { apiObject.Namespace = aws.String(v) } @@ -1336,7 +1336,7 @@ func flattenActionDeclaration(d *schema.ResourceData, i, j int, apiObject types. } if v := apiObject.Namespace; v != nil { - tfMap["namespace"] = aws.ToString(v) + tfMap[names.AttrNamespace] = aws.ToString(v) } if v := apiObject.OutputArtifacts; len(v) > 0 { From c1f9bb778490313430452b00b39f3b59b33fa6da Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:25 -0400 Subject: [PATCH 1432/1490] cognitoidp: Use constants for strings --- internal/service/cognitoidp/resource_server.go | 6 +++--- internal/service/cognitoidp/resource_server_test.go | 4 ++-- .../cognitoidp/user_pool_signing_certificate_data_source.go | 5 +++-- .../user_pool_signing_certificate_data_source_test.go | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/service/cognitoidp/resource_server.go b/internal/service/cognitoidp/resource_server.go index 8c5d443775a..169ea589011 100644 --- a/internal/service/cognitoidp/resource_server.go +++ b/internal/service/cognitoidp/resource_server.go @@ -36,7 +36,7 @@ func resourceResourceServer() *schema.Resource { // https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateResourceServer.html Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -85,7 +85,7 @@ func resourceResourceServerCreate(ctx context.Context, d *schema.ResourceData, m var diags diag.Diagnostics conn := meta.(*conns.AWSClient).CognitoIDPConn(ctx) - identifier := d.Get("identifier").(string) + identifier := d.Get(names.AttrIdentifier).(string) userPoolID := d.Get("user_pool_id").(string) params := &cognitoidentityprovider.CreateResourceServerInput{ @@ -150,7 +150,7 @@ func resourceResourceServerRead(ctx context.Context, d *schema.ResourceData, met return create.AppendDiagError(diags, names.CognitoIDP, create.ErrActionReading, ResNameResourceServer, d.Id(), errors.New("not found after creation")) } - d.Set("identifier", resp.ResourceServer.Identifier) + d.Set(names.AttrIdentifier, resp.ResourceServer.Identifier) d.Set(names.AttrName, resp.ResourceServer.Name) d.Set("user_pool_id", resp.ResourceServer.UserPoolId) diff --git a/internal/service/cognitoidp/resource_server_test.go b/internal/service/cognitoidp/resource_server_test.go index cccfb879d22..877d89df4fb 100644 --- a/internal/service/cognitoidp/resource_server_test.go +++ b/internal/service/cognitoidp/resource_server_test.go @@ -40,7 +40,7 @@ func TestAccCognitoIDPResourceServer_basic(t *testing.T) { Config: testAccResourceServerConfig_basic(identifier, name1, poolName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckResourceServerExists(ctx, resourceName, &resourceServer), - resource.TestCheckResourceAttr(resourceName, "identifier", identifier), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, identifier), resource.TestCheckResourceAttr(resourceName, names.AttrName, name1), resource.TestCheckResourceAttr(resourceName, "scope.#", "0"), resource.TestCheckResourceAttr(resourceName, "scope_identifiers.#", "0"), @@ -50,7 +50,7 @@ func TestAccCognitoIDPResourceServer_basic(t *testing.T) { Config: testAccResourceServerConfig_basic(identifier, name2, poolName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckResourceServerExists(ctx, resourceName, &resourceServer), - resource.TestCheckResourceAttr(resourceName, "identifier", identifier), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, identifier), resource.TestCheckResourceAttr(resourceName, names.AttrName, name2), resource.TestCheckResourceAttr(resourceName, "scope.#", "0"), resource.TestCheckResourceAttr(resourceName, "scope_identifiers.#", "0"), diff --git a/internal/service/cognitoidp/user_pool_signing_certificate_data_source.go b/internal/service/cognitoidp/user_pool_signing_certificate_data_source.go index d4e779efe2c..13f1c3b085b 100644 --- a/internal/service/cognitoidp/user_pool_signing_certificate_data_source.go +++ b/internal/service/cognitoidp/user_pool_signing_certificate_data_source.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_cognito_user_pool_signing_certificate", name="User Pool Signing Certificate") @@ -20,7 +21,7 @@ func dataSourceUserPoolSigningCertificate() *schema.Resource { ReadWithoutTimeout: dataSourceUserPoolSigningCertificateRead, Schema: map[string]*schema.Schema{ - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Computed: true, }, @@ -48,7 +49,7 @@ func dataSourceUserPoolSigningCertificateRead(ctx context.Context, d *schema.Res } d.SetId(userPoolID) - d.Set("certificate", output.Certificate) + d.Set(names.AttrCertificate, output.Certificate) return diags } diff --git a/internal/service/cognitoidp/user_pool_signing_certificate_data_source_test.go b/internal/service/cognitoidp/user_pool_signing_certificate_data_source_test.go index bfbcb2599d9..d5b8a8beb9a 100644 --- a/internal/service/cognitoidp/user_pool_signing_certificate_data_source_test.go +++ b/internal/service/cognitoidp/user_pool_signing_certificate_data_source_test.go @@ -26,7 +26,7 @@ func TestAccCognitoIDPUserPoolSigningCertificateDataSource_basic(t *testing.T) { { Config: testAccUserPoolSigningCertificateDataSourceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttrSet(datasourceName, "certificate"), + resource.TestCheckResourceAttrSet(datasourceName, names.AttrCertificate), ), }, }, From eafba32b271c3ab71dc95ebcd1ec4437e24a9d99 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:25 -0400 Subject: [PATCH 1433/1490] configservice: Use constants for strings --- internal/service/configservice/delivery_channel.go | 12 ++++++------ .../service/configservice/delivery_channel_test.go | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/service/configservice/delivery_channel.go b/internal/service/configservice/delivery_channel.go index 36db9e5f3bd..4a933c754b7 100644 --- a/internal/service/configservice/delivery_channel.go +++ b/internal/service/configservice/delivery_channel.go @@ -44,7 +44,7 @@ func resourceDeliveryChannel() *schema.Resource { Default: defaultDeliveryChannelName, ValidateFunc: validation.StringLenBetween(0, 256), }, - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Required: true, }, @@ -71,7 +71,7 @@ func resourceDeliveryChannel() *schema.Resource { }, }, }, - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, @@ -88,7 +88,7 @@ func resourceDeliveryChannelPut(ctx context.Context, d *schema.ResourceData, met input := &configservice.PutDeliveryChannelInput{ DeliveryChannel: &types.DeliveryChannel{ Name: aws.String(name), - S3BucketName: aws.String(d.Get("s3_bucket_name").(string)), + S3BucketName: aws.String(d.Get(names.AttrS3BucketName).(string)), }, } @@ -110,7 +110,7 @@ func resourceDeliveryChannelPut(ctx context.Context, d *schema.ResourceData, met } } - if v, ok := d.GetOk("sns_topic_arn"); ok { + if v, ok := d.GetOk(names.AttrSNSTopicARN); ok { input.DeliveryChannel.SnsTopicARN = aws.String(v.(string)) } @@ -146,13 +146,13 @@ func resourceDeliveryChannelRead(ctx context.Context, d *schema.ResourceData, me } d.Set(names.AttrName, channel.Name) - d.Set("s3_bucket_name", channel.S3BucketName) + d.Set(names.AttrS3BucketName, channel.S3BucketName) d.Set("s3_key_prefix", channel.S3KeyPrefix) d.Set("s3_kms_key_arn", channel.S3KmsKeyArn) if channel.ConfigSnapshotDeliveryProperties != nil { d.Set("snapshot_delivery_properties", flattenSnapshotDeliveryProperties(channel.ConfigSnapshotDeliveryProperties)) } - d.Set("sns_topic_arn", channel.SnsTopicARN) + d.Set(names.AttrSNSTopicARN, channel.SnsTopicARN) return diags } diff --git a/internal/service/configservice/delivery_channel_test.go b/internal/service/configservice/delivery_channel_test.go index f8ae7dba28f..67ebbab5e8c 100644 --- a/internal/service/configservice/delivery_channel_test.go +++ b/internal/service/configservice/delivery_channel_test.go @@ -36,7 +36,7 @@ func testAccDeliveryChannel_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckDeliveryChannelExists(ctx, resourceName, &dc), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "s3_bucket_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrS3BucketName, rName), ), }, { @@ -89,10 +89,10 @@ func testAccDeliveryChannel_allParams(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckDeliveryChannelExists(ctx, resourceName, &dc), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), - resource.TestCheckResourceAttr(resourceName, "s3_bucket_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrS3BucketName, rName), resource.TestCheckResourceAttr(resourceName, "s3_key_prefix", "one/two/three"), resource.TestCheckResourceAttrPair(resourceName, "s3_kms_key_arn", "aws_kms_key.test", names.AttrARN), - resource.TestCheckResourceAttrPair(resourceName, "sns_topic_arn", "aws_sns_topic.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSNSTopicARN, "aws_sns_topic.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "snapshot_delivery_properties.0.delivery_frequency", "Six_Hours"), ), }, From f74f56a114defeef49d34bb939b70ed8ef8637f4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:25 -0400 Subject: [PATCH 1434/1490] customerprofiles: Use constants for strings --- internal/service/customerprofiles/domain.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/customerprofiles/domain.go b/internal/service/customerprofiles/domain.go index d18ccbcffa4..2140b7fce97 100644 --- a/internal/service/customerprofiles/domain.go +++ b/internal/service/customerprofiles/domain.go @@ -240,7 +240,7 @@ func exportingConfigSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Required: true, }, @@ -545,7 +545,7 @@ func expandS3ExportingConfig(tfMap []interface{}) *types.S3ExportingConfig { apiObject := &types.S3ExportingConfig{} - if v, ok := tfList["s3_bucket_name"]; ok { + if v, ok := tfList[names.AttrS3BucketName]; ok { apiObject.S3BucketName = aws.String(v.(string)) } @@ -840,7 +840,7 @@ func flattenS3Exporting(apiObject *types.S3ExportingConfig) []interface{} { tfMap := map[string]interface{}{} if v := apiObject.S3BucketName; v != nil { - tfMap["s3_bucket_name"] = aws.ToString(v) + tfMap[names.AttrS3BucketName] = aws.ToString(v) } if v := apiObject.S3KeyName; v != nil { From f0cb5f153b1778dfd123996c6b426636e84864d6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:25 -0400 Subject: [PATCH 1435/1490] deploy: Use constants for strings --- internal/service/deploy/deployment_group.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/deploy/deployment_group.go b/internal/service/deploy/deployment_group.go index 9ad362de269..a26d32c2ae8 100644 --- a/internal/service/deploy/deployment_group.go +++ b/internal/service/deploy/deployment_group.go @@ -286,7 +286,7 @@ func resourceDeploymentGroup() *schema.Resource { Required: true, ValidateFunc: validation.NoZeroValues, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Required: true, ValidateFunc: validation.NoZeroValues, @@ -906,7 +906,7 @@ func expandECSServices(l []interface{}) []types.ECSService { ecsService := types.ECSService{ ClusterName: aws.String(m["cluster_name"].(string)), - ServiceName: aws.String(m["service_name"].(string)), + ServiceName: aws.String(m[names.AttrServiceName].(string)), } ecsServices = append(ecsServices, ecsService) @@ -1202,8 +1202,8 @@ func flattenECSServices(ecsServices []types.ECSService) []interface{} { for _, ecsService := range ecsServices { m := map[string]interface{}{ - "cluster_name": aws.ToString(ecsService.ClusterName), - "service_name": aws.ToString(ecsService.ServiceName), + "cluster_name": aws.ToString(ecsService.ClusterName), + names.AttrServiceName: aws.ToString(ecsService.ServiceName), } l = append(l, m) From b2d8d382cad86aefa499441190337f1a79f74aad Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:25 -0400 Subject: [PATCH 1436/1490] devicefarm: Use constants for strings --- internal/service/devicefarm/upload.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/devicefarm/upload.go b/internal/service/devicefarm/upload.go index 53f209758b8..a8d89d50827 100644 --- a/internal/service/devicefarm/upload.go +++ b/internal/service/devicefarm/upload.go @@ -40,7 +40,7 @@ func ResourceUpload() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 64), @@ -84,7 +84,7 @@ func resourceUploadCreate(ctx context.Context, d *schema.ResourceData, meta inte Type: aws.String(d.Get(names.AttrType).(string)), } - if v, ok := d.GetOk("content_type"); ok { + if v, ok := d.GetOk(names.AttrContentType); ok { input.ContentType = aws.String(v.(string)) } @@ -119,7 +119,7 @@ func resourceUploadRead(ctx context.Context, d *schema.ResourceData, meta interf arn := aws.StringValue(upload.Arn) d.Set(names.AttrName, upload.Name) d.Set(names.AttrType, upload.Type) - d.Set("content_type", upload.ContentType) + d.Set(names.AttrContentType, upload.ContentType) d.Set(names.AttrURL, upload.Url) d.Set("category", upload.Category) d.Set("metadata", upload.Metadata) @@ -147,8 +147,8 @@ func resourceUploadUpdate(ctx context.Context, d *schema.ResourceData, meta inte input.Name = aws.String(d.Get(names.AttrName).(string)) } - if d.HasChange("content_type") { - input.ContentType = aws.String(d.Get("content_type").(string)) + if d.HasChange(names.AttrContentType) { + input.ContentType = aws.String(d.Get(names.AttrContentType).(string)) } log.Printf("[DEBUG] Updating DeviceFarm Upload: %s", d.Id()) From 5d44579613f8ac63a481067e610edee494d04fd9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:26 -0400 Subject: [PATCH 1437/1490] dms: Use constants for strings --- internal/service/dms/endpoint.go | 10 +++++----- internal/service/dms/endpoint_data_source.go | 4 ++-- .../service/dms/endpoint_data_source_test.go | 2 +- internal/service/dms/event_subscription.go | 8 ++++---- .../service/dms/event_subscription_test.go | 2 +- internal/service/dms/replication_task_test.go | 2 +- internal/service/dms/s3_endpoint.go | 18 +++++++++--------- internal/service/dms/s3_endpoint_test.go | 6 +++--- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/internal/service/dms/endpoint.go b/internal/service/dms/endpoint.go index 737b16c44b1..4eb324a1d4e 100644 --- a/internal/service/dms/endpoint.go +++ b/internal/service/dms/endpoint.go @@ -109,7 +109,7 @@ func ResourceEndpoint() *schema.Resource { ForceNew: true, ValidateFunc: validEndpointID, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(dms.ReplicationEndpointTypeValue_Values(), false), @@ -781,7 +781,7 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in endpointID := d.Get("endpoint_id").(string) input := &dms.CreateEndpointInput{ EndpointIdentifier: aws.String(endpointID), - EndpointType: aws.String(d.Get("endpoint_type").(string)), + EndpointType: aws.String(d.Get(names.AttrEndpointType).(string)), EngineName: aws.String(d.Get("engine_name").(string)), Tags: getTagsIn(ctx), } @@ -1079,8 +1079,8 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta in input.CertificateArn = aws.String(d.Get(names.AttrCertificateARN).(string)) } - if d.HasChange("endpoint_type") { - input.EndpointType = aws.String(d.Get("endpoint_type").(string)) + if d.HasChange(names.AttrEndpointType) { + input.EndpointType = aws.String(d.Get(names.AttrEndpointType).(string)) } if d.HasChange("engine_name") { @@ -1534,7 +1534,7 @@ func resourceEndpointSetState(d *schema.ResourceData, endpoint *dms.Endpoint) er d.Set("endpoint_arn", endpoint.EndpointArn) d.Set("endpoint_id", endpoint.EndpointIdentifier) // For some reason the AWS API only accepts lowercase type but returns it as uppercase - d.Set("endpoint_type", strings.ToLower(aws.StringValue(endpoint.EndpointType))) + d.Set(names.AttrEndpointType, strings.ToLower(aws.StringValue(endpoint.EndpointType))) d.Set("engine_name", endpoint.EngineName) d.Set("extra_connection_attributes", endpoint.ExtraConnectionAttributes) diff --git a/internal/service/dms/endpoint_data_source.go b/internal/service/dms/endpoint_data_source.go index a533b694be9..f504ea19a5a 100644 --- a/internal/service/dms/endpoint_data_source.go +++ b/internal/service/dms/endpoint_data_source.go @@ -61,7 +61,7 @@ func DataSourceEndpoint() *schema.Resource { Type: schema.TypeString, Required: true, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Computed: true, }, @@ -587,7 +587,7 @@ func dataSourceEndpointRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("endpoint_id", out.EndpointIdentifier) arn := aws.StringValue(out.EndpointArn) d.Set("endpoint_arn", arn) - d.Set("endpoint_type", out.EndpointType) + d.Set(names.AttrEndpointType, out.EndpointType) d.Set(names.AttrDatabaseName, out.DatabaseName) d.Set("engine_name", out.EngineName) d.Set(names.AttrPort, out.Port) diff --git a/internal/service/dms/endpoint_data_source_test.go b/internal/service/dms/endpoint_data_source_test.go index dcf9a664e7f..862279196f0 100644 --- a/internal/service/dms/endpoint_data_source_test.go +++ b/internal/service/dms/endpoint_data_source_test.go @@ -30,7 +30,7 @@ func TestAccDMSEndpointDataSource_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckEndpointExists(ctx, dataSourceName), resource.TestCheckResourceAttrPair(dataSourceName, "endpoint_id", resourceName, "endpoint_id"), - resource.TestCheckResourceAttrPair(dataSourceName, "endpoint_type", resourceName, "endpoint_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrEndpointType, resourceName, names.AttrEndpointType), resource.TestCheckResourceAttrPair(dataSourceName, "engine_name", resourceName, "engine_name"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrPort, resourceName, names.AttrPort), resource.TestCheckResourceAttrPair(dataSourceName, "server_name", resourceName, "server_name"), diff --git a/internal/service/dms/event_subscription.go b/internal/service/dms/event_subscription.go index 2f896fadfec..3e8491459a4 100644 --- a/internal/service/dms/event_subscription.go +++ b/internal/service/dms/event_subscription.go @@ -66,7 +66,7 @@ func ResourceEventSubscription() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -102,7 +102,7 @@ func resourceEventSubscriptionCreate(ctx context.Context, d *schema.ResourceData input := &dms.CreateEventSubscriptionInput{ Enabled: aws.Bool(d.Get(names.AttrEnabled).(bool)), EventCategories: flex.ExpandStringSet(d.Get("event_categories").(*schema.Set)), - SnsTopicArn: aws.String(d.Get("sns_topic_arn").(string)), + SnsTopicArn: aws.String(d.Get(names.AttrSNSTopicARN).(string)), SourceType: aws.String(d.Get("source_type").(string)), SubscriptionName: aws.String(name), Tags: getTagsIn(ctx), @@ -154,7 +154,7 @@ func resourceEventSubscriptionRead(ctx context.Context, d *schema.ResourceData, d.Set(names.AttrEnabled, subscription.Enabled) d.Set("event_categories", aws.StringValueSlice(subscription.EventCategoriesList)) d.Set(names.AttrName, d.Id()) - d.Set("sns_topic_arn", subscription.SnsTopicArn) + d.Set(names.AttrSNSTopicARN, subscription.SnsTopicArn) d.Set("source_ids", aws.StringValueSlice(subscription.SourceIdsList)) d.Set("source_type", subscription.SourceType) @@ -169,7 +169,7 @@ func resourceEventSubscriptionUpdate(ctx context.Context, d *schema.ResourceData input := &dms.ModifyEventSubscriptionInput{ Enabled: aws.Bool(d.Get(names.AttrEnabled).(bool)), EventCategories: flex.ExpandStringSet(d.Get("event_categories").(*schema.Set)), - SnsTopicArn: aws.String(d.Get("sns_topic_arn").(string)), + SnsTopicArn: aws.String(d.Get(names.AttrSNSTopicARN).(string)), SourceType: aws.String(d.Get("source_type").(string)), SubscriptionName: aws.String(d.Id()), } diff --git a/internal/service/dms/event_subscription_test.go b/internal/service/dms/event_subscription_test.go index af6ff2f9a61..407e51327c0 100644 --- a/internal/service/dms/event_subscription_test.go +++ b/internal/service/dms/event_subscription_test.go @@ -41,7 +41,7 @@ func TestAccDMSEventSubscription_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "event_categories.#", "2"), resource.TestCheckTypeSetElemAttr(resourceName, "event_categories.*", "creation"), resource.TestCheckTypeSetElemAttr(resourceName, "event_categories.*", "failure"), - resource.TestCheckResourceAttrPair(resourceName, "sns_topic_arn", snsTopicResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSNSTopicARN, snsTopicResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "source_ids.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_type", "replication-instance"), ), diff --git a/internal/service/dms/replication_task_test.go b/internal/service/dms/replication_task_test.go index be7fb24fea8..898eac67f5c 100644 --- a/internal/service/dms/replication_task_test.go +++ b/internal/service/dms/replication_task_test.go @@ -427,7 +427,7 @@ func TestAccDMSReplicationTask_resourceIdentifier(t *testing.T) { Config: testAccReplicationTaskConfig_resourceIdentifier(rName), Check: resource.ComposeTestCheckFunc( testAccCheckReplicationTaskExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "resource_identifier", "identifier"), + resource.TestCheckResourceAttr(resourceName, "resource_identifier", names.AttrIdentifier), ), }, { diff --git a/internal/service/dms/s3_endpoint.go b/internal/service/dms/s3_endpoint.go index 2ecc0b4c414..caa5c0f1e53 100644 --- a/internal/service/dms/s3_endpoint.go +++ b/internal/service/dms/s3_endpoint.go @@ -62,7 +62,7 @@ func ResourceS3Endpoint() *schema.Resource { ForceNew: true, ValidateFunc: validEndpointID, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(dms.ReplicationEndpointTypeValue_Values(), false), @@ -331,7 +331,7 @@ func resourceS3EndpointCreate(ctx context.Context, d *schema.ResourceData, meta input := &dms.CreateEndpointInput{ EndpointIdentifier: aws.String(d.Get("endpoint_id").(string)), - EndpointType: aws.String(d.Get("endpoint_type").(string)), + EndpointType: aws.String(d.Get(names.AttrEndpointType).(string)), EngineName: aws.String("s3"), Tags: getTagsIn(ctx), } @@ -352,7 +352,7 @@ func resourceS3EndpointCreate(ctx context.Context, d *schema.ResourceData, meta input.ServiceAccessRoleArn = aws.String(v.(string)) } - input.S3Settings = s3Settings(d, d.Get("endpoint_type").(string) == dms.ReplicationEndpointTypeValueTarget) + input.S3Settings = s3Settings(d, d.Get(names.AttrEndpointType).(string) == dms.ReplicationEndpointTypeValueTarget) input.ExtraConnectionAttributes = extraConnectionAnomalies(d) @@ -417,7 +417,7 @@ func resourceS3EndpointRead(ctx context.Context, d *schema.ResourceData, meta in d.Set(names.AttrCertificateARN, endpoint.CertificateArn) d.Set("endpoint_id", endpoint.EndpointIdentifier) - d.Set("endpoint_type", strings.ToLower(*endpoint.EndpointType)) // For some reason the AWS API only accepts lowercase type but returns it as uppercase + d.Set(names.AttrEndpointType, strings.ToLower(*endpoint.EndpointType)) // For some reason the AWS API only accepts lowercase type but returns it as uppercase d.Set("engine_display_name", endpoint.EngineDisplayName) d.Set("external_id", endpoint.ExternalId) // d.Set("external_table_definition", endpoint.ExternalTableDefinition) // set from s3 settings @@ -455,7 +455,7 @@ func resourceS3EndpointRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("timestamp_column_name", s3settings.TimestampColumnName) d.Set("use_task_start_time_for_full_load_timestamp", s3settings.UseTaskStartTimeForFullLoadTimestamp) - if d.Get("endpoint_type").(string) == dms.ReplicationEndpointTypeValueTarget { + if d.Get(names.AttrEndpointType).(string) == dms.ReplicationEndpointTypeValueTarget { d.Set("add_trailing_padding_character", s3settings.AddTrailingPaddingCharacter) d.Set("compression_type", s3settings.CompressionType) d.Set("csv_no_sup_value", s3settings.CsvNoSupValue) @@ -496,8 +496,8 @@ func resourceS3EndpointUpdate(ctx context.Context, d *schema.ResourceData, meta input.CertificateArn = aws.String(d.Get(names.AttrCertificateARN).(string)) } - if d.HasChange("endpoint_type") { - input.EndpointType = aws.String(d.Get("endpoint_type").(string)) + if d.HasChange(names.AttrEndpointType) { + input.EndpointType = aws.String(d.Get(names.AttrEndpointType).(string)) } input.EngineName = aws.String(engineNameS3) @@ -508,10 +508,10 @@ func resourceS3EndpointUpdate(ctx context.Context, d *schema.ResourceData, meta if d.HasChangesExcept( names.AttrCertificateARN, - "endpoint_type", + names.AttrEndpointType, "ssl_mode", ) { - input.S3Settings = s3Settings(d, d.Get("endpoint_type").(string) == dms.ReplicationEndpointTypeValueTarget) + input.S3Settings = s3Settings(d, d.Get(names.AttrEndpointType).(string) == dms.ReplicationEndpointTypeValueTarget) input.ServiceAccessRoleArn = aws.String(d.Get("service_access_role_arn").(string)) input.ExtraConnectionAttributes = extraConnectionAnomalies(d) diff --git a/internal/service/dms/s3_endpoint_test.go b/internal/service/dms/s3_endpoint_test.go index e26f2fd30f5..dce6f83d916 100644 --- a/internal/service/dms/s3_endpoint_test.go +++ b/internal/service/dms/s3_endpoint_test.go @@ -284,7 +284,7 @@ func TestAccDMSS3Endpoint_sourceSimple(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "enable_statistics", "true"), resource.TestCheckResourceAttr(resourceName, "encoding_type", ""), resource.TestCheckResourceAttr(resourceName, "endpoint_id", rName), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", names.AttrSource), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, names.AttrSource), resource.TestCheckResourceAttr(resourceName, "expected_bucket_owner", ""), 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", "0"), @@ -333,7 +333,7 @@ func TestAccDMSS3Endpoint_source(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "csv_delimiter", ";"), resource.TestCheckResourceAttr(resourceName, "csv_row_delimiter", "\\r\\n"), resource.TestCheckResourceAttr(resourceName, "endpoint_id", rName), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", names.AttrSource), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, names.AttrSource), resource.TestCheckResourceAttr(resourceName, "ignore_header_rows", "1"), resource.TestCheckResourceAttr(resourceName, "rfc_4180", "false"), resource.TestCheckResourceAttrPair(resourceName, "service_access_role_arn", "aws_iam_role.test", names.AttrARN), @@ -369,7 +369,7 @@ func TestAccDMSS3Endpoint_source(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "csv_delimiter", ","), resource.TestCheckResourceAttr(resourceName, "csv_row_delimiter", "\\n"), resource.TestCheckResourceAttr(resourceName, "endpoint_id", rName), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", names.AttrSource), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, names.AttrSource), resource.TestCheckResourceAttr(resourceName, "ignore_header_rows", "1"), resource.TestCheckResourceAttr(resourceName, "rfc_4180", "true"), resource.TestCheckResourceAttrPair(resourceName, "service_access_role_arn", "aws_iam_role.test", names.AttrARN), From 2098f27af3dcb08730942a9dcdc9986ff826b289 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:26 -0400 Subject: [PATCH 1438/1490] docdb: Use constants for strings --- internal/service/docdb/cluster_instance.go | 6 +++--- internal/service/docdb/cluster_instance_test.go | 6 +++--- internal/service/docdb/event_subscription.go | 10 +++++----- internal/service/docdb/event_subscription_test.go | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/docdb/cluster_instance.go b/internal/service/docdb/cluster_instance.go index e3a332ed80a..dfde5114006 100644 --- a/internal/service/docdb/cluster_instance.go +++ b/internal/service/docdb/cluster_instance.go @@ -106,7 +106,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Optional: true, Computed: true, @@ -186,7 +186,7 @@ func resourceClusterInstanceCreate(ctx context.Context, d *schema.ResourceData, conn := meta.(*conns.AWSClient).DocDBConn(ctx) identifier := create.NewNameGenerator( - create.WithConfiguredName(d.Get("identifier").(string)), + create.WithConfiguredName(d.Get(names.AttrIdentifier).(string)), create.WithConfiguredPrefix(d.Get("identifier_prefix").(string)), create.WithDefaultPrefix("tf-"), ).Generate() @@ -279,7 +279,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me } d.Set("engine", db.Engine) d.Set(names.AttrEngineVersion, db.EngineVersion) - d.Set("identifier", db.DBInstanceIdentifier) + d.Set(names.AttrIdentifier, db.DBInstanceIdentifier) d.Set("identifier_prefix", create.NamePrefixFromName(aws.StringValue(db.DBInstanceIdentifier))) d.Set("instance_class", db.DBInstanceClass) d.Set(names.AttrKMSKeyID, db.KmsKeyId) diff --git a/internal/service/docdb/cluster_instance_test.go b/internal/service/docdb/cluster_instance_test.go index e726f70aaff..1a7ea12a710 100644 --- a/internal/service/docdb/cluster_instance_test.go +++ b/internal/service/docdb/cluster_instance_test.go @@ -49,7 +49,7 @@ func TestAccDocDBClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrEndpoint), resource.TestCheckResourceAttr(resourceName, "engine", "docdb"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), resource.TestCheckResourceAttrSet(resourceName, "instance_class"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyID, ""), @@ -125,7 +125,7 @@ func TestAccDocDBClusterInstance_identifierGenerated(t *testing.T) { Config: testAccClusterInstanceConfig_identifierGenerated(rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameGeneratedWithPrefix(resourceName, "identifier", "tf-"), + acctest.CheckResourceAttrNameGeneratedWithPrefix(resourceName, names.AttrIdentifier, "tf-"), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", "tf-"), ), }, @@ -157,7 +157,7 @@ func TestAccDocDBClusterInstance_identifierPrefix(t *testing.T) { Config: testAccClusterInstanceConfig_identifierPrefix(rName, "tf-acc-test-prefix-"), Check: resource.ComposeTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameFromPrefix(resourceName, "identifier", "tf-acc-test-prefix-"), + acctest.CheckResourceAttrNameFromPrefix(resourceName, names.AttrIdentifier, "tf-acc-test-prefix-"), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", "tf-acc-test-prefix-"), ), }, diff --git a/internal/service/docdb/event_subscription.go b/internal/service/docdb/event_subscription.go index 4bb1e9417b4..e448149e40e 100644 --- a/internal/service/docdb/event_subscription.go +++ b/internal/service/docdb/event_subscription.go @@ -78,7 +78,7 @@ func ResourceEventSubscription() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validEventSubscriptionNamePrefix, }, - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -108,7 +108,7 @@ func resourceEventSubscriptionCreate(ctx context.Context, d *schema.ResourceData name := create.Name(d.Get(names.AttrName).(string), d.Get(names.AttrNamePrefix).(string)) input := &docdb.CreateEventSubscriptionInput{ Enabled: aws.Bool(d.Get(names.AttrEnabled).(bool)), - SnsTopicArn: aws.String(d.Get("sns_topic_arn").(string)), + SnsTopicArn: aws.String(d.Get(names.AttrSNSTopicARN).(string)), SubscriptionName: aws.String(name), Tags: getTagsIn(ctx), } @@ -163,7 +163,7 @@ func resourceEventSubscriptionRead(ctx context.Context, d *schema.ResourceData, d.Set("event_categories", aws.StringValueSlice(output.EventCategoriesList)) d.Set(names.AttrName, output.CustSubscriptionId) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.StringValue(output.CustSubscriptionId))) - d.Set("sns_topic_arn", output.SnsTopicArn) + d.Set(names.AttrSNSTopicARN, output.SnsTopicArn) d.Set("source_ids", aws.StringValueSlice(output.SourceIdsList)) d.Set("source_type", output.SourceType) @@ -189,8 +189,8 @@ func resourceEventSubscriptionUpdate(ctx context.Context, d *schema.ResourceData input.SourceType = aws.String(d.Get("source_type").(string)) } - if d.HasChange("sns_topic_arn") { - input.SnsTopicArn = aws.String(d.Get("sns_topic_arn").(string)) + if d.HasChange(names.AttrSNSTopicARN) { + input.SnsTopicArn = aws.String(d.Get(names.AttrSNSTopicARN).(string)) } if d.HasChange("source_type") { diff --git a/internal/service/docdb/event_subscription_test.go b/internal/service/docdb/event_subscription_test.go index 67b0bec1111..1fd2ea728c1 100644 --- a/internal/service/docdb/event_subscription_test.go +++ b/internal/service/docdb/event_subscription_test.go @@ -45,7 +45,7 @@ func TestAccDocDBEventSubscription_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrNamePrefix, ""), resource.TestCheckResourceAttr(resourceName, "source_ids.#", "1"), resource.TestCheckResourceAttr(resourceName, "source_type", "db-cluster"), - resource.TestCheckResourceAttrPair(resourceName, "sns_topic_arn", snsTopicResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSNSTopicARN, snsTopicResourceName, names.AttrARN), ), }, { From 9c2bc2341492499eab87def4d88dae80cb2676cf Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:26 -0400 Subject: [PATCH 1439/1490] ds: Use constants for strings --- internal/service/ds/log_subscription.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/service/ds/log_subscription.go b/internal/service/ds/log_subscription.go index 169714e5356..d2ef189b6bf 100644 --- a/internal/service/ds/log_subscription.go +++ b/internal/service/ds/log_subscription.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_directory_service_log_subscription") @@ -31,7 +32,7 @@ func ResourceLogSubscription() *schema.Resource { Required: true, ForceNew: true, }, - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -45,7 +46,7 @@ func resourceLogSubscriptionCreate(ctx context.Context, d *schema.ResourceData, conn := meta.(*conns.AWSClient).DSConn(ctx) directoryId := d.Get("directory_id") - logGroupName := d.Get("log_group_name") + logGroupName := d.Get(names.AttrLogGroupName) input := directoryservice.CreateLogSubscriptionInput{ DirectoryId: aws.String(directoryId.(string)), @@ -85,7 +86,7 @@ func resourceLogSubscriptionRead(ctx context.Context, d *schema.ResourceData, me logSubscription := out.LogSubscriptions[0] d.Set("directory_id", logSubscription.DirectoryId) - d.Set("log_group_name", logSubscription.LogGroupName) + d.Set(names.AttrLogGroupName, logSubscription.LogGroupName) return diags } From 32ba93f98d18515a62f151a89538a57b14087975 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:27 -0400 Subject: [PATCH 1440/1490] dynamodb: Use constants for strings --- .../service/dynamodb/contributor_insights.go | 7 ++--- .../dynamodb/contributor_insights_test.go | 2 +- .../dynamodb/kinesis_streaming_destination.go | 7 ++--- .../kinesis_streaming_destination_test.go | 6 ++--- internal/service/dynamodb/table_item.go | 11 ++++---- .../dynamodb/table_item_data_source.go | 6 ++--- .../dynamodb/table_item_data_source_test.go | 6 ++--- internal/service/dynamodb/table_item_test.go | 26 +++++++++---------- 8 files changed, 37 insertions(+), 34 deletions(-) diff --git a/internal/service/dynamodb/contributor_insights.go b/internal/service/dynamodb/contributor_insights.go index 2d236c383b6..faadfb3b9ce 100644 --- a/internal/service/dynamodb/contributor_insights.go +++ b/internal/service/dynamodb/contributor_insights.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_dynamodb_contributor_insights", name="Contributor Insights") @@ -45,7 +46,7 @@ func resourceContributorInsights() *schema.Resource { Optional: true, ForceNew: true, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -58,7 +59,7 @@ func resourceContributorInsightsCreate(ctx context.Context, d *schema.ResourceDa var diags diag.Diagnostics conn := meta.(*conns.AWSClient).DynamoDBClient(ctx) - tableName := d.Get("table_name").(string) + tableName := d.Get(names.AttrTableName).(string) input := &dynamodb.UpdateContributorInsightsInput{ ContributorInsightsAction: awstypes.ContributorInsightsActionEnable, TableName: aws.String(tableName), @@ -107,7 +108,7 @@ func resourceContributorInsightsRead(ctx context.Context, d *schema.ResourceData } d.Set("index_name", output.IndexName) - d.Set("table_name", output.TableName) + d.Set(names.AttrTableName, output.TableName) return diags } diff --git a/internal/service/dynamodb/contributor_insights_test.go b/internal/service/dynamodb/contributor_insights_test.go index fac0859d55b..d586fd022cd 100644 --- a/internal/service/dynamodb/contributor_insights_test.go +++ b/internal/service/dynamodb/contributor_insights_test.go @@ -36,7 +36,7 @@ func TestAccDynamoDBContributorInsights_basic(t *testing.T) { Config: testAccContributorInsightsConfig_basic(rName, ""), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckContributorInsightsExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "table_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrTableName, rName), ), }, { diff --git a/internal/service/dynamodb/kinesis_streaming_destination.go b/internal/service/dynamodb/kinesis_streaming_destination.go index f0f546484d2..922fc7eb138 100644 --- a/internal/service/dynamodb/kinesis_streaming_destination.go +++ b/internal/service/dynamodb/kinesis_streaming_destination.go @@ -23,6 +23,7 @@ import ( tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) const ( @@ -47,7 +48,7 @@ func resourceKinesisStreamingDestination() *schema.Resource { ForceNew: true, ValidateFunc: verify.ValidARN, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -61,7 +62,7 @@ func resourceKinesisStreamingDestinationCreate(ctx context.Context, d *schema.Re conn := meta.(*conns.AWSClient).DynamoDBClient(ctx) streamARN := d.Get("stream_arn").(string) - tableName := d.Get("table_name").(string) + tableName := d.Get(names.AttrTableName).(string) id := errs.Must(flex.FlattenResourceId([]string{tableName, streamARN}, kinesisStreamingDestinationResourceIDPartCount, false)) input := &dynamodb.EnableKinesisStreamingDestinationInput{ StreamArn: aws.String(streamARN), @@ -106,7 +107,7 @@ func resourceKinesisStreamingDestinationRead(ctx context.Context, d *schema.Reso } d.Set("stream_arn", output.StreamArn) - d.Set("table_name", tableName) + d.Set(names.AttrTableName, tableName) return diags } diff --git a/internal/service/dynamodb/kinesis_streaming_destination_test.go b/internal/service/dynamodb/kinesis_streaming_destination_test.go index 8b02e11656f..de56806b7ad 100644 --- a/internal/service/dynamodb/kinesis_streaming_destination_test.go +++ b/internal/service/dynamodb/kinesis_streaming_destination_test.go @@ -35,7 +35,7 @@ func TestAccDynamoDBKinesisStreamingDestination_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckKinesisStreamingDestinationExists(ctx, resourceName), acctest.MatchResourceAttrRegionalARN(resourceName, "stream_arn", "kinesis", regexache.MustCompile(fmt.Sprintf("stream/%s", rName))), - resource.TestCheckResourceAttr(resourceName, "table_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrTableName, rName), ), }, { @@ -130,7 +130,7 @@ func testAccCheckKinesisStreamingDestinationExists(ctx context.Context, n string conn := acctest.Provider.Meta().(*conns.AWSClient).DynamoDBClient(ctx) - _, err := tfdynamodb.FindKinesisDataStreamDestinationByTwoPartKey(ctx, conn, rs.Primary.Attributes["stream_arn"], rs.Primary.Attributes["table_name"]) + _, err := tfdynamodb.FindKinesisDataStreamDestinationByTwoPartKey(ctx, conn, rs.Primary.Attributes["stream_arn"], rs.Primary.Attributes[names.AttrTableName]) return err } @@ -145,7 +145,7 @@ func testAccCheckKinesisStreamingDestinationDestroy(ctx context.Context) resourc continue } - _, err := tfdynamodb.FindKinesisDataStreamDestinationByTwoPartKey(ctx, conn, rs.Primary.Attributes["stream_arn"], rs.Primary.Attributes["table_name"]) + _, err := tfdynamodb.FindKinesisDataStreamDestinationByTwoPartKey(ctx, conn, rs.Primary.Attributes["stream_arn"], rs.Primary.Attributes[names.AttrTableName]) if tfresource.NotFound(err) { continue diff --git a/internal/service/dynamodb/table_item.go b/internal/service/dynamodb/table_item.go index 95028bc6cf9..fe09f9ced1a 100644 --- a/internal/service/dynamodb/table_item.go +++ b/internal/service/dynamodb/table_item.go @@ -22,6 +22,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/tfresource" itypes "github.com/hashicorp/terraform-provider-aws/internal/types" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_dynamodb_table_item", name="Table Item") @@ -50,7 +51,7 @@ func resourceTableItem() *schema.Resource { ForceNew: true, Optional: true, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -76,7 +77,7 @@ func resourceTableItemCreate(ctx context.Context, d *schema.ResourceData, meta i return sdkdiag.AppendFromErr(diags, err) } - tableName := d.Get("table_name").(string) + tableName := d.Get(names.AttrTableName).(string) hashKey := d.Get("hash_key").(string) input := &dynamodb.PutItemInput{ // Explode if item exists. We didn't create it. @@ -101,7 +102,7 @@ func resourceTableItemRead(ctx context.Context, d *schema.ResourceData, meta int var diags diag.Diagnostics conn := meta.(*conns.AWSClient).DynamoDBClient(ctx) - tableName := d.Get("table_name").(string) + tableName := d.Get(names.AttrTableName).(string) hashKey := d.Get("hash_key").(string) rangeKey := d.Get("range_key").(string) attributes, err := expandTableItemAttributes(d.Get("item").(string)) @@ -139,7 +140,7 @@ func resourceTableItemUpdate(ctx context.Context, d *schema.ResourceData, meta i conn := meta.(*conns.AWSClient).DynamoDBClient(ctx) if d.HasChange("item") { - tableName := d.Get("table_name").(string) + tableName := d.Get(names.AttrTableName).(string) hashKey := d.Get("hash_key").(string) rangeKey := d.Get("range_key").(string) @@ -228,7 +229,7 @@ func resourceTableItemDelete(ctx context.Context, d *schema.ResourceData, meta i _, err = conn.DeleteItem(ctx, &dynamodb.DeleteItemInput{ Key: queryKey, - TableName: aws.String(d.Get("table_name").(string)), + TableName: aws.String(d.Get(names.AttrTableName).(string)), }) if err != nil { diff --git a/internal/service/dynamodb/table_item_data_source.go b/internal/service/dynamodb/table_item_data_source.go index 0c48052ecd6..d5c1330891e 100644 --- a/internal/service/dynamodb/table_item_data_source.go +++ b/internal/service/dynamodb/table_item_data_source.go @@ -43,7 +43,7 @@ func dataSourceTableItem() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -55,7 +55,7 @@ func dataSourceTableItemRead(ctx context.Context, d *schema.ResourceData, meta i var diags diag.Diagnostics conn := meta.(*conns.AWSClient).DynamoDBClient(ctx) - tableName := d.Get("table_name").(string) + tableName := d.Get(names.AttrTableName).(string) key, err := expandTableItemAttributes(d.Get(names.AttrKey).(string)) if err != nil { return sdkdiag.AppendFromErr(diags, err) @@ -85,7 +85,7 @@ func dataSourceTableItemRead(ctx context.Context, d *schema.ResourceData, meta i d.SetId(id) d.Set("expression_attribute_names", input.ExpressionAttributeNames) d.Set("projection_expression", input.ProjectionExpression) - d.Set("table_name", tableName) + d.Set(names.AttrTableName, tableName) itemAttrs, err := flattenTableItemAttributes(item) diff --git a/internal/service/dynamodb/table_item_data_source_test.go b/internal/service/dynamodb/table_item_data_source_test.go index f30c52db910..6d3dda3a326 100644 --- a/internal/service/dynamodb/table_item_data_source_test.go +++ b/internal/service/dynamodb/table_item_data_source_test.go @@ -41,7 +41,7 @@ func TestAccDynamoDBTableItemDataSource_basic(t *testing.T) { Config: testAccTableItemDataSourceConfig_basic(rName, hashKey, itemContent, key), Check: resource.ComposeTestCheckFunc( acctest.CheckResourceAttrEquivalentJSON(dataSourceName, "item", itemContent), - resource.TestCheckResourceAttr(dataSourceName, "table_name", rName), + resource.TestCheckResourceAttr(dataSourceName, names.AttrTableName, rName), ), }, }, @@ -82,7 +82,7 @@ func TestAccDynamoDBTableItemDataSource_projectionExpression(t *testing.T) { Config: testAccTableItemDataSourceConfig_projectionExpression(rName, hashKey, itemContent, projectionExpression, key), Check: resource.ComposeTestCheckFunc( acctest.CheckResourceAttrEquivalentJSON(dataSourceName, "item", expected), - resource.TestCheckResourceAttr(dataSourceName, "table_name", rName), + resource.TestCheckResourceAttr(dataSourceName, names.AttrTableName, rName), resource.TestCheckResourceAttr(dataSourceName, "projection_expression", projectionExpression), ), }, @@ -120,7 +120,7 @@ func TestAccDynamoDBTableItemDataSource_expressionAttributeNames(t *testing.T) { Config: testAccTableItemDataSourceConfig_expressionAttributeNames(rName, hashKey, itemContent, key), Check: resource.ComposeTestCheckFunc( acctest.CheckResourceAttrEquivalentJSON(dataSourceName, "item", expected), - resource.TestCheckResourceAttr(dataSourceName, "table_name", rName), + resource.TestCheckResourceAttr(dataSourceName, names.AttrTableName, rName), resource.TestCheckResourceAttr(dataSourceName, "projection_expression", "#P"), ), }, diff --git a/internal/service/dynamodb/table_item_test.go b/internal/service/dynamodb/table_item_test.go index fce0b673d21..0babd12cb1e 100644 --- a/internal/service/dynamodb/table_item_test.go +++ b/internal/service/dynamodb/table_item_test.go @@ -48,7 +48,7 @@ func TestAccDynamoDBTableItem_basic(t *testing.T) { testAccCheckTableItemExists(ctx, "aws_dynamodb_table_item.test", &conf), testAccCheckTableItemCount(ctx, tableName, 1), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "hash_key", hashKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "table_name", tableName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", names.AttrTableName, tableName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test", "item", itemContent), ), }, @@ -85,7 +85,7 @@ func TestAccDynamoDBTableItem_rangeKey(t *testing.T) { testAccCheckTableItemCount(ctx, tableName, 1), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "hash_key", hashKey), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "range_key", rangeKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "table_name", tableName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", names.AttrTableName, tableName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test", "item", itemContent), ), }, @@ -132,12 +132,12 @@ func TestAccDynamoDBTableItem_withMultipleItems(t *testing.T) { resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", "hash_key", hashKey), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", "range_key", rangeKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", "table_name", tableName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", names.AttrTableName, tableName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test1", "item", firstItem), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test2", "hash_key", hashKey), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test2", "range_key", rangeKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test2", "table_name", tableName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test2", names.AttrTableName, tableName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test2", "item", secondItem), ), }, @@ -210,12 +210,12 @@ func TestAccDynamoDBTableItem_withDuplicateItemsDifferentRangeKey(t *testing.T) resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", "hash_key", hashKey), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", "range_key", rangeKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", "table_name", tableName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", names.AttrTableName, tableName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test1", "item", firstItem), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test2", "hash_key", hashKey), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test2", "range_key", rangeKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test2", "table_name", tableName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test2", names.AttrTableName, tableName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test2", "item", secondItem), ), }, @@ -253,7 +253,7 @@ func TestAccDynamoDBTableItem_wonkyItems(t *testing.T) { resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", "hash_key", hashKey), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", "range_key", rangeKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", "table_name", rName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test1", names.AttrTableName, rName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test1", "item", item), ), }, @@ -294,7 +294,7 @@ func TestAccDynamoDBTableItem_update(t *testing.T) { testAccCheckTableItemExists(ctx, "aws_dynamodb_table_item.test", &conf), testAccCheckTableItemCount(ctx, tableName, 1), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "hash_key", hashKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "table_name", tableName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", names.AttrTableName, tableName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test", "item", itemBefore), ), }, @@ -304,7 +304,7 @@ func TestAccDynamoDBTableItem_update(t *testing.T) { testAccCheckTableItemExists(ctx, "aws_dynamodb_table_item.test", &conf), testAccCheckTableItemCount(ctx, tableName, 1), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "hash_key", hashKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "table_name", tableName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", names.AttrTableName, tableName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test", "item", itemAfter), ), }, @@ -344,7 +344,7 @@ func TestAccDynamoDBTableItem_updateWithRangeKey(t *testing.T) { testAccCheckTableItemCount(ctx, tableName, 1), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "hash_key", hashKey), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "range_key", rangeKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "table_name", tableName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", names.AttrTableName, tableName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test", "item", itemBefore), ), }, @@ -355,7 +355,7 @@ func TestAccDynamoDBTableItem_updateWithRangeKey(t *testing.T) { testAccCheckTableItemCount(ctx, tableName, 1), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "hash_key", hashKey), resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "range_key", rangeKey), - resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", "table_name", tableName), + resource.TestCheckResourceAttr("aws_dynamodb_table_item.test", names.AttrTableName, tableName), acctest.CheckResourceAttrEquivalentJSON("aws_dynamodb_table_item.test", "item", itemAfter), ), }, @@ -492,7 +492,7 @@ func testAccCheckTableItemDestroy(ctx context.Context) resource.TestCheckFunc { key := tfdynamodb.ExpandTableItemQueryKey(attributes, rs.Primary.Attributes["hash_key"], rs.Primary.Attributes["range_key"]) - _, err = tfdynamodb.FindTableItemByTwoPartKey(ctx, conn, rs.Primary.Attributes["table_name"], key) + _, err = tfdynamodb.FindTableItemByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrTableName], key) if tfresource.NotFound(err) { continue @@ -525,7 +525,7 @@ func testAccCheckTableItemExists(ctx context.Context, n string, v *map[string]aw key := tfdynamodb.ExpandTableItemQueryKey(attributes, rs.Primary.Attributes["hash_key"], rs.Primary.Attributes["range_key"]) - output, err := tfdynamodb.FindTableItemByTwoPartKey(ctx, conn, rs.Primary.Attributes["table_name"], key) + output, err := tfdynamodb.FindTableItemByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrTableName], key) if err != nil { return err From 83bd2bdffd578dadc3b9a4378db71ba8f54cc8a5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:27 -0400 Subject: [PATCH 1441/1490] ec2: Use constants for strings --- .../service/ec2/verifiedaccess_endpoint.go | 6 ++--- .../ec2/verifiedaccess_endpoint_test.go | 4 ++-- internal/service/ec2/vpc_endpoint.go | 10 ++++---- .../service/ec2/vpc_endpoint_data_source.go | 6 ++--- .../ec2/vpc_endpoint_data_source_test.go | 12 +++++----- internal/service/ec2/vpc_endpoint_service.go | 4 ++-- .../ec2/vpc_endpoint_service_data_source.go | 10 ++++---- .../vpc_endpoint_service_data_source_test.go | 8 +++---- .../service/ec2/vpc_endpoint_service_test.go | 2 +- internal/service/ec2/vpc_flow_log.go | 8 +++---- internal/service/ec2/vpc_flow_log_test.go | 24 +++++++++---------- 11 files changed, 47 insertions(+), 47 deletions(-) diff --git a/internal/service/ec2/verifiedaccess_endpoint.go b/internal/service/ec2/verifiedaccess_endpoint.go index 558df9b14c5..cbee15885b6 100644 --- a/internal/service/ec2/verifiedaccess_endpoint.go +++ b/internal/service/ec2/verifiedaccess_endpoint.go @@ -79,7 +79,7 @@ func ResourceVerifiedAccessEndpoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -195,7 +195,7 @@ func resourceVerifiedAccessEndpointCreate(ctx context.Context, d *schema.Resourc ClientToken: aws.String(id.UniqueId()), DomainCertificateArn: aws.String(d.Get("domain_certificate_arn").(string)), EndpointDomainPrefix: aws.String(d.Get("endpoint_domain_prefix").(string)), - EndpointType: types.VerifiedAccessEndpointType(d.Get("endpoint_type").(string)), + EndpointType: types.VerifiedAccessEndpointType(d.Get(names.AttrEndpointType).(string)), TagSpecifications: getTagSpecificationsInV2(ctx, types.ResourceTypeVerifiedAccessEndpoint), VerifiedAccessGroupId: aws.String(d.Get("verified_access_group_id").(string)), } @@ -262,7 +262,7 @@ func resourceVerifiedAccessEndpointRead(ctx context.Context, d *schema.ResourceD d.Set("device_validation_domain", ep.DeviceValidationDomain) d.Set("domain_certificate_arn", ep.DomainCertificateArn) d.Set("endpoint_domain", ep.EndpointDomain) - d.Set("endpoint_type", ep.EndpointType) + d.Set(names.AttrEndpointType, ep.EndpointType) if err := d.Set("load_balancer_options", flattenVerifiedAccessEndpointLoadBalancerOptions(ep.LoadBalancerOptions)); err != nil { return sdkdiag.AppendErrorf(diags, "setting load_balancer_options: %s", err) } diff --git a/internal/service/ec2/verifiedaccess_endpoint_test.go b/internal/service/ec2/verifiedaccess_endpoint_test.go index 49ee498687d..6197b7940cc 100644 --- a/internal/service/ec2/verifiedaccess_endpoint_test.go +++ b/internal/service/ec2/verifiedaccess_endpoint_test.go @@ -47,7 +47,7 @@ func testAccVerifiedAccessEndpoint_basic(t *testing.T, semaphore tfsync.Semaphor resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "example"), resource.TestCheckResourceAttrSet(resourceName, "domain_certificate_arn"), resource.TestCheckResourceAttr(resourceName, "endpoint_domain_prefix", "example"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "load-balancer"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "load-balancer"), resource.TestCheckResourceAttr(resourceName, "policy_document", ""), resource.TestCheckResourceAttr(resourceName, "sse_specification.0.customer_managed_key_enabled", "false"), resource.TestCheckResourceAttrSet(resourceName, "load_balancer_options.0.load_balancer_arn"), @@ -97,7 +97,7 @@ func testAccVerifiedAccessEndpoint_networkInterface(t *testing.T, semaphore tfsy resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "example"), resource.TestCheckResourceAttrSet(resourceName, "domain_certificate_arn"), resource.TestCheckResourceAttr(resourceName, "endpoint_domain_prefix", "example"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "network-interface"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "network-interface"), resource.TestCheckResourceAttrSet(resourceName, "network_interface_options.0.network_interface_id"), resource.TestCheckResourceAttr(resourceName, "network_interface_options.0.port", "443"), resource.TestCheckResourceAttr(resourceName, "network_interface_options.0.protocol", "https"), diff --git a/internal/service/ec2/vpc_endpoint.go b/internal/service/ec2/vpc_endpoint.go index e6709086d26..9cc76fe5ca2 100644 --- a/internal/service/ec2/vpc_endpoint.go +++ b/internal/service/ec2/vpc_endpoint.go @@ -151,7 +151,7 @@ func ResourceVPCEndpoint() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -196,7 +196,7 @@ func resourceVPCEndpointCreate(ctx context.Context, d *schema.ResourceData, meta var diags diag.Diagnostics conn := meta.(*conns.AWSClient).EC2Conn(ctx) - serviceName := d.Get("service_name").(string) + serviceName := d.Get(names.AttrServiceName).(string) input := &ec2.CreateVpcEndpointInput{ ClientToken: aws.String(id.UniqueId()), PrivateDnsEnabled: aws.Bool(d.Get("private_dns_enabled").(bool)), @@ -326,7 +326,7 @@ func resourceVPCEndpointRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("requester_managed", vpce.RequesterManaged) d.Set("route_table_ids", aws.StringValueSlice(vpce.RouteTableIds)) d.Set(names.AttrSecurityGroupIDs, flattenSecurityGroupIdentifiers(vpce.Groups)) - d.Set("service_name", serviceName) + d.Set(names.AttrServiceName, serviceName) d.Set(names.AttrState, vpce.State) d.Set(names.AttrSubnetIDs, aws.StringValueSlice(vpce.SubnetIds)) // VPC endpoints don't have types in GovCloud, so set type to default if empty @@ -372,7 +372,7 @@ func resourceVPCEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).EC2Conn(ctx) if d.HasChange("auto_accept") && d.Get("auto_accept").(bool) && d.Get(names.AttrState).(string) == vpcEndpointStatePendingAcceptance { - if err := vpcEndpointAccept(ctx, conn, d.Id(), d.Get("service_name").(string), d.Timeout(schema.TimeoutUpdate)); err != nil { + if err := vpcEndpointAccept(ctx, conn, d.Id(), d.Get(names.AttrServiceName).(string), d.Timeout(schema.TimeoutUpdate)); err != nil { return sdkdiag.AppendFromErr(diags, err) } } @@ -388,7 +388,7 @@ func resourceVPCEndpointUpdate(ctx context.Context, d *schema.ResourceData, meta tfMap := v.([]interface{})[0].(map[string]interface{}) // PrivateDnsOnlyForInboundResolverEndpoint is only supported for services // that support both gateway and interface endpoints, i.e. S3. - if isAmazonS3VPCEndpoint(d.Get("service_name").(string)) { + if isAmazonS3VPCEndpoint(d.Get(names.AttrServiceName).(string)) { input.DnsOptions = expandDNSOptionsSpecificationWithPrivateDNSOnly(tfMap) } else { input.DnsOptions = expandDNSOptionsSpecification(tfMap) diff --git a/internal/service/ec2/vpc_endpoint_data_source.go b/internal/service/ec2/vpc_endpoint_data_source.go index 841381a8747..0c44bbab2a9 100644 --- a/internal/service/ec2/vpc_endpoint_data_source.go +++ b/internal/service/ec2/vpc_endpoint_data_source.go @@ -117,7 +117,7 @@ func DataSourceVPCEndpoint() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -156,7 +156,7 @@ func dataSourceVPCEndpointRead(ctx context.Context, d *schema.ResourceData, meta map[string]string{ "vpc-endpoint-state": d.Get(names.AttrState).(string), "vpc-id": d.Get(names.AttrVPCID).(string), - "service-name": d.Get("service_name").(string), + "service-name": d.Get(names.AttrServiceName).(string), }, ), } @@ -211,7 +211,7 @@ func dataSourceVPCEndpointRead(ctx context.Context, d *schema.ResourceData, meta d.Set("requester_managed", vpce.RequesterManaged) d.Set("route_table_ids", aws.StringValueSlice(vpce.RouteTableIds)) d.Set(names.AttrSecurityGroupIDs, flattenSecurityGroupIdentifiers(vpce.Groups)) - d.Set("service_name", serviceName) + d.Set(names.AttrServiceName, serviceName) d.Set(names.AttrState, vpce.State) d.Set(names.AttrSubnetIDs, aws.StringValueSlice(vpce.SubnetIds)) // VPC endpoints don't have types in GovCloud, so set type to default if empty diff --git a/internal/service/ec2/vpc_endpoint_data_source_test.go b/internal/service/ec2/vpc_endpoint_data_source_test.go index f4a01bb98f2..8267c30b222 100644 --- a/internal/service/ec2/vpc_endpoint_data_source_test.go +++ b/internal/service/ec2/vpc_endpoint_data_source_test.go @@ -41,7 +41,7 @@ func TestAccVPCEndpointDataSource_gatewayBasic(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "requester_managed", resourceName, "requester_managed"), resource.TestCheckResourceAttrPair(datasourceName, "route_table_ids.#", resourceName, "route_table_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "security_group_ids.#", resourceName, "security_group_ids.#"), - resource.TestCheckResourceAttrPair(datasourceName, "service_name", resourceName, "service_name"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrServiceName, resourceName, names.AttrServiceName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrState, resourceName, names.AttrState), resource.TestCheckResourceAttrPair(datasourceName, "subnet_ids.#", resourceName, "subnet_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), @@ -81,7 +81,7 @@ func TestAccVPCEndpointDataSource_byID(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "requester_managed", resourceName, "requester_managed"), resource.TestCheckResourceAttrPair(datasourceName, "route_table_ids.#", resourceName, "route_table_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "security_group_ids.#", resourceName, "security_group_ids.#"), - resource.TestCheckResourceAttrPair(datasourceName, "service_name", resourceName, "service_name"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrServiceName, resourceName, names.AttrServiceName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrState, resourceName, names.AttrState), resource.TestCheckResourceAttrPair(datasourceName, "subnet_ids.#", resourceName, "subnet_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), @@ -121,7 +121,7 @@ func TestAccVPCEndpointDataSource_byFilter(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "requester_managed", resourceName, "requester_managed"), resource.TestCheckResourceAttrPair(datasourceName, "route_table_ids.#", resourceName, "route_table_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "security_group_ids.#", resourceName, "security_group_ids.#"), - resource.TestCheckResourceAttrPair(datasourceName, "service_name", resourceName, "service_name"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrServiceName, resourceName, names.AttrServiceName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrState, resourceName, names.AttrState), resource.TestCheckResourceAttrPair(datasourceName, "subnet_ids.#", resourceName, "subnet_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), @@ -161,7 +161,7 @@ func TestAccVPCEndpointDataSource_byTags(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "requester_managed", resourceName, "requester_managed"), resource.TestCheckResourceAttrPair(datasourceName, "route_table_ids.#", resourceName, "route_table_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "security_group_ids.#", resourceName, "security_group_ids.#"), - resource.TestCheckResourceAttrPair(datasourceName, "service_name", resourceName, "service_name"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrServiceName, resourceName, names.AttrServiceName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrState, resourceName, names.AttrState), resource.TestCheckResourceAttrPair(datasourceName, "subnet_ids.#", resourceName, "subnet_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), @@ -201,7 +201,7 @@ func TestAccVPCEndpointDataSource_gatewayWithRouteTableAndTags(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "requester_managed", resourceName, "requester_managed"), resource.TestCheckResourceAttrPair(datasourceName, "route_table_ids.#", resourceName, "route_table_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "security_group_ids.#", resourceName, "security_group_ids.#"), - resource.TestCheckResourceAttrPair(datasourceName, "service_name", resourceName, "service_name"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrServiceName, resourceName, names.AttrServiceName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrState, resourceName, names.AttrState), resource.TestCheckResourceAttrPair(datasourceName, "subnet_ids.#", resourceName, "subnet_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), @@ -241,7 +241,7 @@ func TestAccVPCEndpointDataSource_interface(t *testing.T) { resource.TestCheckResourceAttrPair(datasourceName, "requester_managed", resourceName, "requester_managed"), resource.TestCheckResourceAttrPair(datasourceName, "route_table_ids.#", resourceName, "route_table_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "security_group_ids.#", resourceName, "security_group_ids.#"), - resource.TestCheckResourceAttrPair(datasourceName, "service_name", resourceName, "service_name"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrServiceName, resourceName, names.AttrServiceName), resource.TestCheckResourceAttrPair(datasourceName, names.AttrState, resourceName, names.AttrState), resource.TestCheckResourceAttrPair(datasourceName, "subnet_ids.#", resourceName, "subnet_ids.#"), resource.TestCheckResourceAttrPair(datasourceName, "tags.%", resourceName, "tags.%"), diff --git a/internal/service/ec2/vpc_endpoint_service.go b/internal/service/ec2/vpc_endpoint_service.go index 881a14e501a..0b4f41ef037 100644 --- a/internal/service/ec2/vpc_endpoint_service.go +++ b/internal/service/ec2/vpc_endpoint_service.go @@ -115,7 +115,7 @@ func ResourceVPCEndpointService() *schema.Resource { }, }, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Computed: true, }, @@ -242,7 +242,7 @@ func resourceVPCEndpointServiceRead(ctx context.Context, d *schema.ResourceData, } else { d.Set("private_dns_name_configuration", nil) } - d.Set("service_name", svcCfg.ServiceName) + d.Set(names.AttrServiceName, svcCfg.ServiceName) if len(svcCfg.ServiceType) > 0 { d.Set("service_type", svcCfg.ServiceType[0].ServiceType) } else { diff --git a/internal/service/ec2/vpc_endpoint_service_data_source.go b/internal/service/ec2/vpc_endpoint_service_data_source.go index d8257857fa2..3851a7f06af 100644 --- a/internal/service/ec2/vpc_endpoint_service_data_source.go +++ b/internal/service/ec2/vpc_endpoint_service_data_source.go @@ -66,13 +66,13 @@ func DataSourceVPCEndpointService() *schema.Resource { "service": { Type: schema.TypeString, Optional: true, - ConflictsWith: []string{"service_name"}, + ConflictsWith: []string{names.AttrServiceName}, }, "service_id": { Type: schema.TypeString, Computed: true, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -113,7 +113,7 @@ func dataSourceVPCEndpointServiceRead(ctx context.Context, d *schema.ResourceDat var serviceName string - if v, ok := d.GetOk("service_name"); ok { + if v, ok := d.GetOk(names.AttrServiceName); ok { serviceName = v.(string) } else if v, ok := d.GetOk("service"); ok { serviceName = fmt.Sprintf("com.amazonaws.%s.%s", meta.(*conns.AWSClient).Region, v.(string)) @@ -155,7 +155,7 @@ func dataSourceVPCEndpointServiceRead(ctx context.Context, d *schema.ResourceDat for _, name := range serviceNames { if name == serviceName { d.SetId(strconv.Itoa(create.StringHashcode(name))) - d.Set("service_name", name) + d.Set(names.AttrServiceName, name) return diags } } @@ -189,7 +189,7 @@ func dataSourceVPCEndpointServiceRead(ctx context.Context, d *schema.ResourceDat d.Set("owner", sd.Owner) d.Set("private_dns_name", sd.PrivateDnsName) d.Set("service_id", serviceID) - d.Set("service_name", serviceName) + d.Set(names.AttrServiceName, serviceName) if len(sd.ServiceType) > 0 { d.Set("service_type", sd.ServiceType[0].ServiceType) } else { diff --git a/internal/service/ec2/vpc_endpoint_service_data_source_test.go b/internal/service/ec2/vpc_endpoint_service_data_source_test.go index f48c6d433ef..3044e5ad4a7 100644 --- a/internal/service/ec2/vpc_endpoint_service_data_source_test.go +++ b/internal/service/ec2/vpc_endpoint_service_data_source_test.go @@ -34,7 +34,7 @@ func TestAccVPCEndpointServiceDataSource_gateway(t *testing.T) { resource.TestCheckResourceAttr(datasourceName, "manages_vpc_endpoints", "false"), resource.TestCheckResourceAttr(datasourceName, "owner", "amazon"), resource.TestCheckResourceAttr(datasourceName, "private_dns_name", ""), - testAccCheckResourceAttrRegionalReverseDNSService(datasourceName, "service_name", "dynamodb"), + testAccCheckResourceAttrRegionalReverseDNSService(datasourceName, names.AttrServiceName, "dynamodb"), resource.TestCheckResourceAttr(datasourceName, "service_type", "Gateway"), acctest.CheckResourceAttrGreaterThanValue(datasourceName, "supported_ip_address_types.#", 0), resource.TestCheckResourceAttr(datasourceName, "tags.%", "0"), @@ -64,7 +64,7 @@ func TestAccVPCEndpointServiceDataSource_interface(t *testing.T) { resource.TestCheckResourceAttr(datasourceName, "manages_vpc_endpoints", "false"), resource.TestCheckResourceAttr(datasourceName, "owner", "amazon"), acctest.CheckResourceAttrRegionalHostnameService(datasourceName, "private_dns_name", "ec2"), - testAccCheckResourceAttrRegionalReverseDNSService(datasourceName, "service_name", "ec2"), + testAccCheckResourceAttrRegionalReverseDNSService(datasourceName, names.AttrServiceName, "ec2"), resource.TestCheckResourceAttr(datasourceName, "service_type", "Interface"), acctest.CheckResourceAttrGreaterThanValue(datasourceName, "supported_ip_address_types.#", 0), resource.TestCheckResourceAttr(datasourceName, "tags.%", "0"), @@ -180,7 +180,7 @@ func TestAccVPCEndpointServiceDataSource_ServiceType_gateway(t *testing.T) { { Config: testAccVPCEndpointServiceDataSourceConfig_type("s3", "Gateway"), Check: resource.ComposeTestCheckFunc( - testAccCheckResourceAttrRegionalReverseDNSService(datasourceName, "service_name", "s3"), + testAccCheckResourceAttrRegionalReverseDNSService(datasourceName, names.AttrServiceName, "s3"), resource.TestCheckResourceAttr(datasourceName, "service_type", "Gateway"), ), }, @@ -200,7 +200,7 @@ func TestAccVPCEndpointServiceDataSource_ServiceType_interface(t *testing.T) { { Config: testAccVPCEndpointServiceDataSourceConfig_type("ec2", "Interface"), Check: resource.ComposeTestCheckFunc( - testAccCheckResourceAttrRegionalReverseDNSService(datasourceName, "service_name", "ec2"), + testAccCheckResourceAttrRegionalReverseDNSService(datasourceName, names.AttrServiceName, "ec2"), resource.TestCheckResourceAttr(datasourceName, "service_type", "Interface"), ), }, diff --git a/internal/service/ec2/vpc_endpoint_service_test.go b/internal/service/ec2/vpc_endpoint_service_test.go index 34a9ee752a4..43c58c401c7 100644 --- a/internal/service/ec2/vpc_endpoint_service_test.go +++ b/internal/service/ec2/vpc_endpoint_service_test.go @@ -46,7 +46,7 @@ func TestAccVPCEndpointService_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "network_load_balancer_arns.#", "1"), resource.TestCheckResourceAttr(resourceName, "private_dns_name", ""), resource.TestCheckResourceAttr(resourceName, "private_dns_name_configuration.#", "0"), - resource.TestCheckResourceAttrSet(resourceName, "service_name"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrServiceName), resource.TestCheckResourceAttr(resourceName, "service_type", "Interface"), resource.TestCheckResourceAttr(resourceName, "supported_ip_address_types.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "supported_ip_address_types.*", "ipv4"), diff --git a/internal/service/ec2/vpc_flow_log.go b/internal/service/ec2/vpc_flow_log.go index e1ff9348a59..c0d8058f1fd 100644 --- a/internal/service/ec2/vpc_flow_log.go +++ b/internal/service/ec2/vpc_flow_log.go @@ -97,7 +97,7 @@ func ResourceFlowLog() *schema.Resource { Computed: true, ForceNew: true, ValidateFunc: verify.ValidARN, - ConflictsWith: []string{"log_group_name"}, + ConflictsWith: []string{names.AttrLogGroupName}, }, "log_destination_type": { Type: schema.TypeString, @@ -112,7 +112,7 @@ func ResourceFlowLog() *schema.Resource { ForceNew: true, Computed: true, }, - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -237,7 +237,7 @@ func resourceLogFlowCreate(ctx context.Context, d *schema.ResourceData, meta int input.LogFormat = aws.String(v.(string)) } - if v, ok := d.GetOk("log_group_name"); ok { + if v, ok := d.GetOk(names.AttrLogGroupName); ok { input.LogGroupName = aws.String(v.(string)) } @@ -298,7 +298,7 @@ func resourceLogFlowRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("log_destination", fl.LogDestination) d.Set("log_destination_type", fl.LogDestinationType) d.Set("log_format", fl.LogFormat) - d.Set("log_group_name", fl.LogGroupName) + d.Set(names.AttrLogGroupName, fl.LogGroupName) d.Set("max_aggregation_interval", fl.MaxAggregationInterval) switch resourceID := aws.StringValue(fl.ResourceId); { case strings.HasPrefix(resourceID, "vpc-"): diff --git a/internal/service/ec2/vpc_flow_log_test.go b/internal/service/ec2/vpc_flow_log_test.go index b58dd3664fd..6cde4b7135e 100644 --- a/internal/service/ec2/vpc_flow_log_test.go +++ b/internal/service/ec2/vpc_flow_log_test.go @@ -44,7 +44,7 @@ func TestAccVPCFlowLog_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "iam_role_arn", iamRoleResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination", ""), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "cloud-watch-logs"), - resource.TestCheckResourceAttrPair(resourceName, "log_group_name", cloudwatchLogGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrLogGroupName, cloudwatchLogGroupResourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "max_aggregation_interval", "600"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "traffic_type", "ALL"), @@ -111,7 +111,7 @@ func TestAccVPCFlowLog_subnetID(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "iam_role_arn", iamRoleResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination", ""), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "cloud-watch-logs"), - resource.TestCheckResourceAttrPair(resourceName, "log_group_name", cloudwatchLogGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrLogGroupName, cloudwatchLogGroupResourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "max_aggregation_interval", "600"), resource.TestCheckResourceAttrPair(resourceName, names.AttrSubnetID, subnetResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, "traffic_type", "ALL"), @@ -149,7 +149,7 @@ func TestAccVPCFlowLog_transitGatewayID(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "iam_role_arn", iamRoleResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination", ""), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "cloud-watch-logs"), - resource.TestCheckResourceAttrPair(resourceName, "log_group_name", cloudwatchLogGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrLogGroupName, cloudwatchLogGroupResourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "max_aggregation_interval", "60"), resource.TestCheckResourceAttrPair(resourceName, names.AttrTransitGatewayID, transitGatewayResourceName, names.AttrID), ), @@ -186,7 +186,7 @@ func TestAccVPCFlowLog_transitGatewayAttachmentID(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "iam_role_arn", iamRoleResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination", ""), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "cloud-watch-logs"), - resource.TestCheckResourceAttrPair(resourceName, "log_group_name", cloudwatchLogGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrLogGroupName, cloudwatchLogGroupResourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "max_aggregation_interval", "60"), resource.TestCheckResourceAttrPair(resourceName, names.AttrTransitGatewayAttachmentID, transitGatewayAttachmentResourceName, names.AttrID), ), @@ -220,7 +220,7 @@ func TestAccVPCFlowLog_LogDestinationType_cloudWatchLogs(t *testing.T) { // We automatically trim :* from ARNs if present acctest.CheckResourceAttrRegionalARN(resourceName, "log_destination", "logs", fmt.Sprintf("log-group:%s", rName)), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "cloud-watch-logs"), - resource.TestCheckResourceAttrPair(resourceName, "log_group_name", cloudwatchLogGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrLogGroupName, cloudwatchLogGroupResourceName, names.AttrName), ), }, { @@ -251,7 +251,7 @@ func TestAccVPCFlowLog_LogDestinationType_kinesisFirehose(t *testing.T) { testAccCheckFlowLogExists(ctx, resourceName, &flowLog), resource.TestCheckResourceAttrPair(resourceName, "log_destination", kinesisFirehoseResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "kinesis-data-firehose"), - resource.TestCheckResourceAttr(resourceName, "log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrLogGroupName, ""), ), }, { @@ -282,7 +282,7 @@ func TestAccVPCFlowLog_LogDestinationType_s3(t *testing.T) { testAccCheckFlowLogExists(ctx, resourceName, &flowLog), resource.TestCheckResourceAttrPair(resourceName, "log_destination", s3ResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "s3"), - resource.TestCheckResourceAttr(resourceName, "log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrLogGroupName, ""), ), }, { @@ -331,7 +331,7 @@ func TestAccVPCFlowLog_LogDestinationTypeS3DO_plainText(t *testing.T) { testAccCheckFlowLogExists(ctx, resourceName, &flowLog), resource.TestCheckResourceAttrPair(resourceName, "log_destination", s3ResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "s3"), - resource.TestCheckResourceAttr(resourceName, "log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrLogGroupName, ""), resource.TestCheckResourceAttr(resourceName, "destination_options.0.file_format", "plain-text"), ), }, @@ -363,7 +363,7 @@ func TestAccVPCFlowLog_LogDestinationTypeS3DOPlainText_hiveCompatible(t *testing testAccCheckFlowLogExists(ctx, resourceName, &flowLog), resource.TestCheckResourceAttrPair(resourceName, "log_destination", s3ResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "s3"), - resource.TestCheckResourceAttr(resourceName, "log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrLogGroupName, ""), resource.TestCheckResourceAttr(resourceName, "destination_options.0.file_format", "plain-text"), resource.TestCheckResourceAttr(resourceName, "destination_options.0.hive_compatible_partitions", "true"), resource.TestCheckResourceAttr(resourceName, "destination_options.0.per_hour_partition", "true"), @@ -397,7 +397,7 @@ func TestAccVPCFlowLog_LogDestinationTypeS3DO_parquet(t *testing.T) { testAccCheckFlowLogExists(ctx, resourceName, &flowLog), resource.TestCheckResourceAttrPair(resourceName, "log_destination", s3ResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "s3"), - resource.TestCheckResourceAttr(resourceName, "log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrLogGroupName, ""), resource.TestCheckResourceAttr(resourceName, "destination_options.0.file_format", "parquet"), ), }, @@ -429,7 +429,7 @@ func TestAccVPCFlowLog_LogDestinationTypeS3DOParquet_hiveCompatible(t *testing.T testAccCheckFlowLogExists(ctx, resourceName, &flowLog), resource.TestCheckResourceAttrPair(resourceName, "log_destination", s3ResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "s3"), - resource.TestCheckResourceAttr(resourceName, "log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrLogGroupName, ""), resource.TestCheckResourceAttr(resourceName, "destination_options.0.file_format", "parquet"), resource.TestCheckResourceAttr(resourceName, "destination_options.0.hive_compatible_partitions", "true"), ), @@ -462,7 +462,7 @@ func TestAccVPCFlowLog_LogDestinationTypeS3DOParquetHiveCompatible_perHour(t *te testAccCheckFlowLogExists(ctx, resourceName, &flowLog), resource.TestCheckResourceAttrPair(resourceName, "log_destination", s3ResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "log_destination_type", "s3"), - resource.TestCheckResourceAttr(resourceName, "log_group_name", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrLogGroupName, ""), resource.TestCheckResourceAttr(resourceName, "destination_options.0.file_format", "parquet"), resource.TestCheckResourceAttr(resourceName, "destination_options.0.hive_compatible_partitions", "true"), resource.TestCheckResourceAttr(resourceName, "destination_options.0.per_hour_partition", "true"), From 7d28712cec1859e69d46a9c885bc960d7eb17805 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:27 -0400 Subject: [PATCH 1442/1490] ecr: Use constants for strings --- internal/service/ecr/authorization_token_data_source.go | 4 ++-- .../service/ecr/authorization_token_data_source_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/ecr/authorization_token_data_source.go b/internal/service/ecr/authorization_token_data_source.go index 03551570abc..5ebebfe0910 100644 --- a/internal/service/ecr/authorization_token_data_source.go +++ b/internal/service/ecr/authorization_token_data_source.go @@ -46,7 +46,7 @@ func dataSourceAuthorizationToken() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Computed: true, }, @@ -83,7 +83,7 @@ func dataSourceAuthorizationTokenRead(ctx context.Context, d *schema.ResourceDat d.Set("authorization_token", authorizationToken) d.Set("proxy_endpoint", proxyEndpoint) d.Set("expires_at", expiresAt) - d.Set("user_name", userName) + d.Set(names.AttrUserName, userName) d.Set(names.AttrPassword, password) return diags diff --git a/internal/service/ecr/authorization_token_data_source_test.go b/internal/service/ecr/authorization_token_data_source_test.go index e0661dd69bd..01598db355f 100644 --- a/internal/service/ecr/authorization_token_data_source_test.go +++ b/internal/service/ecr/authorization_token_data_source_test.go @@ -30,8 +30,8 @@ func TestAccECRAuthorizationTokenDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet(dataSourceName, "authorization_token"), resource.TestCheckResourceAttrSet(dataSourceName, "proxy_endpoint"), resource.TestCheckResourceAttrSet(dataSourceName, "expires_at"), - resource.TestCheckResourceAttrSet(dataSourceName, "user_name"), - resource.TestMatchResourceAttr(dataSourceName, "user_name", regexache.MustCompile(`AWS`)), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrUserName), + resource.TestMatchResourceAttr(dataSourceName, names.AttrUserName, regexache.MustCompile(`AWS`)), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrPassword), ), }, @@ -42,8 +42,8 @@ func TestAccECRAuthorizationTokenDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrSet(dataSourceName, "authorization_token"), resource.TestCheckResourceAttrSet(dataSourceName, "proxy_endpoint"), resource.TestCheckResourceAttrSet(dataSourceName, "expires_at"), - resource.TestCheckResourceAttrSet(dataSourceName, "user_name"), - resource.TestMatchResourceAttr(dataSourceName, "user_name", regexache.MustCompile(`AWS`)), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrUserName), + resource.TestMatchResourceAttr(dataSourceName, names.AttrUserName, regexache.MustCompile(`AWS`)), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrPassword), ), }, From 12d6010354196decd06da10f00ae43003d954450 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:28 -0400 Subject: [PATCH 1443/1490] ecrpublic: Use constants for strings --- internal/service/ecrpublic/authorization_token_data_source.go | 4 ++-- .../service/ecrpublic/authorization_token_data_source_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/ecrpublic/authorization_token_data_source.go b/internal/service/ecrpublic/authorization_token_data_source.go index c6e15d77ef4..9d7b802cf1b 100644 --- a/internal/service/ecrpublic/authorization_token_data_source.go +++ b/internal/service/ecrpublic/authorization_token_data_source.go @@ -38,7 +38,7 @@ func DataSourceAuthorizationToken() *schema.Resource { Computed: true, Sensitive: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Computed: true, }, @@ -76,7 +76,7 @@ func dataSourceAuthorizationTokenRead(ctx context.Context, d *schema.ResourceDat d.SetId(meta.(*conns.AWSClient).Region) d.Set("authorization_token", authorizationToken) d.Set("expires_at", expiresAt) - d.Set("user_name", userName) + d.Set(names.AttrUserName, userName) d.Set(names.AttrPassword, password) return diags diff --git a/internal/service/ecrpublic/authorization_token_data_source_test.go b/internal/service/ecrpublic/authorization_token_data_source_test.go index f016d5918af..caf56ca71a3 100644 --- a/internal/service/ecrpublic/authorization_token_data_source_test.go +++ b/internal/service/ecrpublic/authorization_token_data_source_test.go @@ -26,8 +26,8 @@ func TestAccECRPublicAuthorizationTokenDataSource_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet(dataSourceName, "authorization_token"), resource.TestCheckResourceAttrSet(dataSourceName, "expires_at"), - resource.TestCheckResourceAttrSet(dataSourceName, "user_name"), - resource.TestMatchResourceAttr(dataSourceName, "user_name", regexache.MustCompile(`AWS`)), + resource.TestCheckResourceAttrSet(dataSourceName, names.AttrUserName), + resource.TestMatchResourceAttr(dataSourceName, names.AttrUserName, regexache.MustCompile(`AWS`)), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrPassword), ), }, From fed446fccbccd9e39e8603f0bee25186e6b6c934 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:28 -0400 Subject: [PATCH 1444/1490] ecs: Use constants for strings --- internal/service/ecs/cluster.go | 12 ++++++------ internal/service/ecs/cluster_data_source.go | 2 +- internal/service/ecs/service.go | 4 ++-- internal/service/ecs/service_data_source.go | 6 +++--- internal/service/ecs/service_data_source_test.go | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/ecs/cluster.go b/internal/service/ecs/cluster.go index 9f997ff116e..efb9420426c 100644 --- a/internal/service/ecs/cluster.go +++ b/internal/service/ecs/cluster.go @@ -79,7 +79,7 @@ func ResourceCluster() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Optional: true, }, @@ -114,7 +114,7 @@ func ResourceCluster() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -478,7 +478,7 @@ func expandClusterServiceConnectDefaultsRequest(tfMap map[string]interface{}) *e apiObject := &ecs.ClusterServiceConnectDefaultsRequest{} - if v, ok := tfMap["namespace"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrNamespace].(string); ok && v != "" { apiObject.Namespace = aws.String(v) } @@ -493,7 +493,7 @@ func flattenClusterServiceConnectDefaults(apiObject *ecs.ClusterServiceConnectDe tfMap := map[string]interface{}{} if v := apiObject.Namespace; v != nil { - tfMap["namespace"] = aws.StringValue(v) + tfMap[names.AttrNamespace] = aws.StringValue(v) } return tfMap @@ -566,7 +566,7 @@ func flattenClusterConfigurationExecuteCommandConfigurationLogConfiguration(apiO } if apiObject.S3BucketName != nil { - tfMap["s3_bucket_name"] = aws.StringValue(apiObject.S3BucketName) + tfMap[names.AttrS3BucketName] = aws.StringValue(apiObject.S3BucketName) } if apiObject.S3KeyPrefix != nil { @@ -624,7 +624,7 @@ func expandClusterConfigurationExecuteCommandLogConfiguration(nc []interface{}) config.CloudWatchLogGroupName = aws.String(v) } - if v, ok := raw["s3_bucket_name"].(string); ok && v != "" { + if v, ok := raw[names.AttrS3BucketName].(string); ok && v != "" { config.S3BucketName = aws.String(v) } diff --git a/internal/service/ecs/cluster_data_source.go b/internal/service/ecs/cluster_data_source.go index c1446cb9c9a..2b9bc53c221 100644 --- a/internal/service/ecs/cluster_data_source.go +++ b/internal/service/ecs/cluster_data_source.go @@ -46,7 +46,7 @@ func DataSourceCluster() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/ecs/service.go b/internal/service/ecs/service.go index c94da446416..e8479dc2218 100644 --- a/internal/service/ecs/service.go +++ b/internal/service/ecs/service.go @@ -374,7 +374,7 @@ func ResourceService() *schema.Resource { }, }, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, }, @@ -1409,7 +1409,7 @@ func expandServiceConnectConfiguration(sc []interface{}) *ecs.ServiceConnectConf config.LogConfiguration = expandLogConfiguration(v) } - if v, ok := raw["namespace"].(string); ok && v != "" { + if v, ok := raw[names.AttrNamespace].(string); ok && v != "" { config.Namespace = aws.String(v) } diff --git a/internal/service/ecs/service_data_source.go b/internal/service/ecs/service_data_source.go index ec9619f806f..9c57ba5f386 100644 --- a/internal/service/ecs/service_data_source.go +++ b/internal/service/ecs/service_data_source.go @@ -23,7 +23,7 @@ func DataSourceService() *schema.Resource { ReadWithoutTimeout: dataSourceServiceRead, Schema: map[string]*schema.Schema{ - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Required: true, }, @@ -62,7 +62,7 @@ func dataSourceServiceRead(ctx context.Context, d *schema.ResourceData, meta int ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig clusterArn := d.Get("cluster_arn").(string) - serviceName := d.Get("service_name").(string) + serviceName := d.Get(names.AttrServiceName).(string) params := &ecs.DescribeServicesInput{ Cluster: aws.String(clusterArn), @@ -87,7 +87,7 @@ func dataSourceServiceRead(ctx context.Context, d *schema.ResourceData, meta int service := desc.Services[0] d.SetId(aws.StringValue(service.ServiceArn)) - d.Set("service_name", service.ServiceName) + d.Set(names.AttrServiceName, service.ServiceName) d.Set(names.AttrARN, service.ServiceArn) d.Set("cluster_arn", service.ClusterArn) d.Set("desired_count", service.DesiredCount) diff --git a/internal/service/ecs/service_data_source_test.go b/internal/service/ecs/service_data_source_test.go index 16f2ca8e869..d34c9da4cd3 100644 --- a/internal/service/ecs/service_data_source_test.go +++ b/internal/service/ecs/service_data_source_test.go @@ -31,7 +31,7 @@ func TestAccECSServiceDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "desired_count", dataSourceName, "desired_count"), resource.TestCheckResourceAttrPair(resourceName, "launch_type", dataSourceName, "launch_type"), resource.TestCheckResourceAttrPair(resourceName, "scheduling_strategy", dataSourceName, "scheduling_strategy"), - resource.TestCheckResourceAttrPair(resourceName, names.AttrName, dataSourceName, "service_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrName, dataSourceName, names.AttrServiceName), resource.TestCheckResourceAttrPair(resourceName, "task_definition", dataSourceName, "task_definition"), resource.TestCheckResourceAttrPair(resourceName, names.AttrTags, dataSourceName, names.AttrTags), ), From b4c5b4490fd07baececbde5ab8865ad61574a237 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:28 -0400 Subject: [PATCH 1445/1490] eks: Use constants for strings --- internal/service/eks/access_entry.go | 8 ++++---- internal/service/eks/access_entry_datasource.go | 4 ++-- internal/service/eks/access_entry_datasource_test.go | 2 +- internal/service/eks/access_entry_test.go | 10 +++++----- internal/service/eks/fargate_profile.go | 8 ++++---- internal/service/eks/pod_identity_association.go | 2 +- internal/service/eks/pod_identity_association_test.go | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/eks/access_entry.go b/internal/service/eks/access_entry.go index 5f491989582..1de3c4f3ecb 100644 --- a/internal/service/eks/access_entry.go +++ b/internal/service/eks/access_entry.go @@ -89,7 +89,7 @@ func resourceAccessEntry() *schema.Resource { Default: accessEntryTypeStandard, ValidateFunc: validation.StringInSlice(accessEntryType_Values(), false), }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Computed: true, Optional: true, @@ -116,7 +116,7 @@ func resourceAccessEntryCreate(ctx context.Context, d *schema.ResourceData, meta input.KubernetesGroups = flex.ExpandStringValueSet(v.(*schema.Set)) } - if v, ok := d.GetOk("user_name"); ok { + if v, ok := d.GetOk(names.AttrUserName); ok { input.Username = aws.String(v.(string)) } @@ -161,7 +161,7 @@ func resourceAccessEntryRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("modified_at", aws.ToTime(output.ModifiedAt).Format(time.RFC3339)) d.Set("principal_arn", output.PrincipalArn) d.Set(names.AttrType, output.Type) - d.Set("user_name", output.Username) + d.Set(names.AttrUserName, output.Username) setTagsOut(ctx, output.Tags) @@ -184,7 +184,7 @@ func resourceAccessEntryUpdate(ctx context.Context, d *schema.ResourceData, meta } input.KubernetesGroups = flex.ExpandStringValueSet(d.Get("kubernetes_groups").(*schema.Set)) - input.Username = aws.String(d.Get("user_name").(string)) + input.Username = aws.String(d.Get(names.AttrUserName).(string)) _, err = conn.UpdateAccessEntry(ctx, input) diff --git a/internal/service/eks/access_entry_datasource.go b/internal/service/eks/access_entry_datasource.go index 582ba0cd8ba..624ae107d8f 100644 --- a/internal/service/eks/access_entry_datasource.go +++ b/internal/service/eks/access_entry_datasource.go @@ -52,7 +52,7 @@ func dataSourceAccessEntry() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Computed: true, }, @@ -87,7 +87,7 @@ func dataSourceAccessEntryRead(ctx context.Context, d *schema.ResourceData, meta d.Set("modified_at", aws.ToTime(output.ModifiedAt).Format(time.RFC3339)) d.Set("principal_arn", output.PrincipalArn) d.Set(names.AttrType, output.Type) - d.Set("user_name", output.Username) + d.Set(names.AttrUserName, output.Username) setTagsOut(ctx, output.Tags) diff --git a/internal/service/eks/access_entry_datasource_test.go b/internal/service/eks/access_entry_datasource_test.go index 890f50e6410..1124a2cdd4d 100644 --- a/internal/service/eks/access_entry_datasource_test.go +++ b/internal/service/eks/access_entry_datasource_test.go @@ -34,7 +34,7 @@ func TestAccEKSAccessEntryDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "principal_arn", dataSourceResourceName, "principal_arn"), resource.TestCheckResourceAttrPair(resourceName, "tags.%", dataSourceResourceName, "tags.%"), resource.TestCheckResourceAttrPair(resourceName, names.AttrType, dataSourceResourceName, names.AttrType), - resource.TestCheckResourceAttrPair(resourceName, "user_name", dataSourceResourceName, "user_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrUserName, dataSourceResourceName, names.AttrUserName), ), }, }, diff --git a/internal/service/eks/access_entry_test.go b/internal/service/eks/access_entry_test.go index f7259700b17..d2ce1e8d6f3 100644 --- a/internal/service/eks/access_entry_test.go +++ b/internal/service/eks/access_entry_test.go @@ -48,7 +48,7 @@ func TestAccEKSAccessEntry_basic(t *testing.T) { acctest.CheckResourceAttrRFC3339(resourceName, "modified_at"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "STANDARD"), - resource.TestCheckResourceAttrSet(resourceName, "user_name"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrUserName), ), }, { @@ -201,7 +201,7 @@ func TestAccEKSAccessEntry_type(t *testing.T) { testAccCheckAccessEntryExists(ctx, resourceName, &accessentry), acctest.CheckResourceAttrGreaterThanOrEqualValue(resourceName, "kubernetes_groups.#", 1), resource.TestCheckResourceAttr(resourceName, names.AttrType, "EC2_LINUX"), - resource.TestCheckResourceAttrSet(resourceName, "user_name"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrUserName), ), }, { @@ -239,7 +239,7 @@ func TestAccEKSAccessEntry_username(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "kubernetes_groups.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "kubernetes_groups.*", "ae-test"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "STANDARD"), - resource.TestCheckResourceAttr(resourceName, "user_name", "user1"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "user1"), ), }, { @@ -254,7 +254,7 @@ func TestAccEKSAccessEntry_username(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "kubernetes_groups.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "kubernetes_groups.*", "ae-test"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "STANDARD"), - resource.TestCheckResourceAttr(resourceName, "user_name", "user2"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "user2"), ), }, }, @@ -286,7 +286,7 @@ func TestAccEKSAccessEntry_eventualConsistency(t *testing.T) { testAccCheckAccessEntryExists(ctx, resourceName, &accessentry), acctest.CheckResourceAttrGreaterThanOrEqualValue(resourceName, "kubernetes_groups.#", 1), resource.TestCheckResourceAttr(resourceName, names.AttrType, "EC2_LINUX"), - resource.TestCheckResourceAttrSet(resourceName, "user_name"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrUserName), ), }, { diff --git a/internal/service/eks/fargate_profile.go b/internal/service/eks/fargate_profile.go index b2723c27c00..706b2639d7d 100644 --- a/internal/service/eks/fargate_profile.go +++ b/internal/service/eks/fargate_profile.go @@ -84,7 +84,7 @@ func resourceFargateProfile() *schema.Resource { ForceNew: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -324,7 +324,7 @@ func expandFargateProfileSelectors(l []interface{}) []types.FargateProfileSelect fargateProfileSelector.Labels = flex.ExpandStringValueMap(v) } - if v, ok := m["namespace"].(string); ok && v != "" { + if v, ok := m[names.AttrNamespace].(string); ok && v != "" { fargateProfileSelector.Namespace = aws.String(v) } @@ -343,8 +343,8 @@ func flattenFargateProfileSelectors(fargateProfileSelectors []types.FargateProfi for _, fargateProfileSelector := range fargateProfileSelectors { m := map[string]interface{}{ - "labels": fargateProfileSelector.Labels, - "namespace": aws.ToString(fargateProfileSelector.Namespace), + "labels": fargateProfileSelector.Labels, + names.AttrNamespace: aws.ToString(fargateProfileSelector.Namespace), } l = append(l, m) diff --git a/internal/service/eks/pod_identity_association.go b/internal/service/eks/pod_identity_association.go index 421077d3896..f714ad8f001 100644 --- a/internal/service/eks/pod_identity_association.go +++ b/internal/service/eks/pod_identity_association.go @@ -88,7 +88,7 @@ func (r *podIdentityAssociationResource) Schema(ctx context.Context, req resourc }, }, names.AttrID: framework.IDAttribute(), - "namespace": schema.StringAttribute{ + names.AttrNamespace: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), diff --git a/internal/service/eks/pod_identity_association_test.go b/internal/service/eks/pod_identity_association_test.go index d805b82cccc..26e93c09dff 100644 --- a/internal/service/eks/pod_identity_association_test.go +++ b/internal/service/eks/pod_identity_association_test.go @@ -42,7 +42,7 @@ func TestAccEKSPodIdentityAssociation_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPodIdentityAssociationExists(ctx, resourceName, &podidentityassociation), resource.TestCheckResourceAttrSet(resourceName, "cluster_name"), - resource.TestCheckResourceAttrSet(resourceName, "namespace"), + resource.TestCheckResourceAttrSet(resourceName, names.AttrNamespace), resource.TestCheckResourceAttrSet(resourceName, names.AttrRoleARN), resource.TestCheckResourceAttrSet(resourceName, "service_account"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), From e87cde31e6dceb57926e6ee67ab8f19f30055086 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:28 -0400 Subject: [PATCH 1446/1490] elasticache: Use constants for strings --- internal/service/elasticache/user.go | 6 +++--- internal/service/elasticache/user_data_source.go | 4 ++-- .../service/elasticache/user_data_source_test.go | 2 +- internal/service/elasticache/user_test.go | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/elasticache/user.go b/internal/service/elasticache/user.go index 642f3379259..5dee7a68fd1 100644 --- a/internal/service/elasticache/user.go +++ b/internal/service/elasticache/user.go @@ -117,7 +117,7 @@ func resourceUser() *schema.Resource { Required: true, ForceNew: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -137,7 +137,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf NoPasswordRequired: aws.Bool(d.Get("no_password_required").(bool)), Tags: getTagsIn(ctx), UserId: aws.String(userID), - UserName: aws.String(d.Get("user_name").(string)), + UserName: aws.String(d.Get(names.AttrUserName).(string)), } if v, ok := d.GetOk("authentication_mode"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { @@ -219,7 +219,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac } d.Set("engine", user.Engine) d.Set("user_id", user.UserId) - d.Set("user_name", user.UserName) + d.Set(names.AttrUserName, user.UserName) return diags } diff --git a/internal/service/elasticache/user_data_source.go b/internal/service/elasticache/user_data_source.go index e8d153271ee..9e6fc71e039 100644 --- a/internal/service/elasticache/user_data_source.go +++ b/internal/service/elasticache/user_data_source.go @@ -60,7 +60,7 @@ func dataSourceUser() *schema.Resource { Type: schema.TypeString, Required: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Optional: true, }, @@ -92,7 +92,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf } d.Set("engine", user.Engine) d.Set("user_id", user.UserId) - d.Set("user_name", user.UserName) + d.Set(names.AttrUserName, user.UserName) return diags } diff --git a/internal/service/elasticache/user_data_source_test.go b/internal/service/elasticache/user_data_source_test.go index 139f8af2b6f..62c62b46d7e 100644 --- a/internal/service/elasticache/user_data_source_test.go +++ b/internal/service/elasticache/user_data_source_test.go @@ -29,7 +29,7 @@ func TestAccElastiCacheUserDataSource_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "engine", resourceName, "engine"), resource.TestCheckResourceAttrPair(dataSourceName, "user_id", resourceName, "user_id"), - resource.TestCheckResourceAttrPair(dataSourceName, "user_name", resourceName, "user_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUserName, resourceName, names.AttrUserName), resource.TestCheckResourceAttrPair(dataSourceName, "access_string", resourceName, "access_string"), ), }, diff --git a/internal/service/elasticache/user_test.go b/internal/service/elasticache/user_test.go index a5f6342b9ab..9f63718d08e 100644 --- a/internal/service/elasticache/user_test.go +++ b/internal/service/elasticache/user_test.go @@ -38,7 +38,7 @@ func TestAccElastiCacheUser_basic(t *testing.T) { testAccCheckUserExists(ctx, resourceName, &user), resource.TestCheckResourceAttr(resourceName, "user_id", rName), resource.TestCheckResourceAttr(resourceName, "no_password_required", "false"), - resource.TestCheckResourceAttr(resourceName, "user_name", "username1"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "username1"), resource.TestCheckResourceAttr(resourceName, "engine", "redis"), ), }, @@ -72,7 +72,7 @@ func TestAccElastiCacheUser_password_auth_mode(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &user), resource.TestCheckResourceAttr(resourceName, "user_id", rName), - resource.TestCheckResourceAttr(resourceName, "user_name", "username1"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "username1"), resource.TestCheckResourceAttr(resourceName, "engine", "redis"), resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.password_count", "1"), resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.passwords.#", "1"), @@ -111,7 +111,7 @@ func TestAccElastiCacheUser_iam_auth_mode(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &user), resource.TestCheckResourceAttr(resourceName, "user_id", rName), - resource.TestCheckResourceAttr(resourceName, "user_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, rName), resource.TestCheckResourceAttr(resourceName, "engine", "redis"), resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.type", "iam"), ), @@ -248,7 +248,7 @@ func TestAccElastiCacheUser_tags(t *testing.T) { testAccCheckUserExists(ctx, resourceName, &user), resource.TestCheckResourceAttr(resourceName, "user_id", rName), resource.TestCheckResourceAttr(resourceName, "no_password_required", "false"), - resource.TestCheckResourceAttr(resourceName, "user_name", "username1"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "username1"), resource.TestCheckResourceAttr(resourceName, "engine", "redis"), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.tagKey", "tagVal"), @@ -260,7 +260,7 @@ func TestAccElastiCacheUser_tags(t *testing.T) { testAccCheckUserExists(ctx, resourceName, &user), resource.TestCheckResourceAttr(resourceName, "user_id", rName), resource.TestCheckResourceAttr(resourceName, "no_password_required", "false"), - resource.TestCheckResourceAttr(resourceName, "user_name", "username1"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "username1"), resource.TestCheckResourceAttr(resourceName, "engine", "redis"), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.tagKey", "tagVal2"), @@ -272,7 +272,7 @@ func TestAccElastiCacheUser_tags(t *testing.T) { testAccCheckUserExists(ctx, resourceName, &user), resource.TestCheckResourceAttr(resourceName, "user_id", rName), resource.TestCheckResourceAttr(resourceName, "no_password_required", "false"), - resource.TestCheckResourceAttr(resourceName, "user_name", "username1"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "username1"), resource.TestCheckResourceAttr(resourceName, "engine", "redis"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), From c39e43df4fb04df50d650fe5942858382c3d14a5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:29 -0400 Subject: [PATCH 1447/1490] elasticbeanstalk: Use constants for strings --- internal/service/elasticbeanstalk/environment.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/elasticbeanstalk/environment.go b/internal/service/elasticbeanstalk/environment.go index 9dbf0983511..d0bb39ddde4 100644 --- a/internal/service/elasticbeanstalk/environment.go +++ b/internal/service/elasticbeanstalk/environment.go @@ -43,7 +43,7 @@ func settingSchema() *schema.Resource { Type: schema.TypeString, Required: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, }, @@ -386,7 +386,7 @@ func resourceEnvironmentRead(ctx context.Context, d *schema.ResourceData, meta i m := map[string]interface{}{} if optionSetting.Namespace != nil { - m["namespace"] = aws.ToString(optionSetting.Namespace) + m[names.AttrNamespace] = aws.ToString(optionSetting.Namespace) } if optionSetting.OptionName != nil { @@ -784,7 +784,7 @@ func waitEnvironmentDeleted(ctx context.Context, conn *elasticbeanstalk.Client, // as they become overridden from within the template func optionSettingValueHash(v interface{}) int { rd := v.(map[string]interface{}) - namespace := rd["namespace"].(string) + namespace := rd[names.AttrNamespace].(string) optionName := rd[names.AttrName].(string) var resourceName string if v, ok := rd["resource"].(string); ok { @@ -799,7 +799,7 @@ func optionSettingValueHash(v interface{}) int { func optionSettingKeyHash(v interface{}) int { rd := v.(map[string]interface{}) - namespace := rd["namespace"].(string) + namespace := rd[names.AttrNamespace].(string) optionName := rd[names.AttrName].(string) var resourceName string if v, ok := rd["resource"].(string); ok { @@ -822,7 +822,7 @@ func extractOptionSettings(s *schema.Set) []awstypes.ConfigurationOptionSetting if s != nil { for _, setting := range s.List() { optionSetting := awstypes.ConfigurationOptionSetting{ - Namespace: aws.String(setting.(map[string]interface{})["namespace"].(string)), + Namespace: aws.String(setting.(map[string]interface{})[names.AttrNamespace].(string)), OptionName: aws.String(setting.(map[string]interface{})[names.AttrName].(string)), Value: aws.String(setting.(map[string]interface{})[names.AttrValue].(string)), } From 6121348ccd95d896880662f2874441cdd9f57bc1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:29 -0400 Subject: [PATCH 1448/1490] elbv2: Use constants for strings --- internal/service/elbv2/listener.go | 10 +++++----- internal/service/elbv2/listener_data_source.go | 2 +- internal/service/elbv2/listener_rule.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/elbv2/listener.go b/internal/service/elbv2/listener.go index 12f37066430..c3733a283a6 100644 --- a/internal/service/elbv2/listener.go +++ b/internal/service/elbv2/listener.go @@ -191,7 +191,7 @@ func ResourceListener() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ @@ -836,7 +836,7 @@ func expandLbListenerFixedResponseConfig(l []interface{}) *awstypes.FixedRespons } return &awstypes.FixedResponseActionConfig{ - ContentType: aws.String(tfMap["content_type"].(string)), + ContentType: aws.String(tfMap[names.AttrContentType].(string)), MessageBody: aws.String(tfMap["message_body"].(string)), StatusCode: aws.String(tfMap["status_code"].(string)), } @@ -1118,9 +1118,9 @@ func flattenLbListenerActionFixedResponseConfig(config *awstypes.FixedResponseAc } m := map[string]interface{}{ - "content_type": aws.ToString(config.ContentType), - "message_body": aws.ToString(config.MessageBody), - "status_code": aws.ToString(config.StatusCode), + names.AttrContentType: aws.ToString(config.ContentType), + "message_body": aws.ToString(config.MessageBody), + "status_code": aws.ToString(config.StatusCode), } return []interface{}{m} diff --git a/internal/service/elbv2/listener_data_source.go b/internal/service/elbv2/listener_data_source.go index 33fe67f8dd2..52dc29b4d9f 100644 --- a/internal/service/elbv2/listener_data_source.go +++ b/internal/service/elbv2/listener_data_source.go @@ -153,7 +153,7 @@ func DataSourceListener() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/elbv2/listener_rule.go b/internal/service/elbv2/listener_rule.go index e93aed3fdf1..b9b6b3eab08 100644 --- a/internal/service/elbv2/listener_rule.go +++ b/internal/service/elbv2/listener_rule.go @@ -214,7 +214,7 @@ func ResourceListenerRule() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice([]string{ From 79895d6bd77ae35b7c942dcad44159a127f18786 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:29 -0400 Subject: [PATCH 1449/1490] emrcontainers: Use constants for strings --- internal/service/emrcontainers/job_template.go | 4 ++-- internal/service/emrcontainers/virtual_cluster.go | 6 +++--- .../service/emrcontainers/virtual_cluster_data_source.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/emrcontainers/job_template.go b/internal/service/emrcontainers/job_template.go index 0e8bf1d2c94..d4e0ed52d98 100644 --- a/internal/service/emrcontainers/job_template.go +++ b/internal/service/emrcontainers/job_template.go @@ -116,7 +116,7 @@ func ResourceJobTemplate() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -672,7 +672,7 @@ func flattenCloudWatchMonitoringConfiguration(apiObject *emrcontainers.Parametri tfMap := map[string]interface{}{} if v := apiObject.LogGroupName; v != nil { - tfMap["log_group_name"] = aws.StringValue(v) + tfMap[names.AttrLogGroupName] = aws.StringValue(v) } if v := apiObject.LogStreamNamePrefix; v != nil { diff --git a/internal/service/emrcontainers/virtual_cluster.go b/internal/service/emrcontainers/virtual_cluster.go index f7ebf2ed9fc..8f85f7ac99f 100644 --- a/internal/service/emrcontainers/virtual_cluster.go +++ b/internal/service/emrcontainers/virtual_cluster.go @@ -74,7 +74,7 @@ func ResourceVirtualCluster() *schema.Resource { ForceNew: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -252,7 +252,7 @@ func expandEKSInfo(tfMap map[string]interface{}) *emrcontainers.EksInfo { apiObject := &emrcontainers.EksInfo{} - if v, ok := tfMap["namespace"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrNamespace].(string); ok && v != "" { apiObject.Namespace = aws.String(v) } @@ -303,7 +303,7 @@ func flattenEKSInfo(apiObject *emrcontainers.EksInfo) map[string]interface{} { tfMap := map[string]interface{}{} if v := apiObject.Namespace; v != nil { - tfMap["namespace"] = aws.StringValue(v) + tfMap[names.AttrNamespace] = aws.StringValue(v) } return tfMap diff --git a/internal/service/emrcontainers/virtual_cluster_data_source.go b/internal/service/emrcontainers/virtual_cluster_data_source.go index 3a064d53bef..0781a864ba7 100644 --- a/internal/service/emrcontainers/virtual_cluster_data_source.go +++ b/internal/service/emrcontainers/virtual_cluster_data_source.go @@ -44,7 +44,7 @@ func DataSourceVirtualCluster() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Computed: true, }, From aeee324718ae3774a57bd889ec9a983f01647fa0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:29 -0400 Subject: [PATCH 1450/1490] firehose: Use constants for strings --- internal/service/firehose/delivery_stream.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/firehose/delivery_stream.go b/internal/service/firehose/delivery_stream.go index 3f95d087369..c242b8d71bd 100644 --- a/internal/service/firehose/delivery_stream.go +++ b/internal/service/firehose/delivery_stream.go @@ -106,7 +106,7 @@ func resourceDeliveryStream() *schema.Resource { Optional: true, Default: false, }, - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Optional: true, }, @@ -675,7 +675,7 @@ func resourceDeliveryStream() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -2202,7 +2202,7 @@ func expandSchemaConfiguration(l []interface{}) *types.SchemaConfiguration { config := &types.SchemaConfiguration{ DatabaseName: aws.String(m[names.AttrDatabaseName].(string)), RoleARN: aws.String(m[names.AttrRoleARN].(string)), - TableName: aws.String(m["table_name"].(string)), + TableName: aws.String(m[names.AttrTableName].(string)), VersionId: aws.String(m["version_id"].(string)), } @@ -2333,7 +2333,7 @@ func expandCloudWatchLoggingOptions(s3 map[string]interface{}) *types.CloudWatch Enabled: aws.Bool(loggingConfig[names.AttrEnabled].(bool)), } - if v, ok := loggingConfig["log_group_name"]; ok { + if v, ok := loggingConfig[names.AttrLogGroupName]; ok { loggingOptions.LogGroupName = aws.String(v.(string)) } @@ -3210,7 +3210,7 @@ func flattenCloudWatchLoggingOptions(clo *types.CloudWatchLoggingOptions) []inte names.AttrEnabled: aws.ToBool(clo.Enabled), } if aws.ToBool(clo.Enabled) { - cloudwatchLoggingOptions["log_group_name"] = aws.ToString(clo.LogGroupName) + cloudwatchLoggingOptions[names.AttrLogGroupName] = aws.ToString(clo.LogGroupName) cloudwatchLoggingOptions["log_stream_name"] = aws.ToString(clo.LogStreamName) } return []interface{}{cloudwatchLoggingOptions} @@ -3699,7 +3699,7 @@ func flattenSchemaConfiguration(sc *types.SchemaConfiguration) []map[string]inte names.AttrDatabaseName: aws.ToString(sc.DatabaseName), names.AttrRegion: aws.ToString(sc.Region), names.AttrRoleARN: aws.ToString(sc.RoleARN), - "table_name": aws.ToString(sc.TableName), + names.AttrTableName: aws.ToString(sc.TableName), "version_id": aws.ToString(sc.VersionId), } From 7a587d211b3319e679ac3aea6e916e499036254d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:29 -0400 Subject: [PATCH 1451/1490] glue: Use constants for strings --- internal/service/glue/catalog_database.go | 6 +++--- internal/service/glue/data_quality_ruleset.go | 6 +++--- internal/service/glue/ml_transform.go | 6 +++--- internal/service/glue/partition.go | 6 +++--- internal/service/glue/partition_index.go | 6 +++--- internal/service/glue/partition_index_test.go | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/service/glue/catalog_database.go b/internal/service/glue/catalog_database.go index 92be69c06ad..d3ae76e8ccd 100644 --- a/internal/service/glue/catalog_database.go +++ b/internal/service/glue/catalog_database.go @@ -105,7 +105,7 @@ func ResourceCatalogDatabase() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Optional: true, }, @@ -354,7 +354,7 @@ func expandDatabaseFederatedDatabase(tfMap map[string]interface{}) *glue.Federat apiObject.ConnectionName = aws.String(v) } - if v, ok := tfMap["identifier"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrIdentifier].(string); ok && v != "" { apiObject.Identifier = aws.String(v) } @@ -395,7 +395,7 @@ func flattenDatabaseFederatedDatabase(apiObject *glue.FederatedDatabase) map[str } if v := apiObject.Identifier; v != nil { - tfMap["identifier"] = aws.StringValue(v) + tfMap[names.AttrIdentifier] = aws.StringValue(v) } return tfMap diff --git a/internal/service/glue/data_quality_ruleset.go b/internal/service/glue/data_quality_ruleset.go index 21310d12a40..fe7a9cd7042 100644 --- a/internal/service/glue/data_quality_ruleset.go +++ b/internal/service/glue/data_quality_ruleset.go @@ -90,7 +90,7 @@ func ResourceDataQualityRuleset() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -222,7 +222,7 @@ func expandTargetTable(tfMap map[string]interface{}) *glue.DataQualityTargetTabl apiObject := &glue.DataQualityTargetTable{ DatabaseName: aws.String(tfMap[names.AttrDatabaseName].(string)), - TableName: aws.String(tfMap["table_name"].(string)), + TableName: aws.String(tfMap[names.AttrTableName].(string)), } if v, ok := tfMap[names.AttrCatalogID].(string); ok && v != "" { @@ -239,7 +239,7 @@ func flattenTargetTable(apiObject *glue.DataQualityTargetTable) []interface{} { tfMap := map[string]interface{}{ names.AttrDatabaseName: aws.StringValue(apiObject.DatabaseName), - "table_name": aws.StringValue(apiObject.TableName), + names.AttrTableName: aws.StringValue(apiObject.TableName), } if v := apiObject.CatalogId; v != nil { diff --git a/internal/service/glue/ml_transform.go b/internal/service/glue/ml_transform.go index 474a74841b8..56d18737725 100644 --- a/internal/service/glue/ml_transform.go +++ b/internal/service/glue/ml_transform.go @@ -51,7 +51,7 @@ func ResourceMLTransform() *schema.Resource { Type: schema.TypeString, Required: true, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -380,7 +380,7 @@ func expandMLTransformInputRecordTables(l []interface{}) []*glue.Table { table := &glue.Table{} - if v, ok := m["table_name"].(string); ok { + if v, ok := m[names.AttrTableName].(string); ok { table.TableName = aws.String(v) } @@ -407,7 +407,7 @@ func flattenMLTransformInputRecordTables(tables []*glue.Table) []interface{} { for _, table := range tables { m := map[string]interface{}{ - "table_name": aws.StringValue(table.TableName), + names.AttrTableName: aws.StringValue(table.TableName), names.AttrDatabaseName: aws.StringValue(table.DatabaseName), } diff --git a/internal/service/glue/partition.go b/internal/service/glue/partition.go index 99f2e53b613..c7f29e8b4f4 100644 --- a/internal/service/glue/partition.go +++ b/internal/service/glue/partition.go @@ -44,7 +44,7 @@ func ResourcePartition() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, ForceNew: true, Required: true, @@ -210,7 +210,7 @@ func resourcePartitionCreate(ctx context.Context, d *schema.ResourceData, meta i conn := meta.(*conns.AWSClient).GlueConn(ctx) catalogID := createCatalogID(d, meta.(*conns.AWSClient).AccountID) dbName := d.Get(names.AttrDatabaseName).(string) - tableName := d.Get("table_name").(string) + tableName := d.Get(names.AttrTableName).(string) values := d.Get("partition_values").([]interface{}) input := &glue.CreatePartitionInput{ @@ -246,7 +246,7 @@ func resourcePartitionRead(ctx context.Context, d *schema.ResourceData, meta int return sdkdiag.AppendErrorf(diags, "reading Glue Partition: %s", err) } - d.Set("table_name", partition.TableName) + d.Set(names.AttrTableName, partition.TableName) d.Set(names.AttrCatalogID, partition.CatalogId) d.Set(names.AttrDatabaseName, partition.DatabaseName) d.Set("partition_values", flex.FlattenStringList(partition.Values)) diff --git a/internal/service/glue/partition_index.go b/internal/service/glue/partition_index.go index 2f8f92278eb..372a0f6a8a9 100644 --- a/internal/service/glue/partition_index.go +++ b/internal/service/glue/partition_index.go @@ -44,7 +44,7 @@ func ResourcePartitionIndex() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(1, 255), }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, ForceNew: true, Required: true, @@ -89,7 +89,7 @@ func resourcePartitionIndexCreate(ctx context.Context, d *schema.ResourceData, m conn := meta.(*conns.AWSClient).GlueConn(ctx) catalogID := createCatalogID(d, meta.(*conns.AWSClient).AccountID) dbName := d.Get(names.AttrDatabaseName).(string) - tableName := d.Get("table_name").(string) + tableName := d.Get(names.AttrTableName).(string) input := &glue.CreatePartitionIndexInput{ CatalogId: aws.String(catalogID), @@ -134,7 +134,7 @@ func resourcePartitionIndexRead(ctx context.Context, d *schema.ResourceData, met return sdkdiag.AppendErrorf(diags, "reading Glue Partition Index (%s): %s", d.Id(), err) } - d.Set("table_name", tableName) + d.Set(names.AttrTableName, tableName) d.Set(names.AttrCatalogID, catalogID) d.Set(names.AttrDatabaseName, dbName) diff --git a/internal/service/glue/partition_index_test.go b/internal/service/glue/partition_index_test.go index 94074875106..b4b33ca8139 100644 --- a/internal/service/glue/partition_index_test.go +++ b/internal/service/glue/partition_index_test.go @@ -35,7 +35,7 @@ func TestAccGluePartitionIndex_basic(t *testing.T) { Destroy: false, Check: resource.ComposeTestCheckFunc( testAccCheckPartitionIndexExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "table_name", "aws_glue_catalog_table.test", names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrTableName, "aws_glue_catalog_table.test", names.AttrName), resource.TestCheckResourceAttrPair(resourceName, names.AttrDatabaseName, "aws_glue_catalog_database.test", names.AttrName), resource.TestCheckResourceAttr(resourceName, "partition_index.#", "1"), resource.TestCheckResourceAttr(resourceName, "partition_index.0.index_name", rName), From 40d18da82b971cdcae6af4ed736a612b1e2781f3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:29 -0400 Subject: [PATCH 1452/1490] iam: Use constants for strings --- internal/service/iam/group_data_source.go | 4 ++-- .../service/iam/service_specific_credential.go | 16 ++++++++-------- .../iam/service_specific_credential_test.go | 12 ++++++------ internal/service/iam/signing_certificate.go | 8 ++++---- internal/service/iam/signing_certificate_test.go | 2 +- internal/service/iam/sweep.go | 8 ++++---- internal/service/iam/user_data_source.go | 4 ++-- internal/service/iam/user_data_source_test.go | 2 +- internal/service/iam/virtual_mfa_device.go | 6 +++--- internal/service/iam/virtual_mfa_device_test.go | 2 +- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/internal/service/iam/group_data_source.go b/internal/service/iam/group_data_source.go index d78932cfc7f..e8c1ac9211f 100644 --- a/internal/service/iam/group_data_source.go +++ b/internal/service/iam/group_data_source.go @@ -51,7 +51,7 @@ func dataSourceGroup() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Computed: true, }, @@ -113,7 +113,7 @@ func dataSourceGroupUsersRead(iamUsers []awstypes.User) []map[string]interface{} u := make(map[string]interface{}) u[names.AttrARN] = aws.ToString(i.Arn) u["user_id"] = aws.ToString(i.UserId) - u["user_name"] = aws.ToString(i.UserName) + u[names.AttrUserName] = aws.ToString(i.UserName) u[names.AttrPath] = aws.ToString(i.Path) users = append(users, u) } diff --git a/internal/service/iam/service_specific_credential.go b/internal/service/iam/service_specific_credential.go index 034fe54c5d4..c11bda5ab1c 100644 --- a/internal/service/iam/service_specific_credential.go +++ b/internal/service/iam/service_specific_credential.go @@ -35,12 +35,12 @@ func resourceServiceSpecificCredential() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Required: true, ForceNew: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -74,8 +74,8 @@ func resourceServiceSpecificCredentialCreate(ctx context.Context, d *schema.Reso conn := meta.(*conns.AWSClient).IAMClient(ctx) input := &iam.CreateServiceSpecificCredentialInput{ - ServiceName: aws.String(d.Get("service_name").(string)), - UserName: aws.String(d.Get("user_name").(string)), + ServiceName: aws.String(d.Get(names.AttrServiceName).(string)), + UserName: aws.String(d.Get(names.AttrUserName).(string)), } out, err := conn.CreateServiceSpecificCredential(ctx, input) @@ -131,8 +131,8 @@ func resourceServiceSpecificCredentialRead(ctx context.Context, d *schema.Resour d.Set("service_specific_credential_id", cred.ServiceSpecificCredentialId) d.Set("service_user_name", cred.ServiceUserName) - d.Set("service_name", cred.ServiceName) - d.Set("user_name", cred.UserName) + d.Set(names.AttrServiceName, cred.ServiceName) + d.Set(names.AttrUserName, cred.UserName) d.Set(names.AttrStatus, cred.Status) return diags @@ -144,7 +144,7 @@ func resourceServiceSpecificCredentialUpdate(ctx context.Context, d *schema.Reso request := &iam.UpdateServiceSpecificCredentialInput{ ServiceSpecificCredentialId: aws.String(d.Get("service_specific_credential_id").(string)), - UserName: aws.String(d.Get("user_name").(string)), + UserName: aws.String(d.Get(names.AttrUserName).(string)), Status: awstypes.StatusType(d.Get(names.AttrStatus).(string)), } _, err := conn.UpdateServiceSpecificCredential(ctx, request) @@ -161,7 +161,7 @@ func resourceServiceSpecificCredentialDelete(ctx context.Context, d *schema.Reso request := &iam.DeleteServiceSpecificCredentialInput{ ServiceSpecificCredentialId: aws.String(d.Get("service_specific_credential_id").(string)), - UserName: aws.String(d.Get("user_name").(string)), + UserName: aws.String(d.Get(names.AttrUserName).(string)), } if _, err := conn.DeleteServiceSpecificCredential(ctx, request); err != nil { diff --git a/internal/service/iam/service_specific_credential_test.go b/internal/service/iam/service_specific_credential_test.go index 86cb8397665..bdc45e3948c 100644 --- a/internal/service/iam/service_specific_credential_test.go +++ b/internal/service/iam/service_specific_credential_test.go @@ -36,8 +36,8 @@ func TestAccIAMServiceSpecificCredential_basic(t *testing.T) { Config: testAccServiceSpecificCredentialConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckServiceSpecificCredentialExists(ctx, resourceName, &cred), - resource.TestCheckResourceAttrPair(resourceName, "user_name", "aws_iam_user.test", names.AttrName), - resource.TestCheckResourceAttr(resourceName, "service_name", "codecommit.amazonaws.com"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrUserName, "aws_iam_user.test", names.AttrName), + resource.TestCheckResourceAttr(resourceName, names.AttrServiceName, "codecommit.amazonaws.com"), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, "Active"), resource.TestCheckResourceAttrSet(resourceName, "service_user_name"), resource.TestCheckResourceAttrSet(resourceName, "service_specific_credential_id"), @@ -71,13 +71,13 @@ func TestAccIAMServiceSpecificCredential_multi(t *testing.T) { Config: testAccServiceSpecificCredentialConfig_multi(rName), Check: resource.ComposeTestCheckFunc( testAccCheckServiceSpecificCredentialExists(ctx, resourceName, &cred), - resource.TestCheckResourceAttrPair(resourceName, "user_name", "aws_iam_user.test", names.AttrName), - resource.TestCheckResourceAttr(resourceName, "service_name", "codecommit.amazonaws.com"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrUserName, "aws_iam_user.test", names.AttrName), + resource.TestCheckResourceAttr(resourceName, names.AttrServiceName, "codecommit.amazonaws.com"), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, "Active"), resource.TestCheckResourceAttrSet(resourceName, "service_user_name"), resource.TestCheckResourceAttrSet(resourceName, "service_specific_credential_id"), - resource.TestCheckResourceAttrPair(resourceName2, "user_name", "aws_iam_user.test", names.AttrName), - resource.TestCheckResourceAttr(resourceName2, "service_name", "codecommit.amazonaws.com"), + resource.TestCheckResourceAttrPair(resourceName2, names.AttrUserName, "aws_iam_user.test", names.AttrName), + resource.TestCheckResourceAttr(resourceName2, names.AttrServiceName, "codecommit.amazonaws.com"), resource.TestCheckResourceAttr(resourceName2, names.AttrStatus, "Active"), resource.TestCheckResourceAttrSet(resourceName2, "service_user_name"), resource.TestCheckResourceAttrSet(resourceName2, "service_specific_credential_id"), diff --git a/internal/service/iam/signing_certificate.go b/internal/service/iam/signing_certificate.go index 03dc9c9e14a..0e582af2929 100644 --- a/internal/service/iam/signing_certificate.go +++ b/internal/service/iam/signing_certificate.go @@ -51,7 +51,7 @@ func resourceSigningCertificate() *schema.Resource { Default: awstypes.StatusTypeActive, ValidateDiagFunc: enum.Validate[awstypes.StatusType](), }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -66,7 +66,7 @@ func resourceSigningCertificateCreate(ctx context.Context, d *schema.ResourceDat createOpts := &iam.UploadSigningCertificateInput{ CertificateBody: aws.String(d.Get("certificate_body").(string)), - UserName: aws.String(d.Get("user_name").(string)), + UserName: aws.String(d.Get(names.AttrUserName).(string)), } resp, err := conn.UploadSigningCertificate(ctx, createOpts) @@ -81,7 +81,7 @@ func resourceSigningCertificateCreate(ctx context.Context, d *schema.ResourceDat if v, ok := d.GetOk(names.AttrStatus); ok && v.(string) != string(awstypes.StatusTypeActive) { updateInput := &iam.UpdateSigningCertificateInput{ CertificateId: certId, - UserName: aws.String(d.Get("user_name").(string)), + UserName: aws.String(d.Get(names.AttrUserName).(string)), Status: awstypes.StatusType(v.(string)), } @@ -121,7 +121,7 @@ func resourceSigningCertificateRead(ctx context.Context, d *schema.ResourceData, d.Set("certificate_body", resp.CertificateBody) d.Set("certificate_id", resp.CertificateId) - d.Set("user_name", resp.UserName) + d.Set(names.AttrUserName, resp.UserName) d.Set(names.AttrStatus, resp.Status) return diags diff --git a/internal/service/iam/signing_certificate_test.go b/internal/service/iam/signing_certificate_test.go index 6a8979e704c..07933e4d606 100644 --- a/internal/service/iam/signing_certificate_test.go +++ b/internal/service/iam/signing_certificate_test.go @@ -38,7 +38,7 @@ func TestAccIAMSigningCertificate_basic(t *testing.T) { Config: testAccSigningCertificateConfig_basic(rName, certificate), Check: resource.ComposeTestCheckFunc( testAccCheckSigningCertificateExists(ctx, resourceName, &cred), - resource.TestCheckResourceAttrPair(resourceName, "user_name", "aws_iam_user.test", names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrUserName, "aws_iam_user.test", names.AttrName), resource.TestCheckResourceAttrSet(resourceName, "certificate_id"), resource.TestCheckResourceAttrSet(resourceName, "certificate_body"), resource.TestCheckResourceAttr(resourceName, names.AttrStatus, "Active"), diff --git a/internal/service/iam/sweep.go b/internal/service/iam/sweep.go index 9c5d44d8485..b069b6049df 100644 --- a/internal/service/iam/sweep.go +++ b/internal/service/iam/sweep.go @@ -328,8 +328,8 @@ func sweepServiceSpecificCredentials(ctx context.Context, client *conns.AWSClien }) if err != nil { tflog.Warn(ctx, "Skipping resource", map[string]any{ - "error": err.Error(), - "user_name": user.UserName, + "error": err.Error(), + names.AttrUserName: user.UserName, }) continue } @@ -785,8 +785,8 @@ func sweepSigningCertificates(ctx context.Context, client *conns.AWSClient) ([]s }) if err != nil { tflog.Warn(ctx, "Skipping resource", map[string]any{ - "error": err.Error(), - "user_name": user.UserName, + "error": err.Error(), + names.AttrUserName: user.UserName, }) continue } diff --git a/internal/service/iam/user_data_source.go b/internal/service/iam/user_data_source.go index 48f581b409d..8e67513d779 100644 --- a/internal/service/iam/user_data_source.go +++ b/internal/service/iam/user_data_source.go @@ -39,7 +39,7 @@ func dataSourceUser() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, }, @@ -53,7 +53,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf conn := meta.(*conns.AWSClient).IAMClient(ctx) ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig - userName := d.Get("user_name").(string) + userName := d.Get(names.AttrUserName).(string) req := &iam.GetUserInput{ UserName: aws.String(userName), } diff --git a/internal/service/iam/user_data_source_test.go b/internal/service/iam/user_data_source_test.go index 5cf0d396421..17741d09ad5 100644 --- a/internal/service/iam/user_data_source_test.go +++ b/internal/service/iam/user_data_source_test.go @@ -31,7 +31,7 @@ func TestAccIAMUserDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "user_id", resourceName, "unique_id"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrPath, resourceName, names.AttrPath), resource.TestCheckResourceAttr(dataSourceName, "permissions_boundary", ""), - resource.TestCheckResourceAttrPair(dataSourceName, "user_name", resourceName, names.AttrName), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUserName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrTags, resourceName, names.AttrTags), ), diff --git a/internal/service/iam/virtual_mfa_device.go b/internal/service/iam/virtual_mfa_device.go index c1d9e62d204..8f919bb9017 100644 --- a/internal/service/iam/virtual_mfa_device.go +++ b/internal/service/iam/virtual_mfa_device.go @@ -68,7 +68,7 @@ func resourceVirtualMFADevice() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Computed: true, }, @@ -167,7 +167,7 @@ func resourceVirtualMFADeviceRead(ctx context.Context, d *schema.ResourceData, m } if u := vMFA.User; u != nil { - d.Set("user_name", u.UserName) + d.Set(names.AttrUserName, u.UserName) } // The call above returns empty tags. @@ -193,7 +193,7 @@ func resourceVirtualMFADeviceDelete(ctx context.Context, d *schema.ResourceData, var diags diag.Diagnostics conn := meta.(*conns.AWSClient).IAMClient(ctx) - if v := d.Get("user_name"); v != "" { + if v := d.Get(names.AttrUserName); v != "" { _, err := conn.DeactivateMFADevice(ctx, &iam.DeactivateMFADeviceInput{ UserName: aws.String(v.(string)), SerialNumber: aws.String(d.Id()), diff --git a/internal/service/iam/virtual_mfa_device_test.go b/internal/service/iam/virtual_mfa_device_test.go index f4b91d1cf99..98ac5107362 100644 --- a/internal/service/iam/virtual_mfa_device_test.go +++ b/internal/service/iam/virtual_mfa_device_test.go @@ -42,7 +42,7 @@ func TestAccIAMVirtualMFADevice_basic(t *testing.T) { resource.TestCheckNoResourceAttr(resourceName, "enable_date"), resource.TestCheckResourceAttr(resourceName, names.AttrPath, "/"), resource.TestCheckResourceAttrSet(resourceName, "qr_code_png"), - resource.TestCheckNoResourceAttr(resourceName, "user_name"), + resource.TestCheckNoResourceAttr(resourceName, names.AttrUserName), ), }, { From 6907e7ffbe2a01eddd8d908f964809fcff15e8fa Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:30 -0400 Subject: [PATCH 1453/1490] identitystore: Use constants for strings --- internal/service/identitystore/user.go | 6 +++--- internal/service/identitystore/user_data_source.go | 6 +++--- .../service/identitystore/user_data_source_test.go | 12 ++++++------ internal/service/identitystore/user_test.go | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/identitystore/user.go b/internal/service/identitystore/user.go index fa120b52018..68eed366260 100644 --- a/internal/service/identitystore/user.go +++ b/internal/service/identitystore/user.go @@ -234,7 +234,7 @@ func ResourceUser() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -261,7 +261,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf in := &identitystore.CreateUserInput{ DisplayName: aws.String(d.Get(names.AttrDisplayName).(string)), IdentityStoreId: aws.String(d.Get("identity_store_id").(string)), - UserName: aws.String(d.Get("user_name").(string)), + UserName: aws.String(d.Get(names.AttrUserName).(string)), } if v, ok := d.GetOk("addresses"); ok && len(v.([]interface{})) > 0 { @@ -354,7 +354,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac d.Set("timezone", out.Timezone) d.Set("title", out.Title) d.Set("user_id", out.UserId) - d.Set("user_name", out.UserName) + d.Set(names.AttrUserName, out.UserName) d.Set("user_type", out.UserType) if err := d.Set("addresses", flattenAddresses(out.Addresses)); err != nil { diff --git a/internal/service/identitystore/user_data_source.go b/internal/service/identitystore/user_data_source.go index 9c3e8c6d963..81d81e60582 100644 --- a/internal/service/identitystore/user_data_source.go +++ b/internal/service/identitystore/user_data_source.go @@ -268,7 +268,7 @@ func DataSourceUser() *schema.Resource { AtLeastOneOf: []string{"alternate_identifier", names.AttrFilter, "user_id"}, ConflictsWith: []string{"alternate_identifier"}, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Computed: true, }, @@ -336,7 +336,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("timezone", user.Timezone) d.Set("title", user.Title) d.Set("user_id", user.UserId) - d.Set("user_name", user.UserName) + d.Set(names.AttrUserName, user.UserName) d.Set("user_type", user.UserType) if err := d.Set("addresses", flattenAddresses(user.Addresses)); err != nil { @@ -414,7 +414,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("timezone", user.Timezone) d.Set("title", user.Title) d.Set("user_id", user.UserId) - d.Set("user_name", user.UserName) + d.Set(names.AttrUserName, user.UserName) d.Set("user_type", user.UserType) if err := d.Set("addresses", flattenAddresses(user.Addresses)); err != nil { diff --git a/internal/service/identitystore/user_data_source_test.go b/internal/service/identitystore/user_data_source_test.go index ec9cd544378..6d9730a13f8 100644 --- a/internal/service/identitystore/user_data_source_test.go +++ b/internal/service/identitystore/user_data_source_test.go @@ -46,8 +46,8 @@ func TestAccIdentityStoreUserDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "timezone", resourceName, "timezone"), resource.TestCheckResourceAttrPair(dataSourceName, "title", resourceName, "title"), resource.TestCheckResourceAttrPair(dataSourceName, "user_id", resourceName, "user_id"), - resource.TestCheckResourceAttrPair(dataSourceName, "user_name", resourceName, "user_name"), - resource.TestCheckResourceAttr(dataSourceName, "user_name", name), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUserName, resourceName, names.AttrUserName), + resource.TestCheckResourceAttr(dataSourceName, names.AttrUserName, name), resource.TestCheckResourceAttrPair(dataSourceName, "user_type", resourceName, "user_type"), ), }, @@ -75,7 +75,7 @@ func TestAccIdentityStoreUserDataSource_filterUserName(t *testing.T) { Config: testAccUserDataSourceConfig_filterUserName(name, email), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "user_id", resourceName, "user_id"), - resource.TestCheckResourceAttr(dataSourceName, "user_name", name), + resource.TestCheckResourceAttr(dataSourceName, names.AttrUserName, name), ), }, }, @@ -102,7 +102,7 @@ func TestAccIdentityStoreUserDataSource_uniqueAttributeUserName(t *testing.T) { Config: testAccUserDataSourceConfig_uniqueAttributeUserName(name, email), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "user_id", resourceName, "user_id"), - resource.TestCheckResourceAttr(dataSourceName, "user_name", name), + resource.TestCheckResourceAttr(dataSourceName, names.AttrUserName, name), ), }, }, @@ -129,7 +129,7 @@ func TestAccIdentityStoreUserDataSource_email(t *testing.T) { Config: testAccUserDataSourceConfig_email(name, email), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "user_id", resourceName, "user_id"), - resource.TestCheckResourceAttr(dataSourceName, "user_name", name), + resource.TestCheckResourceAttr(dataSourceName, names.AttrUserName, name), ), }, }, @@ -156,7 +156,7 @@ func TestAccIdentityStoreUserDataSource_userID(t *testing.T) { Config: testAccUserDataSourceConfig_id(name, email), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "user_id", resourceName, "user_id"), - resource.TestCheckResourceAttrPair(dataSourceName, "user_name", resourceName, "user_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUserName, resourceName, names.AttrUserName), ), }, }, diff --git a/internal/service/identitystore/user_test.go b/internal/service/identitystore/user_test.go index 82e90e5cb9a..c4511b3d616 100644 --- a/internal/service/identitystore/user_test.go +++ b/internal/service/identitystore/user_test.go @@ -60,7 +60,7 @@ func TestAccIdentityStoreUser_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "timezone", ""), resource.TestCheckResourceAttr(resourceName, "title", ""), resource.TestCheckResourceAttrSet(resourceName, "user_id"), - resource.TestCheckResourceAttr(resourceName, "user_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, rName), resource.TestCheckResourceAttr(resourceName, "user_type", ""), ), }, From a0e43a0113edba38aab3ebead0a671ace7212867 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:30 -0400 Subject: [PATCH 1454/1490] imagebuilder: Use constants for strings --- .../imagebuilder/infrastructure_configuration.go | 16 ++++++++-------- .../infrastructure_configuration_data_source.go | 6 +++--- ...rastructure_configuration_data_source_test.go | 2 +- .../infrastructure_configuration_test.go | 6 +++--- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/service/imagebuilder/infrastructure_configuration.go b/internal/service/imagebuilder/infrastructure_configuration.go index 0bb0c5f6c66..593b3ae63ba 100644 --- a/internal/service/imagebuilder/infrastructure_configuration.go +++ b/internal/service/imagebuilder/infrastructure_configuration.go @@ -101,7 +101,7 @@ func ResourceInfrastructureConfiguration() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 1024), @@ -130,7 +130,7 @@ func ResourceInfrastructureConfiguration() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, @@ -199,7 +199,7 @@ func resourceInfrastructureConfigurationCreate(ctx context.Context, d *schema.Re input.SecurityGroupIds = flex.ExpandStringSet(v.(*schema.Set)) } - if v, ok := d.GetOk("sns_topic_arn"); ok { + if v, ok := d.GetOk(names.AttrSNSTopicARN); ok { input.SnsTopicArn = aws.String(v.(string)) } @@ -291,7 +291,7 @@ func resourceInfrastructureConfigurationRead(ctx context.Context, d *schema.Reso d.Set(names.AttrName, infrastructureConfiguration.Name) d.Set("resource_tags", KeyValueTags(ctx, infrastructureConfiguration.ResourceTags).Map()) d.Set(names.AttrSecurityGroupIDs, aws.StringValueSlice(infrastructureConfiguration.SecurityGroupIds)) - d.Set("sns_topic_arn", infrastructureConfiguration.SnsTopicArn) + d.Set(names.AttrSNSTopicARN, infrastructureConfiguration.SnsTopicArn) d.Set(names.AttrSubnetID, infrastructureConfiguration.SubnetId) setTagsOut(ctx, infrastructureConfiguration.Tags) @@ -314,7 +314,7 @@ func resourceInfrastructureConfigurationUpdate(ctx context.Context, d *schema.Re "logging", "resource_tags", names.AttrSecurityGroupIDs, - "sns_topic_arn", + names.AttrSNSTopicARN, names.AttrSubnetID, "terminate_instance_on_failure", ) { @@ -355,7 +355,7 @@ func resourceInfrastructureConfigurationUpdate(ctx context.Context, d *schema.Re input.SecurityGroupIds = flex.ExpandStringSet(v.(*schema.Set)) } - if v, ok := d.GetOk("sns_topic_arn"); ok { + if v, ok := d.GetOk(names.AttrSNSTopicARN); ok { input.SnsTopicArn = aws.String(v.(string)) } @@ -449,7 +449,7 @@ func expandS3Logs(tfMap map[string]interface{}) *imagebuilder.S3Logs { apiObject := &imagebuilder.S3Logs{} - if v, ok := tfMap["s3_bucket_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrS3BucketName].(string); ok && v != "" { apiObject.S3BucketName = aws.String(v) } @@ -500,7 +500,7 @@ func flattenS3Logs(apiObject *imagebuilder.S3Logs) map[string]interface{} { tfMap := map[string]interface{}{} if v := apiObject.S3BucketName; v != nil { - tfMap["s3_bucket_name"] = aws.StringValue(v) + tfMap[names.AttrS3BucketName] = aws.StringValue(v) } if v := apiObject.S3KeyPrefix; v != nil { diff --git a/internal/service/imagebuilder/infrastructure_configuration_data_source.go b/internal/service/imagebuilder/infrastructure_configuration_data_source.go index 3420cc76c51..e0c3fe3ae80 100644 --- a/internal/service/imagebuilder/infrastructure_configuration_data_source.go +++ b/internal/service/imagebuilder/infrastructure_configuration_data_source.go @@ -79,7 +79,7 @@ func DataSourceInfrastructureConfiguration() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Computed: true, }, @@ -103,7 +103,7 @@ func DataSourceInfrastructureConfiguration() *schema.Resource { Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, }, - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Computed: true, }, @@ -166,7 +166,7 @@ func dataSourceInfrastructureConfigurationRead(ctx context.Context, d *schema.Re d.Set(names.AttrName, infrastructureConfiguration.Name) d.Set("resource_tags", KeyValueTags(ctx, infrastructureConfiguration.ResourceTags).Map()) d.Set(names.AttrSecurityGroupIDs, aws.StringValueSlice(infrastructureConfiguration.SecurityGroupIds)) - d.Set("sns_topic_arn", infrastructureConfiguration.SnsTopicArn) + d.Set(names.AttrSNSTopicARN, infrastructureConfiguration.SnsTopicArn) d.Set(names.AttrSubnetID, infrastructureConfiguration.SubnetId) d.Set(names.AttrTags, KeyValueTags(ctx, infrastructureConfiguration.Tags).IgnoreAWS().IgnoreConfig(ignoreTagsConfig).Map()) d.Set("terminate_instance_on_failure", infrastructureConfiguration.TerminateInstanceOnFailure) diff --git a/internal/service/imagebuilder/infrastructure_configuration_data_source_test.go b/internal/service/imagebuilder/infrastructure_configuration_data_source_test.go index da2f69e300e..32bdbac4587 100644 --- a/internal/service/imagebuilder/infrastructure_configuration_data_source_test.go +++ b/internal/service/imagebuilder/infrastructure_configuration_data_source_test.go @@ -40,7 +40,7 @@ func TestAccImageBuilderInfrastructureConfigurationDataSource_arn(t *testing.T) resource.TestCheckResourceAttrPair(dataSourceName, names.AttrName, resourceName, names.AttrName), resource.TestCheckResourceAttrPair(dataSourceName, "resource_tags.%", resourceName, "resource_tags.%"), resource.TestCheckResourceAttrPair(dataSourceName, "security_group_ids.#", resourceName, "security_group_ids.#"), - resource.TestCheckResourceAttrPair(dataSourceName, "sns_topic_arn", resourceName, "sns_topic_arn"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrSNSTopicARN, resourceName, names.AttrSNSTopicARN), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrSubnetID, resourceName, names.AttrSubnetID), resource.TestCheckResourceAttrPair(dataSourceName, "tags.%", resourceName, "tags.%"), resource.TestCheckResourceAttrPair(dataSourceName, "terminate_instance_on_failure", resourceName, "terminate_instance_on_failure"), diff --git a/internal/service/imagebuilder/infrastructure_configuration_test.go b/internal/service/imagebuilder/infrastructure_configuration_test.go index 280fcf295ea..adc3e3eea34 100644 --- a/internal/service/imagebuilder/infrastructure_configuration_test.go +++ b/internal/service/imagebuilder/infrastructure_configuration_test.go @@ -48,7 +48,7 @@ func TestAccImageBuilderInfrastructureConfiguration_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, "resource_tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "security_group_ids.#", "0"), - resource.TestCheckResourceAttr(resourceName, "sns_topic_arn", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrSNSTopicARN, ""), resource.TestCheckResourceAttr(resourceName, names.AttrSubnetID, ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "terminate_instance_on_failure", "false"), @@ -441,7 +441,7 @@ func TestAccImageBuilderInfrastructureConfiguration_snsTopicARN(t *testing.T) { Config: testAccInfrastructureConfigurationConfig_snsTopicARN1(rName), Check: resource.ComposeTestCheckFunc( testAccCheckInfrastructureConfigurationExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "sns_topic_arn", snsTopicResourceName, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSNSTopicARN, snsTopicResourceName, names.AttrARN), ), }, { @@ -454,7 +454,7 @@ func TestAccImageBuilderInfrastructureConfiguration_snsTopicARN(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckInfrastructureConfigurationExists(ctx, resourceName), acctest.CheckResourceAttrRFC3339(resourceName, "date_updated"), - resource.TestCheckResourceAttrPair(resourceName, "sns_topic_arn", snsTopicResourceName2, names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSNSTopicARN, snsTopicResourceName2, names.AttrARN), ), }, }, From 26df952cbf5f12e6d9d423b19cabafafed5ed000 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:30 -0400 Subject: [PATCH 1455/1490] iot: Use constants for strings --- internal/service/iot/endpoint_data_source.go | 5 +-- internal/service/iot/topic_rule.go | 32 ++++++++--------- internal/service/iot/topic_rule_test.go | 36 ++++++++++---------- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/internal/service/iot/endpoint_data_source.go b/internal/service/iot/endpoint_data_source.go index a8299445e76..5d110fdbf63 100644 --- a/internal/service/iot/endpoint_data_source.go +++ b/internal/service/iot/endpoint_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_iot_endpoint") @@ -24,7 +25,7 @@ func DataSourceEndpoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ @@ -43,7 +44,7 @@ func dataSourceEndpointRead(ctx context.Context, d *schema.ResourceData, meta in conn := meta.(*conns.AWSClient).IoTConn(ctx) input := &iot.DescribeEndpointInput{} - if v, ok := d.GetOk("endpoint_type"); ok { + if v, ok := d.GetOk(names.AttrEndpointType); ok { input.EndpointType = aws.String(v.(string)) } diff --git a/internal/service/iot/topic_rule.go b/internal/service/iot/topic_rule.go index b36d815d48f..fe26aaa62a9 100644 --- a/internal/service/iot/topic_rule.go +++ b/internal/service/iot/topic_rule.go @@ -71,7 +71,7 @@ func ResourceTopicRule() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, }, @@ -168,7 +168,7 @@ func ResourceTopicRule() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -186,7 +186,7 @@ func ResourceTopicRule() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -275,7 +275,7 @@ func ResourceTopicRule() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, }, @@ -372,7 +372,7 @@ func ResourceTopicRule() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -392,7 +392,7 @@ func ResourceTopicRule() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -787,7 +787,7 @@ func ResourceTopicRule() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -1159,7 +1159,7 @@ func ResourceTopicRule() *schema.Resource { Required: true, ValidateFunc: verify.ValidARN, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -1406,7 +1406,7 @@ func expandPutItemInput(tfList []interface{}) *iot.PutItemInput { apiObject := &iot.PutItemInput{} tfMap := tfList[0].(map[string]interface{}) - if v, ok := tfMap["table_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrTableName].(string); ok && v != "" { apiObject.TableName = aws.String(v) } @@ -1448,7 +1448,7 @@ func expandCloudWatchLogsAction(tfList []interface{}) *iot.CloudwatchLogsAction apiObject := &iot.CloudwatchLogsAction{} tfMap := tfList[0].(map[string]interface{}) - if v, ok := tfMap["log_group_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrLogGroupName].(string); ok && v != "" { apiObject.LogGroupName = aws.String(v) } @@ -1538,7 +1538,7 @@ func expandDynamoDBAction(tfList []interface{}) *iot.DynamoDBAction { apiObject.RoleArn = aws.String(v) } - if v, ok := tfMap["table_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrTableName].(string); ok && v != "" { apiObject.TableName = aws.String(v) } @@ -1944,7 +1944,7 @@ func expandTimestreamAction(tfList []interface{}) *iot.TimestreamAction { apiObject.RoleArn = aws.String(v) } - if v, ok := tfMap["table_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrTableName].(string); ok && v != "" { apiObject.TableName = aws.String(v) } @@ -2476,7 +2476,7 @@ func flattenCloudWatchLogsAction(apiObject *iot.CloudwatchLogsAction) []interfac tfMap := make(map[string]interface{}) if v := apiObject.LogGroupName; v != nil { - tfMap["log_group_name"] = aws.StringValue(v) + tfMap[names.AttrLogGroupName] = aws.StringValue(v) } if v := apiObject.RoleArn; v != nil { @@ -2615,7 +2615,7 @@ func flattenDynamoDBAction(apiObject *iot.DynamoDBAction) []interface{} { } if v := apiObject.TableName; v != nil { - tfMap["table_name"] = aws.StringValue(v) + tfMap[names.AttrTableName] = aws.StringValue(v) } return []interface{}{tfMap} @@ -3027,7 +3027,7 @@ func flattenPutItemInput(apiObject *iot.PutItemInput) []interface{} { tfMap := make(map[string]interface{}) if v := apiObject.TableName; v != nil { - tfMap["table_name"] = aws.StringValue(v) + tfMap[names.AttrTableName] = aws.StringValue(v) } return []interface{}{tfMap} @@ -3269,7 +3269,7 @@ func flattenTimestreamAction(apiObject *iot.TimestreamAction) []interface{} { } if v := apiObject.TableName; v != nil { - tfMap["table_name"] = aws.StringValue(v) + tfMap[names.AttrTableName] = aws.StringValue(v) } if v := apiObject.Timestamp; v != nil { diff --git a/internal/service/iot/topic_rule_test.go b/internal/service/iot/topic_rule_test.go index 69646d4a99e..83565f75282 100644 --- a/internal/service/iot/topic_rule_test.go +++ b/internal/service/iot/topic_rule_test.go @@ -251,10 +251,10 @@ func TestAccIoTTopicRule_cloudWatchLogs(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "cloudwatch_alarm.#", "0"), resource.TestCheckResourceAttr(resourceName, "cloudwatch_logs.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "cloudwatch_logs.*", map[string]string{ - "log_group_name": "mylogs1", + names.AttrLogGroupName: "mylogs1", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "cloudwatch_logs.*", map[string]string{ - "log_group_name": "mylogs2", + names.AttrLogGroupName: "mylogs2", }), resource.TestCheckResourceAttr(resourceName, "cloudwatch_metric.#", "0"), resource.TestCheckResourceAttr(resourceName, "dynamodb.#", "0"), @@ -289,10 +289,10 @@ func TestAccIoTTopicRule_cloudWatchLogs(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "cloudwatch_alarm.#", "0"), resource.TestCheckResourceAttr(resourceName, "cloudwatch_logs.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "cloudwatch_logs.*", map[string]string{ - "log_group_name": "updatedlogs1", + names.AttrLogGroupName: "updatedlogs1", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "cloudwatch_logs.*", map[string]string{ - "log_group_name": "mylogs2", + names.AttrLogGroupName: "mylogs2", }), resource.TestCheckResourceAttr(resourceName, "cloudwatch_metric.#", "0"), resource.TestCheckResourceAttr(resourceName, "dynamodb.#", "0"), @@ -424,10 +424,10 @@ func TestAccIoTTopicRule_dynamoDB(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "Description1"), resource.TestCheckResourceAttr(resourceName, "dynamodb.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "dynamodb.*", map[string]string{ - "hash_key_field": "hkf", - "hash_key_value": "hkv", - "payload_field": "pf", - "table_name": "tn", + "hash_key_field": "hkf", + "hash_key_value": "hkv", + "payload_field": "pf", + names.AttrTableName: "tn", }), resource.TestCheckResourceAttr(resourceName, "dynamodbv2.#", "0"), resource.TestCheckResourceAttr(resourceName, "elasticsearch.#", "0"), @@ -462,14 +462,14 @@ func TestAccIoTTopicRule_dynamoDB(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "Description2"), resource.TestCheckResourceAttr(resourceName, "dynamodb.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "dynamodb.*", map[string]string{ - "hash_key_field": "hkf", - "hash_key_value": "hkv", - "operation": "INSERT", - "payload_field": "pf", - "range_key_field": "rkf", - "range_key_type": "STRING", - "range_key_value": "rkv", - "table_name": "tn", + "hash_key_field": "hkf", + "hash_key_value": "hkv", + "operation": "INSERT", + "payload_field": "pf", + "range_key_field": "rkf", + "range_key_type": "STRING", + "range_key_value": "rkv", + names.AttrTableName: "tn", }), resource.TestCheckResourceAttr(resourceName, "dynamodbv2.#", "0"), resource.TestCheckResourceAttr(resourceName, "elasticsearch.#", "0"), @@ -2102,7 +2102,7 @@ func TestAccIoTTopicRule_Timestream(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "timestream.*", map[string]string{ names.AttrDatabaseName: "TestDB", "dimension.#": "2", - "table_name": "test_table", + names.AttrTableName: "test_table", "timestamp.#": "1", "timestamp.0.unit": "MILLISECONDS", "timestamp.0.value": "${time}", @@ -2144,7 +2144,7 @@ func TestAccIoTTopicRule_Timestream(t *testing.T) { resource.TestCheckTypeSetElemNestedAttrs(resourceName, "timestream.*", map[string]string{ names.AttrDatabaseName: "TestDB", "dimension.#": "2", - "table_name": "test_table", + names.AttrTableName: "test_table", "timestamp.#": "1", "timestamp.0.unit": "MILLISECONDS", "timestamp.0.value": "${time}", From 4527ee111fa6cc61e9d03a921b841163233b57c0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:30 -0400 Subject: [PATCH 1456/1490] ivschat: Use constants for strings --- internal/service/ivschat/logging_configuration.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/ivschat/logging_configuration.go b/internal/service/ivschat/logging_configuration.go index 713db73dcfd..b911d23f160 100644 --- a/internal/service/ivschat/logging_configuration.go +++ b/internal/service/ivschat/logging_configuration.go @@ -70,7 +70,7 @@ func ResourceLoggingConfiguration() *schema.Resource { }, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_./#-]{1,512}$`), "must contain only lowercase alphanumeric characters, hyphen, dot, underscore, forward slash, or hash sign, and between 1 and 512 characters"), @@ -304,7 +304,7 @@ func flattenCloudWatchDestinationConfiguration(apiObject types.CloudWatchLogsDes m := map[string]interface{}{} if v := apiObject.LogGroupName; v != nil { - m["log_group_name"] = aws.ToString(v) + m[names.AttrLogGroupName] = aws.ToString(v) } return []interface{}{m} @@ -363,7 +363,7 @@ func expandCloudWatchLogsDestinationConfiguration(vSettings []interface{}) *type tfMap := vSettings[0].(map[string]interface{}) - if v, ok := tfMap["log_group_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrLogGroupName].(string); ok && v != "" { a.LogGroupName = aws.String(v) } From 894c17d5377f1a6b424fa3b46d6f77f2a870110d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:30 -0400 Subject: [PATCH 1457/1490] kafkaconnect: Use constants for strings --- internal/service/kafkaconnect/custom_plugin.go | 8 ++++---- internal/service/kafkaconnect/custom_plugin_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/kafkaconnect/custom_plugin.go b/internal/service/kafkaconnect/custom_plugin.go index 61089960f81..2babb5a40fc 100644 --- a/internal/service/kafkaconnect/custom_plugin.go +++ b/internal/service/kafkaconnect/custom_plugin.go @@ -42,7 +42,7 @@ func ResourceCustomPlugin() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -113,7 +113,7 @@ func resourceCustomPluginCreate(ctx context.Context, d *schema.ResourceData, met name := d.Get(names.AttrName).(string) input := &kafkaconnect.CreateCustomPluginInput{ - ContentType: aws.String(d.Get("content_type").(string)), + ContentType: aws.String(d.Get(names.AttrContentType).(string)), Location: expandCustomPluginLocation(d.Get("location").([]interface{})[0].(map[string]interface{})), Name: aws.String(name), } @@ -163,7 +163,7 @@ func resourceCustomPluginRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrState, plugin.CustomPluginState) if plugin.LatestRevision != nil { - d.Set("content_type", plugin.LatestRevision.ContentType) + d.Set(names.AttrContentType, plugin.LatestRevision.ContentType) d.Set("latest_revision", plugin.LatestRevision.Revision) if plugin.LatestRevision.Location != nil { if err := d.Set("location", []interface{}{flattenCustomPluginLocationDescription(plugin.LatestRevision.Location)}); err != nil { @@ -173,7 +173,7 @@ func resourceCustomPluginRead(ctx context.Context, d *schema.ResourceData, meta d.Set("location", nil) } } else { - d.Set("content_type", nil) + d.Set(names.AttrContentType, nil) d.Set("latest_revision", nil) d.Set("location", nil) } diff --git a/internal/service/kafkaconnect/custom_plugin_test.go b/internal/service/kafkaconnect/custom_plugin_test.go index afe4e103451..73c4beb9b8c 100644 --- a/internal/service/kafkaconnect/custom_plugin_test.go +++ b/internal/service/kafkaconnect/custom_plugin_test.go @@ -35,7 +35,7 @@ func TestAccKafkaConnectCustomPlugin_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckCustomPluginExists(ctx, resourceName), resource.TestCheckResourceAttrSet(resourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "content_type", "ZIP"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "ZIP"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), resource.TestCheckResourceAttrSet(resourceName, "latest_revision"), resource.TestCheckResourceAttr(resourceName, "location.#", "1"), From 3c4f9b9b3549efee689933c78f9d6a55bbe8fad0 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:31 -0400 Subject: [PATCH 1458/1490] kendra: Use constants for strings --- internal/service/kendra/experience.go | 4 ++-- internal/service/kendra/experience_data_source.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/kendra/experience.go b/internal/service/kendra/experience.go index b1b7570dbc7..ee53a551b91 100644 --- a/internal/service/kendra/experience.go +++ b/internal/service/kendra/experience.go @@ -133,7 +133,7 @@ func ResourceExperience() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Computed: true, }, @@ -496,7 +496,7 @@ func flattenEndpoints(apiObjects []types.ExperienceEndpoint) []interface{} { } if v := string(apiObject.EndpointType); v != "" { - m["endpoint_type"] = v + m[names.AttrEndpointType] = v } l = append(l, m) diff --git a/internal/service/kendra/experience_data_source.go b/internal/service/kendra/experience_data_source.go index fa2176913cd..d0e090564c3 100644 --- a/internal/service/kendra/experience_data_source.go +++ b/internal/service/kendra/experience_data_source.go @@ -91,7 +91,7 @@ func DataSourceExperience() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Computed: true, }, From 6cd481e8414c230f0f3455e1b776f1735f4382d9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:31 -0400 Subject: [PATCH 1459/1490] keyspaces: Use constants for strings --- internal/service/keyspaces/table.go | 6 +++--- internal/service/keyspaces/table_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/keyspaces/table.go b/internal/service/keyspaces/table.go index 11620c6a120..98282a17ed5 100644 --- a/internal/service/keyspaces/table.go +++ b/internal/service/keyspaces/table.go @@ -274,7 +274,7 @@ func resourceTable() *schema.Resource { }, }, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, ForceNew: true, Required: true, @@ -309,7 +309,7 @@ func resourceTableCreate(ctx context.Context, d *schema.ResourceData, meta inter conn := meta.(*conns.AWSClient).KeyspacesClient(ctx) keyspaceName := d.Get("keyspace_name").(string) - tableName := d.Get("table_name").(string) + tableName := d.Get(names.AttrTableName).(string) id := tableCreateResourceID(keyspaceName, tableName) input := &keyspaces.CreateTableInput{ KeyspaceName: aws.String(keyspaceName), @@ -432,7 +432,7 @@ func resourceTableRead(ctx context.Context, d *schema.ResourceData, meta interfa } else { d.Set("schema_definition", nil) } - d.Set("table_name", table.TableName) + d.Set(names.AttrTableName, table.TableName) if table.Ttl != nil { if err := d.Set("ttl", []interface{}{flattenTimeToLive(table.Ttl)}); err != nil { return sdkdiag.AppendErrorf(diags, "setting ttl: %s", err) diff --git a/internal/service/keyspaces/table_test.go b/internal/service/keyspaces/table_test.go index b917df2ef1d..63c01caf887 100644 --- a/internal/service/keyspaces/table_test.go +++ b/internal/service/keyspaces/table_test.go @@ -62,7 +62,7 @@ func TestAccKeyspacesTable_basic(t *testing.T) { names.AttrName: "message", }), resource.TestCheckResourceAttr(resourceName, "schema_definition.0.static_column.#", "0"), - resource.TestCheckResourceAttr(resourceName, "table_name", rName2), + resource.TestCheckResourceAttr(resourceName, names.AttrTableName, rName2), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "ttl.#", "0"), ), @@ -305,7 +305,7 @@ func TestAccKeyspacesTable_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "point_in_time_recovery.#", "1"), resource.TestCheckResourceAttr(resourceName, "point_in_time_recovery.0.status", "ENABLED"), resource.TestCheckResourceAttr(resourceName, "schema_definition.#", "1"), - resource.TestCheckResourceAttr(resourceName, "table_name", rName2), + resource.TestCheckResourceAttr(resourceName, names.AttrTableName, rName2), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "ttl.#", "1"), resource.TestCheckResourceAttr(resourceName, "ttl.0.status", "ENABLED"), @@ -336,7 +336,7 @@ func TestAccKeyspacesTable_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "point_in_time_recovery.#", "1"), resource.TestCheckResourceAttr(resourceName, "point_in_time_recovery.0.status", "DISABLED"), resource.TestCheckResourceAttr(resourceName, "schema_definition.#", "1"), - resource.TestCheckResourceAttr(resourceName, "table_name", rName2), + resource.TestCheckResourceAttr(resourceName, names.AttrTableName, rName2), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "ttl.#", "1"), resource.TestCheckResourceAttr(resourceName, "ttl.0.status", "ENABLED"), From 64d57a9f105429934ce46219ba3c576f34bae040 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:31 -0400 Subject: [PATCH 1460/1490] kinesisanalytics: Use constants for strings --- internal/service/kinesisanalytics/application.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/kinesisanalytics/application.go b/internal/service/kinesisanalytics/application.go index 3acb835829a..f498b00ff79 100644 --- a/internal/service/kinesisanalytics/application.go +++ b/internal/service/kinesisanalytics/application.go @@ -592,7 +592,7 @@ func ResourceApplication() *schema.Resource { }, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 32), @@ -1672,7 +1672,7 @@ func expandReferenceDataSource(vReferenceDataSource []interface{}) *kinesisanaly referenceDataSource.S3ReferenceDataSource = s3ReferenceDataSource } - if vTableName, ok := mReferenceDataSource["table_name"].(string); ok && vTableName != "" { + if vTableName, ok := mReferenceDataSource[names.AttrTableName].(string); ok && vTableName != "" { referenceDataSource.TableName = aws.String(vTableName) } @@ -1714,7 +1714,7 @@ func expandReferenceDataSourceUpdate(vReferenceDataSource []interface{}) *kinesi referenceDataSourceUpdate.S3ReferenceDataSourceUpdate = s3ReferenceDataSourceUpdate } - if vTableName, ok := mReferenceDataSource["table_name"].(string); ok && vTableName != "" { + if vTableName, ok := mReferenceDataSource[names.AttrTableName].(string); ok && vTableName != "" { referenceDataSourceUpdate.TableNameUpdate = aws.String(vTableName) } @@ -1894,8 +1894,8 @@ func flattenReferenceDataSourceDescriptions(referenceDataSourceDescriptions []*k referenceDataSourceDescription := referenceDataSourceDescriptions[0] mReferenceDataSource := map[string]interface{}{ - names.AttrID: aws.StringValue(referenceDataSourceDescription.ReferenceId), - "table_name": aws.StringValue(referenceDataSourceDescription.TableName), + names.AttrID: aws.StringValue(referenceDataSourceDescription.ReferenceId), + names.AttrTableName: aws.StringValue(referenceDataSourceDescription.TableName), } if referenceSchema := referenceDataSourceDescription.ReferenceSchema; referenceSchema != nil { From 1631d32c76d2c5c85cf0bd127bfae7ca0f6c8f07 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:31 -0400 Subject: [PATCH 1461/1490] kinesisanalyticsv2: Use constants for strings --- internal/service/kinesisanalyticsv2/application.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/kinesisanalyticsv2/application.go b/internal/service/kinesisanalyticsv2/application.go index 2ca2253ed13..9b8fb980c03 100644 --- a/internal/service/kinesisanalyticsv2/application.go +++ b/internal/service/kinesisanalyticsv2/application.go @@ -785,7 +785,7 @@ func ResourceApplication() *schema.Resource { }, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 32), @@ -2366,7 +2366,7 @@ func expandReferenceDataSource(vReferenceDataSource []interface{}) *kinesisanaly referenceDataSource.S3ReferenceDataSource = s3ReferenceDataSource } - if vTableName, ok := mReferenceDataSource["table_name"].(string); ok && vTableName != "" { + if vTableName, ok := mReferenceDataSource[names.AttrTableName].(string); ok && vTableName != "" { referenceDataSource.TableName = aws.String(vTableName) } @@ -2405,7 +2405,7 @@ func expandReferenceDataSourceUpdate(vReferenceDataSource []interface{}) *kinesi referenceDataSourceUpdate.S3ReferenceDataSourceUpdate = s3ReferenceDataSourceUpdate } - if vTableName, ok := mReferenceDataSource["table_name"].(string); ok && vTableName != "" { + if vTableName, ok := mReferenceDataSource[names.AttrTableName].(string); ok && vTableName != "" { referenceDataSourceUpdate.TableNameUpdate = aws.String(vTableName) } @@ -2761,8 +2761,8 @@ func flattenApplicationConfigurationDescription(applicationConfigurationDescript referenceDataSourceDescription := referenceDataSourceDescriptions[0] mReferenceDataSource := map[string]interface{}{ - "reference_id": aws.StringValue(referenceDataSourceDescription.ReferenceId), - "table_name": aws.StringValue(referenceDataSourceDescription.TableName), + "reference_id": aws.StringValue(referenceDataSourceDescription.ReferenceId), + names.AttrTableName: aws.StringValue(referenceDataSourceDescription.TableName), } if referenceSchema := referenceDataSourceDescription.ReferenceSchema; referenceSchema != nil { From 1b102fde2499181a5094447035c94e3503bae44c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:31 -0400 Subject: [PATCH 1462/1490] lakeformation: Use constants for strings --- internal/service/lakeformation/data_cells_filter.go | 2 +- internal/service/lakeformation/permissions.go | 6 +++--- internal/service/lakeformation/permissions_data_source.go | 2 +- internal/service/lakeformation/permissions_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/lakeformation/data_cells_filter.go b/internal/service/lakeformation/data_cells_filter.go index 9b55883de03..e558f352a40 100644 --- a/internal/service/lakeformation/data_cells_filter.go +++ b/internal/service/lakeformation/data_cells_filter.go @@ -96,7 +96,7 @@ func (r *resourceDataCellsFilter) Schema(ctx context.Context, _ resource.SchemaR stringplanmodifier.RequiresReplace(), }, }, - "table_name": schema.StringAttribute{ + names.AttrTableName: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), diff --git a/internal/service/lakeformation/permissions.go b/internal/service/lakeformation/permissions.go index 56239f8348b..f67a5e69b54 100644 --- a/internal/service/lakeformation/permissions.go +++ b/internal/service/lakeformation/permissions.go @@ -77,7 +77,7 @@ func ResourcePermissions() *schema.Resource { Type: schema.TypeString, Required: true, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, @@ -879,7 +879,7 @@ func ExpandDataCellsFilter(in []interface{}) *awstypes.DataCellsFilterResource { out.TableCatalogId = aws.String(v) } - if v, ok := m["table_name"].(string); ok && v != "" { + if v, ok := m[names.AttrTableName].(string); ok && v != "" { out.TableName = aws.String(v) } @@ -895,7 +895,7 @@ func flattenDataCellsFilter(in *awstypes.DataCellsFilterResource) []interface{} names.AttrDatabaseName: aws.ToString(in.DatabaseName), names.AttrName: aws.ToString(in.Name), "table_catalog_id": aws.ToString(in.TableCatalogId), - "table_name": aws.ToString(in.TableName), + names.AttrTableName: aws.ToString(in.TableName), } return []interface{}{m} diff --git a/internal/service/lakeformation/permissions_data_source.go b/internal/service/lakeformation/permissions_data_source.go index c49be58eaa0..2614c2466d2 100644 --- a/internal/service/lakeformation/permissions_data_source.go +++ b/internal/service/lakeformation/permissions_data_source.go @@ -58,7 +58,7 @@ func DataSourcePermissions() *schema.Resource { Type: schema.TypeString, Required: true, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, }, diff --git a/internal/service/lakeformation/permissions_test.go b/internal/service/lakeformation/permissions_test.go index 78dd45512fa..bbccbd8cb0f 100644 --- a/internal/service/lakeformation/permissions_test.go +++ b/internal/service/lakeformation/permissions_test.go @@ -1041,7 +1041,7 @@ func permissionCountForResource(ctx context.Context, conn *lakeformation.Client, } if v := rs.Primary.Attributes["data_cells_filter.0.table_name"]; v != "" { - tfMap["table_name"] = v + tfMap[names.AttrTableName] = v } input.Resource.DataCellsFilter = tflakeformation.ExpandDataCellsFilter([]interface{}{tfMap}) From 1124b09194cca579061d0b6eeae6a2b0e21a8795 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:31 -0400 Subject: [PATCH 1463/1490] lexmodels: Use constants for strings --- internal/service/lexmodels/intent.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/lexmodels/intent.go b/internal/service/lexmodels/intent.go index 7b1549f0942..90083f8aeee 100644 --- a/internal/service/lexmodels/intent.go +++ b/internal/service/lexmodels/intent.go @@ -567,7 +567,7 @@ var messageResource = &schema.Resource{ Required: true, ValidateFunc: validation.StringLenBetween(1, 1000), }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringInSlice(lexmodelbuildingservice.ContentType_Values(), false), @@ -685,9 +685,9 @@ func expandFulfilmentActivity(rawObject interface{}) (activity *lexmodelbuilding func flattenMessages(messages []*lexmodelbuildingservice.Message) (flattenedMessages []map[string]interface{}) { for _, message := range messages { flattenedMessages = append(flattenedMessages, map[string]interface{}{ - "content": aws.StringValue(message.Content), - "content_type": aws.StringValue(message.ContentType), - "group_number": aws.Int64Value(message.GroupNumber), + "content": aws.StringValue(message.Content), + names.AttrContentType: aws.StringValue(message.ContentType), + "group_number": aws.Int64Value(message.GroupNumber), }) } @@ -708,7 +708,7 @@ func expandMessages(rawValues []interface{}) []*lexmodelbuildingservice.Message message := &lexmodelbuildingservice.Message{ Content: aws.String(value["content"].(string)), - ContentType: aws.String(value["content_type"].(string)), + ContentType: aws.String(value[names.AttrContentType].(string)), } if v, ok := value["group_number"]; ok && v != 0 { From 6a929d2113ec62278bc2e3c87663a9e22bbd6302 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:32 -0400 Subject: [PATCH 1464/1490] lexv2models: Use constants for strings --- internal/service/lexv2models/slot_type.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/service/lexv2models/slot_type.go b/internal/service/lexv2models/slot_type.go index 846be35395a..2c38765710a 100644 --- a/internal/service/lexv2models/slot_type.go +++ b/internal/service/lexv2models/slot_type.go @@ -145,7 +145,7 @@ func (r *resourceSlotType) Schema(ctx context.Context, req resource.SchemaReques CustomType: fwtypes.NewListNestedObjectTypeOf[Source](ctx), NestedObject: schema.NestedBlockObject{ Attributes: map[string]schema.Attribute{ - "s3_bucket_name": schema.StringAttribute{ + names.AttrS3BucketName: schema.StringAttribute{ Required: true, }, "s3_object_key": schema.StringAttribute{ From 94134551fce8490caed8763241d59407e186f6b8 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:32 -0400 Subject: [PATCH 1465/1490] lightsail: Use constants for strings --- internal/service/lightsail/container_service.go | 6 +++--- .../lightsail/container_service_deployment_version.go | 6 +++--- .../lightsail/container_service_deployment_version_test.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/lightsail/container_service.go b/internal/service/lightsail/container_service.go index 489714b6b56..c7ad2f49d41 100644 --- a/internal/service/lightsail/container_service.go +++ b/internal/service/lightsail/container_service.go @@ -95,7 +95,7 @@ func ResourceContainerService() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate": { + names.AttrCertificate: { Type: schema.TypeSet, Required: true, Elem: &schema.Resource{ @@ -335,7 +335,7 @@ func expandContainerServicePublicDomainNames(rawPublicDomainNames []interface{}) for _, rpdn := range rawPublicDomainNames { rpdnMap := rpdn.(map[string]interface{}) - rawCertificates := rpdnMap["certificate"].(*schema.Set).List() + rawCertificates := rpdnMap[names.AttrCertificate].(*schema.Set).List() for _, rc := range rawCertificates { rcMap := rc.(map[string]interface{}) @@ -432,7 +432,7 @@ func flattenContainerServicePublicDomainNames(domainNames map[string][]string) [ return []interface{}{ map[string]interface{}{ - "certificate": rawCertificates, + names.AttrCertificate: rawCertificates, }, } } diff --git a/internal/service/lightsail/container_service_deployment_version.go b/internal/service/lightsail/container_service_deployment_version.go index b6329a3c07c..e78bd4947a5 100644 --- a/internal/service/lightsail/container_service_deployment_version.go +++ b/internal/service/lightsail/container_service_deployment_version.go @@ -156,7 +156,7 @@ func ResourceContainerServiceDeploymentVersion() *schema.Resource { }, }, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -177,7 +177,7 @@ func resourceContainerServiceDeploymentVersionCreate(ctx context.Context, d *sch var diags diag.Diagnostics conn := meta.(*conns.AWSClient).LightsailClient(ctx) - serviceName := d.Get("service_name").(string) + serviceName := d.Get(names.AttrServiceName).(string) input := lightsail.CreateContainerServiceDeploymentInput{ ServiceName: aws.String(serviceName), @@ -234,7 +234,7 @@ func resourceContainerServiceDeploymentVersionRead(ctx context.Context, d *schem } d.Set(names.AttrCreatedAt, aws.ToTime(deployment.CreatedAt).Format(time.RFC3339)) - d.Set("service_name", serviceName) + d.Set(names.AttrServiceName, serviceName) d.Set(names.AttrState, deployment.State) d.Set(names.AttrVersion, deployment.Version) diff --git a/internal/service/lightsail/container_service_deployment_version_test.go b/internal/service/lightsail/container_service_deployment_version_test.go index c9a18240fe3..29a71fda662 100644 --- a/internal/service/lightsail/container_service_deployment_version_test.go +++ b/internal/service/lightsail/container_service_deployment_version_test.go @@ -128,7 +128,7 @@ func TestAccLightsailContainerServiceDeploymentVersion_container_basic(t *testin resource.TestCheckResourceAttr(resourceName, "container.0.command.#", "0"), resource.TestCheckResourceAttr(resourceName, "container.0.environment.%", "0"), resource.TestCheckResourceAttr(resourceName, "container.0.ports.%", "0"), - resource.TestCheckResourceAttrPair(resourceName, "service_name", "aws_lightsail_container_service.test", names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrServiceName, "aws_lightsail_container_service.test", names.AttrName), ), }, { From cbf360afffc2e8612faa879794409fc9eba1e0d5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:32 -0400 Subject: [PATCH 1466/1490] logs: Use constants for strings --- .../service/logs/data_protection_policy.go | 7 ++++--- .../logs/data_protection_policy_test.go | 2 +- internal/service/logs/metric_filter.go | 20 +++++++++---------- internal/service/logs/metric_filter_test.go | 12 +++++------ internal/service/logs/stream.go | 12 +++++------ internal/service/logs/stream_test.go | 6 +++--- internal/service/logs/subscription_filter.go | 12 +++++------ .../service/logs/subscription_filter_test.go | 8 ++++---- 8 files changed, 40 insertions(+), 39 deletions(-) diff --git a/internal/service/logs/data_protection_policy.go b/internal/service/logs/data_protection_policy.go index d5b4336571d..2b41f342164 100644 --- a/internal/service/logs/data_protection_policy.go +++ b/internal/service/logs/data_protection_policy.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_cloudwatch_log_data_protection_policy") @@ -35,7 +36,7 @@ func resourceDataProtectionPolicy() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -61,7 +62,7 @@ func resourceDataProtectionPolicyPut(ctx context.Context, d *schema.ResourceData conn := meta.(*conns.AWSClient).LogsClient(ctx) - logGroupName := d.Get("log_group_name").(string) + logGroupName := d.Get(names.AttrLogGroupName).(string) policy, err := structure.NormalizeJsonString(d.Get("policy_document").(string)) @@ -104,7 +105,7 @@ func resourceDataProtectionPolicyRead(ctx context.Context, d *schema.ResourceDat return sdkdiag.AppendErrorf(diags, "reading CloudWatch Logs Data Protection Policy (%s): %s", d.Id(), err) } - d.Set("log_group_name", output.LogGroupIdentifier) + d.Set(names.AttrLogGroupName, output.LogGroupIdentifier) policyToSet, err := verify.SecondJSONUnlessEquivalent(d.Get("policy_document").(string), aws.ToString(output.PolicyDocument)) diff --git a/internal/service/logs/data_protection_policy_test.go b/internal/service/logs/data_protection_policy_test.go index 4e96161be50..f487faa0ee3 100644 --- a/internal/service/logs/data_protection_policy_test.go +++ b/internal/service/logs/data_protection_policy_test.go @@ -35,7 +35,7 @@ func TestAccLogsDataProtectionPolicy_basic(t *testing.T) { Config: testAccDataProtectionPolicy_basic(name), Check: resource.ComposeTestCheckFunc( testAccCheckDataProtectionPolicyExists(ctx, resourceName, &policy), - resource.TestCheckResourceAttrPair(resourceName, "log_group_name", "aws_cloudwatch_log_group.test", names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrLogGroupName, "aws_cloudwatch_log_group.test", names.AttrName), //lintignore:AWSAT005 acctest.CheckResourceAttrEquivalentJSON(resourceName, "policy_document", fmt.Sprintf(` { diff --git a/internal/service/logs/metric_filter.go b/internal/service/logs/metric_filter.go index ffe697ec90f..404ce37d3df 100644 --- a/internal/service/logs/metric_filter.go +++ b/internal/service/logs/metric_filter.go @@ -40,7 +40,7 @@ func resourceMetricFilter() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -67,7 +67,7 @@ func resourceMetricFilter() *schema.Resource { Required: true, ValidateFunc: validLogMetricFilterTransformationName, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, ValidateFunc: validLogMetricFilterTransformationName, @@ -114,7 +114,7 @@ func resourceMetricFilterPut(ctx context.Context, d *schema.ResourceData, meta i conn := meta.(*conns.AWSClient).LogsClient(ctx) name := d.Get(names.AttrName).(string) - logGroupName := d.Get("log_group_name").(string) + logGroupName := d.Get(names.AttrLogGroupName).(string) input := &cloudwatchlogs.PutMetricFilterInput{ FilterName: aws.String(name), FilterPattern: aws.String(strings.TrimSpace(d.Get("pattern").(string))), @@ -147,7 +147,7 @@ func resourceMetricFilterRead(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).LogsClient(ctx) - mf, err := findMetricFilterByTwoPartKey(ctx, conn, d.Get("log_group_name").(string), d.Id()) + mf, err := findMetricFilterByTwoPartKey(ctx, conn, d.Get(names.AttrLogGroupName).(string), d.Id()) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] CloudWatch Logs Metric Filter (%s) not found, removing from state", d.Id()) @@ -159,7 +159,7 @@ func resourceMetricFilterRead(ctx context.Context, d *schema.ResourceData, meta return sdkdiag.AppendErrorf(diags, "reading CloudWatch Logs Metric Filter (%s): %s", d.Id(), err) } - d.Set("log_group_name", mf.LogGroupName) + d.Set(names.AttrLogGroupName, mf.LogGroupName) if err := d.Set("metric_transformation", flattenMetricTransformations(mf.MetricTransformations)); err != nil { return sdkdiag.AppendErrorf(diags, "setting metric_transformation: %s", err) } @@ -177,14 +177,14 @@ func resourceMetricFilterDelete(ctx context.Context, d *schema.ResourceData, met // Creating multiple filters on the same log group can sometimes cause // clashes, so use a mutex here (and on creation) to serialise actions on // log groups. - mutexKey := fmt.Sprintf(`log-group-%s`, d.Get(`log_group_name`)) + mutexKey := fmt.Sprintf(`log-group-%s`, d.Get(names.AttrLogGroupName)) conns.GlobalMutexKV.Lock(mutexKey) defer conns.GlobalMutexKV.Unlock(mutexKey) log.Printf("[INFO] Deleting CloudWatch Logs Metric Filter: %s", d.Id()) _, err := conn.DeleteMetricFilter(ctx, &cloudwatchlogs.DeleteMetricFilterInput{ FilterName: aws.String(d.Id()), - LogGroupName: aws.String(d.Get("log_group_name").(string)), + LogGroupName: aws.String(d.Get(names.AttrLogGroupName).(string)), }) if errs.IsA[*types.ResourceNotFoundException](err) { @@ -205,7 +205,7 @@ func resourceMetricFilterImport(d *schema.ResourceData, meta interface{}) ([]*sc } logGroupName := idParts[0] name := idParts[1] - d.Set("log_group_name", logGroupName) + d.Set(names.AttrLogGroupName, logGroupName) d.Set(names.AttrName, name) d.SetId(name) return []*schema.ResourceData{d}, nil @@ -263,7 +263,7 @@ func expandMetricTransformation(tfMap map[string]interface{}) *types.MetricTrans apiObject.MetricName = aws.String(v) } - if v, ok := tfMap["namespace"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrNamespace].(string); ok && v != "" { apiObject.MetricNamespace = aws.String(v) } @@ -322,7 +322,7 @@ func flattenMetricTransformation(apiObject types.MetricTransformation) map[strin } if v := apiObject.MetricNamespace; v != nil { - tfMap["namespace"] = aws.ToString(v) + tfMap[names.AttrNamespace] = aws.ToString(v) } if v := apiObject.MetricValue; v != nil { diff --git a/internal/service/logs/metric_filter_test.go b/internal/service/logs/metric_filter_test.go index 7825a5156b3..e5fa086e845 100644 --- a/internal/service/logs/metric_filter_test.go +++ b/internal/service/logs/metric_filter_test.go @@ -36,7 +36,7 @@ func TestAccLogsMetricFilter_basic(t *testing.T) { Config: testAccMetricFilterConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMetricFilterExists(ctx, resourceName, &mf), - resource.TestCheckResourceAttrPair(resourceName, "log_group_name", logGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrLogGroupName, logGroupResourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "metric_transformation.#", "1"), resource.TestCheckResourceAttr(resourceName, "metric_transformation.0.default_value", ""), resource.TestCheckResourceAttr(resourceName, "metric_transformation.0.dimensions.%", "0"), @@ -143,7 +143,7 @@ func TestAccLogsMetricFilter_update(t *testing.T) { Config: testAccMetricFilterConfig_allAttributes1(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMetricFilterExists(ctx, resourceName, &mf), - resource.TestCheckResourceAttrPair(resourceName, "log_group_name", logGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrLogGroupName, logGroupResourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "metric_transformation.#", "1"), resource.TestCheckResourceAttr(resourceName, "metric_transformation.0.default_value", "2.5"), resource.TestCheckResourceAttr(resourceName, "metric_transformation.0.dimensions.%", "0"), @@ -165,7 +165,7 @@ func TestAccLogsMetricFilter_update(t *testing.T) { Config: testAccMetricFilterConfig_allAttributes2(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMetricFilterExists(ctx, resourceName, &mf), - resource.TestCheckResourceAttrPair(resourceName, "log_group_name", logGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrLogGroupName, logGroupResourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, "metric_transformation.#", "1"), resource.TestCheckResourceAttr(resourceName, "metric_transformation.0.default_value", ""), resource.TestCheckResourceAttr(resourceName, "metric_transformation.0.dimensions.%", "3"), @@ -191,7 +191,7 @@ func testAccMetricFilterImportStateIdFunc(resourceName string) resource.ImportSt return "", fmt.Errorf("Not found: %s", resourceName) } - return rs.Primary.Attributes["log_group_name"] + ":" + rs.Primary.Attributes[names.AttrName], nil + return rs.Primary.Attributes[names.AttrLogGroupName] + ":" + rs.Primary.Attributes[names.AttrName], nil } } @@ -204,7 +204,7 @@ func testAccCheckMetricFilterExists(ctx context.Context, n string, v *types.Metr conn := acctest.Provider.Meta().(*conns.AWSClient).LogsClient(ctx) - output, err := tflogs.FindMetricFilterByTwoPartKey(ctx, conn, rs.Primary.Attributes["log_group_name"], rs.Primary.ID) + output, err := tflogs.FindMetricFilterByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrLogGroupName], rs.Primary.ID) if err != nil { return err @@ -225,7 +225,7 @@ func testAccCheckMetricFilterDestroy(ctx context.Context) resource.TestCheckFunc continue } - _, err := tflogs.FindMetricFilterByTwoPartKey(ctx, conn, rs.Primary.Attributes["log_group_name"], rs.Primary.ID) + _, err := tflogs.FindMetricFilterByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrLogGroupName], rs.Primary.ID) if tfresource.NotFound(err) { continue diff --git a/internal/service/logs/stream.go b/internal/service/logs/stream.go index 04643e1a94d..dfa90ffceea 100644 --- a/internal/service/logs/stream.go +++ b/internal/service/logs/stream.go @@ -39,7 +39,7 @@ func resourceStream() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -61,7 +61,7 @@ func resourceStreamCreate(ctx context.Context, d *schema.ResourceData, meta inte name := d.Get(names.AttrName).(string) input := &cloudwatchlogs.CreateLogStreamInput{ - LogGroupName: aws.String(d.Get("log_group_name").(string)), + LogGroupName: aws.String(d.Get(names.AttrLogGroupName).(string)), LogStreamName: aws.String(name), } @@ -74,7 +74,7 @@ func resourceStreamCreate(ctx context.Context, d *schema.ResourceData, meta inte d.SetId(name) _, err = tfresource.RetryWhenNotFound(ctx, propagationTimeout, func() (interface{}, error) { - return findLogStreamByTwoPartKey(ctx, conn, d.Get("log_group_name").(string), d.Id()) + return findLogStreamByTwoPartKey(ctx, conn, d.Get(names.AttrLogGroupName).(string), d.Id()) }) if err != nil { @@ -89,7 +89,7 @@ func resourceStreamRead(ctx context.Context, d *schema.ResourceData, meta interf conn := meta.(*conns.AWSClient).LogsClient(ctx) - ls, err := findLogStreamByTwoPartKey(ctx, conn, d.Get("log_group_name").(string), d.Id()) + ls, err := findLogStreamByTwoPartKey(ctx, conn, d.Get(names.AttrLogGroupName).(string), d.Id()) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] CloudWatch Logs Log Stream (%s) not found, removing from state", d.Id()) @@ -114,7 +114,7 @@ func resourceStreamDelete(ctx context.Context, d *schema.ResourceData, meta inte log.Printf("[INFO] Deleting CloudWatch Logs Log Stream: %s", d.Id()) _, err := conn.DeleteLogStream(ctx, &cloudwatchlogs.DeleteLogStreamInput{ - LogGroupName: aws.String(d.Get("log_group_name").(string)), + LogGroupName: aws.String(d.Get(names.AttrLogGroupName).(string)), LogStreamName: aws.String(d.Id()), }) @@ -139,7 +139,7 @@ func resourceStreamImport(d *schema.ResourceData, meta interface{}) ([]*schema.R logStreamName := parts[1] d.SetId(logStreamName) - d.Set("log_group_name", logGroupName) + d.Set(names.AttrLogGroupName, logGroupName) return []*schema.ResourceData{d}, nil } diff --git a/internal/service/logs/stream_test.go b/internal/service/logs/stream_test.go index 2771f204798..d5243a8dfb5 100644 --- a/internal/service/logs/stream_test.go +++ b/internal/service/logs/stream_test.go @@ -105,7 +105,7 @@ func testAccCheckStreamExists(ctx context.Context, n string, v *types.LogStream) conn := acctest.Provider.Meta().(*conns.AWSClient).LogsClient(ctx) - output, err := tflogs.FindLogStreamByTwoPartKey(ctx, conn, rs.Primary.Attributes["log_group_name"], rs.Primary.ID) + output, err := tflogs.FindLogStreamByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrLogGroupName], rs.Primary.ID) if err != nil { return err @@ -126,7 +126,7 @@ func testAccCheckStreamDestroy(ctx context.Context) resource.TestCheckFunc { continue } - _, err := tflogs.FindLogStreamByTwoPartKey(ctx, conn, rs.Primary.Attributes["log_group_name"], rs.Primary.ID) + _, err := tflogs.FindLogStreamByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrLogGroupName], rs.Primary.ID) if tfresource.NotFound(err) { continue @@ -150,7 +150,7 @@ func testAccStreamImportStateIdFunc(n string) resource.ImportStateIdFunc { return "", fmt.Errorf("Not Found: %s", n) } - return fmt.Sprintf("%s:%s", rs.Primary.Attributes["log_group_name"], rs.Primary.ID), nil + return fmt.Sprintf("%s:%s", rs.Primary.Attributes[names.AttrLogGroupName], rs.Primary.ID), nil } } diff --git a/internal/service/logs/subscription_filter.go b/internal/service/logs/subscription_filter.go index 5222e770165..39ddddd045b 100644 --- a/internal/service/logs/subscription_filter.go +++ b/internal/service/logs/subscription_filter.go @@ -58,7 +58,7 @@ func resourceSubscriptionFilter() *schema.Resource { Required: true, ValidateFunc: validation.StringLenBetween(0, 1024), }, - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -84,7 +84,7 @@ func resourceSubscriptionFilterPut(ctx context.Context, d *schema.ResourceData, conn := meta.(*conns.AWSClient).LogsClient(ctx) - logGroupName := d.Get("log_group_name").(string) + logGroupName := d.Get(names.AttrLogGroupName).(string) name := d.Get(names.AttrName).(string) input := &cloudwatchlogs.PutSubscriptionFilterInput{ DestinationArn: aws.String(d.Get(names.AttrDestinationARN).(string)), @@ -135,7 +135,7 @@ func resourceSubscriptionFilterRead(ctx context.Context, d *schema.ResourceData, conn := meta.(*conns.AWSClient).LogsClient(ctx) - subscriptionFilter, err := findSubscriptionFilterByTwoPartKey(ctx, conn, d.Get("log_group_name").(string), d.Get(names.AttrName).(string)) + subscriptionFilter, err := findSubscriptionFilterByTwoPartKey(ctx, conn, d.Get(names.AttrLogGroupName).(string), d.Get(names.AttrName).(string)) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] CloudWatch Logs Subscription Filter (%s) not found, removing from state", d.Id()) @@ -150,7 +150,7 @@ func resourceSubscriptionFilterRead(ctx context.Context, d *schema.ResourceData, d.Set(names.AttrDestinationARN, subscriptionFilter.DestinationArn) d.Set("distribution", subscriptionFilter.Distribution) d.Set("filter_pattern", subscriptionFilter.FilterPattern) - d.Set("log_group_name", subscriptionFilter.LogGroupName) + d.Set(names.AttrLogGroupName, subscriptionFilter.LogGroupName) d.Set(names.AttrName, subscriptionFilter.FilterName) d.Set(names.AttrRoleARN, subscriptionFilter.RoleArn) @@ -165,7 +165,7 @@ func resourceSubscriptionFilterDelete(ctx context.Context, d *schema.ResourceDat log.Printf("[INFO] Deleting CloudWatch Logs Subscription Filter: %s", d.Id()) _, err := conn.DeleteSubscriptionFilter(ctx, &cloudwatchlogs.DeleteSubscriptionFilterInput{ FilterName: aws.String(d.Get(names.AttrName).(string)), - LogGroupName: aws.String(d.Get("log_group_name").(string)), + LogGroupName: aws.String(d.Get(names.AttrLogGroupName).(string)), }) if errs.IsA[*types.ResourceNotFoundException](err) { @@ -188,7 +188,7 @@ func resourceSubscriptionFilterImport(d *schema.ResourceData, meta interface{}) logGroupName := idParts[0] filterNamePrefix := idParts[1] - d.Set("log_group_name", logGroupName) + d.Set(names.AttrLogGroupName, logGroupName) d.Set(names.AttrName, filterNamePrefix) d.SetId(subscriptionFilterID(filterNamePrefix)) diff --git a/internal/service/logs/subscription_filter_test.go b/internal/service/logs/subscription_filter_test.go index 4babd638ec8..d9d5ea445f3 100644 --- a/internal/service/logs/subscription_filter_test.go +++ b/internal/service/logs/subscription_filter_test.go @@ -40,7 +40,7 @@ func TestAccLogsSubscriptionFilter_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, names.AttrDestinationARN, lambdaFunctionResourceName, names.AttrARN), resource.TestCheckResourceAttr(resourceName, "distribution", "ByLogStream"), resource.TestCheckResourceAttr(resourceName, "filter_pattern", "logtype test"), - resource.TestCheckResourceAttrPair(resourceName, "log_group_name", logGroupResourceName, names.AttrName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrLogGroupName, logGroupResourceName, names.AttrName), resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), ), }, @@ -265,7 +265,7 @@ func testAccCheckSubscriptionFilterDestroy(ctx context.Context) resource.TestChe continue } - _, err := tflogs.FindSubscriptionFilterByTwoPartKey(ctx, conn, rs.Primary.Attributes["log_group_name"], rs.Primary.Attributes[names.AttrName]) + _, err := tflogs.FindSubscriptionFilterByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrLogGroupName], rs.Primary.Attributes[names.AttrName]) if tfresource.NotFound(err) { continue @@ -291,7 +291,7 @@ func testAccCheckSubscriptionFilterExists(ctx context.Context, n string, v *type conn := acctest.Provider.Meta().(*conns.AWSClient).LogsClient(ctx) - output, err := tflogs.FindSubscriptionFilterByTwoPartKey(ctx, conn, rs.Primary.Attributes["log_group_name"], rs.Primary.Attributes[names.AttrName]) + output, err := tflogs.FindSubscriptionFilterByTwoPartKey(ctx, conn, rs.Primary.Attributes[names.AttrLogGroupName], rs.Primary.Attributes[names.AttrName]) if err != nil { return err @@ -310,7 +310,7 @@ func testAccSubscriptionFilterImportStateIDFunc(resourceName string) resource.Im return "", fmt.Errorf("Not found: %s", resourceName) } - logGroupName := rs.Primary.Attributes["log_group_name"] + logGroupName := rs.Primary.Attributes[names.AttrLogGroupName] filterNamePrefix := rs.Primary.Attributes[names.AttrName] stateID := fmt.Sprintf("%s|%s", logGroupName, filterNamePrefix) From 53c84f51fefdcfad229f5cf128a1920bf5284839 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:32 -0400 Subject: [PATCH 1467/1490] medialive: Use constants for strings --- .../service/medialive/channel_encoder_settings_schema.go | 6 +++--- internal/service/medialive/multiplex_program.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index 9fe0215d125..6bb04ea689d 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -2872,7 +2872,7 @@ func m2tsSettingsSchema() *schema.Schema { Type: schema.TypeInt, Optional: true, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(1, 256), @@ -4859,7 +4859,7 @@ func expandM2tsDvbSdtSettings(tfList []interface{}) *types.DvbSdtSettings { if v, ok := m["rep_interval"].(int); ok && v != 0 { s.RepInterval = aws.Int32(int32(v)) } - if v, ok := m["service_name"].(string); ok && v != "" { + if v, ok := m[names.AttrServiceName].(string); ok && v != "" { s.ServiceName = aws.String(v) } if v, ok := m["service_provider_name"].(string); ok && v != "" { @@ -6225,7 +6225,7 @@ func flattenDvbSdtSettings(in *types.DvbSdtSettings) []interface{} { m := map[string]interface{}{ "output_sdt": string(in.OutputSdt), "rep_interval": int(aws.ToInt32(in.RepInterval)), - "service_name": aws.ToString(in.ServiceName), + names.AttrServiceName: aws.ToString(in.ServiceName), "service_provider_name": aws.ToString(in.ServiceProviderName), } diff --git a/internal/service/medialive/multiplex_program.go b/internal/service/medialive/multiplex_program.go index 5876c8be438..d6c588a6f0b 100644 --- a/internal/service/medialive/multiplex_program.go +++ b/internal/service/medialive/multiplex_program.go @@ -95,7 +95,7 @@ func (m *multiplexProgram) Schema(ctx context.Context, req resource.SchemaReques "provider_name": schema.StringAttribute{ Required: true, }, - "service_name": schema.StringAttribute{ + names.AttrServiceName: schema.StringAttribute{ Required: true, }, }, @@ -495,8 +495,8 @@ var ( } serviceDescriptorAttrs = map[string]attr.Type{ - "provider_name": types.StringType, - "service_name": types.StringType, + "provider_name": types.StringType, + names.AttrServiceName: types.StringType, } multiplexProgramSettingsAttrs = map[string]attr.Type{ @@ -534,7 +534,7 @@ func flattenServiceDescriptor(ctx context.Context, sd *mltypes.MultiplexProgramS attrs := map[string]attr.Value{} attrs["provider_name"] = flex.StringToFrameworkLegacy(ctx, sd.ProviderName) - attrs["service_name"] = flex.StringToFrameworkLegacy(ctx, sd.ServiceName) + attrs[names.AttrServiceName] = flex.StringToFrameworkLegacy(ctx, sd.ServiceName) vals := types.ObjectValueMust(serviceDescriptorAttrs, attrs) From cf5e0c74c5e5039a5d644320ff0bf861276f081f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:32 -0400 Subject: [PATCH 1468/1490] memorydb: Use constants for strings --- internal/service/memorydb/acl_test.go | 2 +- internal/service/memorydb/cluster.go | 12 ++++++------ internal/service/memorydb/cluster_data_source.go | 6 +++--- .../service/memorydb/cluster_data_source_test.go | 2 +- internal/service/memorydb/cluster_test.go | 10 +++++----- internal/service/memorydb/user.go | 6 +++--- internal/service/memorydb/user_data_source.go | 6 +++--- internal/service/memorydb/user_data_source_test.go | 4 ++-- internal/service/memorydb/user_test.go | 8 ++++---- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/internal/service/memorydb/acl_test.go b/internal/service/memorydb/acl_test.go index 8755371d9ce..4a7e4c3d333 100644 --- a/internal/service/memorydb/acl_test.go +++ b/internal/service/memorydb/acl_test.go @@ -40,7 +40,7 @@ func TestAccMemoryDBACL_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.Test", "test"), resource.TestCheckResourceAttr(resourceName, "user_names.#", "1"), - resource.TestCheckTypeSetElemAttrPair(resourceName, "user_names.*", "aws_memorydb_user.test.0", "user_name"), + resource.TestCheckTypeSetElemAttrPair(resourceName, "user_names.*", "aws_memorydb_user.test.0", names.AttrUserName), ), }, { diff --git a/internal/service/memorydb/cluster.go b/internal/service/memorydb/cluster.go index 431078c0f9b..90085d5c5b3 100644 --- a/internal/service/memorydb/cluster.go +++ b/internal/service/memorydb/cluster.go @@ -229,7 +229,7 @@ func ResourceCluster() *schema.Resource { Computed: true, ValidateFunc: verify.ValidOnceADayWindowFormat, }, - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, @@ -339,7 +339,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int input.SnapshotWindow = aws.String(v.(string)) } - if v, ok := d.GetOk("sns_topic_arn"); ok { + if v, ok := d.GetOk(names.AttrSNSTopicARN); ok { input.SnsTopicArn = aws.String(v.(string)) } @@ -436,8 +436,8 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int input.SnapshotWindow = aws.String(d.Get("snapshot_window").(string)) } - if d.HasChange("sns_topic_arn") { - v := d.Get("sns_topic_arn").(string) + if d.HasChange(names.AttrSNSTopicARN) { + v := d.Get(names.AttrSNSTopicARN).(string) input.SnsTopicArn = aws.String(v) @@ -542,9 +542,9 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("snapshot_window", cluster.SnapshotWindow) if aws.StringValue(cluster.SnsTopicStatus) == ClusterSNSTopicStatusActive { - d.Set("sns_topic_arn", cluster.SnsTopicArn) + d.Set(names.AttrSNSTopicARN, cluster.SnsTopicArn) } else { - d.Set("sns_topic_arn", "") + d.Set(names.AttrSNSTopicARN, "") } d.Set("subnet_group_name", cluster.SubnetGroupName) diff --git a/internal/service/memorydb/cluster_data_source.go b/internal/service/memorydb/cluster_data_source.go index edaaec6ae9e..e9737c43960 100644 --- a/internal/service/memorydb/cluster_data_source.go +++ b/internal/service/memorydb/cluster_data_source.go @@ -147,7 +147,7 @@ func DataSourceCluster() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Computed: true, }, @@ -229,9 +229,9 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("snapshot_window", cluster.SnapshotWindow) if aws.StringValue(cluster.SnsTopicStatus) == ClusterSNSTopicStatusActive { - d.Set("sns_topic_arn", cluster.SnsTopicArn) + d.Set(names.AttrSNSTopicARN, cluster.SnsTopicArn) } else { - d.Set("sns_topic_arn", "") + d.Set(names.AttrSNSTopicARN, "") } d.Set("subnet_group_name", cluster.SubnetGroupName) diff --git a/internal/service/memorydb/cluster_data_source_test.go b/internal/service/memorydb/cluster_data_source_test.go index f06e56344f3..e0548591529 100644 --- a/internal/service/memorydb/cluster_data_source_test.go +++ b/internal/service/memorydb/cluster_data_source_test.go @@ -58,7 +58,7 @@ func TestAccMemoryDBClusterDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "shards.0.nodes.0.endpoint.0.port", resourceName, "shards.0.nodes.0.endpoint.0.port"), resource.TestCheckResourceAttrPair(dataSourceName, "snapshot_retention_limit", resourceName, "snapshot_retention_limit"), resource.TestCheckResourceAttrPair(dataSourceName, "snapshot_window", resourceName, "snapshot_window"), - resource.TestCheckResourceAttrPair(dataSourceName, "sns_topic_arn", resourceName, "sns_topic_arn"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrSNSTopicARN, resourceName, names.AttrSNSTopicARN), resource.TestCheckResourceAttrPair(dataSourceName, "subnet_group_name", resourceName, "subnet_group_name"), resource.TestCheckResourceAttr(dataSourceName, "tags.%", "1"), resource.TestCheckResourceAttr(dataSourceName, "tags.Test", "test"), diff --git a/internal/service/memorydb/cluster_test.go b/internal/service/memorydb/cluster_test.go index 81922c6abc1..0fad5129b07 100644 --- a/internal/service/memorydb/cluster_test.go +++ b/internal/service/memorydb/cluster_test.go @@ -65,7 +65,7 @@ func TestAccMemoryDBCluster_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "shards.0.nodes.0.endpoint.0.port", "6379"), resource.TestCheckResourceAttr(resourceName, "snapshot_retention_limit", "7"), resource.TestCheckResourceAttrSet(resourceName, "snapshot_window"), - resource.TestCheckResourceAttr(resourceName, "sns_topic_arn", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrSNSTopicARN, ""), resource.TestCheckTypeSetElemAttrPair(resourceName, "subnet_group_name", "aws_memorydb_subnet_group.test", names.AttrID), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.Test", "test"), @@ -116,7 +116,7 @@ func TestAccMemoryDBCluster_defaults(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "security_group_ids.#", "0"), resource.TestCheckResourceAttr(resourceName, "snapshot_retention_limit", "0"), resource.TestCheckResourceAttrSet(resourceName, "snapshot_window"), - resource.TestCheckResourceAttr(resourceName, "sns_topic_arn", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrSNSTopicARN, ""), resource.TestCheckResourceAttr(resourceName, "subnet_group_name", "default"), // created automatically & matches the default vpc resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), resource.TestCheckResourceAttr(resourceName, "tls_enabled", "true"), @@ -951,7 +951,7 @@ func TestAccMemoryDBCluster_Update_snsTopicARN(t *testing.T) { Config: testAccClusterConfig_snsTopic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "sns_topic_arn", "aws_sns_topic.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSNSTopicARN, "aws_sns_topic.test", names.AttrARN), ), }, { @@ -963,7 +963,7 @@ func TestAccMemoryDBCluster_Update_snsTopicARN(t *testing.T) { Config: testAccClusterConfig_snsTopicNull(rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "sns_topic_arn", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrSNSTopicARN, ""), ), }, { @@ -975,7 +975,7 @@ func TestAccMemoryDBCluster_Update_snsTopicARN(t *testing.T) { Config: testAccClusterConfig_snsTopic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterExists(ctx, resourceName), - resource.TestCheckResourceAttrPair(resourceName, "sns_topic_arn", "aws_sns_topic.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSNSTopicARN, "aws_sns_topic.test", names.AttrARN), ), }, { diff --git a/internal/service/memorydb/user.go b/internal/service/memorydb/user.go index 4d5cde92215..688059531af 100644 --- a/internal/service/memorydb/user.go +++ b/internal/service/memorydb/user.go @@ -82,7 +82,7 @@ func ResourceUser() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -97,7 +97,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf conn := meta.(*conns.AWSClient).MemoryDBConn(ctx) - userName := d.Get("user_name").(string) + userName := d.Get(names.AttrUserName).(string) input := &memorydb.CreateUserInput{ AccessString: aws.String(d.Get("access_string").(string)), Tags: getTagsIn(ctx), @@ -152,7 +152,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac } d.Set("minimum_engine_version", user.MinimumEngineVersion) - d.Set("user_name", user.Name) + d.Set(names.AttrUserName, user.Name) return diags } diff --git a/internal/service/memorydb/user_data_source.go b/internal/service/memorydb/user_data_source.go index 36c9422347d..28b962c60e7 100644 --- a/internal/service/memorydb/user_data_source.go +++ b/internal/service/memorydb/user_data_source.go @@ -51,7 +51,7 @@ func DataSourceUser() *schema.Resource { Computed: true, }, names.AttrTags: tftags.TagsSchemaComputed(), - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, }, @@ -65,7 +65,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf conn := meta.(*conns.AWSClient).MemoryDBConn(ctx) ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig - userName := d.Get("user_name").(string) + userName := d.Get(names.AttrUserName).(string) user, err := FindUserByName(ctx, conn, userName) @@ -90,7 +90,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf } d.Set("minimum_engine_version", user.MinimumEngineVersion) - d.Set("user_name", user.Name) + d.Set(names.AttrUserName, user.Name) tags, err := listTags(ctx, conn, d.Get(names.AttrARN).(string)) diff --git a/internal/service/memorydb/user_data_source_test.go b/internal/service/memorydb/user_data_source_test.go index a64908ddc38..14a043b5092 100644 --- a/internal/service/memorydb/user_data_source_test.go +++ b/internal/service/memorydb/user_data_source_test.go @@ -34,7 +34,7 @@ func TestAccMemoryDBUserDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "minimum_engine_version", resourceName, "minimum_engine_version"), resource.TestCheckResourceAttr(dataSourceName, "tags.%", "1"), resource.TestCheckResourceAttrPair(dataSourceName, "tags.Test", resourceName, "tags.Test"), - resource.TestCheckResourceAttrPair(dataSourceName, "user_name", resourceName, "user_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUserName, resourceName, names.AttrUserName), ), }, }, @@ -60,7 +60,7 @@ func TestAccMemoryDBUserDataSource_authenticationModeIAM(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "authentication_mode.0.type", resourceName, "authentication_mode.0.type"), resource.TestCheckResourceAttrPair(dataSourceName, "authentication_mode.0.password_count", resourceName, "authentication_mode.0.password_count"), resource.TestCheckResourceAttrPair(dataSourceName, "minimum_engine_version", resourceName, "minimum_engine_version"), - resource.TestCheckResourceAttrPair(dataSourceName, "user_name", resourceName, "user_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUserName, resourceName, names.AttrUserName), ), }, }, diff --git a/internal/service/memorydb/user_test.go b/internal/service/memorydb/user_test.go index f0f11ac015c..fbd56aa577d 100644 --- a/internal/service/memorydb/user_test.go +++ b/internal/service/memorydb/user_test.go @@ -40,7 +40,7 @@ func TestAccMemoryDBUser_basic(t *testing.T) { resource.TestCheckTypeSetElemAttr(resourceName, "authentication_mode.0.passwords.*", "aaaaaaaaaaaaaaaa"), resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.type", names.AttrPassword), resource.TestCheckResourceAttrSet(resourceName, "minimum_engine_version"), - resource.TestCheckResourceAttr(resourceName, "user_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, rName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.Test", "test"), ), @@ -75,7 +75,7 @@ func TestAccMemoryDBUser_authenticationModeIAM(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.type", "iam"), resource.TestCheckResourceAttr(resourceName, "authentication_mode.0.password_count", "0"), resource.TestCheckResourceAttrSet(resourceName, "minimum_engine_version"), - resource.TestCheckResourceAttr(resourceName, "user_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, rName), ), }, { @@ -257,7 +257,7 @@ func testAccCheckUserDestroy(ctx context.Context) resource.TestCheckFunc { continue } - _, err := tfmemorydb.FindUserByName(ctx, conn, rs.Primary.Attributes["user_name"]) + _, err := tfmemorydb.FindUserByName(ctx, conn, rs.Primary.Attributes[names.AttrUserName]) if tfresource.NotFound(err) { continue @@ -287,7 +287,7 @@ func testAccCheckUserExists(ctx context.Context, n string) resource.TestCheckFun conn := acctest.Provider.Meta().(*conns.AWSClient).MemoryDBConn(ctx) - _, err := tfmemorydb.FindUserByName(ctx, conn, rs.Primary.Attributes["user_name"]) + _, err := tfmemorydb.FindUserByName(ctx, conn, rs.Primary.Attributes[names.AttrUserName]) return err } From 22a4afb2871c0dfa3dddc8b3698cc18d074d9f2a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:33 -0400 Subject: [PATCH 1469/1490] neptune: Use constants for strings --- internal/service/neptune/cluster_endpoint.go | 10 +++++----- internal/service/neptune/cluster_endpoint_test.go | 2 +- internal/service/neptune/cluster_instance.go | 8 ++++---- internal/service/neptune/cluster_instance_test.go | 6 +++--- internal/service/neptune/event_subscription.go | 10 +++++----- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/service/neptune/cluster_endpoint.go b/internal/service/neptune/cluster_endpoint.go index a5f3e0d0592..a2153e76c7c 100644 --- a/internal/service/neptune/cluster_endpoint.go +++ b/internal/service/neptune/cluster_endpoint.go @@ -61,7 +61,7 @@ func ResourceClusterEndpoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -92,7 +92,7 @@ func resourceClusterEndpointCreate(ctx context.Context, d *schema.ResourceData, input := &neptune.CreateDBClusterEndpointInput{ DBClusterEndpointIdentifier: aws.String(d.Get("cluster_endpoint_identifier").(string)), DBClusterIdentifier: aws.String(d.Get(names.AttrClusterIdentifier).(string)), - EndpointType: aws.String(d.Get("endpoint_type").(string)), + EndpointType: aws.String(d.Get(names.AttrEndpointType).(string)), Tags: getTagsIn(ctx), } @@ -150,7 +150,7 @@ func resourceClusterEndpointRead(ctx context.Context, d *schema.ResourceData, me d.Set("cluster_endpoint_identifier", ep.DBClusterEndpointIdentifier) d.Set(names.AttrClusterIdentifier, ep.DBClusterIdentifier) d.Set(names.AttrEndpoint, ep.Endpoint) - d.Set("endpoint_type", ep.CustomEndpointType) + d.Set(names.AttrEndpointType, ep.CustomEndpointType) d.Set("excluded_members", aws.StringValueSlice(ep.ExcludedMembers)) d.Set("static_members", aws.StringValueSlice(ep.StaticMembers)) @@ -171,8 +171,8 @@ func resourceClusterEndpointUpdate(ctx context.Context, d *schema.ResourceData, DBClusterEndpointIdentifier: aws.String(clusterEndpointID), } - if d.HasChange("endpoint_type") { - input.EndpointType = aws.String(d.Get("endpoint_type").(string)) + if d.HasChange(names.AttrEndpointType) { + input.EndpointType = aws.String(d.Get(names.AttrEndpointType).(string)) } if d.HasChange("excluded_members") { diff --git a/internal/service/neptune/cluster_endpoint_test.go b/internal/service/neptune/cluster_endpoint_test.go index d5a009018bc..26cb540d3d5 100644 --- a/internal/service/neptune/cluster_endpoint_test.go +++ b/internal/service/neptune/cluster_endpoint_test.go @@ -37,7 +37,7 @@ func TestAccNeptuneClusterEndpoint_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckClusterEndpointExists(ctx, resourceName, &dbCluster), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "rds", regexache.MustCompile(`cluster-endpoint:.+`)), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "READER"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "READER"), resource.TestCheckResourceAttr(resourceName, "cluster_endpoint_identifier", rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrClusterIdentifier, "aws_neptune_cluster.test", names.AttrClusterIdentifier), resource.TestCheckResourceAttr(resourceName, "tags.#", "0"), diff --git a/internal/service/neptune/cluster_instance.go b/internal/service/neptune/cluster_instance.go index 097463cd9f4..54087607f56 100644 --- a/internal/service/neptune/cluster_instance.go +++ b/internal/service/neptune/cluster_instance.go @@ -96,7 +96,7 @@ func ResourceClusterInstance() *schema.Resource { Optional: true, Computed: true, }, - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Optional: true, Computed: true, @@ -109,7 +109,7 @@ func ResourceClusterInstance() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ConflictsWith: []string{"identifier"}, + ConflictsWith: []string{names.AttrIdentifier}, ValidateFunc: validIdentifierPrefix, }, "instance_class": { @@ -195,7 +195,7 @@ func resourceClusterInstanceCreate(ctx context.Context, d *schema.ResourceData, conn := meta.(*conns.AWSClient).NeptuneConn(ctx) instanceID := create.NewNameGenerator( - create.WithConfiguredName(d.Get("identifier").(string)), + create.WithConfiguredName(d.Get(names.AttrIdentifier).(string)), create.WithConfiguredPrefix(d.Get("identifier_prefix").(string)), create.WithDefaultPrefix("tf-"), ).Generate() @@ -275,7 +275,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me d.Set("dbi_resource_id", db.DbiResourceId) d.Set(names.AttrEngineVersion, db.EngineVersion) d.Set("engine", db.Engine) - d.Set("identifier", db.DBInstanceIdentifier) + d.Set(names.AttrIdentifier, db.DBInstanceIdentifier) d.Set("identifier_prefix", create.NamePrefixFromName(aws.StringValue(db.DBInstanceIdentifier))) d.Set("instance_class", db.DBInstanceClass) d.Set(names.AttrKMSKeyARN, db.KmsKeyId) diff --git a/internal/service/neptune/cluster_instance_test.go b/internal/service/neptune/cluster_instance_test.go index 337a2313765..560dd171238 100644 --- a/internal/service/neptune/cluster_instance_test.go +++ b/internal/service/neptune/cluster_instance_test.go @@ -48,7 +48,7 @@ func TestAccNeptuneClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrAddress), resource.TestCheckResourceAttr(resourceName, "engine", "neptune"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), resource.TestCheckResourceAttrPair(resourceName, "instance_class", "data.aws_neptune_orderable_db_instance.test", "instance_class"), resource.TestCheckResourceAttr(resourceName, names.AttrKMSKeyARN, ""), @@ -121,7 +121,7 @@ func TestAccNeptuneClusterInstance_identifierGenerated(t *testing.T) { Config: testAccClusterInstanceConfig_identifierGenerated(rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameGeneratedWithPrefix(resourceName, "identifier", "tf-"), + acctest.CheckResourceAttrNameGeneratedWithPrefix(resourceName, names.AttrIdentifier, "tf-"), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", "tf-"), ), }, @@ -150,7 +150,7 @@ func TestAccNeptuneClusterInstance_identifierPrefix(t *testing.T) { Config: testAccClusterInstanceConfig_identifierPrefix(rName, "tf-acc-test-prefix-"), Check: resource.ComposeTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameFromPrefix(resourceName, "identifier", "tf-acc-test-prefix-"), + acctest.CheckResourceAttrNameFromPrefix(resourceName, names.AttrIdentifier, "tf-acc-test-prefix-"), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", "tf-acc-test-prefix-"), ), }, diff --git a/internal/service/neptune/event_subscription.go b/internal/service/neptune/event_subscription.go index 1617d747b59..3d0897d769d 100644 --- a/internal/service/neptune/event_subscription.go +++ b/internal/service/neptune/event_subscription.go @@ -78,7 +78,7 @@ func ResourceEventSubscription() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validEventSubscriptionNamePrefix, }, - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -111,7 +111,7 @@ func resourceEventSubscriptionCreate(ctx context.Context, d *schema.ResourceData ).Generate() input := &neptune.CreateEventSubscriptionInput{ Enabled: aws.Bool(d.Get(names.AttrEnabled).(bool)), - SnsTopicArn: aws.String(d.Get("sns_topic_arn").(string)), + SnsTopicArn: aws.String(d.Get(names.AttrSNSTopicARN).(string)), SubscriptionName: aws.String(name), Tags: getTagsIn(ctx), } @@ -165,7 +165,7 @@ func resourceEventSubscriptionRead(ctx context.Context, d *schema.ResourceData, d.Set("event_categories", aws.StringValueSlice(output.EventCategoriesList)) d.Set(names.AttrName, output.CustSubscriptionId) d.Set(names.AttrNamePrefix, create.NamePrefixFromName(aws.StringValue(output.CustSubscriptionId))) - d.Set("sns_topic_arn", output.SnsTopicArn) + d.Set(names.AttrSNSTopicARN, output.SnsTopicArn) d.Set("source_ids", aws.StringValueSlice(output.SourceIdsList)) d.Set("source_type", output.SourceType) @@ -190,8 +190,8 @@ func resourceEventSubscriptionUpdate(ctx context.Context, d *schema.ResourceData input.SourceType = aws.String(d.Get("source_type").(string)) } - if d.HasChange("sns_topic_arn") { - input.SnsTopicArn = aws.String(d.Get("sns_topic_arn").(string)) + if d.HasChange(names.AttrSNSTopicARN) { + input.SnsTopicArn = aws.String(d.Get(names.AttrSNSTopicARN).(string)) } if d.HasChange("source_type") { From 187ed537a50f7a72aca3ad430c63f27b66a66e65 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:33 -0400 Subject: [PATCH 1470/1490] opensearch: Use constants for strings --- internal/service/opensearch/package.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/service/opensearch/package.go b/internal/service/opensearch/package.go index c474ba0a44c..b3e300f61f4 100644 --- a/internal/service/opensearch/package.go +++ b/internal/service/opensearch/package.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_opensearch_package") @@ -57,7 +58,7 @@ func ResourcePackage() *schema.Resource { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -230,7 +231,7 @@ func expandPackageSource(v interface{}) *opensearchservice.PackageSource { } return &opensearchservice.PackageSource{ - S3BucketName: aws.String(v.(map[string]interface{})["s3_bucket_name"].(string)), + S3BucketName: aws.String(v.(map[string]interface{})[names.AttrS3BucketName].(string)), S3Key: aws.String(v.(map[string]interface{})["s3_key"].(string)), } } From 6dc6dcb5f0e10073b630f7c547d1590e909ee28d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:33 -0400 Subject: [PATCH 1471/1490] opsworks: Use constants for strings --- internal/service/opsworks/application.go | 4 ++-- internal/service/opsworks/layers.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/opsworks/application.go b/internal/service/opsworks/application.go index cca1cb1f873..2f322954df1 100644 --- a/internal/service/opsworks/application.go +++ b/internal/service/opsworks/application.go @@ -175,7 +175,7 @@ func ResourceApplication() *schema.Resource { //Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Required: true, StateFunc: func(v interface{}) string { @@ -549,7 +549,7 @@ func resourceSetApplicationSSL(d *schema.ResourceData, v *opsworks.SslConfigurat set = true } if v.Certificate != nil { - m["certificate"] = aws.StringValue(v.Certificate) + m[names.AttrCertificate] = aws.StringValue(v.Certificate) set = true } if v.Chain != nil { diff --git a/internal/service/opsworks/layers.go b/internal/service/opsworks/layers.go index dd09cca4b98..12283624b86 100644 --- a/internal/service/opsworks/layers.go +++ b/internal/service/opsworks/layers.go @@ -153,7 +153,7 @@ func (lt *opsworksLayerType) resourceSchema() *schema.Resource { Default: opsworks.CloudWatchLogsInitialPositionStartOfFile, ValidateFunc: validation.StringInSlice(opsworks.CloudWatchLogsInitialPosition_Values(), false), }, - "log_group_name": { + names.AttrLogGroupName: { Type: schema.TypeString, Required: true, }, @@ -1079,7 +1079,7 @@ func expandCloudWatchLogsLogStream(tfMap map[string]interface{}) *opsworks.Cloud apiObject.InitialPosition = aws.String(v) } - if v, ok := tfMap["log_group_name"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrLogGroupName].(string); ok && v != "" { apiObject.LogGroupName = aws.String(v) } @@ -1178,7 +1178,7 @@ func flattenCloudWatchLogsLogStream(apiObject *opsworks.CloudWatchLogsLogStream) } if v := apiObject.LogGroupName; v != nil { - tfMap["log_group_name"] = aws.StringValue(v) + tfMap[names.AttrLogGroupName] = aws.StringValue(v) } if v := apiObject.MultiLineStartPattern; v != nil { From 94e857f7e33f9970f25e6bb4c337159b1c800b0f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:33 -0400 Subject: [PATCH 1472/1490] pinpoint: Use constants for strings --- internal/service/pinpoint/apns_channel.go | 4 ++-- internal/service/pinpoint/apns_channel_test.go | 2 +- internal/service/pinpoint/apns_sandbox_channel.go | 4 ++-- internal/service/pinpoint/apns_sandbox_channel_test.go | 2 +- internal/service/pinpoint/apns_voip_channel.go | 4 ++-- internal/service/pinpoint/apns_voip_channel_test.go | 2 +- internal/service/pinpoint/apns_voip_sandbox_channel.go | 4 ++-- internal/service/pinpoint/apns_voip_sandbox_channel_test.go | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/pinpoint/apns_channel.go b/internal/service/pinpoint/apns_channel.go index 8d8673bb182..d4486409200 100644 --- a/internal/service/pinpoint/apns_channel.go +++ b/internal/service/pinpoint/apns_channel.go @@ -39,7 +39,7 @@ func ResourceAPNSChannel() *schema.Resource { Optional: true, Sensitive: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -79,7 +79,7 @@ func ResourceAPNSChannel() *schema.Resource { func resourceAPNSChannelUpsert(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - certificate, certificateOk := d.GetOk("certificate") + certificate, certificateOk := d.GetOk(names.AttrCertificate) privateKey, privateKeyOk := d.GetOk("private_key") bundleId, bundleIdOk := d.GetOk("bundle_id") diff --git a/internal/service/pinpoint/apns_channel_test.go b/internal/service/pinpoint/apns_channel_test.go index af149515bc2..87e88cd0486 100644 --- a/internal/service/pinpoint/apns_channel_test.go +++ b/internal/service/pinpoint/apns_channel_test.go @@ -118,7 +118,7 @@ func TestAccPinpointAPNSChannel_basicCertificate(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"certificate", "private_key"}, + ImportStateVerifyIgnore: []string{names.AttrCertificate, "private_key"}, }, { Config: testAccAPNSChannelConfig_basicCertificate(configuration), diff --git a/internal/service/pinpoint/apns_sandbox_channel.go b/internal/service/pinpoint/apns_sandbox_channel.go index 5c21e3ae67e..3d182e62b3a 100644 --- a/internal/service/pinpoint/apns_sandbox_channel.go +++ b/internal/service/pinpoint/apns_sandbox_channel.go @@ -39,7 +39,7 @@ func ResourceAPNSSandboxChannel() *schema.Resource { Optional: true, Sensitive: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -79,7 +79,7 @@ func ResourceAPNSSandboxChannel() *schema.Resource { func resourceAPNSSandboxChannelUpsert(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - certificate, certificateOk := d.GetOk("certificate") + certificate, certificateOk := d.GetOk(names.AttrCertificate) privateKey, privateKeyOk := d.GetOk("private_key") bundleId, bundleIdOk := d.GetOk("bundle_id") diff --git a/internal/service/pinpoint/apns_sandbox_channel_test.go b/internal/service/pinpoint/apns_sandbox_channel_test.go index 5ce5f90b4f7..91bc549d777 100644 --- a/internal/service/pinpoint/apns_sandbox_channel_test.go +++ b/internal/service/pinpoint/apns_sandbox_channel_test.go @@ -118,7 +118,7 @@ func TestAccPinpointAPNSSandboxChannel_basicCertificate(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"certificate", "private_key"}, + ImportStateVerifyIgnore: []string{names.AttrCertificate, "private_key"}, }, { Config: testAccAPNSSandboxChannelConfig_basicCertificate(configuration), diff --git a/internal/service/pinpoint/apns_voip_channel.go b/internal/service/pinpoint/apns_voip_channel.go index 1c364022fc5..4d8b96a4546 100644 --- a/internal/service/pinpoint/apns_voip_channel.go +++ b/internal/service/pinpoint/apns_voip_channel.go @@ -39,7 +39,7 @@ func ResourceAPNSVoIPChannel() *schema.Resource { Optional: true, Sensitive: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -79,7 +79,7 @@ func ResourceAPNSVoIPChannel() *schema.Resource { func resourceAPNSVoIPChannelUpsert(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - certificate, certificateOk := d.GetOk("certificate") + certificate, certificateOk := d.GetOk(names.AttrCertificate) privateKey, privateKeyOk := d.GetOk("private_key") bundleId, bundleIdOk := d.GetOk("bundle_id") diff --git a/internal/service/pinpoint/apns_voip_channel_test.go b/internal/service/pinpoint/apns_voip_channel_test.go index 135c54f5888..e178caf849e 100644 --- a/internal/service/pinpoint/apns_voip_channel_test.go +++ b/internal/service/pinpoint/apns_voip_channel_test.go @@ -118,7 +118,7 @@ func TestAccPinpointAPNSVoIPChannel_basicCertificate(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"certificate", "private_key"}, + ImportStateVerifyIgnore: []string{names.AttrCertificate, "private_key"}, }, { Config: testAccAPNSVoIPChannelConfig_basicCertificate(configuration), diff --git a/internal/service/pinpoint/apns_voip_sandbox_channel.go b/internal/service/pinpoint/apns_voip_sandbox_channel.go index adc8d1c0744..4a9c893274a 100644 --- a/internal/service/pinpoint/apns_voip_sandbox_channel.go +++ b/internal/service/pinpoint/apns_voip_sandbox_channel.go @@ -39,7 +39,7 @@ func ResourceAPNSVoIPSandboxChannel() *schema.Resource { Optional: true, Sensitive: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -79,7 +79,7 @@ func ResourceAPNSVoIPSandboxChannel() *schema.Resource { func resourceAPNSVoIPSandboxChannelUpsert(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics - certificate, certificateOk := d.GetOk("certificate") + certificate, certificateOk := d.GetOk(names.AttrCertificate) privateKey, privateKeyOk := d.GetOk("private_key") bundleId, bundleIdOk := d.GetOk("bundle_id") diff --git a/internal/service/pinpoint/apns_voip_sandbox_channel_test.go b/internal/service/pinpoint/apns_voip_sandbox_channel_test.go index 87585a284bb..3a5e6de6c0f 100644 --- a/internal/service/pinpoint/apns_voip_sandbox_channel_test.go +++ b/internal/service/pinpoint/apns_voip_sandbox_channel_test.go @@ -118,7 +118,7 @@ func TestAccPinpointAPNSVoIPSandboxChannel_basicCertificate(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"certificate", "private_key"}, + ImportStateVerifyIgnore: []string{names.AttrCertificate, "private_key"}, }, { Config: testAccAPNSVoIPSandboxChannelConfig_basicCertificate(configuration), From d32ce13cb2bc19f2610fc3434ec794d0c80c6c78 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:33 -0400 Subject: [PATCH 1473/1490] quicksight: Use constants for strings --- internal/service/quicksight/data_set.go | 6 +++--- internal/service/quicksight/data_set_data_source.go | 2 +- internal/service/quicksight/group.go | 6 +++--- internal/service/quicksight/group_data_source.go | 4 ++-- .../service/quicksight/group_data_source_test.go | 2 +- internal/service/quicksight/group_membership.go | 6 +++--- internal/service/quicksight/group_membership_test.go | 4 ++-- internal/service/quicksight/iam_policy_assignment.go | 2 +- .../service/quicksight/iam_policy_assignment_test.go | 12 ++++++------ internal/service/quicksight/namespace.go | 2 +- internal/service/quicksight/namespace_test.go | 8 ++++---- internal/service/quicksight/schema/analysis.go | 2 +- internal/service/quicksight/schema/dashboard.go | 2 +- internal/service/quicksight/schema/dataset.go | 9 +++++---- internal/service/quicksight/schema/template.go | 4 ++-- internal/service/quicksight/schema/template_sheet.go | 2 +- .../quicksight/schema/visual_custom_content.go | 11 ++++++----- internal/service/quicksight/user.go | 12 ++++++------ internal/service/quicksight/user_data_source.go | 10 +++++----- internal/service/quicksight/user_data_source_test.go | 4 ++-- internal/service/quicksight/user_test.go | 6 +++--- 21 files changed, 59 insertions(+), 57 deletions(-) diff --git a/internal/service/quicksight/data_set.go b/internal/service/quicksight/data_set.go index 1d559902a1d..d11638f6b9f 100644 --- a/internal/service/quicksight/data_set.go +++ b/internal/service/quicksight/data_set.go @@ -242,7 +242,7 @@ func ResourceDataSet() *schema.Resource { Optional: true, ValidateFunc: validation.StringInSlice(quicksight.RowLevelPermissionFormatVersion_Values(), false), }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringLenBetween(0, 64), @@ -1830,7 +1830,7 @@ func expandDataSetRowLevelPermissionDataSet(tfList []interface{}) *quicksight.Ro if v, ok := tfMap["format_version"].(string); ok { rowLevelPermission.FormatVersion = aws.String(v) } - if v, ok := tfMap["namespace"].(string); ok { + if v, ok := tfMap[names.AttrNamespace].(string); ok { rowLevelPermission.Namespace = aws.String(v) } if v, ok := tfMap[names.AttrStatus].(string); ok { @@ -2581,7 +2581,7 @@ func flattenRowLevelPermissionDataSet(apiObject *quicksight.RowLevelPermissionDa tfMap["format_version"] = aws.StringValue(apiObject.FormatVersion) } if apiObject.Namespace != nil { - tfMap["namespace"] = aws.StringValue(apiObject.Namespace) + tfMap[names.AttrNamespace] = aws.StringValue(apiObject.Namespace) } if apiObject.PermissionPolicy != nil { tfMap["permission_policy"] = aws.StringValue(apiObject.PermissionPolicy) diff --git a/internal/service/quicksight/data_set_data_source.go b/internal/service/quicksight/data_set_data_source.go index 6efc06e63f6..74da5696b7a 100644 --- a/internal/service/quicksight/data_set_data_source.go +++ b/internal/service/quicksight/data_set_data_source.go @@ -172,7 +172,7 @@ func DataSourceDataSet() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Computed: true, }, diff --git a/internal/service/quicksight/group.go b/internal/service/quicksight/group.go index ad968351db9..916d6ee933b 100644 --- a/internal/service/quicksight/group.go +++ b/internal/service/quicksight/group.go @@ -62,7 +62,7 @@ func ResourceGroup() *schema.Resource { ForceNew: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -82,7 +82,7 @@ func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta inter conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountID := meta.(*conns.AWSClient).AccountID - namespace := d.Get("namespace").(string) + namespace := d.Get(names.AttrNamespace).(string) if v, ok := d.GetOk("aws_account_id"); ok { awsAccountID = v.(string) @@ -137,7 +137,7 @@ func resourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interfa d.Set("aws_account_id", awsAccountID) d.Set("group_name", resp.Group.GroupName) d.Set(names.AttrDescription, resp.Group.Description) - d.Set("namespace", namespace) + d.Set(names.AttrNamespace, namespace) return diags } diff --git a/internal/service/quicksight/group_data_source.go b/internal/service/quicksight/group_data_source.go index 47e4ef83da9..d814e5ace7b 100644 --- a/internal/service/quicksight/group_data_source.go +++ b/internal/service/quicksight/group_data_source.go @@ -43,7 +43,7 @@ func DataSourceGroup() *schema.Resource { Type: schema.TypeString, Required: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, Default: DefaultGroupNamespace, @@ -70,7 +70,7 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter awsAccountID = v.(string) } groupName := d.Get("group_name").(string) - namespace := d.Get("namespace").(string) + namespace := d.Get(names.AttrNamespace).(string) in := &quicksight.DescribeGroupInput{ GroupName: aws.String(groupName), AwsAccountId: aws.String(awsAccountID), diff --git a/internal/service/quicksight/group_data_source_test.go b/internal/service/quicksight/group_data_source_test.go index 97fb1d1683a..1f2a866ce36 100644 --- a/internal/service/quicksight/group_data_source_test.go +++ b/internal/service/quicksight/group_data_source_test.go @@ -33,7 +33,7 @@ func TestAccQuickSightGroupDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "group_name", resourceName, "group_name"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttr(dataSourceName, names.AttrDescription, "text1"), - resource.TestCheckResourceAttr(dataSourceName, "namespace", tfquicksight.DefaultUserNamespace), + resource.TestCheckResourceAttr(dataSourceName, names.AttrNamespace, tfquicksight.DefaultUserNamespace), resource.TestCheckResourceAttrSet(dataSourceName, "principal_id"), ), }, diff --git a/internal/service/quicksight/group_membership.go b/internal/service/quicksight/group_membership.go index 45976179ce5..1cf19152fc6 100644 --- a/internal/service/quicksight/group_membership.go +++ b/internal/service/quicksight/group_membership.go @@ -53,7 +53,7 @@ func ResourceGroupMembership() *schema.Resource { Required: true, ForceNew: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -72,7 +72,7 @@ func resourceGroupMembershipCreate(ctx context.Context, d *schema.ResourceData, conn := meta.(*conns.AWSClient).QuickSightConn(ctx) awsAccountID := meta.(*conns.AWSClient).AccountID - namespace := d.Get("namespace").(string) + namespace := d.Get(names.AttrNamespace).(string) groupName := d.Get("group_name").(string) memberName := d.Get("member_name").(string) @@ -123,7 +123,7 @@ func resourceGroupMembershipRead(ctx context.Context, d *schema.ResourceData, me } d.Set("aws_account_id", awsAccountID) - d.Set("namespace", namespace) + d.Set(names.AttrNamespace, namespace) d.Set("member_name", userName) d.Set("group_name", groupName) diff --git a/internal/service/quicksight/group_membership_test.go b/internal/service/quicksight/group_membership_test.go index c7872db2b34..e7bae54aa9e 100644 --- a/internal/service/quicksight/group_membership_test.go +++ b/internal/service/quicksight/group_membership_test.go @@ -66,8 +66,8 @@ func TestAccQuickSightGroupMembership_withNamespace(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckGroupMembershipExists(ctx, resourceName), resource.TestCheckResourceAttrPair(resourceName, "group_name", groupResourceName, "group_name"), - resource.TestCheckResourceAttrPair(resourceName, "member_name", userResourceName, "user_name"), - resource.TestCheckResourceAttrPair(resourceName, "namespace", namespaceResourceName, "namespace"), + resource.TestCheckResourceAttrPair(resourceName, "member_name", userResourceName, names.AttrUserName), + resource.TestCheckResourceAttrPair(resourceName, names.AttrNamespace, namespaceResourceName, names.AttrNamespace), ), }, { diff --git a/internal/service/quicksight/iam_policy_assignment.go b/internal/service/quicksight/iam_policy_assignment.go index b4348940436..069c304b971 100644 --- a/internal/service/quicksight/iam_policy_assignment.go +++ b/internal/service/quicksight/iam_policy_assignment.go @@ -80,7 +80,7 @@ func (r *resourceIAMPolicyAssignment) Schema(ctx context.Context, req resource.S }, }, names.AttrID: framework.IDAttribute(), - "namespace": schema.StringAttribute{ + names.AttrNamespace: schema.StringAttribute{ Optional: true, Computed: true, Default: stringdefault.StaticString(DefaultIAMPolicyAssignmentNamespace), diff --git a/internal/service/quicksight/iam_policy_assignment_test.go b/internal/service/quicksight/iam_policy_assignment_test.go index d2143ecf6d0..b1700cd3fe4 100644 --- a/internal/service/quicksight/iam_policy_assignment_test.go +++ b/internal/service/quicksight/iam_policy_assignment_test.go @@ -38,7 +38,7 @@ func TestAccQuickSightIAMPolicyAssignment_basic(t *testing.T) { testAccCheckIAMPolicyAssignmentExists(ctx, resourceName, &assignment), resource.TestCheckResourceAttr(resourceName, "assignment_name", rName), resource.TestCheckResourceAttr(resourceName, "assignment_status", quicksight.AssignmentStatusEnabled), - resource.TestCheckResourceAttr(resourceName, "namespace", tfquicksight.DefaultIAMPolicyAssignmentNamespace), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, tfquicksight.DefaultIAMPolicyAssignmentNamespace), ), }, { @@ -92,7 +92,7 @@ func TestAccQuickSightIAMPolicyAssignment_assignmentStatus(t *testing.T) { testAccCheckIAMPolicyAssignmentExists(ctx, resourceName, &assignment), resource.TestCheckResourceAttr(resourceName, "assignment_name", rName), resource.TestCheckResourceAttr(resourceName, "assignment_status", quicksight.AssignmentStatusDraft), - resource.TestCheckResourceAttr(resourceName, "namespace", tfquicksight.DefaultIAMPolicyAssignmentNamespace), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, tfquicksight.DefaultIAMPolicyAssignmentNamespace), ), }, { @@ -106,7 +106,7 @@ func TestAccQuickSightIAMPolicyAssignment_assignmentStatus(t *testing.T) { testAccCheckIAMPolicyAssignmentExists(ctx, resourceName, &assignment), resource.TestCheckResourceAttr(resourceName, "assignment_name", rName), resource.TestCheckResourceAttr(resourceName, "assignment_status", quicksight.AssignmentStatusEnabled), - resource.TestCheckResourceAttr(resourceName, "namespace", tfquicksight.DefaultIAMPolicyAssignmentNamespace), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, tfquicksight.DefaultIAMPolicyAssignmentNamespace), ), }, { @@ -115,7 +115,7 @@ func TestAccQuickSightIAMPolicyAssignment_assignmentStatus(t *testing.T) { testAccCheckIAMPolicyAssignmentExists(ctx, resourceName, &assignment), resource.TestCheckResourceAttr(resourceName, "assignment_name", rName), resource.TestCheckResourceAttr(resourceName, "assignment_status", quicksight.AssignmentStatusDisabled), - resource.TestCheckResourceAttr(resourceName, "namespace", tfquicksight.DefaultIAMPolicyAssignmentNamespace), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, tfquicksight.DefaultIAMPolicyAssignmentNamespace), ), }, }, @@ -142,10 +142,10 @@ func TestAccQuickSightIAMPolicyAssignment_identities(t *testing.T) { testAccCheckIAMPolicyAssignmentExists(ctx, resourceName, &assignment), resource.TestCheckResourceAttr(resourceName, "assignment_name", rName), resource.TestCheckResourceAttr(resourceName, "assignment_status", quicksight.AssignmentStatusEnabled), - resource.TestCheckResourceAttr(resourceName, "namespace", tfquicksight.DefaultIAMPolicyAssignmentNamespace), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, tfquicksight.DefaultIAMPolicyAssignmentNamespace), resource.TestCheckResourceAttr(resourceName, "identities.#", "1"), resource.TestCheckResourceAttr(resourceName, "identities.0.user.#", "1"), - resource.TestCheckResourceAttrPair(resourceName, "identities.0.user.0", userResourceName, "user_name"), + resource.TestCheckResourceAttrPair(resourceName, "identities.0.user.0", userResourceName, names.AttrUserName), resource.TestCheckResourceAttrPair(resourceName, "policy_arn", policyResourceName, names.AttrARN), ), }, diff --git a/internal/service/quicksight/namespace.go b/internal/service/quicksight/namespace.go index 32592f68953..777329f8aef 100644 --- a/internal/service/quicksight/namespace.go +++ b/internal/service/quicksight/namespace.go @@ -86,7 +86,7 @@ func (r *resourceNamespace) Schema(ctx context.Context, req resource.SchemaReque stringplanmodifier.RequiresReplace(), }, }, - "namespace": schema.StringAttribute{ + names.AttrNamespace: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), diff --git a/internal/service/quicksight/namespace_test.go b/internal/service/quicksight/namespace_test.go index 69c7a7f14e3..8d8856e3375 100644 --- a/internal/service/quicksight/namespace_test.go +++ b/internal/service/quicksight/namespace_test.go @@ -36,7 +36,7 @@ func TestAccQuickSightNamespace_basic(t *testing.T) { Config: testAccNamespaceConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckNamespaceExists(ctx, resourceName, &namespace), - resource.TestCheckResourceAttr(resourceName, "namespace", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, rName), resource.TestCheckResourceAttr(resourceName, "identity_store", quicksight.IdentityStoreQuicksight), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "quicksight", fmt.Sprintf("namespace/%[1]s", rName)), ), @@ -90,7 +90,7 @@ func TestAccQuickSightNamespace_tags(t *testing.T) { Config: testAccNamespaceConfig_tags1(rName, "key1", "value1"), Check: resource.ComposeTestCheckFunc( testAccCheckNamespaceExists(ctx, resourceName, &namespace), - resource.TestCheckResourceAttr(resourceName, "namespace", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, rName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), ), @@ -104,7 +104,7 @@ func TestAccQuickSightNamespace_tags(t *testing.T) { Config: testAccNamespaceConfig_tags2(rName, "key1", "value1updated", "key2", "value2"), Check: resource.ComposeTestCheckFunc( testAccCheckNamespaceExists(ctx, resourceName, &namespace), - resource.TestCheckResourceAttr(resourceName, "namespace", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, rName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), @@ -114,7 +114,7 @@ func TestAccQuickSightNamespace_tags(t *testing.T) { Config: testAccNamespaceConfig_tags1(rName, "key2", "value2"), Check: resource.ComposeTestCheckFunc( testAccCheckNamespaceExists(ctx, resourceName, &namespace), - resource.TestCheckResourceAttr(resourceName, "namespace", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, rName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), ), diff --git a/internal/service/quicksight/schema/analysis.go b/internal/service/quicksight/schema/analysis.go index a7d96e48188..fbbaa249c28 100644 --- a/internal/service/quicksight/schema/analysis.go +++ b/internal/service/quicksight/schema/analysis.go @@ -77,7 +77,7 @@ func AnalysisDefinitionSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "sheet_id": idSchema(), - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/internal/service/quicksight/schema/dashboard.go b/internal/service/quicksight/schema/dashboard.go index f0f91e8ae20..c34d743a6e5 100644 --- a/internal/service/quicksight/schema/dashboard.go +++ b/internal/service/quicksight/schema/dashboard.go @@ -77,7 +77,7 @@ func DashboardDefinitionSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "sheet_id": idSchema(), - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/internal/service/quicksight/schema/dataset.go b/internal/service/quicksight/schema/dataset.go index 67a57f4385e..28e54188afa 100644 --- a/internal/service/quicksight/schema/dataset.go +++ b/internal/service/quicksight/schema/dataset.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) func dataSetIdentifierDeclarationsSchema() *schema.Schema { @@ -19,8 +20,8 @@ func dataSetIdentifierDeclarationsSchema() *schema.Schema { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "data_set_arn": stringSchema(false, verify.ValidARN), - "identifier": stringSchema(false, validation.StringLenBetween(1, 2048)), + "data_set_arn": stringSchema(false, verify.ValidARN), + names.AttrIdentifier: stringSchema(false, validation.StringLenBetween(1, 2048)), }, }, } @@ -80,7 +81,7 @@ func expandDataSetIdentifierDeclaration(tfMap map[string]interface{}) *quicksigh if v, ok := tfMap["data_set_arn"].(string); ok && v != "" { identifier.DataSetArn = aws.String(v) } - if v, ok := tfMap["identifier"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrIdentifier].(string); ok && v != "" { identifier.Identifier = aws.String(v) } @@ -103,7 +104,7 @@ func flattenDataSetIdentifierDeclarations(apiObject []*quicksight.DataSetIdentif tfMap["data_set_arn"] = aws.StringValue(identifier.DataSetArn) } if identifier.Identifier != nil { - tfMap["identifier"] = aws.StringValue(identifier.Identifier) + tfMap[names.AttrIdentifier] = aws.StringValue(identifier.Identifier) } tfList = append(tfList, tfMap) } diff --git a/internal/service/quicksight/schema/template.go b/internal/service/quicksight/schema/template.go index 0e86b8d81b0..874381af28a 100644 --- a/internal/service/quicksight/schema/template.go +++ b/internal/service/quicksight/schema/template.go @@ -78,7 +78,7 @@ func TemplateDefinitionSchema() *schema.Schema { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "sheet_id": idSchema(), - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Optional: true, Computed: true, @@ -1381,7 +1381,7 @@ func flattenSheetDefinitions(apiObject []*quicksight.SheetDefinition) []interfac "sheet_id": aws.StringValue(config.SheetId), } if config.ContentType != nil { - tfMap["content_type"] = aws.StringValue(config.ContentType) + tfMap[names.AttrContentType] = aws.StringValue(config.ContentType) } if config.Description != nil { tfMap[names.AttrDescription] = aws.StringValue(config.Description) diff --git a/internal/service/quicksight/schema/template_sheet.go b/internal/service/quicksight/schema/template_sheet.go index 8f492e80d75..bec291d2728 100644 --- a/internal/service/quicksight/schema/template_sheet.go +++ b/internal/service/quicksight/schema/template_sheet.go @@ -892,7 +892,7 @@ func expandSheetDefinition(tfMap map[string]interface{}) *quicksight.SheetDefini if v, ok := tfMap["sheet_id"].(string); ok && v != "" { sheet.SheetId = aws.String(v) } - if v, ok := tfMap["content_type"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrContentType].(string); ok && v != "" { sheet.ContentType = aws.String(v) } if v, ok := tfMap[names.AttrDescription].(string); ok && v != "" { diff --git a/internal/service/quicksight/schema/visual_custom_content.go b/internal/service/quicksight/schema/visual_custom_content.go index ed88377c625..49e9deb5a35 100644 --- a/internal/service/quicksight/schema/visual_custom_content.go +++ b/internal/service/quicksight/schema/visual_custom_content.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/verify" + "github.com/hashicorp/terraform-provider-aws/names" ) func customContentVisualSchema() *schema.Schema { @@ -30,9 +31,9 @@ func customContentVisualSchema() *schema.Schema { DiffSuppressFunc: verify.SuppressMissingOptionalConfigurationBlock, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "content_type": stringSchema(false, validation.StringInSlice(quicksight.CustomContentType_Values(), false)), - "content_url": stringSchema(false, validation.StringLenBetween(1, 2048)), - "image_scaling": stringSchema(false, validation.StringInSlice(quicksight.CustomContentImageScalingConfiguration_Values(), false)), + names.AttrContentType: stringSchema(false, validation.StringInSlice(quicksight.CustomContentType_Values(), false)), + "content_url": stringSchema(false, validation.StringLenBetween(1, 2048)), + "image_scaling": stringSchema(false, validation.StringInSlice(quicksight.CustomContentImageScalingConfiguration_Values(), false)), }, }, }, @@ -89,7 +90,7 @@ func expandCustomContentConfiguration(tfList []interface{}) *quicksight.CustomCo config := &quicksight.CustomContentConfiguration{} - if v, ok := tfMap["content_type"].(string); ok && v != "" { + if v, ok := tfMap[names.AttrContentType].(string); ok && v != "" { config.ContentType = aws.String(v) } if v, ok := tfMap["content_url"].(string); ok && v != "" { @@ -134,7 +135,7 @@ func flattenCustomContentConfiguration(apiObject *quicksight.CustomContentConfig tfMap := map[string]interface{}{} if apiObject.ContentType != nil { - tfMap["content_type"] = aws.StringValue(apiObject.ContentType) + tfMap[names.AttrContentType] = aws.StringValue(apiObject.ContentType) } if apiObject.ContentUrl != nil { tfMap["content_url"] = aws.StringValue(apiObject.ContentUrl) diff --git a/internal/service/quicksight/user.go b/internal/service/quicksight/user.go index 1d07b5bb11f..18f84381c21 100644 --- a/internal/service/quicksight/user.go +++ b/internal/service/quicksight/user.go @@ -69,7 +69,7 @@ func ResourceUser() *schema.Resource { }, false), }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, ForceNew: true, @@ -86,7 +86,7 @@ func ResourceUser() *schema.Resource { ForceNew: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Optional: true, ValidateFunc: validation.NoZeroValues, @@ -113,7 +113,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf awsAccountID := meta.(*conns.AWSClient).AccountID - namespace := d.Get("namespace").(string) + namespace := d.Get(names.AttrNamespace).(string) if v, ok := d.GetOk("aws_account_id"); ok { awsAccountID = v.(string) @@ -135,7 +135,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf createOpts.SessionName = aws.String(v.(string)) } - if v, ok := d.GetOk("user_name"); ok { + if v, ok := d.GetOk(names.AttrUserName); ok { createOpts.UserName = aws.String(v.(string)) } @@ -177,9 +177,9 @@ 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("email", resp.User.Email) - d.Set("namespace", namespace) + d.Set(names.AttrNamespace, namespace) d.Set("user_role", resp.User.Role) - d.Set("user_name", resp.User.UserName) + d.Set(names.AttrUserName, resp.User.UserName) return diags } diff --git a/internal/service/quicksight/user_data_source.go b/internal/service/quicksight/user_data_source.go index a02f531b1ed..cee2709be71 100644 --- a/internal/service/quicksight/user_data_source.go +++ b/internal/service/quicksight/user_data_source.go @@ -47,7 +47,7 @@ func DataSourceUser() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Optional: true, Default: DefaultUserNamespace, @@ -60,7 +60,7 @@ func DataSourceUser() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, }, @@ -81,9 +81,9 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf if v, ok := d.GetOk("aws_account_id"); ok { awsAccountID = v.(string) } - namespace := d.Get("namespace").(string) + namespace := d.Get(names.AttrNamespace).(string) in := &quicksight.DescribeUserInput{ - UserName: aws.String(d.Get("user_name").(string)), + UserName: aws.String(d.Get(names.AttrUserName).(string)), AwsAccountId: aws.String(awsAccountID), Namespace: aws.String(namespace), } @@ -103,7 +103,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("email", out.User.Email) d.Set("identity_type", out.User.IdentityType) d.Set("principal_id", out.User.PrincipalId) - d.Set("user_name", out.User.UserName) + d.Set(names.AttrUserName, out.User.UserName) d.Set("user_role", out.User.Role) return diags diff --git a/internal/service/quicksight/user_data_source_test.go b/internal/service/quicksight/user_data_source_test.go index b131aecd929..9a6d6314080 100644 --- a/internal/service/quicksight/user_data_source_test.go +++ b/internal/service/quicksight/user_data_source_test.go @@ -31,10 +31,10 @@ func TestAccQuickSightUserDataSource_basic(t *testing.T) { { Config: testAccUserDataSourceConfig(rName), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(dataSourceName, "user_name", resourceName, "user_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUserName, resourceName, names.AttrUserName), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttr(dataSourceName, "email", acctest.DefaultEmailAddress), - resource.TestCheckResourceAttr(dataSourceName, "namespace", tfquicksight.DefaultUserNamespace), + resource.TestCheckResourceAttr(dataSourceName, names.AttrNamespace, tfquicksight.DefaultUserNamespace), resource.TestCheckResourceAttr(dataSourceName, "identity_type", quicksight.IdentityTypeQuicksight), resource.TestCheckResourceAttrSet(dataSourceName, "principal_id"), resource.TestCheckResourceAttr(dataSourceName, "user_role", quicksight.UserRoleReader), diff --git a/internal/service/quicksight/user_test.go b/internal/service/quicksight/user_test.go index be9860a5aaa..2de6d54ca19 100644 --- a/internal/service/quicksight/user_test.go +++ b/internal/service/quicksight/user_test.go @@ -41,7 +41,7 @@ func TestAccQuickSightUser_basic(t *testing.T) { Config: testAccUserConfig_basic(rName1), Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName1, &user), - resource.TestCheckResourceAttr(resourceName1, "user_name", rName1), + resource.TestCheckResourceAttr(resourceName1, names.AttrUserName, rName1), acctest.CheckResourceAttrRegionalARN(resourceName1, names.AttrARN, "quicksight", fmt.Sprintf("user/default/%s", rName1)), ), }, @@ -49,7 +49,7 @@ func TestAccQuickSightUser_basic(t *testing.T) { Config: testAccUserConfig_basic(rName2), Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName2, &user), - resource.TestCheckResourceAttr(resourceName2, "user_name", rName2), + resource.TestCheckResourceAttr(resourceName2, names.AttrUserName, rName2), acctest.CheckResourceAttrRegionalARN(resourceName2, names.AttrARN, "quicksight", fmt.Sprintf("user/default/%s", rName2)), ), }, @@ -109,7 +109,7 @@ func TestAccQuickSightUser_withNamespace(t *testing.T) { Config: testAccUserConfig_namespace(rName, namespace), Check: resource.ComposeTestCheckFunc( testAccCheckUserExists(ctx, resourceName, &user), - resource.TestCheckResourceAttr(resourceName, "namespace", namespace), + resource.TestCheckResourceAttr(resourceName, names.AttrNamespace, namespace), ), }, }, From 16ce38ba3e806f2d9db0940e2f6f8442c012fddd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:34 -0400 Subject: [PATCH 1474/1490] rds: Use constants for strings --- internal/service/rds/blue_green.go | 4 +- internal/service/rds/cluster_instance.go | 8 +- internal/service/rds/cluster_instance_test.go | 6 +- internal/service/rds/export_task.go | 2 +- internal/service/rds/export_task_test.go | 4 +- internal/service/rds/instance.go | 88 +++++++++---------- internal/service/rds/instance_migrate.go | 6 +- internal/service/rds/instance_migrate_test.go | 52 +++++------ .../rds/instance_role_association_test.go | 2 +- internal/service/rds/instance_test.go | 62 ++++++------- .../service/rds/instances_data_source_test.go | 4 +- internal/service/rds/sweep.go | 2 +- 12 files changed, 120 insertions(+), 120 deletions(-) diff --git a/internal/service/rds/blue_green.go b/internal/service/rds/blue_green.go index 1e743e44c9b..da04628fc6e 100644 --- a/internal/service/rds/blue_green.go +++ b/internal/service/rds/blue_green.go @@ -103,7 +103,7 @@ func (h *instanceHandler) precondition(ctx context.Context, d *schema.ResourceDa needsPreConditions := false input := &rds_sdkv2.ModifyDBInstanceInput{ ApplyImmediately: aws.Bool(true), - DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), + DBInstanceIdentifier: aws.String(d.Get(names.AttrIdentifier).(string)), } // Backups must be enabled for Blue/Green Deployments. Enable them first. @@ -129,7 +129,7 @@ func (h *instanceHandler) precondition(ctx context.Context, d *schema.ResourceDa func (h *instanceHandler) createBlueGreenInput(d *schema.ResourceData) *rds_sdkv2.CreateBlueGreenDeploymentInput { input := &rds_sdkv2.CreateBlueGreenDeploymentInput{ - BlueGreenDeploymentName: aws.String(d.Get("identifier").(string)), + BlueGreenDeploymentName: aws.String(d.Get(names.AttrIdentifier).(string)), Source: aws.String(d.Get(names.AttrARN).(string)), } diff --git a/internal/service/rds/cluster_instance.go b/internal/service/rds/cluster_instance.go index 8ca4f358f7a..34d858b151b 100644 --- a/internal/service/rds/cluster_instance.go +++ b/internal/service/rds/cluster_instance.go @@ -126,7 +126,7 @@ func ResourceClusterInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Optional: true, Computed: true, @@ -139,7 +139,7 @@ func ResourceClusterInstance() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ConflictsWith: []string{"identifier"}, + ConflictsWith: []string{names.AttrIdentifier}, ValidateFunc: validIdentifierPrefix, }, "instance_class": { @@ -243,7 +243,7 @@ func resourceClusterInstanceCreate(ctx context.Context, d *schema.ResourceData, clusterID := d.Get(names.AttrClusterIdentifier).(string) identifier := create.NewNameGenerator( - create.WithConfiguredName(d.Get("identifier").(string)), + create.WithConfiguredName(d.Get(names.AttrIdentifier).(string)), create.WithConfiguredPrefix(d.Get("identifier_prefix").(string)), create.WithDefaultPrefix("tf-"), ).Generate() @@ -409,7 +409,7 @@ func resourceClusterInstanceRead(ctx context.Context, d *schema.ResourceData, me } d.Set("dbi_resource_id", db.DbiResourceId) d.Set("engine", db.Engine) - d.Set("identifier", db.DBInstanceIdentifier) + d.Set(names.AttrIdentifier, db.DBInstanceIdentifier) d.Set("identifier_prefix", create.NamePrefixFromName(aws.StringValue(db.DBInstanceIdentifier))) d.Set("instance_class", db.DBInstanceClass) d.Set(names.AttrKMSKeyID, db.KmsKeyId) diff --git a/internal/service/rds/cluster_instance_test.go b/internal/service/rds/cluster_instance_test.go index 76ccdf97263..fee2f58ad8f 100644 --- a/internal/service/rds/cluster_instance_test.go +++ b/internal/service/rds/cluster_instance_test.go @@ -51,7 +51,7 @@ func TestAccRDSClusterInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "dbi_resource_id"), resource.TestCheckResourceAttr(resourceName, "engine", "aurora-mysql"), resource.TestCheckResourceAttrSet(resourceName, names.AttrEngineVersion), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), resource.TestCheckResourceAttr(resourceName, "network_type", "IPV4"), resource.TestCheckResourceAttrSet(resourceName, "preferred_backup_window"), @@ -125,7 +125,7 @@ func TestAccRDSClusterInstance_identifierGenerated(t *testing.T) { Config: testAccClusterInstanceConfig_identifierGenerated(rName), Check: resource.ComposeTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameGeneratedWithPrefix(resourceName, "identifier", "tf-"), + acctest.CheckResourceAttrNameGeneratedWithPrefix(resourceName, names.AttrIdentifier, "tf-"), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", "tf-"), ), }, @@ -161,7 +161,7 @@ func TestAccRDSClusterInstance_identifierPrefix(t *testing.T) { Config: testAccClusterInstanceConfig_identifierPrefix(rName, "tf-acc-test-prefix-"), Check: resource.ComposeTestCheckFunc( testAccCheckClusterInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameFromPrefix(resourceName, "identifier", "tf-acc-test-prefix-"), + acctest.CheckResourceAttrNameFromPrefix(resourceName, names.AttrIdentifier, "tf-acc-test-prefix-"), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", "tf-acc-test-prefix-"), ), }, diff --git a/internal/service/rds/export_task.go b/internal/service/rds/export_task.go index 9f471b8efc3..ccbb65dfe8b 100644 --- a/internal/service/rds/export_task.go +++ b/internal/service/rds/export_task.go @@ -94,7 +94,7 @@ func (r *resourceExportTask) Schema(ctx context.Context, req resource.SchemaRequ "percent_progress": schema.Int64Attribute{ Computed: true, }, - "s3_bucket_name": schema.StringAttribute{ + names.AttrS3BucketName: schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplaceIfConfigured(), diff --git a/internal/service/rds/export_task_test.go b/internal/service/rds/export_task_test.go index f6be0fa0c0c..6da8363b80b 100644 --- a/internal/service/rds/export_task_test.go +++ b/internal/service/rds/export_task_test.go @@ -45,7 +45,7 @@ func TestAccRDSExportTask_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "export_task_identifier", rName), resource.TestCheckResourceAttr(resourceName, names.AttrID, rName), resource.TestCheckResourceAttrPair(resourceName, "source_arn", "aws_db_snapshot.test", "db_snapshot_arn"), - resource.TestCheckResourceAttrPair(resourceName, "s3_bucket_name", "aws_s3_bucket.test", names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrS3BucketName, "aws_s3_bucket.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "iam_role_arn", "aws_iam_role.test", names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrKMSKeyID, "aws_kms_key.test", names.AttrARN), ), @@ -82,7 +82,7 @@ func TestAccRDSExportTask_optional(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "export_task_identifier", rName), resource.TestCheckResourceAttr(resourceName, names.AttrID, rName), resource.TestCheckResourceAttrPair(resourceName, "source_arn", "aws_db_snapshot.test", "db_snapshot_arn"), - resource.TestCheckResourceAttrPair(resourceName, "s3_bucket_name", "aws_s3_bucket.test", names.AttrID), + resource.TestCheckResourceAttrPair(resourceName, names.AttrS3BucketName, "aws_s3_bucket.test", names.AttrID), resource.TestCheckResourceAttrPair(resourceName, "iam_role_arn", "aws_iam_role.test", names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, names.AttrKMSKeyID, "aws_kms_key.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "export_only.#", "1"), diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go index c23d0e72898..096153d4176 100644 --- a/internal/service/rds/instance.go +++ b/internal/service/rds/instance.go @@ -333,7 +333,7 @@ func ResourceInstance() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Optional: true, Computed: true, @@ -344,7 +344,7 @@ func ResourceInstance() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ConflictsWith: []string{"identifier"}, + ConflictsWith: []string{names.AttrIdentifier}, ValidateFunc: validIdentifierPrefix, }, "instance_class": { @@ -721,7 +721,7 @@ func resourceInstanceCreate(ctx context.Context, d *schema.ResourceData, meta in var requiresRebootDbInstance bool // See discussion of IDs at the top of file - this is NOT d.Id() - identifier := create.Name(d.Get("identifier").(string), d.Get("identifier_prefix").(string)) + identifier := create.Name(d.Get(names.AttrIdentifier).(string), d.Get("identifier_prefix").(string)) var resourceID string // will be assigned depending on how it is created @@ -1818,9 +1818,9 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte } else { v, err = findDBInstanceByIDSDKv1(ctx, conn, d.Id()) if tfresource.NotFound(err) { - v, err = findDBInstanceByIDSDKv1(ctx, conn, d.Get("identifier").(string)) + v, err = findDBInstanceByIDSDKv1(ctx, conn, d.Get(names.AttrIdentifier).(string)) if tfresource.NotFound(err) { - log.Printf("[WARN] RDS DB Instance (%s) not found, removing from state", d.Get("identifier").(string)) + log.Printf("[WARN] RDS DB Instance (%s) not found, removing from state", d.Get(names.AttrIdentifier).(string)) d.SetId("") return nil } @@ -1828,7 +1828,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte } if err != nil { - return sdkdiag.AppendErrorf(diags, "reading RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "reading RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } d.SetId(aws.StringValue(v.DbiResourceId)) @@ -1870,7 +1870,7 @@ func resourceInstanceRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("enabled_cloudwatch_logs_exports", aws.StringValueSlice(v.EnabledCloudwatchLogsExports)) d.Set("engine", v.Engine) d.Set("iam_database_authentication_enabled", v.IAMDatabaseAuthenticationEnabled) - d.Set("identifier", v.DBInstanceIdentifier) + d.Set(names.AttrIdentifier, v.DBInstanceIdentifier) d.Set("identifier_prefix", create.NamePrefixFromName(aws.StringValue(v.DBInstanceIdentifier))) d.Set("instance_class", v.DBInstanceClass) d.Set("iops", v.Iops) @@ -1968,7 +1968,7 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in if d.Get("replicate_source_db").(string) == "" { input := &rds_sdkv2.PromoteReadReplicaInput{ BackupRetentionPeriod: aws.Int32(int32(d.Get("backup_retention_period").(int))), - DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), + DBInstanceIdentifier: aws.String(d.Get(names.AttrIdentifier).(string)), } if attr, ok := d.GetOk("backup_window"); ok { @@ -1977,11 +1977,11 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in _, err := conn.PromoteReadReplica(ctx, input) if err != nil { - return sdkdiag.AppendErrorf(diags, "promoting RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "promoting RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } if _, err := waitDBInstanceAvailableSDKv2(ctx, conn, d.Id(), deadline.Remaining()); err != nil { - return sdkdiag.AppendErrorf(diags, "promoting RDS DB Instance (%s): waiting for completion: %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "promoting RDS DB Instance (%s): waiting for completion: %s", d.Get(names.AttrIdentifier).(string), err) } } else { return sdkdiag.AppendErrorf(diags, "cannot elect new source database for replication") @@ -2017,24 +2017,24 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in err := handler.precondition(ctx, d) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } createIn := handler.createBlueGreenInput(d) - log.Printf("[DEBUG] Updating RDS DB Instance (%s): Creating Blue/Green Deployment", d.Get("identifier").(string)) + log.Printf("[DEBUG] Updating RDS DB Instance (%s): Creating Blue/Green Deployment", d.Get(names.AttrIdentifier).(string)) dep, err := orchestrator.CreateDeployment(ctx, createIn) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } deploymentIdentifier := dep.BlueGreenDeploymentIdentifier defer func() { - log.Printf("[DEBUG] Updating RDS DB Instance (%s): Deleting Blue/Green Deployment", d.Get("identifier").(string)) + log.Printf("[DEBUG] Updating RDS DB Instance (%s): Deleting Blue/Green Deployment", d.Get(names.AttrIdentifier).(string)) if dep == nil { - log.Printf("[DEBUG] Updating RDS DB Instance (%s): Deleting Blue/Green Deployment: deployment disappeared", d.Get("identifier").(string)) + log.Printf("[DEBUG] Updating RDS DB Instance (%s): Deleting Blue/Green Deployment: deployment disappeared", d.Get(names.AttrIdentifier).(string)) return } @@ -2047,58 +2047,58 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in } _, err = conn.DeleteBlueGreenDeployment(ctx, input) if err != nil { - diags = sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment: %s", d.Get("identifier").(string), err) + diags = sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment: %s", d.Get(names.AttrIdentifier).(string), err) return } orchestrator.AddCleanupWaiter(func(ctx context.Context, conn *rds_sdkv2.Client, optFns ...tfresource.OptionsFunc) { _, err = waitBlueGreenDeploymentDeleted(ctx, conn, aws.StringValue(deploymentIdentifier), deadline.Remaining(), optFns...) if err != nil { - diags = sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment: waiting for completion: %s", d.Get("identifier").(string), err) + diags = sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment: waiting for completion: %s", d.Get(names.AttrIdentifier).(string), err) } }) }() dep, err = orchestrator.waitForDeploymentAvailable(ctx, aws.StringValue(dep.BlueGreenDeploymentIdentifier), deadline.Remaining()) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } targetARN, err := parseDBInstanceARN(aws.StringValue(dep.Target)) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): creating Blue/Green Deployment: waiting for Green environment: %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): creating Blue/Green Deployment: waiting for Green environment: %s", d.Get(names.AttrIdentifier).(string), err) } _, err = waitDBInstanceAvailableSDKv2(ctx, conn, targetARN.Identifier, deadline.Remaining()) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): creating Blue/Green Deployment: waiting for Green environment: %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): creating Blue/Green Deployment: waiting for Green environment: %s", d.Get(names.AttrIdentifier).(string), err) } - err = handler.modifyTarget(ctx, targetARN.Identifier, d, deadline.Remaining(), fmt.Sprintf("Updating RDS DB Instance (%s)", d.Get("identifier").(string))) + err = handler.modifyTarget(ctx, targetARN.Identifier, d, deadline.Remaining(), fmt.Sprintf("Updating RDS DB Instance (%s)", d.Get(names.AttrIdentifier).(string))) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } - log.Printf("[DEBUG] Updating RDS DB Instance (%s): Switching over Blue/Green Deployment", d.Get("identifier").(string)) + log.Printf("[DEBUG] Updating RDS DB Instance (%s): Switching over Blue/Green Deployment", d.Get(names.AttrIdentifier).(string)) dep, err = orchestrator.Switchover(ctx, aws.StringValue(dep.BlueGreenDeploymentIdentifier), deadline.Remaining()) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } - target, err := findDBInstanceByIDSDKv2(ctx, conn, d.Get("identifier").(string)) + target, err := findDBInstanceByIDSDKv2(ctx, conn, d.Get(names.AttrIdentifier).(string)) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } // id changes here d.SetId(aws.StringValue(target.DbiResourceId)) d.Set("resource_id", target.DbiResourceId) - log.Printf("[DEBUG] Updating RDS DB Instance (%s): Deleting Blue/Green Deployment source", d.Get("identifier").(string)) + log.Printf("[DEBUG] Updating RDS DB Instance (%s): Deleting Blue/Green Deployment source", d.Get(names.AttrIdentifier).(string)) sourceARN, err := parseDBInstanceARN(aws.StringValue(dep.Source)) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment source: %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment source: %s", d.Get(names.AttrIdentifier).(string), err) } if d.Get("deletion_protection").(bool) { input := &rds_sdkv2.ModifyDBInstanceInput{ @@ -2108,7 +2108,7 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in } err := dbInstanceModify(ctx, conn, d.Id(), input, deadline.Remaining()) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment source: disabling deletion protection: %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment source: disabling deletion protection: %s", d.Get(names.AttrIdentifier).(string), err) } } deleteInput := &rds_sdkv2.DeleteDBInstanceInput{ @@ -2133,13 +2133,13 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in }, ) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment source: %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment source: %s", d.Get(names.AttrIdentifier).(string), err) } orchestrator.AddCleanupWaiter(func(ctx context.Context, conn *rds_sdkv2.Client, optFns ...tfresource.OptionsFunc) { _, err = waitDBInstanceDeleted(ctx, meta.(*conns.AWSClient).RDSConn(ctx), sourceARN.Identifier, deadline.Remaining(), optFns...) if err != nil { - diags = sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment source: waiting for completion: %s", d.Get("identifier").(string), err) + diags = sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): deleting Blue/Green Deployment source: waiting for completion: %s", d.Get(names.AttrIdentifier).(string), err) } }) @@ -2147,9 +2147,9 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in return diags } } else { - oldID := d.Get("identifier").(string) - if d.HasChange("identifier") { - o, _ := d.GetChange("identifier") + oldID := d.Get(names.AttrIdentifier).(string) + if d.HasChange(names.AttrIdentifier) { + o, _ := d.GetChange(names.AttrIdentifier) oldID = o.(string) } @@ -2179,7 +2179,7 @@ func resourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, meta in err := dbInstanceModify(ctx, conn, d.Id(), input, deadline.Remaining()) if err != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } } } @@ -2281,9 +2281,9 @@ func dbInstancePopulateModify(input *rds_sdkv2.ModifyDBInstanceInput, d *schema. input.EnableIAMDatabaseAuthentication = aws.Bool(d.Get("iam_database_authentication_enabled").(bool)) } - if d.HasChange("identifier") { + if d.HasChange(names.AttrIdentifier) { needsModify = true - input.NewDBInstanceIdentifier = aws.String(d.Get("identifier").(string)) + input.NewDBInstanceIdentifier = aws.String(d.Get(names.AttrIdentifier).(string)) } if d.HasChange("instance_class") { @@ -2459,7 +2459,7 @@ func resourceInstanceDelete(ctx context.Context, d *schema.ResourceData, meta in conn := meta.(*conns.AWSClient).RDSConn(ctx) input := &rds.DeleteDBInstanceInput{ - DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), + DBInstanceIdentifier: aws.String(d.Get(names.AttrIdentifier).(string)), DeleteAutomatedBackups: aws.Bool(d.Get("delete_automated_backups").(bool)), } @@ -2475,7 +2475,7 @@ func resourceInstanceDelete(ctx context.Context, d *schema.ResourceData, meta in } } - log.Printf("[DEBUG] Deleting RDS DB Instance: %s", d.Get("identifier").(string)) + log.Printf("[DEBUG] Deleting RDS DB Instance: %s", d.Get(names.AttrIdentifier).(string)) _, err := conn.DeleteDBInstanceWithContext(ctx, input) if tfawserr.ErrMessageContains(err, errCodeInvalidParameterCombination, "disable deletion pro") { @@ -2484,7 +2484,7 @@ func resourceInstanceDelete(ctx context.Context, d *schema.ResourceData, meta in func() (interface{}, error) { return conn.ModifyDBInstanceWithContext(ctx, &rds.ModifyDBInstanceInput{ ApplyImmediately: aws.Bool(true), - DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), + DBInstanceIdentifier: aws.String(d.Get(names.AttrIdentifier).(string)), DeletionProtection: aws.Bool(false), }) }, @@ -2504,11 +2504,11 @@ func resourceInstanceDelete(ctx context.Context, d *schema.ResourceData, meta in ) if ierr != nil { - return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "updating RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } if _, ierr := waitDBInstanceAvailableSDKv1(ctx, conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); ierr != nil { - return sdkdiag.AppendErrorf(diags, "waiting for RDS DB Instance (%s) update: %s", d.Get("identifier").(string), ierr) + return sdkdiag.AppendErrorf(diags, "waiting for RDS DB Instance (%s) update: %s", d.Get(names.AttrIdentifier).(string), ierr) } _, err = conn.DeleteDBInstanceWithContext(ctx, input) @@ -2520,11 +2520,11 @@ func resourceInstanceDelete(ctx context.Context, d *schema.ResourceData, meta in } if err != nil && !tfawserr.ErrMessageContains(err, rds.ErrCodeInvalidDBInstanceStateFault, "is already being deleted") { - return sdkdiag.AppendErrorf(diags, "deleting RDS DB Instance (%s): %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "deleting RDS DB Instance (%s): %s", d.Get(names.AttrIdentifier).(string), err) } if _, err := waitDBInstanceDeleted(ctx, conn, d.Id(), d.Timeout(schema.TimeoutDelete)); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for RDS DB Instance (%s) delete: %s", d.Get("identifier").(string), err) + return sdkdiag.AppendErrorf(diags, "waiting for RDS DB Instance (%s) delete: %s", d.Get(names.AttrIdentifier).(string), err) } return nil diff --git a/internal/service/rds/instance_migrate.go b/internal/service/rds/instance_migrate.go index 4b112f78be8..cd46f0edb18 100644 --- a/internal/service/rds/instance_migrate.go +++ b/internal/service/rds/instance_migrate.go @@ -95,7 +95,7 @@ func resourceInstanceResourceV0() *schema.Resource { Computed: true, }, - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Optional: true, Computed: true, @@ -592,7 +592,7 @@ func resourceInstanceResourceV1() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Optional: true, Computed: true, @@ -603,7 +603,7 @@ func resourceInstanceResourceV1() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ConflictsWith: []string{"identifier"}, + ConflictsWith: []string{names.AttrIdentifier}, ValidateFunc: validIdentifierPrefix, }, "instance_class": { diff --git a/internal/service/rds/instance_migrate_test.go b/internal/service/rds/instance_migrate_test.go index 7a519f1dac9..106d42d98be 100644 --- a/internal/service/rds/instance_migrate_test.go +++ b/internal/service/rds/instance_migrate_test.go @@ -29,19 +29,19 @@ func TestInstanceStateUpgradeV0(t *testing.T) { { Description: "adds delete_automated_backups", InputState: map[string]interface{}{ - "allocated_storage": 10, - "engine": "mariadb", - "identifier": "my-test-instance", - "instance_class": "db.t2.micro", - names.AttrPassword: "avoid-plaintext-passwords", - names.AttrUsername: "tfacctest", - names.AttrTags: map[string]interface{}{"key1": "value1"}, + "allocated_storage": 10, + "engine": "mariadb", + names.AttrIdentifier: "my-test-instance", + "instance_class": "db.t2.micro", + names.AttrPassword: "avoid-plaintext-passwords", + names.AttrUsername: "tfacctest", + names.AttrTags: map[string]interface{}{"key1": "value1"}, }, ExpectedState: map[string]interface{}{ "allocated_storage": 10, "delete_automated_backups": true, "engine": "mariadb", - "identifier": "my-test-instance", + names.AttrIdentifier: "my-test-instance", "instance_class": "db.t2.micro", names.AttrPassword: "avoid-plaintext-passwords", names.AttrUsername: "tfacctest", @@ -84,26 +84,26 @@ func TestInstanceStateUpgradeV1(t *testing.T) { { Description: "change id to resource id", InputState: map[string]interface{}{ - "allocated_storage": 10, - "engine": "mariadb", - names.AttrID: "my-test-instance", - "identifier": "my-test-instance", - "instance_class": "db.t2.micro", - names.AttrPassword: "avoid-plaintext-passwords", - "resource_id": "db-cnuap2ilnbmok4eunzklfvwjca", - names.AttrTags: map[string]interface{}{"key1": "value1"}, - names.AttrUsername: "tfacctest", + "allocated_storage": 10, + "engine": "mariadb", + names.AttrID: "my-test-instance", + names.AttrIdentifier: "my-test-instance", + "instance_class": "db.t2.micro", + names.AttrPassword: "avoid-plaintext-passwords", + "resource_id": "db-cnuap2ilnbmok4eunzklfvwjca", + names.AttrTags: map[string]interface{}{"key1": "value1"}, + names.AttrUsername: "tfacctest", }, ExpectedState: map[string]interface{}{ - "allocated_storage": 10, - "engine": "mariadb", - names.AttrID: "db-cnuap2ilnbmok4eunzklfvwjca", - "identifier": "my-test-instance", - "instance_class": "db.t2.micro", - names.AttrPassword: "avoid-plaintext-passwords", - "resource_id": "db-cnuap2ilnbmok4eunzklfvwjca", - names.AttrTags: map[string]interface{}{"key1": "value1"}, - names.AttrUsername: "tfacctest", + "allocated_storage": 10, + "engine": "mariadb", + names.AttrID: "db-cnuap2ilnbmok4eunzklfvwjca", + names.AttrIdentifier: "my-test-instance", + "instance_class": "db.t2.micro", + names.AttrPassword: "avoid-plaintext-passwords", + "resource_id": "db-cnuap2ilnbmok4eunzklfvwjca", + names.AttrTags: map[string]interface{}{"key1": "value1"}, + names.AttrUsername: "tfacctest", }, }, } diff --git a/internal/service/rds/instance_role_association_test.go b/internal/service/rds/instance_role_association_test.go index fbd039551e0..115a83c2eb5 100644 --- a/internal/service/rds/instance_role_association_test.go +++ b/internal/service/rds/instance_role_association_test.go @@ -42,7 +42,7 @@ func TestAccRDSInstanceRoleAssociation_basic(t *testing.T) { Config: testAccInstanceRoleAssociationConfig_basic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckInstanceRoleAssociationExists(ctx, resourceName, &dbInstanceRole1), - resource.TestCheckResourceAttrPair(resourceName, "db_instance_identifier", dbInstanceResourceName, "identifier"), + resource.TestCheckResourceAttrPair(resourceName, "db_instance_identifier", dbInstanceResourceName, names.AttrIdentifier), resource.TestCheckResourceAttr(resourceName, "feature_name", "S3_INTEGRATION"), resource.TestCheckResourceAttrPair(resourceName, names.AttrRoleARN, iamRoleResourceName, names.AttrARN), ), diff --git a/internal/service/rds/instance_test.go b/internal/service/rds/instance_test.go index 9b79ac80ab3..f39ed04218b 100644 --- a/internal/service/rds/instance_test.go +++ b/internal/service/rds/instance_test.go @@ -74,7 +74,7 @@ func TestAccRDSInstance_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrHostedZoneID), resource.TestCheckResourceAttr(resourceName, "iam_database_authentication_enabled", "false"), resource.TestCheckResourceAttrPair(resourceName, names.AttrID, resourceName, "resource_id"), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), resource.TestCheckResourceAttrPair(resourceName, "instance_class", "data.aws_rds_orderable_db_instance.test", "instance_class"), resource.TestCheckResourceAttr(resourceName, "iops", "0"), @@ -132,7 +132,7 @@ func TestAccRDSInstance_identifierPrefix(t *testing.T) { Config: testAccInstanceConfig_identifierPrefix("tf-acc-test-prefix-"), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameFromPrefix(resourceName, "identifier", "tf-acc-test-prefix-"), + acctest.CheckResourceAttrNameFromPrefix(resourceName, names.AttrIdentifier, "tf-acc-test-prefix-"), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", "tf-acc-test-prefix-"), ), }, @@ -168,7 +168,7 @@ func TestAccRDSInstance_identifierGenerated(t *testing.T) { Config: testAccInstanceConfig_identifierGenerated(), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameGenerated(resourceName, "identifier"), + acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrIdentifier), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", id.UniqueIdPrefix), ), }, @@ -1039,10 +1039,10 @@ func TestAccRDSInstance_ReplicateSourceDB_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, sourceResourceName, &sourceDbInstance), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), testAccCheckInstanceReplicaAttributes(&sourceDbInstance, &dbInstance), - resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, "identifier"), + resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, names.AttrIdentifier), resource.TestCheckResourceAttrPair(resourceName, "db_name", sourceResourceName, "db_name"), resource.TestCheckResourceAttr(resourceName, "dedicated_log_volume", "false"), resource.TestCheckResourceAttrPair(resourceName, names.AttrUsername, sourceResourceName, names.AttrUsername), @@ -1071,7 +1071,7 @@ func TestAccRDSInstance_ReplicateSourceDB_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, sourceResourceName, &sourceDbInstance), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "replicate_source_db", ""), resource.TestCheckResourceAttrPair(resourceName, "db_name", sourceResourceName, "db_name"), resource.TestCheckResourceAttrPair(resourceName, names.AttrUsername, sourceResourceName, names.AttrUsername), @@ -1112,7 +1112,7 @@ func TestAccRDSInstance_ReplicateSourceDB_namePrefix(t *testing.T) { Config: testAccInstanceConfig_ReplicateSourceDB_namePrefix(identifierPrefix, sourceName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameFromPrefix(resourceName, "identifier", identifierPrefix), + acctest.CheckResourceAttrNameFromPrefix(resourceName, names.AttrIdentifier, identifierPrefix), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", identifierPrefix), ), }, @@ -1150,7 +1150,7 @@ func TestAccRDSInstance_ReplicateSourceDB_nameGenerated(t *testing.T) { Config: testAccInstanceConfig_ReplicateSourceDB_nameGenerated(sourceName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameGenerated(resourceName, "identifier"), + acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrIdentifier), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", id.UniqueIdPrefix), ), }, @@ -2070,7 +2070,7 @@ func TestAccRDSInstance_ReplicateSourceDB_characterSet_Source(t *testing.T) { testAccCheckInstanceExists(ctx, sourceResourceName, &sourceDbInstance), resource.TestCheckResourceAttr(sourceResourceName, "character_set_name", "WE8ISO8859P15"), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), - resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, "identifier"), + resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, names.AttrIdentifier), resource.TestCheckResourceAttr(resourceName, "character_set_name", "WE8ISO8859P15"), ), }, @@ -2115,7 +2115,7 @@ func TestAccRDSInstance_ReplicateSourceDB_characterSet_Replica(t *testing.T) { testAccCheckInstanceExists(ctx, sourceResourceName, &sourceDbInstance), resource.TestCheckResourceAttr(sourceResourceName, "character_set_name", "WE8ISO8859P15"), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), - resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, "identifier"), + resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, names.AttrIdentifier), resource.TestCheckResourceAttr(resourceName, "character_set_name", "WE8ISO8859P15"), ), }, @@ -2332,7 +2332,7 @@ func TestAccRDSInstance_s3Import(t *testing.T) { Config: testAccInstanceConfig_s3Import(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), ), }, @@ -2375,7 +2375,7 @@ func TestAccRDSInstance_SnapshotIdentifier_basic(t *testing.T) { testAccCheckInstanceExists(ctx, sourceDbResourceName, &sourceDbInstance), testAccCheckDBSnapshotExists(ctx, snapshotResourceName, &dbSnapshot), testAccCheckInstanceExists(ctx, resourceName, &dbInstance), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), resource.TestCheckResourceAttr(resourceName, "dedicated_log_volume", "false"), resource.TestCheckResourceAttrPair(resourceName, "instance_class", sourceDbResourceName, "instance_class"), @@ -2466,7 +2466,7 @@ func TestAccRDSInstance_SnapshotIdentifier_namePrefix(t *testing.T) { Config: testAccInstanceConfig_SnapshotIdentifier_namePrefix(identifierPrefix, sourceName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameFromPrefix(resourceName, "identifier", identifierPrefix), + acctest.CheckResourceAttrNameFromPrefix(resourceName, names.AttrIdentifier, identifierPrefix), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", identifierPrefix), ), }, @@ -2505,7 +2505,7 @@ func TestAccRDSInstance_SnapshotIdentifier_nameGenerated(t *testing.T) { Config: testAccInstanceConfig_SnapshotIdentifier_nameGenerated(sourceName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameGenerated(resourceName, "identifier"), + acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrIdentifier), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", id.UniqueIdPrefix), ), }, @@ -5390,7 +5390,7 @@ func TestAccRDSInstance_BlueGreenDeployment_updateAndPromoteReplica(t *testing.T Config: testAccInstanceConfig_BlueGreenDeployment_prePromote(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v1), - resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, "identifier"), + resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, names.AttrIdentifier), resource.TestCheckResourceAttrPair(resourceName, "instance_class", "data.aws_rds_orderable_db_instance.test", "instance_class"), resource.TestCheckResourceAttr(resourceName, "backup_retention_period", "1"), ), @@ -5672,7 +5672,7 @@ func TestAccRDSInstance_BlueGreenDeployment_outOfBand(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v1), resource.TestCheckResourceAttrPair(resourceName, names.AttrEngineVersion, "data.aws_rds_engine_version.initial", names.AttrVersion), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttrSet(resourceName, "resource_id"), resource.TestCheckResourceAttrPair(resourceName, names.AttrID, resourceName, "resource_id"), testAccCheckRetrieveValue("data.aws_rds_engine_version.update", names.AttrVersion, &updateVersion), @@ -5785,7 +5785,7 @@ func TestAccRDSInstance_BlueGreenDeployment_outOfBand(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v2), testAccCheckDBInstanceRecreated(&v1, &v2), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttrSet(resourceName, "resource_id"), resource.TestCheckResourceAttrPair(resourceName, names.AttrID, resourceName, "resource_id"), ), @@ -6197,7 +6197,7 @@ func TestAccRDSInstance_newIdentifier_Pending(t *testing.T) { Config: testAccInstanceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v1), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), ), }, { @@ -6215,7 +6215,7 @@ func TestAccRDSInstance_newIdentifier_Pending(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v2), testAccCheckDBInstanceNotRecreated(&v1, &v2), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), ), }, }, @@ -6243,7 +6243,7 @@ func TestAccRDSInstance_newIdentifier_Immediately(t *testing.T) { Config: testAccInstanceConfig_basic(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v1), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), ), }, { @@ -6259,7 +6259,7 @@ func TestAccRDSInstance_newIdentifier_Immediately(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckInstanceExists(ctx, resourceName, &v2), testAccCheckDBInstanceNotRecreated(&v1, &v2), - resource.TestCheckResourceAttr(resourceName, "identifier", rName2), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName2), ), }, }, @@ -6277,17 +6277,17 @@ func testAccCheckInstanceAutomatedBackupsDelete(ctx context.Context) resource.Te log.Printf("[INFO] Trying to locate the DBInstance Automated Backup") describeOutput, err := conn.DescribeDBInstanceAutomatedBackupsWithContext(ctx, &rds.DescribeDBInstanceAutomatedBackupsInput{ - DBInstanceIdentifier: aws.String(rs.Primary.Attributes["identifier"]), + DBInstanceIdentifier: aws.String(rs.Primary.Attributes[names.AttrIdentifier]), }) if err != nil { return err } if describeOutput == nil || len(describeOutput.DBInstanceAutomatedBackups) == 0 { - return fmt.Errorf("Automated backup for %s not found", rs.Primary.Attributes["identifier"]) + return fmt.Errorf("Automated backup for %s not found", rs.Primary.Attributes[names.AttrIdentifier]) } - log.Printf("[INFO] Deleting automated backup for %s", rs.Primary.Attributes["identifier"]) + log.Printf("[INFO] Deleting automated backup for %s", rs.Primary.Attributes[names.AttrIdentifier]) _, err = conn.DeleteDBInstanceAutomatedBackupWithContext(ctx, &rds.DeleteDBInstanceAutomatedBackupInput{ DbiResourceId: describeOutput.DBInstanceAutomatedBackups[0].DbiResourceId, }) @@ -6309,7 +6309,7 @@ func testAccCheckInstanceDestroy(ctx context.Context) resource.TestCheckFunc { continue } - _, err := tfrds.FindDBInstanceByID(ctx, conn, rs.Primary.Attributes["identifier"]) + _, err := tfrds.FindDBInstanceByID(ctx, conn, rs.Primary.Attributes[names.AttrIdentifier]) if tfresource.NotFound(err) { continue @@ -6319,7 +6319,7 @@ func testAccCheckInstanceDestroy(ctx context.Context) resource.TestCheckFunc { return err } - return fmt.Errorf("RDS DB Instance %s still exists", rs.Primary.Attributes["identifier"]) + return fmt.Errorf("RDS DB Instance %s still exists", rs.Primary.Attributes[names.AttrIdentifier]) } return nil @@ -6452,7 +6452,7 @@ func testAccCheckInstanceDestroyWithFinalSnapshot(ctx context.Context) resource. return err } - _, err = tfrds.FindDBInstanceByID(ctx, conn, rs.Primary.Attributes["identifier"]) + _, err = tfrds.FindDBInstanceByID(ctx, conn, rs.Primary.Attributes[names.AttrIdentifier]) if tfresource.NotFound(err) { continue @@ -6462,7 +6462,7 @@ func testAccCheckInstanceDestroyWithFinalSnapshot(ctx context.Context) resource. return err } - return fmt.Errorf("RDS DB Instance %s still exists", rs.Primary.Attributes["identifier"]) + return fmt.Errorf("RDS DB Instance %s still exists", rs.Primary.Attributes[names.AttrIdentifier]) } return nil @@ -6492,7 +6492,7 @@ func testAccCheckInstanceDestroyWithoutFinalSnapshot(ctx context.Context) resour return fmt.Errorf("RDS DB Snapshot %s exists", finalSnapshotID) } - _, err = tfrds.FindDBInstanceByID(ctx, conn, rs.Primary.Attributes["identifier"]) + _, err = tfrds.FindDBInstanceByID(ctx, conn, rs.Primary.Attributes[names.AttrIdentifier]) if tfresource.NotFound(err) { continue @@ -6502,7 +6502,7 @@ func testAccCheckInstanceDestroyWithoutFinalSnapshot(ctx context.Context) resour return err } - return fmt.Errorf("RDS DB Instance %s still exists", rs.Primary.Attributes["identifier"]) + return fmt.Errorf("RDS DB Instance %s still exists", rs.Primary.Attributes[names.AttrIdentifier]) } return nil @@ -6546,7 +6546,7 @@ func testAccCheckInstanceExistsWithProvider(ctx context.Context, n string, v *rd return fmt.Errorf("Not found: %s", n) } - if rs.Primary.Attributes["identifier"] == "" { + if rs.Primary.Attributes[names.AttrIdentifier] == "" { return fmt.Errorf("No RDS DB Instance ID is set") } diff --git a/internal/service/rds/instances_data_source_test.go b/internal/service/rds/instances_data_source_test.go index 333349b2675..08122ea333e 100644 --- a/internal/service/rds/instances_data_source_test.go +++ b/internal/service/rds/instances_data_source_test.go @@ -34,7 +34,7 @@ func TestAccRDSInstancesDataSource_filter(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "instance_arns.#", "1"), resource.TestCheckResourceAttrPair(dataSourceName, "instance_arns.0", resourceName, names.AttrARN), resource.TestCheckResourceAttr(dataSourceName, "instance_identifiers.#", "1"), - resource.TestCheckResourceAttrPair(dataSourceName, "instance_identifiers.0", resourceName, "identifier"), + resource.TestCheckResourceAttrPair(dataSourceName, "instance_identifiers.0", resourceName, names.AttrIdentifier), ), }, }, @@ -61,7 +61,7 @@ func TestAccRDSInstancesDataSource_tags(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "instance_arns.#", "1"), resource.TestCheckResourceAttrPair(dataSourceName, "instance_arns.0", resourceName, names.AttrARN), resource.TestCheckResourceAttr(dataSourceName, "instance_identifiers.#", "1"), - resource.TestCheckResourceAttrPair(dataSourceName, "instance_identifiers.0", resourceName, "identifier"), + resource.TestCheckResourceAttrPair(dataSourceName, "instance_identifiers.0", resourceName, names.AttrIdentifier), ), }, }, diff --git a/internal/service/rds/sweep.go b/internal/service/rds/sweep.go index b8319589a9b..fa2307c6620 100644 --- a/internal/service/rds/sweep.go +++ b/internal/service/rds/sweep.go @@ -385,7 +385,7 @@ func sweepInstances(region string) error { d.Set(names.AttrApplyImmediately, true) d.Set("delete_automated_backups", true) d.Set("deletion_protection", false) - d.Set("identifier", v.DBInstanceIdentifier) + d.Set(names.AttrIdentifier, v.DBInstanceIdentifier) d.Set("skip_final_snapshot", true) sweepResources = append(sweepResources, sweep.NewSweepResource(r, d, client)) From 02ce178a5ea93cd509e22ff0ca730f990a2d5dff Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:34 -0400 Subject: [PATCH 1475/1490] redshift: Use constants for strings --- internal/service/redshift/event_subscription.go | 8 ++++---- internal/service/redshift/event_subscription_test.go | 4 ++-- internal/service/redshift/snapshot_schedule.go | 8 ++++---- internal/service/redshift/snapshot_schedule_test.go | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/service/redshift/event_subscription.go b/internal/service/redshift/event_subscription.go index 944067db484..e39cfc4ea82 100644 --- a/internal/service/redshift/event_subscription.go +++ b/internal/service/redshift/event_subscription.go @@ -86,7 +86,7 @@ func resourceEventSubscription() *schema.Resource { "INFO", }, false), }, - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Required: true, ValidateFunc: verify.ValidARN, @@ -119,7 +119,7 @@ func resourceEventSubscriptionCreate(ctx context.Context, d *schema.ResourceData request := &redshift.CreateEventSubscriptionInput{ SubscriptionName: aws.String(d.Get(names.AttrName).(string)), - SnsTopicArn: aws.String(d.Get("sns_topic_arn").(string)), + SnsTopicArn: aws.String(d.Get(names.AttrSNSTopicARN).(string)), Enabled: aws.Bool(d.Get(names.AttrEnabled).(bool)), Tags: getTagsIn(ctx), } @@ -180,7 +180,7 @@ func resourceEventSubscriptionRead(ctx context.Context, d *schema.ResourceData, d.Set("event_categories", aws.StringValueSlice(sub.EventCategoriesList)) d.Set(names.AttrName, sub.CustSubscriptionId) d.Set("severity", sub.Severity) - d.Set("sns_topic_arn", sub.SnsTopicArn) + d.Set(names.AttrSNSTopicARN, sub.SnsTopicArn) d.Set("source_ids", aws.StringValueSlice(sub.SourceIdsList)) d.Set("source_type", sub.SourceType) d.Set(names.AttrStatus, sub.Status) @@ -197,7 +197,7 @@ func resourceEventSubscriptionUpdate(ctx context.Context, d *schema.ResourceData if d.HasChangesExcept(names.AttrTags, names.AttrTagsAll) { req := &redshift.ModifyEventSubscriptionInput{ SubscriptionName: aws.String(d.Id()), - SnsTopicArn: aws.String(d.Get("sns_topic_arn").(string)), + SnsTopicArn: aws.String(d.Get(names.AttrSNSTopicARN).(string)), Enabled: aws.Bool(d.Get(names.AttrEnabled).(bool)), SourceIds: flex.ExpandStringSet(d.Get("source_ids").(*schema.Set)), SourceType: aws.String(d.Get("source_type").(string)), diff --git a/internal/service/redshift/event_subscription_test.go b/internal/service/redshift/event_subscription_test.go index ecac4482683..7e2b40a5f0a 100644 --- a/internal/service/redshift/event_subscription_test.go +++ b/internal/service/redshift/event_subscription_test.go @@ -44,7 +44,7 @@ func TestAccRedshiftEventSubscription_basic(t *testing.T) { acctest.CheckResourceAttrAccountID(resourceName, "customer_aws_id"), resource.TestCheckResourceAttr(resourceName, "event_categories.#", "0"), resource.TestCheckResourceAttr(resourceName, "source_ids.#", "0"), - resource.TestCheckResourceAttrPair(resourceName, "sns_topic_arn", "aws_sns_topic.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSNSTopicARN, "aws_sns_topic.test", names.AttrARN), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, @@ -61,7 +61,7 @@ func TestAccRedshiftEventSubscription_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "severity", "INFO"), resource.TestCheckResourceAttr(resourceName, "source_type", "cluster-snapshot"), resource.TestCheckTypeSetElemAttr(resourceName, "event_categories.*", "monitoring"), - resource.TestCheckResourceAttrPair(resourceName, "sns_topic_arn", "aws_sns_topic.test", names.AttrARN), + resource.TestCheckResourceAttrPair(resourceName, names.AttrSNSTopicARN, "aws_sns_topic.test", names.AttrARN), acctest.CheckResourceAttrAccountID(resourceName, "customer_aws_id"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), diff --git a/internal/service/redshift/snapshot_schedule.go b/internal/service/redshift/snapshot_schedule.go index 55315540025..5f11b4c0b88 100644 --- a/internal/service/redshift/snapshot_schedule.go +++ b/internal/service/redshift/snapshot_schedule.go @@ -57,7 +57,7 @@ func resourceSnapshotSchedule() *schema.Resource { Optional: true, Default: false, }, - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Optional: true, Computed: true, @@ -69,7 +69,7 @@ func resourceSnapshotSchedule() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ConflictsWith: []string{"identifier"}, + ConflictsWith: []string{names.AttrIdentifier}, }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), @@ -83,7 +83,7 @@ func resourceSnapshotScheduleCreate(ctx context.Context, d *schema.ResourceData, var diags diag.Diagnostics conn := meta.(*conns.AWSClient).RedshiftConn(ctx) - identifier := create.Name(d.Get("identifier").(string), d.Get("identifier_prefix").(string)) + identifier := create.Name(d.Get(names.AttrIdentifier).(string), d.Get("identifier_prefix").(string)) input := &redshift.CreateSnapshotScheduleInput{ ScheduleIdentifier: aws.String(identifier), ScheduleDefinitions: flex.ExpandStringSet(d.Get("definitions").(*schema.Set)), @@ -131,7 +131,7 @@ func resourceSnapshotScheduleRead(ctx context.Context, d *schema.ResourceData, m d.Set(names.AttrARN, arn) d.Set("definitions", aws.StringValueSlice(snapshotSchedule.ScheduleDefinitions)) d.Set(names.AttrDescription, snapshotSchedule.ScheduleDescription) - d.Set("identifier", snapshotSchedule.ScheduleIdentifier) + d.Set(names.AttrIdentifier, snapshotSchedule.ScheduleIdentifier) d.Set("identifier_prefix", create.NamePrefixFromName(aws.StringValue(snapshotSchedule.ScheduleIdentifier))) setTagsOut(ctx, snapshotSchedule.Tags) diff --git a/internal/service/redshift/snapshot_schedule_test.go b/internal/service/redshift/snapshot_schedule_test.go index 84ee4cf436d..1cdd293dec6 100644 --- a/internal/service/redshift/snapshot_schedule_test.go +++ b/internal/service/redshift/snapshot_schedule_test.go @@ -41,7 +41,7 @@ func TestAccRedshiftSnapshotSchedule_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "definitions.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "definitions.*", "rate(12 hours)"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, ""), - resource.TestCheckResourceAttr(resourceName, "identifier", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, rName), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), @@ -146,7 +146,7 @@ func TestAccRedshiftSnapshotSchedule_identifierGenerated(t *testing.T) { Config: testAccSnapshotScheduleConfig_identifierGenerated(), Check: resource.ComposeTestCheckFunc( testAccCheckSnapshotScheduleExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameGenerated(resourceName, "identifier"), + acctest.CheckResourceAttrNameGenerated(resourceName, names.AttrIdentifier), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", id.UniqueIdPrefix), ), }, @@ -177,7 +177,7 @@ func TestAccRedshiftSnapshotSchedule_identifierPrefix(t *testing.T) { Config: testAccSnapshotScheduleConfig_identifierPrefix("tf-acc-test-prefix-"), Check: resource.ComposeTestCheckFunc( testAccCheckSnapshotScheduleExists(ctx, resourceName, &v), - acctest.CheckResourceAttrNameFromPrefix(resourceName, "identifier", "tf-acc-test-prefix-"), + acctest.CheckResourceAttrNameFromPrefix(resourceName, names.AttrIdentifier, "tf-acc-test-prefix-"), resource.TestCheckResourceAttr(resourceName, "identifier_prefix", "tf-acc-test-prefix-"), ), }, From 0f58ddda98d2afc09e7bb64c3ad4f99accc7566c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:35 -0400 Subject: [PATCH 1476/1490] s3: Use constants for strings --- internal/service/s3/bucket_object.go | 8 ++-- .../service/s3/bucket_object_data_source.go | 4 +- .../s3/bucket_object_data_source_test.go | 26 ++++++------- internal/service/s3/bucket_object_test.go | 4 +- internal/service/s3/object.go | 8 ++-- internal/service/s3/object_copy.go | 8 ++-- internal/service/s3/object_copy_test.go | 6 +-- internal/service/s3/object_data_source.go | 4 +- .../service/s3/object_data_source_test.go | 38 +++++++++---------- internal/service/s3/object_test.go | 8 ++-- 10 files changed, 57 insertions(+), 57 deletions(-) diff --git a/internal/service/s3/bucket_object.go b/internal/service/s3/bucket_object.go index 69ff40498d0..9ec7cde4491 100644 --- a/internal/service/s3/bucket_object.go +++ b/internal/service/s3/bucket_object.go @@ -105,7 +105,7 @@ func resourceBucketObject() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Optional: true, Computed: true, @@ -236,7 +236,7 @@ func resourceBucketObjectRead(ctx context.Context, d *schema.ResourceData, meta d.Set("content_disposition", output.ContentDisposition) d.Set("content_encoding", output.ContentEncoding) d.Set("content_language", output.ContentLanguage) - d.Set("content_type", output.ContentType) + d.Set(names.AttrContentType, output.ContentType) // See https://forums.aws.amazon.com/thread.jspa?threadID=44003 d.Set("etag", strings.Trim(aws.ToString(output.ETag), `"`)) d.Set("metadata", output.Metadata) @@ -442,7 +442,7 @@ func resourceBucketObjectUpload(ctx context.Context, d *schema.ResourceData, met input.ContentLanguage = aws.String(v.(string)) } - if v, ok := d.GetOk("content_type"); ok { + if v, ok := d.GetOk(names.AttrContentType); ok { input.ContentType = aws.String(v.(string)) } @@ -544,7 +544,7 @@ func hasBucketObjectContentChanges(d sdkv2.ResourceDiffer) bool { "content_disposition", "content_encoding", "content_language", - "content_type", + names.AttrContentType, "content", "etag", names.AttrKMSKeyID, diff --git a/internal/service/s3/bucket_object_data_source.go b/internal/service/s3/bucket_object_data_source.go index fc816a782e9..199a58d3824 100644 --- a/internal/service/s3/bucket_object_data_source.go +++ b/internal/service/s3/bucket_object_data_source.go @@ -67,7 +67,7 @@ func dataSourceBucketObject() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Computed: true, }, @@ -186,7 +186,7 @@ func dataSourceBucketObjectRead(ctx context.Context, d *schema.ResourceData, met d.Set("content_encoding", out.ContentEncoding) d.Set("content_language", out.ContentLanguage) d.Set("content_length", out.ContentLength) - d.Set("content_type", out.ContentType) + d.Set(names.AttrContentType, out.ContentType) // See https://forums.aws.amazon.com/thread.jspa?threadID=44003 d.Set("etag", strings.Trim(aws.ToString(out.ETag), `"`)) d.Set("expiration", out.Expiration) diff --git a/internal/service/s3/bucket_object_data_source_test.go b/internal/service/s3/bucket_object_data_source_test.go index 8d89ddae9d6..fbdddfab473 100644 --- a/internal/service/s3/bucket_object_data_source_test.go +++ b/internal/service/s3/bucket_object_data_source_test.go @@ -37,7 +37,7 @@ func TestAccS3BucketObjectDataSource_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, names.AttrARN, resourceName, names.AttrARN), resource.TestCheckResourceAttr(dataSourceName, "content_length", "11"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttrPair(dataSourceName, "object_lock_legal_hold_status", resourceName, "object_lock_legal_hold_status"), @@ -91,7 +91,7 @@ func TestAccS3BucketObjectDataSource_readableBody(t *testing.T) { Config: testAccBucketObjectDataSourceConfig_readableBody(rInt), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttrPair(dataSourceName, "object_lock_legal_hold_status", resourceName, "object_lock_legal_hold_status"), @@ -121,7 +121,7 @@ func TestAccS3BucketObjectDataSource_kmsEncrypted(t *testing.T) { Config: testAccBucketObjectDataSourceConfig_kmsEncrypted(rInt), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "content_length", "22"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestCheckResourceAttrPair(dataSourceName, "server_side_encryption", resourceName, "server_side_encryption"), resource.TestCheckResourceAttrPair(dataSourceName, "sse_kms_key_id", resourceName, names.AttrKMSKeyID), @@ -153,7 +153,7 @@ func TestAccS3BucketObjectDataSource_bucketKeyEnabled(t *testing.T) { Config: testAccBucketObjectDataSourceConfig_keyEnabled(rInt), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "content_length", "22"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestCheckResourceAttrPair(dataSourceName, "server_side_encryption", resourceName, "server_side_encryption"), resource.TestCheckResourceAttrPair(dataSourceName, "sse_kms_key_id", resourceName, names.AttrKMSKeyID), @@ -186,7 +186,7 @@ func TestAccS3BucketObjectDataSource_allParams(t *testing.T) { Config: testAccBucketObjectDataSourceConfig_allParams(rInt), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "content_length", "25"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttrPair(dataSourceName, "version_id", resourceName, "version_id"), @@ -233,7 +233,7 @@ func TestAccS3BucketObjectDataSource_objectLockLegalHoldOff(t *testing.T) { Config: testAccBucketObjectDataSourceConfig_lockLegalHoldOff(rInt), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "content_length", "11"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttrPair(dataSourceName, "object_lock_legal_hold_status", resourceName, "object_lock_legal_hold_status"), @@ -264,7 +264,7 @@ func TestAccS3BucketObjectDataSource_objectLockLegalHoldOn(t *testing.T) { Config: testAccBucketObjectDataSourceConfig_lockLegalHoldOn(rInt, retainUntilDate), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "content_length", "11"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttrPair(dataSourceName, "object_lock_legal_hold_status", resourceName, "object_lock_legal_hold_status"), @@ -301,19 +301,19 @@ func TestAccS3BucketObjectDataSource_leadingSlash(t *testing.T) { Config: conf, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName1, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName1, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName1, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName1, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName1, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttr(dataSourceName1, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName2, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName2, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName2, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName2, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttr(dataSourceName2, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName3, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName3, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName3, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName3, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName3, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttr(dataSourceName3, "body", "yes"), @@ -348,15 +348,15 @@ func TestAccS3BucketObjectDataSource_multipleSlashes(t *testing.T) { Config: conf, Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName1, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName1, "content_type", resourceName1, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName1, names.AttrContentType, resourceName1, names.AttrContentType), resource.TestCheckResourceAttr(dataSourceName1, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName2, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName2, "content_type", resourceName1, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrContentType, resourceName1, names.AttrContentType), resource.TestCheckResourceAttr(dataSourceName2, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName3, "content_length", "2"), - resource.TestCheckResourceAttrPair(dataSourceName3, "content_type", resourceName2, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName3, names.AttrContentType, resourceName2, names.AttrContentType), resource.TestCheckResourceAttr(dataSourceName3, "body", "no"), ), }, diff --git a/internal/service/s3/bucket_object_test.go b/internal/service/s3/bucket_object_test.go index 7c0136da1dd..50d13a1b872 100644 --- a/internal/service/s3/bucket_object_test.go +++ b/internal/service/s3/bucket_object_test.go @@ -82,7 +82,7 @@ func TestAccS3BucketObject_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_disposition", ""), resource.TestCheckResourceAttr(resourceName, "content_encoding", ""), resource.TestCheckResourceAttr(resourceName, "content_language", ""), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/octet-stream"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/octet-stream"), resource.TestCheckResourceAttrSet(resourceName, "etag"), resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, names.AttrKey, "test-key"), @@ -310,7 +310,7 @@ func TestAccS3BucketObject_withContentCharacteristics(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckBucketObjectExists(ctx, resourceName, &obj), testAccCheckObjectBody(&obj, "{anything will do }"), - resource.TestCheckResourceAttr(resourceName, "content_type", "binary/octet-stream"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "binary/octet-stream"), resource.TestCheckResourceAttr(resourceName, "website_redirect", "http://google.com"), ), }, diff --git a/internal/service/s3/object.go b/internal/service/s3/object.go index 79c2ea129db..a781c7a88a1 100644 --- a/internal/service/s3/object.go +++ b/internal/service/s3/object.go @@ -132,7 +132,7 @@ func resourceObject() *schema.Resource { Type: schema.TypeString, Optional: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Optional: true, Computed: true, @@ -296,7 +296,7 @@ func resourceObjectRead(ctx context.Context, d *schema.ResourceData, meta interf d.Set("content_disposition", output.ContentDisposition) d.Set("content_encoding", output.ContentEncoding) d.Set("content_language", output.ContentLanguage) - d.Set("content_type", output.ContentType) + d.Set(names.AttrContentType, output.ContentType) // See https://forums.aws.amazon.com/thread.jspa?threadID=44003 d.Set("etag", strings.Trim(aws.ToString(output.ETag), `"`)) d.Set("metadata", output.Metadata) @@ -529,7 +529,7 @@ func resourceObjectUpload(ctx context.Context, d *schema.ResourceData, meta inte input.ContentLanguage = aws.String(v.(string)) } - if v, ok := d.GetOk("content_type"); ok { + if v, ok := d.GetOk(names.AttrContentType); ok { input.ContentType = aws.String(v.(string)) } @@ -651,7 +651,7 @@ func hasObjectContentChanges(d sdkv2.ResourceDiffer) bool { "content_disposition", "content_encoding", "content_language", - "content_type", + names.AttrContentType, "content", "etag", names.AttrKMSKeyID, diff --git a/internal/service/s3/object_copy.go b/internal/service/s3/object_copy.go index 2a27116f2c2..8ecd548570d 100644 --- a/internal/service/s3/object_copy.go +++ b/internal/service/s3/object_copy.go @@ -102,7 +102,7 @@ func resourceObjectCopy() *schema.Resource { Optional: true, Computed: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Optional: true, Computed: true, @@ -373,7 +373,7 @@ func resourceObjectCopyRead(ctx context.Context, d *schema.ResourceData, meta in d.Set("content_disposition", output.ContentDisposition) d.Set("content_encoding", output.ContentEncoding) d.Set("content_language", output.ContentLanguage) - d.Set("content_type", output.ContentType) + d.Set(names.AttrContentType, output.ContentType) d.Set("customer_algorithm", output.SSECustomerAlgorithm) d.Set("customer_key_md5", output.SSECustomerKeyMD5) // See https://forums.aws.amazon.com/thread.jspa?threadID=44003 @@ -426,7 +426,7 @@ func resourceObjectCopyUpdate(ctx context.Context, d *schema.ResourceData, meta "content_disposition", "content_encoding", "content_language", - "content_type", + names.AttrContentType, "customer_algorithm", "customer_key", "customer_key_md5", @@ -535,7 +535,7 @@ func resourceObjectCopyDoCopy(ctx context.Context, d *schema.ResourceData, meta input.ContentLanguage = aws.String(v.(string)) } - if v, ok := d.GetOk("content_type"); ok { + if v, ok := d.GetOk(names.AttrContentType); ok { input.ContentType = aws.String(v.(string)) } diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index c4b35332d83..05ac38e6c7f 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -51,7 +51,7 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_disposition", ""), resource.TestCheckResourceAttr(resourceName, "content_encoding", ""), resource.TestCheckResourceAttr(resourceName, "content_language", ""), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/octet-stream"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/octet-stream"), resource.TestCheckNoResourceAttr(resourceName, "copy_if_match"), resource.TestCheckNoResourceAttr(resourceName, "copy_if_modified_since"), resource.TestCheckNoResourceAttr(resourceName, "copy_if_none_match"), @@ -536,7 +536,7 @@ func TestAccS3ObjectCopy_directoryBucket(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_disposition", ""), resource.TestCheckResourceAttr(resourceName, "content_encoding", ""), resource.TestCheckResourceAttr(resourceName, "content_language", ""), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/octet-stream"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/octet-stream"), resource.TestCheckNoResourceAttr(resourceName, "copy_if_match"), resource.TestCheckNoResourceAttr(resourceName, "copy_if_modified_since"), resource.TestCheckNoResourceAttr(resourceName, "copy_if_none_match"), @@ -607,7 +607,7 @@ func TestAccS3ObjectCopy_basicViaAccessPoint(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_disposition", ""), resource.TestCheckResourceAttr(resourceName, "content_encoding", ""), resource.TestCheckResourceAttr(resourceName, "content_language", ""), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/octet-stream"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/octet-stream"), resource.TestCheckNoResourceAttr(resourceName, "copy_if_match"), resource.TestCheckNoResourceAttr(resourceName, "copy_if_modified_since"), resource.TestCheckNoResourceAttr(resourceName, "copy_if_none_match"), diff --git a/internal/service/s3/object_data_source.go b/internal/service/s3/object_data_source.go index e82d2709ae5..871181a955c 100644 --- a/internal/service/s3/object_data_source.go +++ b/internal/service/s3/object_data_source.go @@ -89,7 +89,7 @@ func dataSourceObject() *schema.Resource { Type: schema.TypeInt, Computed: true, }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Computed: true, }, @@ -221,7 +221,7 @@ func dataSourceObjectRead(ctx context.Context, d *schema.ResourceData, meta inte d.Set("content_encoding", output.ContentEncoding) d.Set("content_language", output.ContentLanguage) d.Set("content_length", output.ContentLength) - d.Set("content_type", output.ContentType) + d.Set(names.AttrContentType, output.ContentType) // See https://forums.aws.amazon.com/thread.jspa?threadID=44003 d.Set("etag", strings.Trim(aws.ToString(output.ETag), `"`)) d.Set("expiration", output.Expiration) diff --git a/internal/service/s3/object_data_source_test.go b/internal/service/s3/object_data_source_test.go index a5ca425e5cf..d5d035ed909 100644 --- a/internal/service/s3/object_data_source_test.go +++ b/internal/service/s3/object_data_source_test.go @@ -40,7 +40,7 @@ func TestAccS3ObjectDataSource_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "checksum_sha1", ""), resource.TestCheckResourceAttr(resourceName, "checksum_sha256", ""), resource.TestCheckResourceAttr(dataSourceName, "content_length", "11"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttr(dataSourceName, "metadata.%", "0"), @@ -94,7 +94,7 @@ func TestAccS3ObjectDataSource_readableBody(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttrPair(dataSourceName, "object_lock_legal_hold_status", resourceName, "object_lock_legal_hold_status"), @@ -123,7 +123,7 @@ func TestAccS3ObjectDataSource_kmsEncrypted(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName, "body", "Keep Calm and Carry On"), resource.TestCheckResourceAttr(dataSourceName, "content_length", "22"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttrPair(dataSourceName, "object_lock_legal_hold_status", resourceName, "object_lock_legal_hold_status"), @@ -155,7 +155,7 @@ func TestAccS3ObjectDataSource_bucketKeyEnabled(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "body", "Keep Calm and Carry On"), resource.TestCheckResourceAttrPair(dataSourceName, "bucket_key_enabled", resourceName, "bucket_key_enabled"), resource.TestCheckResourceAttr(dataSourceName, "content_length", "22"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttrPair(dataSourceName, "object_lock_legal_hold_status", resourceName, "object_lock_legal_hold_status"), @@ -191,7 +191,7 @@ func TestAccS3ObjectDataSource_allParams(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "content_encoding", resourceName, "content_encoding"), resource.TestCheckResourceAttrPair(dataSourceName, "content_language", resourceName, "content_language"), resource.TestCheckResourceAttr(dataSourceName, "content_length", "25"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestCheckResourceAttr(dataSourceName, "expiration", ""), // Currently unsupported in aws_s3_object resource @@ -232,7 +232,7 @@ func TestAccS3ObjectDataSource_objectLockLegalHoldOff(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckNoResourceAttr(dataSourceName, "body"), resource.TestCheckResourceAttr(dataSourceName, "content_length", "11"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttrPair(dataSourceName, "object_lock_legal_hold_status", resourceName, "object_lock_legal_hold_status"), @@ -262,7 +262,7 @@ func TestAccS3ObjectDataSource_objectLockLegalHoldOn(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckNoResourceAttr(dataSourceName, "body"), resource.TestCheckResourceAttr(dataSourceName, "content_length", "11"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttrPair(dataSourceName, "object_lock_legal_hold_status", resourceName, "object_lock_legal_hold_status"), @@ -298,19 +298,19 @@ func TestAccS3ObjectDataSource_leadingSlash(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName1, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName1, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName1, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName1, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName1, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName1, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttr(dataSourceName2, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName2, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName2, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName2, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName2, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttr(dataSourceName3, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName3, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName3, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName3, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName3, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName3, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), ), @@ -344,15 +344,15 @@ func TestAccS3ObjectDataSource_multipleSlashes(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName1, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName1, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName1, "content_type", resourceName1, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName1, names.AttrContentType, resourceName1, names.AttrContentType), resource.TestCheckResourceAttr(dataSourceName2, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName2, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName2, "content_type", resourceName1, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrContentType, resourceName1, names.AttrContentType), resource.TestCheckResourceAttr(dataSourceName3, "body", "no"), resource.TestCheckResourceAttr(dataSourceName3, "content_length", "2"), - resource.TestCheckResourceAttrPair(dataSourceName3, "content_type", resourceName2, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName3, names.AttrContentType, resourceName2, names.AttrContentType), ), }, }, @@ -400,13 +400,13 @@ func TestAccS3ObjectDataSource_leadingDotSlash(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName1, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName1, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName1, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName1, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName1, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName1, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttr(dataSourceName2, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName2, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName2, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName2, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName2, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), ), @@ -439,19 +439,19 @@ func TestAccS3ObjectDataSource_leadingMultipleSlashes(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(dataSourceName1, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName1, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName1, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName1, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName1, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName1, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttr(dataSourceName2, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName2, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName2, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName2, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName2, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName2, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttr(dataSourceName3, "body", "yes"), resource.TestCheckResourceAttr(dataSourceName3, "content_length", "3"), - resource.TestCheckResourceAttrPair(dataSourceName3, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName3, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName3, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName3, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), ), @@ -568,7 +568,7 @@ func TestAccS3ObjectDataSource_directoryBucket(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "checksum_sha1", ""), resource.TestCheckResourceAttr(resourceName, "checksum_sha256", ""), resource.TestCheckResourceAttr(dataSourceName, "content_length", "11"), - resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrContentType, resourceName, names.AttrContentType), resource.TestCheckResourceAttrPair(dataSourceName, "etag", resourceName, "etag"), resource.TestMatchResourceAttr(dataSourceName, "last_modified", regexache.MustCompile(rfc1123RegexPattern)), resource.TestCheckResourceAttr(dataSourceName, "metadata.%", "0"), diff --git a/internal/service/s3/object_test.go b/internal/service/s3/object_test.go index 210155ddd6f..90af16cea23 100644 --- a/internal/service/s3/object_test.go +++ b/internal/service/s3/object_test.go @@ -139,7 +139,7 @@ func TestAccS3Object_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_disposition", ""), resource.TestCheckResourceAttr(resourceName, "content_encoding", ""), resource.TestCheckResourceAttr(resourceName, "content_language", ""), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/octet-stream"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/octet-stream"), resource.TestCheckResourceAttrSet(resourceName, "etag"), resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, names.AttrKey, "test-key"), @@ -442,7 +442,7 @@ func TestAccS3Object_withContentCharacteristics(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectExists(ctx, resourceName, &obj), testAccCheckObjectBody(&obj, "{anything will do }"), - resource.TestCheckResourceAttr(resourceName, "content_type", "binary/octet-stream"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "binary/octet-stream"), resource.TestCheckResourceAttr(resourceName, "website_redirect", "http://google.com"), ), }, @@ -2011,7 +2011,7 @@ func TestAccS3Object_directoryBucket(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "content_disposition", ""), resource.TestCheckResourceAttr(resourceName, "content_encoding", ""), resource.TestCheckResourceAttr(resourceName, "content_language", ""), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/octet-stream"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/octet-stream"), resource.TestCheckResourceAttrSet(resourceName, "etag"), resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, names.AttrKey, "test-key"), @@ -2119,7 +2119,7 @@ func TestAccS3Object_prefix(t *testing.T) { Config: testAccObjectConfig_prefix(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectExists(ctx, resourceName, &obj), - resource.TestCheckResourceAttr(resourceName, "content_type", "application/x-directory"), + resource.TestCheckResourceAttr(resourceName, names.AttrContentType, "application/x-directory"), resource.TestCheckResourceAttr(resourceName, names.AttrKey, "pfx/"), ), }, From de39e602ed47ed5ff2dee69f615ac236afb0f39f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:35 -0400 Subject: [PATCH 1477/1490] sagemaker: Use constants for strings --- internal/service/sagemaker/feature_group.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/service/sagemaker/feature_group.go b/internal/service/sagemaker/feature_group.go index 164d195c3ed..447349e3f4b 100644 --- a/internal/service/sagemaker/feature_group.go +++ b/internal/service/sagemaker/feature_group.go @@ -122,7 +122,7 @@ func ResourceFeatureGroup() *schema.Resource { Computed: true, ForceNew: true, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Optional: true, Computed: true, @@ -635,7 +635,7 @@ func expandFeatureGroupOfflineStoreConfigDataCatalogConfig(l []interface{}) *sag config := &sagemaker.DataCatalogConfig{ Catalog: aws.String(m["catalog"].(string)), Database: aws.String(m["database"].(string)), - TableName: aws.String(m["table_name"].(string)), + TableName: aws.String(m[names.AttrTableName].(string)), } return config @@ -647,9 +647,9 @@ func flattenFeatureGroupOfflineStoreConfigDataCatalogConfig(config *sagemaker.Da } m := map[string]interface{}{ - "catalog": aws.StringValue(config.Catalog), - "database": aws.StringValue(config.Database), - "table_name": aws.StringValue(config.TableName), + "catalog": aws.StringValue(config.Catalog), + "database": aws.StringValue(config.Database), + names.AttrTableName: aws.StringValue(config.TableName), } return []map[string]interface{}{m} From 31caded1389562782e3fb53ca9deea2c23964c24 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:35 -0400 Subject: [PATCH 1478/1490] securityhub: Use constants for strings --- internal/service/securityhub/action_target.go | 6 +++--- internal/service/securityhub/action_target_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/securityhub/action_target.go b/internal/service/securityhub/action_target.go index 4ad503eae28..e1d3b2da215 100644 --- a/internal/service/securityhub/action_target.go +++ b/internal/service/securityhub/action_target.go @@ -44,7 +44,7 @@ func resourceActionTarget() *schema.Resource { Type: schema.TypeString, Required: true, }, - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -68,7 +68,7 @@ func resourceActionTargetCreate(ctx context.Context, d *schema.ResourceData, met var diags diag.Diagnostics conn := meta.(*conns.AWSClient).SecurityHubClient(ctx) - id := d.Get("identifier").(string) + id := d.Get(names.AttrIdentifier).(string) input := &securityhub.CreateActionTargetInput{ Description: aws.String(d.Get(names.AttrDescription).(string)), Id: aws.String(id), @@ -109,7 +109,7 @@ func resourceActionTargetRead(ctx context.Context, d *schema.ResourceData, meta d.Set(names.AttrARN, output.ActionTargetArn) d.Set(names.AttrDescription, output.Description) - d.Set("identifier", actionTargetIdentifier) + d.Set(names.AttrIdentifier, actionTargetIdentifier) d.Set(names.AttrName, output.Name) return diags diff --git a/internal/service/securityhub/action_target_test.go b/internal/service/securityhub/action_target_test.go index f2cc92e6c22..bbe9971b1ac 100644 --- a/internal/service/securityhub/action_target_test.go +++ b/internal/service/securityhub/action_target_test.go @@ -33,7 +33,7 @@ func testAccActionTarget_basic(t *testing.T) { testAccCheckActionTargetExists(ctx, resourceName), acctest.CheckResourceAttrRegionalARN(resourceName, names.AttrARN, "securityhub", "action/custom/testaction"), resource.TestCheckResourceAttr(resourceName, names.AttrDescription, "This is a test custom action"), - resource.TestCheckResourceAttr(resourceName, "identifier", "testaction"), + resource.TestCheckResourceAttr(resourceName, names.AttrIdentifier, "testaction"), resource.TestCheckResourceAttr(resourceName, names.AttrName, "Test action"), ), }, From 87cb7e7bcd09a14b77ccaf50a266e100e5a10052 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:35 -0400 Subject: [PATCH 1479/1490] servicequotas: Use constants for strings --- .../servicequotas/service_data_source.go | 7 ++-- .../service/servicequotas/service_quota.go | 4 +-- .../service_quota_data_source.go | 4 +-- .../service_quota_data_source_test.go | 12 +++---- .../servicequotas/service_quota_test.go | 6 ++-- internal/service/servicequotas/template.go | 2 +- .../servicequotas/templates_data_source.go | 34 +++++++++---------- 7 files changed, 35 insertions(+), 34 deletions(-) diff --git a/internal/service/servicequotas/service_data_source.go b/internal/service/servicequotas/service_data_source.go index 736e8f4f387..92b970b5592 100644 --- a/internal/service/servicequotas/service_data_source.go +++ b/internal/service/servicequotas/service_data_source.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKDataSource("aws_servicequotas_service") @@ -25,7 +26,7 @@ func DataSourceService() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Required: true, }, @@ -37,7 +38,7 @@ func dataSourceServiceRead(ctx context.Context, d *schema.ResourceData, meta int var diags diag.Diagnostics conn := meta.(*conns.AWSClient).ServiceQuotasClient(ctx) - serviceName := d.Get("service_name").(string) + serviceName := d.Get(names.AttrServiceName).(string) input := &servicequotas.ListServicesInput{} @@ -67,7 +68,7 @@ func dataSourceServiceRead(ctx context.Context, d *schema.ResourceData, meta int } d.Set("service_code", service.ServiceCode) - d.Set("service_name", service.ServiceName) + d.Set(names.AttrServiceName, service.ServiceName) d.SetId(aws.ToString(service.ServiceCode)) return diags diff --git a/internal/service/servicequotas/service_quota.go b/internal/service/servicequotas/service_quota.go index a9701023fb8..0f4b50da79b 100644 --- a/internal/service/servicequotas/service_quota.go +++ b/internal/service/servicequotas/service_quota.go @@ -78,7 +78,7 @@ func ResourceServiceQuota() *schema.Resource { validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z-]+$`), "must contain only alphanumeric and hyphen characters"), ), }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Computed: true, }, @@ -206,7 +206,7 @@ func resourceServiceQuotaRead(ctx context.Context, d *schema.ResourceData, meta d.Set("quota_code", defaultQuota.QuotaCode) d.Set("quota_name", defaultQuota.QuotaName) d.Set("service_code", defaultQuota.ServiceCode) - d.Set("service_name", defaultQuota.ServiceName) + d.Set(names.AttrServiceName, defaultQuota.ServiceName) d.Set(names.AttrValue, defaultQuota.Value) if err := d.Set("usage_metric", flattenUsageMetric(defaultQuota.UsageMetric)); err != nil { diff --git a/internal/service/servicequotas/service_quota_data_source.go b/internal/service/servicequotas/service_quota_data_source.go index ce199c02153..f21a19a0420 100644 --- a/internal/service/servicequotas/service_quota_data_source.go +++ b/internal/service/servicequotas/service_quota_data_source.go @@ -54,7 +54,7 @@ func DataSourceServiceQuota() *schema.Resource { Type: schema.TypeString, Required: true, }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Computed: true, }, @@ -174,7 +174,7 @@ func dataSourceServiceQuotaRead(ctx context.Context, d *schema.ResourceData, met d.Set("quota_code", defaultQuota.QuotaCode) d.Set("quota_name", defaultQuota.QuotaName) d.Set("service_code", defaultQuota.ServiceCode) - d.Set("service_name", defaultQuota.ServiceName) + d.Set(names.AttrServiceName, defaultQuota.ServiceName) d.Set(names.AttrValue, defaultQuota.Value) if err := d.Set("usage_metric", flattenUsageMetric(defaultQuota.UsageMetric)); err != nil { diff --git a/internal/service/servicequotas/service_quota_data_source_test.go b/internal/service/servicequotas/service_quota_data_source_test.go index 31e40ec0a49..e18782fc1ed 100644 --- a/internal/service/servicequotas/service_quota_data_source_test.go +++ b/internal/service/servicequotas/service_quota_data_source_test.go @@ -36,7 +36,7 @@ func TestAccServiceQuotasServiceQuotaDataSource_quotaCode(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "quota_code", setQuotaQuotaCode), resource.TestCheckResourceAttr(dataSourceName, "quota_name", "VPCs per Region"), resource.TestCheckResourceAttr(dataSourceName, "service_code", setQuotaServiceCode), - resource.TestCheckResourceAttr(dataSourceName, "service_name", "Amazon Virtual Private Cloud (Amazon VPC)"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrServiceName, "Amazon Virtual Private Cloud (Amazon VPC)"), resource.TestCheckResourceAttr(dataSourceName, "usage_metric.#", "0"), resource.TestMatchResourceAttr(dataSourceName, names.AttrValue, regexache.MustCompile(`^\d+$`)), ), @@ -68,7 +68,7 @@ func TestAccServiceQuotasServiceQuotaDataSource_quotaCode_Unset(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "quota_code", unsetQuotaQuotaCode), resource.TestCheckResourceAttr(dataSourceName, "quota_name", unsetQuotaQuotaName), resource.TestCheckResourceAttr(dataSourceName, "service_code", unsetQuotaServiceCode), - resource.TestCheckResourceAttr(dataSourceName, "service_name", "Amazon Simple Storage Service (Amazon S3)"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrServiceName, "Amazon Simple Storage Service (Amazon S3)"), resource.TestCheckResourceAttr(dataSourceName, "usage_metric.#", "0"), resource.TestMatchResourceAttr(dataSourceName, names.AttrValue, regexache.MustCompile(`^\d+$`)), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrValue, dataSourceName, "default_value"), @@ -101,7 +101,7 @@ func TestAccServiceQuotasServiceQuotaDataSource_quotaCode_hasUsageMetric(t *test resource.TestCheckResourceAttr(dataSourceName, "quota_code", hasUsageMetricQuotaCode), resource.TestCheckResourceAttr(dataSourceName, "quota_name", hasUsageMetricQuotaName), resource.TestCheckResourceAttr(dataSourceName, "service_code", hasUsageMetricServiceCode), - resource.TestCheckResourceAttr(dataSourceName, "service_name", "Amazon EC2 Auto Scaling"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrServiceName, "Amazon EC2 Auto Scaling"), resource.TestCheckResourceAttr(dataSourceName, "usage_metric.#", "1"), resource.TestCheckResourceAttr(dataSourceName, "usage_metric.0.metric_namespace", "AWS/Usage"), resource.TestCheckResourceAttr(dataSourceName, "usage_metric.0.metric_name", "ResourceCount"), @@ -161,7 +161,7 @@ func TestAccServiceQuotasServiceQuotaDataSource_quotaName(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "quota_code", setQuotaQuotaCode), resource.TestCheckResourceAttr(dataSourceName, "quota_name", setQuotaQuotaName), resource.TestCheckResourceAttr(dataSourceName, "service_code", setQuotaServiceCode), - resource.TestCheckResourceAttr(dataSourceName, "service_name", "Amazon Virtual Private Cloud (Amazon VPC)"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrServiceName, "Amazon Virtual Private Cloud (Amazon VPC)"), resource.TestCheckResourceAttr(dataSourceName, "usage_metric.#", "0"), resource.TestMatchResourceAttr(dataSourceName, names.AttrValue, regexache.MustCompile(`^\d+$`)), ), @@ -193,7 +193,7 @@ func TestAccServiceQuotasServiceQuotaDataSource_quotaName_Unset(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "quota_code", unsetQuotaQuotaCode), resource.TestCheckResourceAttr(dataSourceName, "quota_name", unsetQuotaQuotaName), resource.TestCheckResourceAttr(dataSourceName, "service_code", unsetQuotaServiceCode), - resource.TestCheckResourceAttr(dataSourceName, "service_name", "Amazon Simple Storage Service (Amazon S3)"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrServiceName, "Amazon Simple Storage Service (Amazon S3)"), resource.TestCheckResourceAttr(dataSourceName, "usage_metric.#", "0"), resource.TestMatchResourceAttr(dataSourceName, names.AttrValue, regexache.MustCompile(`^\d+$`)), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrValue, dataSourceName, "default_value"), @@ -226,7 +226,7 @@ func TestAccServiceQuotasServiceQuotaDataSource_quotaName_hasUsageMetric(t *test resource.TestCheckResourceAttr(dataSourceName, "quota_code", hasUsageMetricQuotaCode), resource.TestCheckResourceAttr(dataSourceName, "quota_name", hasUsageMetricQuotaName), resource.TestCheckResourceAttr(dataSourceName, "service_code", hasUsageMetricServiceCode), - resource.TestCheckResourceAttr(dataSourceName, "service_name", "Amazon EC2 Auto Scaling"), + resource.TestCheckResourceAttr(dataSourceName, names.AttrServiceName, "Amazon EC2 Auto Scaling"), resource.TestCheckResourceAttr(dataSourceName, "usage_metric.#", "1"), resource.TestCheckResourceAttr(dataSourceName, "usage_metric.0.metric_namespace", "AWS/Usage"), resource.TestCheckResourceAttr(dataSourceName, "usage_metric.0.metric_name", "ResourceCount"), diff --git a/internal/service/servicequotas/service_quota_test.go b/internal/service/servicequotas/service_quota_test.go index f6653e7b9b0..5ce56d0e362 100644 --- a/internal/service/servicequotas/service_quota_test.go +++ b/internal/service/servicequotas/service_quota_test.go @@ -42,7 +42,7 @@ func TestAccServiceQuotasServiceQuota_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "quota_code", dataSourceName, "quota_code"), resource.TestCheckResourceAttrPair(resourceName, "quota_name", dataSourceName, "quota_name"), resource.TestCheckResourceAttrPair(resourceName, "service_code", dataSourceName, "service_code"), - resource.TestCheckResourceAttrPair(resourceName, "service_name", dataSourceName, "service_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrServiceName, dataSourceName, names.AttrServiceName), resource.TestCheckResourceAttrPair(resourceName, "usage_metric", dataSourceName, "usage_metric"), resource.TestCheckNoResourceAttr(resourceName, "usage_metric.0.metric_name"), resource.TestCheckResourceAttrPair(resourceName, names.AttrValue, dataSourceName, names.AttrValue), @@ -82,7 +82,7 @@ func TestAccServiceQuotasServiceQuota_basic_Unset(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "quota_code", dataSourceName, "quota_code"), resource.TestCheckResourceAttrPair(resourceName, "quota_name", dataSourceName, "quota_name"), resource.TestCheckResourceAttrPair(resourceName, "service_code", dataSourceName, "service_code"), - resource.TestCheckResourceAttrPair(resourceName, "service_name", dataSourceName, "service_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrServiceName, dataSourceName, names.AttrServiceName), resource.TestCheckResourceAttrPair(resourceName, names.AttrValue, dataSourceName, names.AttrValue), resource.TestCheckResourceAttrPair(resourceName, "usage_metric", dataSourceName, "usage_metric"), resource.TestCheckNoResourceAttr(resourceName, "usage_metric.0.metric_name"), @@ -122,7 +122,7 @@ func TestAccServiceQuotasServiceQuota_basic_hasUsageMetric(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "quota_code", dataSourceName, "quota_code"), resource.TestCheckResourceAttrPair(resourceName, "quota_name", dataSourceName, "quota_name"), resource.TestCheckResourceAttrPair(resourceName, "service_code", dataSourceName, "service_code"), - resource.TestCheckResourceAttrPair(resourceName, "service_name", dataSourceName, "service_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrServiceName, dataSourceName, names.AttrServiceName), resource.TestCheckResourceAttrPair(resourceName, names.AttrValue, dataSourceName, names.AttrValue), resource.TestCheckResourceAttrPair(resourceName, "usage_metric", dataSourceName, "usage_metric"), resource.TestCheckResourceAttrPair(resourceName, "usage_metric.0.metric_name", dataSourceName, "usage_metric.0.metric_name"), diff --git a/internal/service/servicequotas/template.go b/internal/service/servicequotas/template.go index 1628fbe6c59..e6d864caa13 100644 --- a/internal/service/servicequotas/template.go +++ b/internal/service/servicequotas/template.go @@ -79,7 +79,7 @@ func (r *resourceTemplate) Schema(ctx context.Context, req resource.SchemaReques stringplanmodifier.RequiresReplace(), }, }, - "service_name": schema.StringAttribute{ + names.AttrServiceName: schema.StringAttribute{ Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), diff --git a/internal/service/servicequotas/templates_data_source.go b/internal/service/servicequotas/templates_data_source.go index e112831df3d..413970fd32c 100644 --- a/internal/service/servicequotas/templates_data_source.go +++ b/internal/service/servicequotas/templates_data_source.go @@ -64,7 +64,7 @@ func (d *dataSourceTemplates) Schema(ctx context.Context, req datasource.SchemaR "service_code": schema.StringAttribute{ Computed: true, }, - "service_name": schema.StringAttribute{ + names.AttrServiceName: schema.StringAttribute{ Computed: true, }, names.AttrUnit: schema.StringAttribute{ @@ -111,14 +111,14 @@ func (d *dataSourceTemplates) Read(ctx context.Context, req datasource.ReadReque } var templatesSourceAttrTypes = map[string]attr.Type{ - "global_quota": types.BoolType, - "quota_code": types.StringType, - "quota_name": types.StringType, - names.AttrRegion: types.StringType, - "service_code": types.StringType, - "service_name": types.StringType, - names.AttrUnit: types.StringType, - names.AttrValue: types.Float64Type, + "global_quota": types.BoolType, + "quota_code": types.StringType, + "quota_name": types.StringType, + names.AttrRegion: types.StringType, + "service_code": types.StringType, + names.AttrServiceName: types.StringType, + names.AttrUnit: types.StringType, + names.AttrValue: types.Float64Type, } type dataSourceTemplatesData struct { @@ -134,14 +134,14 @@ func flattenTemplates(ctx context.Context, apiObject []awstypes.ServiceQuotaIncr elems := []attr.Value{} for _, t := range apiObject { obj := map[string]attr.Value{ - "global_quota": types.BoolValue(t.GlobalQuota), - "quota_code": flex.StringToFramework(ctx, t.QuotaCode), - "quota_name": flex.StringToFramework(ctx, t.QuotaName), - names.AttrRegion: flex.StringToFramework(ctx, t.AwsRegion), - "service_code": flex.StringToFramework(ctx, t.ServiceCode), - "service_name": flex.StringToFramework(ctx, t.ServiceName), - names.AttrUnit: flex.StringToFramework(ctx, t.Unit), - names.AttrValue: flex.Float64ToFramework(ctx, t.DesiredValue), + "global_quota": types.BoolValue(t.GlobalQuota), + "quota_code": flex.StringToFramework(ctx, t.QuotaCode), + "quota_name": flex.StringToFramework(ctx, t.QuotaName), + names.AttrRegion: flex.StringToFramework(ctx, t.AwsRegion), + "service_code": flex.StringToFramework(ctx, t.ServiceCode), + names.AttrServiceName: flex.StringToFramework(ctx, t.ServiceName), + names.AttrUnit: flex.StringToFramework(ctx, t.Unit), + names.AttrValue: flex.Float64ToFramework(ctx, t.DesiredValue), } objVal, d := types.ObjectValue(templatesSourceAttrTypes, obj) diags.Append(d...) From d9127b8a5bd703cd3a1f3a3d3f2855d0b21422f9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:35 -0400 Subject: [PATCH 1480/1490] sns: Use constants for strings --- internal/service/sns/platform_application_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/service/sns/platform_application_test.go b/internal/service/sns/platform_application_test.go index a31ec19b58a..7c77dd9acad 100644 --- a/internal/service/sns/platform_application_test.go +++ b/internal/service/sns/platform_application_test.go @@ -47,7 +47,7 @@ type testAccPlatformApplicationPlatform struct { func testAccPlatformApplicationPlatformFromEnv(t *testing.T, allowedApnsAuthType string) []*testAccPlatformApplicationPlatform { platforms := make([]*testAccPlatformApplicationPlatform, 0, 2) - if os.Getenv("APNS_SANDBOX_CREDENTIAL") != "" && allowedApnsAuthType == "certificate" { + if os.Getenv("APNS_SANDBOX_CREDENTIAL") != "" && allowedApnsAuthType == names.AttrCertificate { if os.Getenv("APNS_SANDBOX_PRINCIPAL") == "" { t.Fatalf("APNS_SANDBOX_CREDENTIAL set but missing APNS_SANDBOX_PRINCIPAL") } @@ -56,10 +56,10 @@ func testAccPlatformApplicationPlatformFromEnv(t *testing.T, allowedApnsAuthType Name: "APNS_SANDBOX", Credential: fmt.Sprintf("< Date: Fri, 10 May 2024 22:53:35 -0400 Subject: [PATCH 1481/1490] ssm: Use constants for strings --- internal/service/ssm/association.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/ssm/association.go b/internal/service/ssm/association.go index 26cbe288556..3d91c1221d0 100644 --- a/internal/service/ssm/association.go +++ b/internal/service/ssm/association.go @@ -103,7 +103,7 @@ func ResourceAssociation() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "s3_bucket_name": { + names.AttrS3BucketName: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(3, 63), @@ -411,7 +411,7 @@ func expandAssociationOutputLocation(config []interface{}) *ssm.InstanceAssociat locationConfig := config[0].(map[string]interface{}) S3OutputLocation := &ssm.S3OutputLocation{ - OutputS3BucketName: aws.String(locationConfig["s3_bucket_name"].(string)), + OutputS3BucketName: aws.String(locationConfig[names.AttrS3BucketName].(string)), } if v, ok := locationConfig["s3_key_prefix"]; ok { @@ -435,7 +435,7 @@ func flattenAssociationOutputLocation(location *ssm.InstanceAssociationOutputLoc result := make([]map[string]interface{}, 0) item := make(map[string]interface{}) - item["s3_bucket_name"] = aws.StringValue(location.S3Location.OutputS3BucketName) + item[names.AttrS3BucketName] = aws.StringValue(location.S3Location.OutputS3BucketName) if location.S3Location.OutputS3KeyPrefix != nil { item["s3_key_prefix"] = aws.StringValue(location.S3Location.OutputS3KeyPrefix) From 56b4147da54126cc8956c7f4ceb44749e6fd397a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:36 -0400 Subject: [PATCH 1482/1490] ssmincidents: Use constants for strings --- internal/service/ssmincidents/flex.go | 4 ++-- internal/service/ssmincidents/response_plan.go | 2 +- internal/service/ssmincidents/response_plan_data_source.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/ssmincidents/flex.go b/internal/service/ssmincidents/flex.go index b5efc8a8764..bc7394e4312 100644 --- a/internal/service/ssmincidents/flex.go +++ b/internal/service/ssmincidents/flex.go @@ -128,7 +128,7 @@ func expandNotificationTargets(targets []interface{}) []types.NotificationTarget targetData := target.(map[string]interface{}) targetItem := &types.NotificationTargetItemMemberSnsTopicArn{ - Value: targetData["sns_topic_arn"].(string), + Value: targetData[names.AttrSNSTopicARN].(string), } notificationTargets[i] = targetItem @@ -147,7 +147,7 @@ func flattenNotificationTargets(targets []types.NotificationTargetItem) []map[st for i, target := range targets { targetItem := make(map[string]interface{}) - targetItem["sns_topic_arn"] = target.(*types.NotificationTargetItemMemberSnsTopicArn).Value + targetItem[names.AttrSNSTopicARN] = target.(*types.NotificationTargetItemMemberSnsTopicArn).Value notificationTargets[i] = targetItem } diff --git a/internal/service/ssmincidents/response_plan.go b/internal/service/ssmincidents/response_plan.go index 4970b5f849b..606aa770af8 100644 --- a/internal/service/ssmincidents/response_plan.go +++ b/internal/service/ssmincidents/response_plan.go @@ -135,7 +135,7 @@ func ResourceResponsePlan() *schema.Resource { Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Required: true, }, diff --git a/internal/service/ssmincidents/response_plan_data_source.go b/internal/service/ssmincidents/response_plan_data_source.go index d526e96541d..caf3db15aba 100644 --- a/internal/service/ssmincidents/response_plan_data_source.go +++ b/internal/service/ssmincidents/response_plan_data_source.go @@ -117,7 +117,7 @@ func DataSourceResponsePlan() *schema.Resource { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "sns_topic_arn": { + names.AttrSNSTopicARN: { Type: schema.TypeString, Computed: true, }, From 35068eae9146caeffec943b2bca55d38773201cb Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:36 -0400 Subject: [PATCH 1483/1490] storagegateway: Use constants for strings --- internal/service/storagegateway/gateway.go | 4 ++-- internal/service/storagegateway/gateway_test.go | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/storagegateway/gateway.go b/internal/service/storagegateway/gateway.go index 5d8b6bba904..32154c3a398 100644 --- a/internal/service/storagegateway/gateway.go +++ b/internal/service/storagegateway/gateway.go @@ -80,7 +80,7 @@ func ResourceGateway() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Computed: true, }, @@ -592,7 +592,7 @@ func resourceGatewayRead(ctx context.Context, d *schema.ResourceData, meta inter d.Set("smb_security_strategy", smbSettingsOutput.SMBSecurityStrategy) d.Set("smb_file_share_visibility", smbSettingsOutput.FileSharesVisible) d.Set("ec2_instance_id", output.Ec2InstanceId) - d.Set("endpoint_type", output.EndpointType) + d.Set(names.AttrEndpointType, output.EndpointType) d.Set("host_environment", output.HostEnvironment) if err := d.Set("gateway_network_interface", flattenGatewayNetworkInterfaces(output.GatewayNetworkInterfaces)); err != nil { diff --git a/internal/service/storagegateway/gateway_test.go b/internal/service/storagegateway/gateway_test.go index 8c9b9de6a1d..328878dd331 100644 --- a/internal/service/storagegateway/gateway_test.go +++ b/internal/service/storagegateway/gateway_test.go @@ -39,7 +39,7 @@ func TestAccStorageGatewayGateway_GatewayType_cached(t *testing.T) { testAccCheckGatewayExists(ctx, resourceName, &gateway), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "storagegateway", regexache.MustCompile(`gateway/sgw-.+`)), resource.TestCheckResourceAttrPair(resourceName, "ec2_instance_id", "aws_instance.test", names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "STANDARD"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "STANDARD"), resource.TestCheckResourceAttrSet(resourceName, "gateway_id"), resource.TestCheckResourceAttr(resourceName, "gateway_name", rName), resource.TestCheckResourceAttr(resourceName, "gateway_network_interface.#", "1"), @@ -83,7 +83,7 @@ func TestAccStorageGatewayGateway_GatewayType_fileFSxSMB(t *testing.T) { testAccCheckGatewayExists(ctx, resourceName, &gateway), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "storagegateway", regexache.MustCompile(`gateway/sgw-.+`)), resource.TestCheckResourceAttrPair(resourceName, "ec2_instance_id", "aws_instance.test", names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "STANDARD"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "STANDARD"), resource.TestCheckResourceAttrSet(resourceName, "gateway_id"), resource.TestCheckResourceAttr(resourceName, "gateway_name", rName), resource.TestCheckResourceAttr(resourceName, "gateway_network_interface.#", "1"), @@ -126,7 +126,7 @@ func TestAccStorageGatewayGateway_GatewayType_fileS3(t *testing.T) { testAccCheckGatewayExists(ctx, resourceName, &gateway), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "storagegateway", regexache.MustCompile(`gateway/sgw-.+`)), resource.TestCheckResourceAttrPair(resourceName, "ec2_instance_id", "aws_instance.test", names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "STANDARD"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "STANDARD"), resource.TestCheckResourceAttrSet(resourceName, "gateway_id"), resource.TestCheckResourceAttr(resourceName, "gateway_name", rName), resource.TestCheckResourceAttr(resourceName, "gateway_network_interface.#", "1"), @@ -169,7 +169,7 @@ func TestAccStorageGatewayGateway_GatewayType_stored(t *testing.T) { testAccCheckGatewayExists(ctx, resourceName, &gateway), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "storagegateway", regexache.MustCompile(`gateway/sgw-.+`)), resource.TestCheckResourceAttrPair(resourceName, "ec2_instance_id", "aws_instance.test", names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "STANDARD"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "STANDARD"), resource.TestCheckResourceAttrSet(resourceName, "gateway_id"), resource.TestCheckResourceAttr(resourceName, "gateway_name", rName), resource.TestCheckResourceAttr(resourceName, "gateway_network_interface.#", "1"), @@ -212,7 +212,7 @@ func TestAccStorageGatewayGateway_GatewayType_vtl(t *testing.T) { testAccCheckGatewayExists(ctx, resourceName, &gateway), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "storagegateway", regexache.MustCompile(`gateway/sgw-.+`)), resource.TestCheckResourceAttrPair(resourceName, "ec2_instance_id", "aws_instance.test", names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "STANDARD"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "STANDARD"), resource.TestCheckResourceAttrSet(resourceName, "gateway_id"), resource.TestCheckResourceAttr(resourceName, "gateway_name", rName), resource.TestCheckResourceAttr(resourceName, "gateway_timezone", "GMT"), From 483d6975ee36b22118c1cb2e38f13c6bef0f5eb1 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:36 -0400 Subject: [PATCH 1484/1490] timestreamwrite: Use constants for strings --- internal/service/timestreamwrite/table.go | 6 +++--- internal/service/timestreamwrite/table_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/timestreamwrite/table.go b/internal/service/timestreamwrite/table.go index 5641bac1ab0..224eedf7d89 100644 --- a/internal/service/timestreamwrite/table.go +++ b/internal/service/timestreamwrite/table.go @@ -162,7 +162,7 @@ func resourceTable() *schema.Resource { }, }, }, - "table_name": { + names.AttrTableName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -183,7 +183,7 @@ func resourceTableCreate(ctx context.Context, d *schema.ResourceData, meta inter conn := meta.(*conns.AWSClient).TimestreamWriteClient(ctx) databaseName := d.Get(names.AttrDatabaseName).(string) - tableName := d.Get("table_name").(string) + tableName := d.Get(names.AttrTableName).(string) id := tableCreateResourceID(tableName, databaseName) input := ×treamwrite.CreateTableInput{ DatabaseName: aws.String(databaseName), @@ -245,7 +245,7 @@ func resourceTableRead(ctx context.Context, d *schema.ResourceData, meta interfa } else { d.Set("schema", nil) } - d.Set("table_name", table.TableName) + d.Set(names.AttrTableName, table.TableName) return nil } diff --git a/internal/service/timestreamwrite/table_test.go b/internal/service/timestreamwrite/table_test.go index 27189bac1a9..1555c81e056 100644 --- a/internal/service/timestreamwrite/table_test.go +++ b/internal/service/timestreamwrite/table_test.go @@ -49,7 +49,7 @@ func TestAccTimestreamWriteTable_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "schema.0.composite_partition_key.0.enforcement_in_record", ""), resource.TestCheckResourceAttr(resourceName, "schema.0.composite_partition_key.0.name", ""), resource.TestCheckResourceAttr(resourceName, "schema.0.composite_partition_key.0.type", "MEASURE"), - resource.TestCheckResourceAttr(resourceName, "table_name", rName), + resource.TestCheckResourceAttr(resourceName, names.AttrTableName, rName), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, From ee7559ffd29bb8f235a8c7d7c9d055fd00a88ff4 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:36 -0400 Subject: [PATCH 1485/1490] transfer: Use constants for strings --- internal/service/transfer/certificate.go | 6 +- internal/service/transfer/certificate_test.go | 12 ++-- internal/service/transfer/server.go | 22 +++---- .../service/transfer/server_data_source.go | 8 +-- .../transfer/server_data_source_test.go | 4 +- internal/service/transfer/server_test.go | 62 +++++++++---------- internal/service/transfer/ssh_key.go | 7 ++- internal/service/transfer/ssh_key_test.go | 2 +- internal/service/transfer/user.go | 6 +- internal/service/transfer/user_test.go | 2 +- 10 files changed, 66 insertions(+), 65 deletions(-) diff --git a/internal/service/transfer/certificate.go b/internal/service/transfer/certificate.go index ade72ca776c..97e45d4b2e9 100644 --- a/internal/service/transfer/certificate.go +++ b/internal/service/transfer/certificate.go @@ -44,7 +44,7 @@ func ResourceCertificate() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -98,7 +98,7 @@ func resourceCertificateCreate(ctx context.Context, d *schema.ResourceData, meta conn := meta.(*conns.AWSClient).TransferConn(ctx) input := &transfer.ImportCertificateInput{ - Certificate: aws.String(d.Get("certificate").(string)), + Certificate: aws.String(d.Get(names.AttrCertificate).(string)), Tags: getTagsIn(ctx), Usage: aws.String(d.Get("usage").(string)), } @@ -144,7 +144,7 @@ func resourceCertificateRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("active_date", aws.ToTime(output.ActiveDate).Format(time.RFC3339)) d.Set(names.AttrARN, output.Arn) - d.Set("certificate", output.Certificate) + d.Set(names.AttrCertificate, output.Certificate) d.Set("certificate_chain", output.CertificateChain) d.Set("certificate_id", output.CertificateId) d.Set(names.AttrDescription, output.Description) diff --git a/internal/service/transfer/certificate_test.go b/internal/service/transfer/certificate_test.go index 62107160b66..962a41e9126 100644 --- a/internal/service/transfer/certificate_test.go +++ b/internal/service/transfer/certificate_test.go @@ -54,7 +54,7 @@ func TestAccTransferCertificate_basic(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"private_key", "certificate", "certificate_chain"}, + ImportStateVerifyIgnore: []string{"private_key", names.AttrCertificate, "certificate_chain"}, }, }, }) @@ -91,7 +91,7 @@ func TestAccTransferCertificate_certificate(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"private_key", "certificate", "certificate_chain"}, + ImportStateVerifyIgnore: []string{"private_key", names.AttrCertificate, "certificate_chain"}, }, }, }) @@ -132,7 +132,7 @@ func TestAccTransferCertificate_certificateChain(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"private_key", "certificate", "certificate_chain"}, + ImportStateVerifyIgnore: []string{"private_key", names.AttrCertificate, "certificate_chain"}, }, }, }) @@ -169,7 +169,7 @@ func TestAccTransferCertificate_certificateKey(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"private_key", "certificate", "certificate_chain"}, + ImportStateVerifyIgnore: []string{"private_key", names.AttrCertificate, "certificate_chain"}, }, }, }) @@ -233,7 +233,7 @@ func TestAccTransferCertificate_tags(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"private_key", "certificate", "certificate_chain"}, + ImportStateVerifyIgnore: []string{"private_key", names.AttrCertificate, "certificate_chain"}, }, { Config: testAccCertificateConfig_tags2(certificate, "key1", "value1updated", "key2", "value2"), @@ -284,7 +284,7 @@ func TestAccTransferCertificate_description(t *testing.T) { ResourceName: resourceName, ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"private_key", "certificate", "certificate_chain"}, + ImportStateVerifyIgnore: []string{"private_key", names.AttrCertificate, "certificate_chain"}, }, { Config: testAccCertificateConfig_description(certificate, "desc2"), diff --git a/internal/service/transfer/server.go b/internal/service/transfer/server.go index 15c9b98dc5b..235bdc01291 100644 --- a/internal/service/transfer/server.go +++ b/internal/service/transfer/server.go @@ -58,7 +58,7 @@ func resourceServer() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Optional: true, ValidateFunc: verify.ValidARN, @@ -118,7 +118,7 @@ func resourceServer() *schema.Resource { }, }, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Optional: true, Default: transfer.EndpointTypePublic, @@ -323,7 +323,7 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte Tags: getTagsIn(ctx), } - if v, ok := d.GetOk("certificate"); ok { + if v, ok := d.GetOk(names.AttrCertificate); ok { input.Certificate = aws.String(v.(string)) } @@ -350,7 +350,7 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte input.EndpointDetails.AddressAllocationIds = nil } - if v, ok := d.GetOk("endpoint_type"); ok { + if v, ok := d.GetOk(names.AttrEndpointType); ok { input.EndpointType = aws.String(v.(string)) } @@ -484,7 +484,7 @@ func resourceServerRead(ctx context.Context, d *schema.ResourceData, meta interf } d.Set(names.AttrARN, output.Arn) - d.Set("certificate", output.Certificate) + d.Set(names.AttrCertificate, output.Certificate) if output.IdentityProviderDetails != nil { d.Set("directory_id", output.IdentityProviderDetails.DirectoryId) } else { @@ -515,7 +515,7 @@ func resourceServerRead(ctx context.Context, d *schema.ResourceData, meta interf } else { d.Set("endpoint_details", nil) } - d.Set("endpoint_type", output.EndpointType) + d.Set(names.AttrEndpointType, output.EndpointType) if output.IdentityProviderDetails != nil { d.Set("function", output.IdentityProviderDetails.Function) } else { @@ -567,7 +567,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte var newEndpointTypeVpc bool var oldEndpointTypeVpc bool - old, new := d.GetChange("endpoint_type") + old, new := d.GetChange(names.AttrEndpointType) if old, new := old.(string), new.(string); new == transfer.EndpointTypeVpc { newEndpointTypeVpc = true @@ -582,8 +582,8 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte ServerId: aws.String(d.Id()), } - if d.HasChange("certificate") { - input.Certificate = aws.String(d.Get("certificate").(string)) + if d.HasChange(names.AttrCertificate) { + input.Certificate = aws.String(d.Get(names.AttrCertificate).(string)) } if d.HasChange("endpoint_details") { @@ -663,8 +663,8 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte } } - if d.HasChange("endpoint_type") { - input.EndpointType = aws.String(d.Get("endpoint_type").(string)) + if d.HasChange(names.AttrEndpointType) { + input.EndpointType = aws.String(d.Get(names.AttrEndpointType).(string)) // Prevent the following error: InvalidRequestException: Server must be OFFLINE to change EndpointType offlineUpdate = true diff --git a/internal/service/transfer/server_data_source.go b/internal/service/transfer/server_data_source.go index a4476401956..afdc2782a4d 100644 --- a/internal/service/transfer/server_data_source.go +++ b/internal/service/transfer/server_data_source.go @@ -23,7 +23,7 @@ func DataSourceServer() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Computed: true, }, @@ -35,7 +35,7 @@ func DataSourceServer() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "endpoint_type": { + names.AttrEndpointType: { Type: schema.TypeString, Computed: true, }, @@ -97,10 +97,10 @@ func dataSourceServerRead(ctx context.Context, d *schema.ResourceData, meta inte d.SetId(aws.StringValue(output.ServerId)) d.Set(names.AttrARN, output.Arn) - d.Set("certificate", output.Certificate) + d.Set(names.AttrCertificate, output.Certificate) d.Set("domain", output.Domain) d.Set(names.AttrEndpoint, meta.(*conns.AWSClient).RegionalHostname(ctx, fmt.Sprintf("%s.server.transfer", serverID))) - d.Set("endpoint_type", output.EndpointType) + d.Set(names.AttrEndpointType, output.EndpointType) d.Set("identity_provider_type", output.IdentityProviderType) if output.IdentityProviderDetails != nil { d.Set("invocation_role", output.IdentityProviderDetails.InvocationRole) diff --git a/internal/service/transfer/server_data_source_test.go b/internal/service/transfer/server_data_source_test.go index 12e7bdcb56b..07ba8b00b90 100644 --- a/internal/service/transfer/server_data_source_test.go +++ b/internal/service/transfer/server_data_source_test.go @@ -53,9 +53,9 @@ func testAccServerDataSource_Service_managed(t *testing.T) { Config: testAccServerDataSourceConfig_serviceManaged(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(datasourceName, names.AttrARN, resourceName, names.AttrARN), - resource.TestCheckResourceAttrPair(datasourceName, "certificate", resourceName, "certificate"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrCertificate, resourceName, names.AttrCertificate), resource.TestCheckResourceAttrPair(datasourceName, names.AttrEndpoint, resourceName, names.AttrEndpoint), - resource.TestCheckResourceAttrPair(datasourceName, "endpoint_type", resourceName, "endpoint_type"), + resource.TestCheckResourceAttrPair(datasourceName, names.AttrEndpointType, resourceName, names.AttrEndpointType), resource.TestCheckResourceAttrPair(datasourceName, "identity_provider_type", resourceName, "identity_provider_type"), resource.TestCheckResourceAttrPair(datasourceName, "invocation_role", resourceName, "invocation_role"), resource.TestCheckResourceAttrPair(datasourceName, "logging_role", resourceName, "logging_role"), diff --git a/internal/service/transfer/server_test.go b/internal/service/transfer/server_test.go index 1215abf9fdb..ba2aef680fe 100644 --- a/internal/service/transfer/server_test.go +++ b/internal/service/transfer/server_test.go @@ -52,10 +52,10 @@ func testAccServer_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "transfer", regexache.MustCompile(`server/.+`)), - resource.TestCheckResourceAttr(resourceName, "certificate", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrCertificate, ""), acctest.MatchResourceAttrRegionalHostname(resourceName, names.AttrEndpoint, "server.transfer", regexache.MustCompile(`s-[0-9a-z]+`)), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "0"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "PUBLIC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "PUBLIC"), resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "function", ""), resource.TestCheckNoResourceAttr(resourceName, "host_key"), @@ -92,11 +92,11 @@ func testAccServer_basic(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), acctest.MatchResourceAttrRegionalARN(resourceName, names.AttrARN, "transfer", regexache.MustCompile(`server/.+`)), - resource.TestCheckResourceAttr(resourceName, "certificate", ""), + resource.TestCheckResourceAttr(resourceName, names.AttrCertificate, ""), resource.TestCheckResourceAttr(resourceName, "domain", "S3"), acctest.MatchResourceAttrRegionalHostname(resourceName, names.AttrEndpoint, "server.transfer", regexache.MustCompile(`s-[0-9a-z]+`)), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "0"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "PUBLIC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "PUBLIC"), resource.TestCheckResourceAttr(resourceName, names.AttrForceDestroy, "false"), resource.TestCheckResourceAttr(resourceName, "function", ""), resource.TestCheckNoResourceAttr(resourceName, "host_key"), @@ -339,7 +339,7 @@ func testAccServer_vpc(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "endpoint_details.0.subnet_ids.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "endpoint_details.0.vpc_endpoint_id"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_id", vpcResourceName, names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -360,7 +360,7 @@ func testAccServer_vpc(t *testing.T) { resource.TestCheckTypeSetElemAttrPair(resourceName, "endpoint_details.0.subnet_ids.*", subnetResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "endpoint_details.0.vpc_endpoint_id"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_id", vpcResourceName, names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -374,7 +374,7 @@ func testAccServer_vpc(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "endpoint_details.0.subnet_ids.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "endpoint_details.0.vpc_endpoint_id"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_id", vpcResourceName, names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, }, @@ -411,7 +411,7 @@ func testAccServer_vpcAddressAllocationIDs(t *testing.T) { resource.TestCheckTypeSetElemAttrPair(resourceName, "endpoint_details.0.subnet_ids.*", subnetResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "endpoint_details.0.vpc_endpoint_id"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_id", vpcResourceName, names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -433,7 +433,7 @@ func testAccServer_vpcAddressAllocationIDs(t *testing.T) { resource.TestCheckTypeSetElemAttrPair(resourceName, "endpoint_details.0.subnet_ids.*", subnetResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "endpoint_details.0.vpc_endpoint_id"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_id", vpcResourceName, names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -447,7 +447,7 @@ func testAccServer_vpcAddressAllocationIDs(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "endpoint_details.0.subnet_ids.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "endpoint_details.0.vpc_endpoint_id"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_id", vpcResourceName, names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, }, @@ -480,7 +480,7 @@ func testAccServer_vpcSecurityGroupIDs(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "endpoint_details.0.subnet_ids.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "endpoint_details.0.vpc_endpoint_id"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_id", vpcResourceName, names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -500,7 +500,7 @@ func testAccServer_vpcSecurityGroupIDs(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "endpoint_details.0.subnet_ids.#", "0"), resource.TestCheckResourceAttrSet(resourceName, "endpoint_details.0.vpc_endpoint_id"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_id", vpcResourceName, names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, }, @@ -538,7 +538,7 @@ func testAccServer_vpcAddressAllocationIds_securityGroupIDs(t *testing.T) { resource.TestCheckTypeSetElemAttrPair(resourceName, "endpoint_details.0.subnet_ids.*", subnetResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "endpoint_details.0.vpc_endpoint_id"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_id", vpcResourceName, names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -560,7 +560,7 @@ func testAccServer_vpcAddressAllocationIds_securityGroupIDs(t *testing.T) { resource.TestCheckTypeSetElemAttrPair(resourceName, "endpoint_details.0.subnet_ids.*", subnetResourceName, names.AttrID), resource.TestCheckResourceAttrSet(resourceName, "endpoint_details.0.vpc_endpoint_id"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_id", vpcResourceName, names.AttrID), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, }, @@ -584,7 +584,7 @@ func testAccServer_updateEndpointType_publicToVPC(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "0"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "PUBLIC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "PUBLIC"), ), }, { @@ -592,7 +592,7 @@ func testAccServer_updateEndpointType_publicToVPC(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "1"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -622,7 +622,7 @@ func testAccServer_updateEndpointType_publicToVPC_addressAllocationIDs(t *testin Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "0"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "PUBLIC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "PUBLIC"), ), }, { @@ -630,7 +630,7 @@ func testAccServer_updateEndpointType_publicToVPC_addressAllocationIDs(t *testin Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "1"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -660,7 +660,7 @@ func testAccServer_updateEndpointType_vpcEndpointToVPC(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "1"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC_ENDPOINT"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC_ENDPOINT"), ), }, { @@ -668,7 +668,7 @@ func testAccServer_updateEndpointType_vpcEndpointToVPC(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "1"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -697,7 +697,7 @@ func testAccServer_updateEndpointType_vpcEndpointToVPC_addressAllocationIDs(t *t Config: testAccServerConfig_vpcEndpoint(rName), Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC_ENDPOINT"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC_ENDPOINT"), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "1"), ), }, @@ -705,7 +705,7 @@ func testAccServer_updateEndpointType_vpcEndpointToVPC_addressAllocationIDs(t *t Config: testAccServerConfig_vpcAddressAllocationIDs(rName), Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "1"), ), }, @@ -736,7 +736,7 @@ func testAccServer_updateEndpointType_vpcEndpointToVPC_securityGroupIDs(t *testi Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "1"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC_ENDPOINT"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC_ENDPOINT"), ), }, { @@ -744,7 +744,7 @@ func testAccServer_updateEndpointType_vpcEndpointToVPC_securityGroupIDs(t *testi Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "1"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -774,7 +774,7 @@ func testAccServer_updateEndpointType_vpcToPublic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "1"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), ), }, { @@ -782,7 +782,7 @@ func testAccServer_updateEndpointType_vpcToPublic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "endpoint_details.#", "0"), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "PUBLIC"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "PUBLIC"), ), }, { @@ -856,8 +856,8 @@ func testAccServer_protocols(t *testing.T) { Config: testAccServerConfig_protocols(rName), Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &s), - resource.TestCheckResourceAttr(resourceName, "certificate", ""), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttr(resourceName, names.AttrCertificate, ""), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), resource.TestCheckResourceAttr(resourceName, "identity_provider_type", "API_GATEWAY"), resource.TestCheckResourceAttr(resourceName, "protocols.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "protocols.*", "FTP"), @@ -881,8 +881,8 @@ func testAccServer_protocols(t *testing.T) { Config: testAccServerConfig_protocolsUpdate(rName, rootDomain, domain), Check: resource.ComposeTestCheckFunc( testAccCheckServerExists(ctx, resourceName, &s), - resource.TestCheckResourceAttrPair(resourceName, "certificate", acmCertificateResourceName, names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrCertificate, acmCertificateResourceName, names.AttrARN), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC"), resource.TestCheckResourceAttr(resourceName, "identity_provider_type", "API_GATEWAY"), resource.TestCheckResourceAttr(resourceName, "protocols.#", "2"), resource.TestCheckTypeSetElemAttr(resourceName, "protocols.*", "FTP"), @@ -1180,7 +1180,7 @@ func testAccServer_vpcEndpointID(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "endpoint_details.0.subnet_ids.#", "0"), resource.TestCheckResourceAttrPair(resourceName, "endpoint_details.0.vpc_endpoint_id", vpcEndpointResourceName, names.AttrID), resource.TestCheckResourceAttr(resourceName, "endpoint_details.0.vpc_id", ""), - resource.TestCheckResourceAttr(resourceName, "endpoint_type", "VPC_ENDPOINT"), + resource.TestCheckResourceAttr(resourceName, names.AttrEndpointType, "VPC_ENDPOINT"), ), }, { diff --git a/internal/service/transfer/ssh_key.go b/internal/service/transfer/ssh_key.go index 7f8c166e9d3..e74d1c51ec3 100644 --- a/internal/service/transfer/ssh_key.go +++ b/internal/service/transfer/ssh_key.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/names" ) // @SDKResource("aws_transfer_ssh_key") @@ -46,7 +47,7 @@ func ResourceSSHKey() *schema.Resource { ValidateFunc: validServerID, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -59,7 +60,7 @@ func ResourceSSHKey() *schema.Resource { func resourceSSHKeyCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { var diags diag.Diagnostics conn := meta.(*conns.AWSClient).TransferConn(ctx) - userName := d.Get("user_name").(string) + userName := d.Get(names.AttrUserName).(string) serverID := d.Get("server_id").(string) createOpts := &transfer.ImportSshPublicKeyInput{ @@ -116,7 +117,7 @@ func resourceSSHKeyRead(ctx context.Context, d *schema.ResourceData, meta interf } d.Set("server_id", resp.ServerId) - d.Set("user_name", resp.User.UserName) + d.Set(names.AttrUserName, resp.User.UserName) d.Set("body", body) return diags diff --git a/internal/service/transfer/ssh_key_test.go b/internal/service/transfer/ssh_key_test.go index 79bfc59d963..8d7ffe4d1c4 100644 --- a/internal/service/transfer/ssh_key_test.go +++ b/internal/service/transfer/ssh_key_test.go @@ -43,7 +43,7 @@ func testAccSSHKey_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckSSHKeyExists(ctx, resourceName, &conf), resource.TestCheckResourceAttrPair(resourceName, "server_id", "aws_transfer_server.test", names.AttrID), - resource.TestCheckResourceAttrPair(resourceName, "user_name", "aws_transfer_user.test", "user_name"), + resource.TestCheckResourceAttrPair(resourceName, names.AttrUserName, "aws_transfer_user.test", names.AttrUserName), resource.TestCheckResourceAttr(resourceName, "body", publicKey), ), }, diff --git a/internal/service/transfer/user.go b/internal/service/transfer/user.go index abdb2fb81c2..36bc6321d37 100644 --- a/internal/service/transfer/user.go +++ b/internal/service/transfer/user.go @@ -123,7 +123,7 @@ func ResourceUser() *schema.Resource { }, names.AttrTags: tftags.TagsSchema(), names.AttrTagsAll: tftags.TagsSchemaComputed(), - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -140,7 +140,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf conn := meta.(*conns.AWSClient).TransferConn(ctx) serverID := d.Get("server_id").(string) - userName := d.Get("user_name").(string) + userName := d.Get(names.AttrUserName).(string) id := UserCreateResourceID(serverID, userName) input := &transfer.CreateUserInput{ Role: aws.String(d.Get("role").(string)), @@ -225,7 +225,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac } d.Set("role", user.Role) d.Set("server_id", serverID) - d.Set("user_name", user.UserName) + d.Set(names.AttrUserName, user.UserName) setTagsOut(ctx, user.Tags) diff --git a/internal/service/transfer/user_test.go b/internal/service/transfer/user_test.go index 3a435c404ae..b0fcf0d4862 100644 --- a/internal/service/transfer/user_test.go +++ b/internal/service/transfer/user_test.go @@ -196,7 +196,7 @@ func testAccUser_modifyWithOptions(t *testing.T) { testAccCheckUserExists(ctx, resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "home_directory", "/home/tftestuser2"), resource.TestCheckResourceAttrPair(resourceName, "role", "aws_iam_role.test", names.AttrARN), - resource.TestCheckResourceAttr(resourceName, "user_name", "tftestuser2"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "tftestuser2"), ), }, }, From fcc3e236c181621b415389e5bb56acf62f8ffc2f Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:36 -0400 Subject: [PATCH 1486/1490] wafv2: Use constants for strings --- internal/service/wafv2/flex.go | 32 +++++++++++------------ internal/service/wafv2/rule_group_test.go | 24 ++++++++--------- internal/service/wafv2/schemas.go | 20 +++++++------- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/internal/service/wafv2/flex.go b/internal/service/wafv2/flex.go index 15029b8df92..305e1316090 100644 --- a/internal/service/wafv2/flex.go +++ b/internal/service/wafv2/flex.go @@ -320,7 +320,7 @@ func expandCustomResponseBodies(m []interface{}) map[string]awstypes.CustomRespo key := vm[names.AttrKey].(string) customResponseBodies[key] = awstypes.CustomResponseBody{ Content: aws.String(vm["content"].(string)), - ContentType: awstypes.ResponseContentType(vm["content_type"].(string)), + ContentType: awstypes.ResponseContentType(vm[names.AttrContentType].(string)), } } @@ -1219,7 +1219,7 @@ func expandEmailField(tfList []interface{}) *awstypes.EmailField { m := tfList[0].(map[string]interface{}) out := awstypes.EmailField{ - Identifier: aws.String(m["identifier"].(string)), + Identifier: aws.String(m[names.AttrIdentifier].(string)), } return &out @@ -1232,7 +1232,7 @@ func expandPasswordField(tfList []interface{}) *awstypes.PasswordField { m := tfList[0].(map[string]interface{}) out := awstypes.PasswordField{ - Identifier: aws.String(m["identifier"].(string)), + Identifier: aws.String(m[names.AttrIdentifier].(string)), } return &out @@ -1263,7 +1263,7 @@ func expandUsernameField(tfList []interface{}) *awstypes.UsernameField { m := tfList[0].(map[string]interface{}) out := awstypes.UsernameField{ - Identifier: aws.String(m["identifier"].(string)), + Identifier: aws.String(m[names.AttrIdentifier].(string)), } return &out @@ -1423,7 +1423,7 @@ func expandResponseInspectionJSON(tfList []interface{}) *awstypes.ResponseInspec m := tfList[0].(map[string]interface{}) out := awstypes.ResponseInspectionJson{ FailureValues: flex.ExpandStringValueSet(m["failure_values"].(*schema.Set)), - Identifier: aws.String(m["identifier"].(string)), + Identifier: aws.String(m[names.AttrIdentifier].(string)), SuccessValues: flex.ExpandStringValueSet(m["success_values"].(*schema.Set)), } @@ -1474,7 +1474,7 @@ func expandRateLimitLabelNamespace(l []interface{}) *awstypes.RateLimitLabelName } m := l[0].(map[string]interface{}) return &awstypes.RateLimitLabelNamespace{ - Namespace: aws.String(m["namespace"].(string)), + Namespace: aws.String(m[names.AttrNamespace].(string)), } } @@ -1813,9 +1813,9 @@ func flattenCustomResponseBodies(b map[string]awstypes.CustomResponseBody) inter i := 0 for key, body := range b { out[i] = map[string]interface{}{ - names.AttrKey: key, - "content": aws.ToString(body.Content), - "content_type": string(body.ContentType), + names.AttrKey: key, + "content": aws.ToString(body.Content), + names.AttrContentType: string(body.ContentType), } i += 1 } @@ -2629,7 +2629,7 @@ func flattenEmailField(apiObject *awstypes.EmailField) []interface{} { } m := map[string]interface{}{ - "identifier": aws.ToString(apiObject.Identifier), + names.AttrIdentifier: aws.ToString(apiObject.Identifier), } return []interface{}{m} @@ -2641,7 +2641,7 @@ func flattenPasswordField(apiObject *awstypes.PasswordField) []interface{} { } m := map[string]interface{}{ - "identifier": aws.ToString(apiObject.Identifier), + names.AttrIdentifier: aws.ToString(apiObject.Identifier), } return []interface{}{m} @@ -2670,7 +2670,7 @@ func flattenUsernameField(apiObject *awstypes.UsernameField) []interface{} { } m := map[string]interface{}{ - "identifier": aws.ToString(apiObject.Identifier), + names.AttrIdentifier: aws.ToString(apiObject.Identifier), } return []interface{}{m} @@ -2812,9 +2812,9 @@ func flattenResponseInspectionJSON(apiObject *awstypes.ResponseInspectionJson) [ } m := map[string]interface{}{ - "failure_values": flex.FlattenStringValueSet(apiObject.FailureValues), - "identifier": aws.ToString(apiObject.Identifier), - "success_values": flex.FlattenStringValueSet(apiObject.SuccessValues), + "failure_values": flex.FlattenStringValueSet(apiObject.FailureValues), + names.AttrIdentifier: aws.ToString(apiObject.Identifier), + "success_values": flex.FlattenStringValueSet(apiObject.SuccessValues), } return []interface{}{m} @@ -2863,7 +2863,7 @@ func flattenRateLimitLabelNamespace(apiObject *awstypes.RateLimitLabelNamespace) } return []interface{}{ map[string]interface{}{ - "namespace": aws.ToString(apiObject.Namespace), + names.AttrNamespace: aws.ToString(apiObject.Namespace), }, } } diff --git a/internal/service/wafv2/rule_group_test.go b/internal/service/wafv2/rule_group_test.go index 4e60ee464ee..eb063308846 100644 --- a/internal/service/wafv2/rule_group_test.go +++ b/internal/service/wafv2/rule_group_test.go @@ -1728,14 +1728,14 @@ func TestAccWAFV2RuleGroup_RuleAction_customResponse(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "scope", string(awstypes.ScopeRegional)), resource.TestCheckResourceAttr(resourceName, "visibility_config.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "custom_response_body.*", map[string]string{ - names.AttrKey: "test_body_1", - "content": "test response 1", - "content_type": "TEXT_PLAIN", + names.AttrKey: "test_body_1", + "content": "test response 1", + names.AttrContentType: "TEXT_PLAIN", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "custom_response_body.*", map[string]string{ - names.AttrKey: "test_body_2", - "content": "test response 2", - "content_type": "TEXT_HTML", + names.AttrKey: "test_body_2", + "content": "test response 2", + names.AttrContentType: "TEXT_HTML", }), resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ @@ -1763,14 +1763,14 @@ func TestAccWAFV2RuleGroup_RuleAction_customResponse(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "visibility_config.#", "1"), resource.TestCheckResourceAttr(resourceName, "custom_response_body.#", "2"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "custom_response_body.*", map[string]string{ - names.AttrKey: "test_body_1", - "content": "test response 1", - "content_type": "TEXT_PLAIN", + names.AttrKey: "test_body_1", + "content": "test response 1", + names.AttrContentType: "TEXT_PLAIN", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "custom_response_body.*", map[string]string{ - names.AttrKey: "test_body_2", - "content": "test response 2", - "content_type": "TEXT_HTML", + names.AttrKey: "test_body_2", + "content": "test response 2", + names.AttrContentType: "TEXT_HTML", }), resource.TestCheckResourceAttr(resourceName, "rule.#", "1"), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "rule.*", map[string]string{ diff --git a/internal/service/wafv2/schemas.go b/internal/service/wafv2/schemas.go index 26589a2ee37..2e368e7c35b 100644 --- a/internal/service/wafv2/schemas.go +++ b/internal/service/wafv2/schemas.go @@ -771,7 +771,7 @@ func customResponseBodySchema() *schema.Schema { Required: true, ValidateFunc: validation.StringLenBetween(1, 10240), }, - "content_type": { + names.AttrContentType: { Type: schema.TypeString, Required: true, ValidateDiagFunc: enum.Validate[awstypes.ResponseContentType](), @@ -1043,7 +1043,7 @@ func rateBasedStatementSchema(level int) *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "namespace": { + names.AttrNamespace: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -1242,7 +1242,7 @@ func managedRuleGroupConfigSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -1264,7 +1264,7 @@ func managedRuleGroupConfigSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -1343,7 +1343,7 @@ func managedRuleGroupConfigACFPRequestInspectionSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -1360,7 +1360,7 @@ func managedRuleGroupConfigACFPRequestInspectionSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -1397,7 +1397,7 @@ func managedRuleGroupConfigACFPRequestInspectionSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -1426,7 +1426,7 @@ func managedRuleGroupConfigATPRequestInspectionSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -1448,7 +1448,7 @@ func managedRuleGroupConfigATPRequestInspectionSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( @@ -1528,7 +1528,7 @@ func managedRuleGroupConfigATPResponseInspectionSchema() *schema.Schema { Elem: &schema.Schema{Type: schema.TypeString}, // TODO: ValidateFunc: length > 0 }, - "identifier": { + names.AttrIdentifier: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(1, 256), From 42b5ba4584918744199f24ea94fe36b6b979853a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:37 -0400 Subject: [PATCH 1487/1490] worklink: Use constants for strings --- .../worklink/website_certificate_authority_association.go | 6 +++--- .../website_certificate_authority_association_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/worklink/website_certificate_authority_association.go b/internal/service/worklink/website_certificate_authority_association.go index 22fd4c51323..fafb5f9bb1f 100644 --- a/internal/service/worklink/website_certificate_authority_association.go +++ b/internal/service/worklink/website_certificate_authority_association.go @@ -38,7 +38,7 @@ func ResourceWebsiteCertificateAuthorityAssociation() *schema.Resource { Required: true, ForceNew: true, }, - "certificate": { + names.AttrCertificate: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -63,7 +63,7 @@ func resourceWebsiteCertificateAuthorityAssociationCreate(ctx context.Context, d input := &worklink.AssociateWebsiteCertificateAuthorityInput{ FleetArn: aws.String(d.Get("fleet_arn").(string)), - Certificate: aws.String(d.Get("certificate").(string)), + Certificate: aws.String(d.Get(names.AttrCertificate).(string)), } if v, ok := d.GetOk(names.AttrDisplayName); ok { @@ -106,7 +106,7 @@ func resourceWebsiteCertificateAuthorityAssociationRead(ctx context.Context, d * d.Set("website_ca_id", websiteCaID) d.Set("fleet_arn", fleetArn) - d.Set("certificate", resp.Certificate) + d.Set(names.AttrCertificate, resp.Certificate) d.Set(names.AttrDisplayName, resp.DisplayName) return diags diff --git a/internal/service/worklink/website_certificate_authority_association_test.go b/internal/service/worklink/website_certificate_authority_association_test.go index 49e2787b9e8..72d7be6ce9a 100644 --- a/internal/service/worklink/website_certificate_authority_association_test.go +++ b/internal/service/worklink/website_certificate_authority_association_test.go @@ -41,7 +41,7 @@ func TestAccWorkLinkWebsiteCertificateAuthorityAssociation_basic(t *testing.T) { resource.TestCheckResourceAttrPair( resourceName, "fleet_arn", "aws_worklink_fleet.test", names.AttrARN), - resource.TestMatchResourceAttr(resourceName, "certificate", regexache.MustCompile("^-----BEGIN CERTIFICATE-----")), + resource.TestMatchResourceAttr(resourceName, names.AttrCertificate, regexache.MustCompile("^-----BEGIN CERTIFICATE-----")), ), }, { From 28380a38052e10ef367e8cc0b03d3f450a9ea6fc Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:37 -0400 Subject: [PATCH 1488/1490] workspaces: Use constants for strings --- internal/service/workspaces/workspace.go | 6 +++--- internal/service/workspaces/workspace_data_source.go | 10 +++++----- .../service/workspaces/workspace_data_source_test.go | 4 ++-- internal/service/workspaces/workspace_test.go | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/workspaces/workspace.go b/internal/service/workspaces/workspace.go index 04565b6fdf1..2a117b8993e 100644 --- a/internal/service/workspaces/workspace.go +++ b/internal/service/workspaces/workspace.go @@ -63,7 +63,7 @@ func ResourceWorkspace() *schema.Resource { ForceNew: true, Default: false, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Required: true, ForceNew: true, @@ -155,7 +155,7 @@ func resourceWorkspaceCreate(ctx context.Context, d *schema.ResourceData, meta i input := types.WorkspaceRequest{ BundleId: aws.String(d.Get("bundle_id").(string)), DirectoryId: aws.String(d.Get("directory_id").(string)), - UserName: aws.String(d.Get("user_name").(string)), + UserName: aws.String(d.Get(names.AttrUserName).(string)), RootVolumeEncryptionEnabled: aws.Bool(d.Get("root_volume_encryption_enabled").(bool)), UserVolumeEncryptionEnabled: aws.Bool(d.Get("user_volume_encryption_enabled").(bool)), Tags: getTagsIn(ctx), @@ -211,7 +211,7 @@ func resourceWorkspaceRead(ctx context.Context, d *schema.ResourceData, meta int d.Set("computer_name", workspace.ComputerName) d.Set(names.AttrState, workspace.State) d.Set("root_volume_encryption_enabled", workspace.RootVolumeEncryptionEnabled) - d.Set("user_name", workspace.UserName) + d.Set(names.AttrUserName, workspace.UserName) d.Set("user_volume_encryption_enabled", workspace.UserVolumeEncryptionEnabled) d.Set("volume_encryption_key", workspace.VolumeEncryptionKey) if err := d.Set("workspace_properties", FlattenWorkspaceProperties(workspace.WorkspaceProperties)); err != nil { diff --git a/internal/service/workspaces/workspace_data_source.go b/internal/service/workspaces/workspace_data_source.go index 944e3cdd4b3..c04235cc541 100644 --- a/internal/service/workspaces/workspace_data_source.go +++ b/internal/service/workspaces/workspace_data_source.go @@ -32,7 +32,7 @@ func DataSourceWorkspace() *schema.Resource { Type: schema.TypeString, Computed: true, Optional: true, - RequiredWith: []string{"user_name"}, + RequiredWith: []string{names.AttrUserName}, ConflictsWith: []string{"workspace_id"}, }, "ip_address": { @@ -51,7 +51,7 @@ func DataSourceWorkspace() *schema.Resource { Type: schema.TypeBool, Computed: true, }, - "user_name": { + names.AttrUserName: { Type: schema.TypeString, Computed: true, Optional: true, @@ -70,7 +70,7 @@ func DataSourceWorkspace() *schema.Resource { Type: schema.TypeString, Computed: true, Optional: true, - ConflictsWith: []string{"directory_id", "user_name"}, + ConflictsWith: []string{"directory_id", names.AttrUserName}, }, "workspace_properties": { Type: schema.TypeList, @@ -132,7 +132,7 @@ func dataSourceWorkspaceRead(ctx context.Context, d *schema.ResourceData, meta i } if directoryID, ok := d.GetOk("directory_id"); ok { - userName := d.Get("user_name").(string) + userName := d.Get(names.AttrUserName).(string) resp, err := conn.DescribeWorkspaces(ctx, &workspaces.DescribeWorkspacesInput{ DirectoryId: aws.String(directoryID.(string)), UserName: aws.String(userName), @@ -159,7 +159,7 @@ func dataSourceWorkspaceRead(ctx context.Context, d *schema.ResourceData, meta i d.Set("computer_name", workspace.ComputerName) d.Set(names.AttrState, workspace.State) d.Set("root_volume_encryption_enabled", workspace.RootVolumeEncryptionEnabled) - d.Set("user_name", workspace.UserName) + d.Set(names.AttrUserName, workspace.UserName) d.Set("user_volume_encryption_enabled", workspace.UserVolumeEncryptionEnabled) d.Set("volume_encryption_key", workspace.VolumeEncryptionKey) if err := d.Set("workspace_properties", FlattenWorkspaceProperties(workspace.WorkspaceProperties)); err != nil { diff --git a/internal/service/workspaces/workspace_data_source_test.go b/internal/service/workspaces/workspace_data_source_test.go index 6584eba6fc9..64cae5e72d5 100644 --- a/internal/service/workspaces/workspace_data_source_test.go +++ b/internal/service/workspaces/workspace_data_source_test.go @@ -35,7 +35,7 @@ func testAccWorkspaceDataSource_byWorkspaceID(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "ip_address", resourceName, "ip_address"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrState, resourceName, names.AttrState), resource.TestCheckResourceAttrPair(dataSourceName, "root_volume_encryption_enabled", resourceName, "root_volume_encryption_enabled"), - resource.TestCheckResourceAttrPair(dataSourceName, "user_name", resourceName, "user_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUserName, resourceName, names.AttrUserName), resource.TestCheckResourceAttrPair(dataSourceName, "volume_encryption_key", resourceName, "volume_encryption_key"), resource.TestCheckResourceAttrPair(dataSourceName, "workspace_properties.#", resourceName, "workspace_properties.#"), resource.TestCheckResourceAttrPair(dataSourceName, "workspace_properties.0.compute_type_name", resourceName, "workspace_properties.0.compute_type_name"), @@ -70,7 +70,7 @@ func testAccWorkspaceDataSource_byDirectoryID_userName(t *testing.T) { resource.TestCheckResourceAttrPair(dataSourceName, "ip_address", resourceName, "ip_address"), resource.TestCheckResourceAttrPair(dataSourceName, names.AttrState, resourceName, names.AttrState), resource.TestCheckResourceAttrPair(dataSourceName, "root_volume_encryption_enabled", resourceName, "root_volume_encryption_enabled"), - resource.TestCheckResourceAttrPair(dataSourceName, "user_name", resourceName, "user_name"), + resource.TestCheckResourceAttrPair(dataSourceName, names.AttrUserName, resourceName, names.AttrUserName), resource.TestCheckResourceAttrPair(dataSourceName, "volume_encryption_key", resourceName, "volume_encryption_key"), resource.TestCheckResourceAttrPair(dataSourceName, "workspace_properties.#", resourceName, "workspace_properties.#"), resource.TestCheckResourceAttrPair(dataSourceName, "workspace_properties.0.compute_type_name", resourceName, "workspace_properties.0.compute_type_name"), diff --git a/internal/service/workspaces/workspace_test.go b/internal/service/workspaces/workspace_test.go index 8dcfa57c6bb..91dc1ce7f8f 100644 --- a/internal/service/workspaces/workspace_test.go +++ b/internal/service/workspaces/workspace_test.go @@ -55,7 +55,7 @@ func testAccWorkspace_basic(t *testing.T) { resource.TestMatchResourceAttr(resourceName, "ip_address", regexache.MustCompile(`\d+\.\d+\.\d+\.\d+`)), resource.TestCheckResourceAttr(resourceName, names.AttrState, string(types.WorkspaceStateAvailable)), resource.TestCheckResourceAttr(resourceName, "root_volume_encryption_enabled", "false"), - resource.TestCheckResourceAttr(resourceName, "user_name", "Administrator"), + resource.TestCheckResourceAttr(resourceName, names.AttrUserName, "Administrator"), resource.TestCheckResourceAttr(resourceName, "volume_encryption_key", ""), resource.TestCheckResourceAttr(resourceName, "workspace_properties.#", "1"), resource.TestCheckResourceAttr(resourceName, "workspace_properties.0.compute_type_name", string(types.ComputeValue)), From 36ee18cbad9c5663940328415456eec748cb878a Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:37 -0400 Subject: [PATCH 1489/1490] xray: Use constants for strings --- internal/service/xray/sampling_rule.go | 8 ++++---- internal/service/xray/sampling_rule_test.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/service/xray/sampling_rule.go b/internal/service/xray/sampling_rule.go index 5bc277282c2..0b71b662d33 100644 --- a/internal/service/xray/sampling_rule.go +++ b/internal/service/xray/sampling_rule.go @@ -87,7 +87,7 @@ func resourceSamplingRule() *schema.Resource { ForceNew: true, ValidateFunc: validation.StringLenBetween(1, 32), }, - "service_name": { + names.AttrServiceName: { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringLenBetween(0, 64), @@ -127,7 +127,7 @@ func resourceSamplingRuleCreate(ctx context.Context, d *schema.ResourceData, met ReservoirSize: int32(d.Get("reservoir_size").(int)), ResourceARN: aws.String(d.Get(names.AttrResourceARN).(string)), RuleName: aws.String(name), - ServiceName: aws.String(d.Get("service_name").(string)), + ServiceName: aws.String(d.Get(names.AttrServiceName).(string)), ServiceType: aws.String(d.Get("service_type").(string)), URLPath: aws.String(d.Get("url_path").(string)), Version: aws.Int32(int32(d.Get(names.AttrVersion).(int))), @@ -178,7 +178,7 @@ func resourceSamplingRuleRead(ctx context.Context, d *schema.ResourceData, meta d.Set("reservoir_size", samplingRule.ReservoirSize) d.Set(names.AttrResourceARN, samplingRule.ResourceARN) d.Set("rule_name", samplingRule.RuleName) - d.Set("service_name", samplingRule.ServiceName) + d.Set(names.AttrServiceName, samplingRule.ServiceName) d.Set("service_type", samplingRule.ServiceType) d.Set("url_path", samplingRule.URLPath) d.Set(names.AttrVersion, samplingRule.Version) @@ -199,7 +199,7 @@ func resourceSamplingRuleUpdate(ctx context.Context, d *schema.ResourceData, met ReservoirSize: aws.Int32(int32(d.Get("reservoir_size").(int))), ResourceARN: aws.String(d.Get(names.AttrResourceARN).(string)), RuleName: aws.String(d.Id()), - ServiceName: aws.String(d.Get("service_name").(string)), + ServiceName: aws.String(d.Get(names.AttrServiceName).(string)), ServiceType: aws.String(d.Get("service_type").(string)), URLPath: aws.String(d.Get("url_path").(string)), } diff --git a/internal/service/xray/sampling_rule_test.go b/internal/service/xray/sampling_rule_test.go index 365399ef74a..53de40c27a9 100644 --- a/internal/service/xray/sampling_rule_test.go +++ b/internal/service/xray/sampling_rule_test.go @@ -44,7 +44,7 @@ func TestAccXRaySamplingRule_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "http_method", "GET"), resource.TestCheckResourceAttr(resourceName, "fixed_rate", "0.3"), resource.TestCheckResourceAttr(resourceName, names.AttrResourceARN, "*"), - resource.TestCheckResourceAttr(resourceName, "service_name", "*"), + resource.TestCheckResourceAttr(resourceName, names.AttrServiceName, "*"), resource.TestCheckResourceAttr(resourceName, "service_type", "*"), resource.TestCheckResourceAttr(resourceName, "attributes.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), @@ -86,7 +86,7 @@ func TestAccXRaySamplingRule_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "http_method", "GET"), resource.TestCheckResourceAttr(resourceName, "fixed_rate", "0.3"), resource.TestCheckResourceAttr(resourceName, names.AttrResourceARN, "*"), - resource.TestCheckResourceAttr(resourceName, "service_name", "*"), + resource.TestCheckResourceAttr(resourceName, names.AttrServiceName, "*"), resource.TestCheckResourceAttr(resourceName, "service_type", "*"), resource.TestCheckResourceAttr(resourceName, "attributes.%", "0"), ), @@ -104,7 +104,7 @@ func TestAccXRaySamplingRule_update(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "http_method", "GET"), resource.TestCheckResourceAttr(resourceName, "fixed_rate", "0.3"), resource.TestCheckResourceAttr(resourceName, names.AttrResourceARN, "*"), - resource.TestCheckResourceAttr(resourceName, "service_name", "*"), + resource.TestCheckResourceAttr(resourceName, names.AttrServiceName, "*"), resource.TestCheckResourceAttr(resourceName, "service_type", "*"), resource.TestCheckResourceAttr(resourceName, "attributes.%", "0"), ), From 0cf7674ec5c60a643d564c4ebb876c3fdf84710c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Fri, 10 May 2024 22:53:37 -0400 Subject: [PATCH 1490/1490] names: Use constants for strings --- names/attr_constants.csv | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/names/attr_constants.csv b/names/attr_constants.csv index 080b3ff8066..78f59151502 100644 --- a/names/attr_constants.csv +++ b/names/attr_constants.csv @@ -8,13 +8,15 @@ arns,ARNs auto_minor_version_upgrade,AutoMinorVersionUpgrade availability_zone,AvailabilityZone availability_zones,AvailabilityZones +bucket,Bucket bucket_name,BucketName bucket_prefix,BucketPrefix -bucket,Bucket catalog_id,CatalogID +certificate,Certificate certificate_arn,CertificateARN cluster_identifier,ClusterIdentifier configuration,Configuration +content_type,ContentType created_at,CreatedAt created_date,CreatedDate creation_date,CreationDate @@ -22,8 +24,8 @@ creation_time,CreationTime database_name,DatabaseName delete_on_termination,DeleteOnTermination description,Description -destination_arn,DestinationARN destination,Destination +destination_arn,DestinationARN device_name,DeviceName display_name,DisplayName domain_name,DomainName @@ -31,6 +33,7 @@ enabled,Enabled encrypted,Encrypted encryption_configuration,EncryptionConfiguration endpoint,Endpoint +endpoint_type,EndpointType endpoints,Endpoints engine_version,EngineVersion execution_role_arn,ExecutionRoleARN @@ -40,17 +43,20 @@ force_destroy,ForceDestroy format,Format hosted_zone_id,HostedZoneID id,ID +identifier,Identifier instance_id,InstanceID instance_type,InstanceType key,Key kms_key_arn,KMSKeyARN kms_key_id,KMSKeyID last_updated_date,LastUpdatedDate +log_group_name,LogGroupName max,Max min,Min mode,Mode -name_prefix,NamePrefix name,Name +name_prefix,NamePrefix +namespace,Namespace network_configuration,NetworkConfiguration network_interface_id,NetworkInterfaceID owner_id,OwnerID @@ -70,21 +76,25 @@ region,Region resource_arn,ResourceARN resource_type,ResourceType role_arn,RoleARN +s3_bucket_name,S3BucketName schedule_expression,ScheduleExpression secret_key,SecretKey security_group_ids,SecurityGroupIDs security_groups,SecurityGroups +service_name,ServiceName session,Session shared_config_files,SharedConfigFiles skip_credentials_validation,SkipCredentialsValidation skip_requesting_account_id,SkipRequestingAccountID +sns_topic_arn,SNSTopicARN source,Source state,State status,Status subnet_id,SubnetID subnet_ids,SubnetIDs -tags_all,TagsAll +table_name,TableName tags,Tags +tags_all,TagsAll target,Target timeouts,Timeouts transit_gateway_attachment_id,TransitGatewayAttachmentID @@ -92,9 +102,10 @@ transit_gateway_id,TransitGatewayID type,Type unit,Unit url,URL +user_name,UserName username,Username value,Value values,Values version,Version vpc_id,VPCID -vpc_security_group_ids,VPCSecurityGroupIDs \ No newline at end of file +vpc_security_group_ids,VPCSecurityGroupIDs