From e41dedb00d0a7bb79ce91f7651061c4bef38e552 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Thu, 29 Aug 2024 18:48:29 -0700 Subject: [PATCH] Semgrep fixes --- internal/generate/tagstests/resource_test.go.gtpl | 2 +- internal/service/amp/scraper_tags_gen_test.go | 4 ++-- internal/service/appconfig/environment_tags_gen_test.go | 4 ++-- .../service/appfabric/app_authorization_tags_gen_test.go | 4 ++-- internal/service/appfabric/app_bundle_tags_gen_test.go | 4 ++-- internal/service/batch/job_queue_tags_gen_test.go | 4 ++-- internal/service/bcmdataexports/export_tags_gen_test.go | 4 ++-- .../replication_configuration_template_tags_gen_test.go | 4 ++-- .../ec2/vpc_security_group_egress_rule_tags_gen_test.go | 4 ++-- .../ec2/vpc_security_group_ingress_rule_tags_gen_test.go | 4 ++-- internal/service/fms/resource_set_tags_gen_test.go | 4 ++-- internal/service/m2/application_tags_gen_test.go | 4 ++-- internal/service/m2/environment_tags_gen_test.go | 4 ++-- internal/service/medialive/input_data_source_test.go | 8 ++++++-- .../timestreaminfluxdb/db_instance_tags_gen_test.go | 4 ++-- 15 files changed, 33 insertions(+), 29 deletions(-) diff --git a/internal/generate/tagstests/resource_test.go.gtpl b/internal/generate/tagstests/resource_test.go.gtpl index bb45dc1b879..ce3dec3621d 100644 --- a/internal/generate/tagstests/resource_test.go.gtpl +++ b/internal/generate/tagstests/resource_test.go.gtpl @@ -71,7 +71,7 @@ plancheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrTagsAll), know {{ template "CommonImportBody" . }} {{ if eq .Implementation "framework" -}} ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" {{ if gt (len .ImportIgnore) 0 -}} {{ range $i, $v := .ImportIgnore }}{{ $v }},{{ end }} {{ end -}} diff --git a/internal/service/amp/scraper_tags_gen_test.go b/internal/service/amp/scraper_tags_gen_test.go index 3755527ca84..e60eec6f5b4 100644 --- a/internal/service/amp/scraper_tags_gen_test.go +++ b/internal/service/amp/scraper_tags_gen_test.go @@ -254,7 +254,7 @@ func TestAccAMPScraper_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1542,7 +1542,7 @@ func TestAccAMPScraper_tags_DefaultTags_nullOverlappingResourceTag(t *testing.T) ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/appconfig/environment_tags_gen_test.go b/internal/service/appconfig/environment_tags_gen_test.go index 5ff01af70c1..41d26f9382d 100644 --- a/internal/service/appconfig/environment_tags_gen_test.go +++ b/internal/service/appconfig/environment_tags_gen_test.go @@ -251,7 +251,7 @@ func TestAccAppConfigEnvironment_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1527,7 +1527,7 @@ func TestAccAppConfigEnvironment_tags_DefaultTags_nullOverlappingResourceTag(t * ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/appfabric/app_authorization_tags_gen_test.go b/internal/service/appfabric/app_authorization_tags_gen_test.go index b4bee2fb69c..135f6b9ee54 100644 --- a/internal/service/appfabric/app_authorization_tags_gen_test.go +++ b/internal/service/appfabric/app_authorization_tags_gen_test.go @@ -279,7 +279,7 @@ func testAccAppFabricAppAuthorization_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" "credential", }, }, @@ -1569,7 +1569,7 @@ func testAccAppFabricAppAuthorization_tags_DefaultTags_nullOverlappingResourceTa ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" "credential", }, }, diff --git a/internal/service/appfabric/app_bundle_tags_gen_test.go b/internal/service/appfabric/app_bundle_tags_gen_test.go index bb7b97e005a..71ae7bd50cb 100644 --- a/internal/service/appfabric/app_bundle_tags_gen_test.go +++ b/internal/service/appfabric/app_bundle_tags_gen_test.go @@ -267,7 +267,7 @@ func testAccAppFabricAppBundle_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1496,7 +1496,7 @@ func testAccAppFabricAppBundle_tags_DefaultTags_nullOverlappingResourceTag(t *te ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/batch/job_queue_tags_gen_test.go b/internal/service/batch/job_queue_tags_gen_test.go index 40fca01a247..2cbaacd1c0b 100644 --- a/internal/service/batch/job_queue_tags_gen_test.go +++ b/internal/service/batch/job_queue_tags_gen_test.go @@ -254,7 +254,7 @@ func TestAccBatchJobQueue_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1542,7 +1542,7 @@ func TestAccBatchJobQueue_tags_DefaultTags_nullOverlappingResourceTag(t *testing ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/bcmdataexports/export_tags_gen_test.go b/internal/service/bcmdataexports/export_tags_gen_test.go index efa5b8dba2f..ef156f24891 100644 --- a/internal/service/bcmdataexports/export_tags_gen_test.go +++ b/internal/service/bcmdataexports/export_tags_gen_test.go @@ -256,7 +256,7 @@ func TestAccBCMDataExportsExport_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1556,7 +1556,7 @@ func TestAccBCMDataExportsExport_tags_DefaultTags_nullOverlappingResourceTag(t * ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/drs/replication_configuration_template_tags_gen_test.go b/internal/service/drs/replication_configuration_template_tags_gen_test.go index d200eca1a12..0599f1a1788 100644 --- a/internal/service/drs/replication_configuration_template_tags_gen_test.go +++ b/internal/service/drs/replication_configuration_template_tags_gen_test.go @@ -280,7 +280,7 @@ func testAccDRSReplicationConfigurationTemplate_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1568,7 +1568,7 @@ func testAccDRSReplicationConfigurationTemplate_tags_DefaultTags_nullOverlapping ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/ec2/vpc_security_group_egress_rule_tags_gen_test.go b/internal/service/ec2/vpc_security_group_egress_rule_tags_gen_test.go index ce25e41601a..d926804df9a 100644 --- a/internal/service/ec2/vpc_security_group_egress_rule_tags_gen_test.go +++ b/internal/service/ec2/vpc_security_group_egress_rule_tags_gen_test.go @@ -254,7 +254,7 @@ func TestAccVPCSecurityGroupEgressRule_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1542,7 +1542,7 @@ func TestAccVPCSecurityGroupEgressRule_tags_DefaultTags_nullOverlappingResourceT ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/ec2/vpc_security_group_ingress_rule_tags_gen_test.go b/internal/service/ec2/vpc_security_group_ingress_rule_tags_gen_test.go index 71ff48adcc0..3e515c99f10 100644 --- a/internal/service/ec2/vpc_security_group_ingress_rule_tags_gen_test.go +++ b/internal/service/ec2/vpc_security_group_ingress_rule_tags_gen_test.go @@ -254,7 +254,7 @@ func TestAccVPCSecurityGroupIngressRule_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1542,7 +1542,7 @@ func TestAccVPCSecurityGroupIngressRule_tags_DefaultTags_nullOverlappingResource ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/fms/resource_set_tags_gen_test.go b/internal/service/fms/resource_set_tags_gen_test.go index 36fcd043830..fb564605d6a 100644 --- a/internal/service/fms/resource_set_tags_gen_test.go +++ b/internal/service/fms/resource_set_tags_gen_test.go @@ -280,7 +280,7 @@ func testAccFMSResourceSet_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1568,7 +1568,7 @@ func testAccFMSResourceSet_tags_DefaultTags_nullOverlappingResourceTag(t *testin ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/m2/application_tags_gen_test.go b/internal/service/m2/application_tags_gen_test.go index 16687946622..69cbc0e1d8c 100644 --- a/internal/service/m2/application_tags_gen_test.go +++ b/internal/service/m2/application_tags_gen_test.go @@ -254,7 +254,7 @@ func TestAccM2Application_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1542,7 +1542,7 @@ func TestAccM2Application_tags_DefaultTags_nullOverlappingResourceTag(t *testing ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/m2/environment_tags_gen_test.go b/internal/service/m2/environment_tags_gen_test.go index ba90cbefa88..ab20e21f1ba 100644 --- a/internal/service/m2/environment_tags_gen_test.go +++ b/internal/service/m2/environment_tags_gen_test.go @@ -254,7 +254,7 @@ func TestAccM2Environment_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, @@ -1542,7 +1542,7 @@ func TestAccM2Environment_tags_DefaultTags_nullOverlappingResourceTag(t *testing ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" }, }, }, diff --git a/internal/service/medialive/input_data_source_test.go b/internal/service/medialive/input_data_source_test.go index f188496ca00..5cb12eb5416 100644 --- a/internal/service/medialive/input_data_source_test.go +++ b/internal/service/medialive/input_data_source_test.go @@ -8,8 +8,11 @@ import ( "testing" "github.com/aws/aws-sdk-go-v2/service/medialive" + "github.com/hashicorp/terraform-plugin-testing/compare" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/statecheck" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -49,10 +52,11 @@ func TestAccMediaLiveInputDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, names.AttrSecurityGroups, dataSourceName, names.AttrSecurityGroups), resource.TestCheckResourceAttrPair(resourceName, "sources", dataSourceName, "sources"), resource.TestCheckResourceAttrSet(dataSourceName, names.AttrState), - resource.TestCheckResourceAttr(dataSourceName, acctest.CtTagsPercent, "1"), - resource.TestCheckResourceAttr(dataSourceName, "tags.Name", rName), resource.TestCheckResourceAttrPair(resourceName, names.AttrType, dataSourceName, names.AttrType), ), + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.CompareValuePairs(dataSourceName, tfjsonpath.New(names.AttrTags), resourceName, tfjsonpath.New(names.AttrTagsAll), compare.ValuesSame()), + }, }, }, }) diff --git a/internal/service/timestreaminfluxdb/db_instance_tags_gen_test.go b/internal/service/timestreaminfluxdb/db_instance_tags_gen_test.go index 7e7a6aca8e3..cd104fbbd33 100644 --- a/internal/service/timestreaminfluxdb/db_instance_tags_gen_test.go +++ b/internal/service/timestreaminfluxdb/db_instance_tags_gen_test.go @@ -266,7 +266,7 @@ func TestAccTimestreamInfluxDBDBInstance_tags_null(t *testing.T) { ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" names.AttrBucket, names.AttrUsername, "organization", names.AttrPassword, }, }, @@ -1615,7 +1615,7 @@ func TestAccTimestreamInfluxDBDBInstance_tags_DefaultTags_nullOverlappingResourc ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "tags.key1", // The canonical value returned by the AWS API is "" + acctest.CtTagsKey1, // The canonical value returned by the AWS API is "" names.AttrBucket, names.AttrUsername, "organization", names.AttrPassword, }, },