From 0ed3e50f69285696fc54e238cacefaea67ed1696 Mon Sep 17 00:00:00 2001 From: Matthew Burgess <549318+mattburgess@users.noreply.github.com> Date: Tue, 5 Jan 2021 15:27:41 +0000 Subject: [PATCH] tests/provider: Enable S1039 check for unnecessary fmt.Sprint()/fmt.Sprintf() usage (#16741) --- .golangci.yml | 4 - aws/data_source_aws_autoscaling_group_test.go | 4 +- ...s_codeartifact_authorization_token_test.go | 15 ++-- ...s_codeartifact_repository_endpoint_test.go | 4 +- ...ce_aws_directory_service_directory_test.go | 5 +- ...ta_source_aws_docdb_engine_version_test.go | 8 +- aws/data_source_aws_ebs_snapshot_ids_test.go | 4 +- aws/data_source_aws_ec2_spot_price_test.go | 5 +- aws/data_source_aws_instance_test.go | 21 ++--- ..._source_aws_neptune_engine_version_test.go | 8 +- ...data_source_aws_rds_engine_version_test.go | 12 +-- ...urce_aws_rds_orderable_db_instance_test.go | 28 +++---- aws/data_source_aws_route_test.go | 4 +- ...ta_source_aws_workspaces_workspace_test.go | 13 ++- ...ource_aws_apigatewayv2_integration_test.go | 10 +-- aws/resource_aws_autoscaling_group_test.go | 79 +++++++++---------- ...ource_aws_autoscaling_notification_test.go | 2 +- ...c_location_fsx_windows_file_system_test.go | 2 +- aws/resource_aws_db_instance_test.go | 16 ++-- aws/resource_aws_docdb_subnet_group_test.go | 8 +- ...urce_aws_ec2_transit_gateway_route_test.go | 4 +- ...ec2_transit_gateway_vpc_attachment_test.go | 16 ++-- aws/resource_aws_eip_association_test.go | 4 +- aws/resource_aws_elb_attachment_test.go | 10 +-- aws/resource_aws_emr_cluster_test.go | 4 +- ...source_aws_fsx_windows_file_system_test.go | 2 +- ...e_data_catalog_encryption_settings_test.go | 4 +- aws/resource_aws_instance_test.go | 72 ++++++++--------- ...rce_aws_lambda_code_signing_config_test.go | 12 +-- aws/resource_aws_neptune_cluster_test.go | 4 +- aws/resource_aws_neptune_subnet_group_test.go | 8 +- aws/resource_aws_network_acl_rule_test.go | 8 +- aws/resource_aws_network_interface_test.go | 18 ++--- aws/resource_aws_route_table_test.go | 4 +- aws/resource_aws_route_test.go | 64 +++++++-------- ..._signer_signing_profile_permission_test.go | 2 +- ...esource_aws_signer_signing_profile_test.go | 18 ++--- aws/resource_aws_vpn_gateway_test.go | 4 +- ...esource_aws_xray_encryption_config_test.go | 4 +- staticcheck.conf | 1 - 40 files changed, 256 insertions(+), 259 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 60f8104a518..ace701c8fbb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,9 +1,5 @@ issues: exclude-rules: - - linters: - - gosimple - text: "S1039:" - # Exclude issues bypassing staticcheck.conf - linters: - staticcheck diff --git a/aws/data_source_aws_autoscaling_group_test.go b/aws/data_source_aws_autoscaling_group_test.go index 970215b10fe..8378e7754b2 100644 --- a/aws/data_source_aws_autoscaling_group_test.go +++ b/aws/data_source_aws_autoscaling_group_test.go @@ -124,7 +124,7 @@ func testAccAutoScalingGroupDataResourceConfig_launchTemplate() string { testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAvailableAZsNoOptInConfig(), testAccAvailableEc2InstanceTypeForAvailabilityZone("data.aws_availability_zones.available.names[0]", "t3.micro", "t2.micro"), - fmt.Sprintf(` + ` data "aws_autoscaling_group" "test" { name = aws_autoscaling_group.test.name } @@ -145,5 +145,5 @@ resource "aws_launch_template" "test" { image_id = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = data.aws_ec2_instance_type_offering.available.instance_type } -`)) +`) } diff --git a/aws/data_source_aws_codeartifact_authorization_token_test.go b/aws/data_source_aws_codeartifact_authorization_token_test.go index b9c3a35e1e4..9c42f339a7e 100644 --- a/aws/data_source_aws_codeartifact_authorization_token_test.go +++ b/aws/data_source_aws_codeartifact_authorization_token_test.go @@ -85,8 +85,9 @@ resource "aws_codeartifact_domain" "test" { } func testAccCheckAWSCodeArtifactAuthorizationTokenBasicConfig(rName string) string { - return testAccCheckAWSCodeArtifactAuthorizationTokenBaseConfig(rName) + - fmt.Sprintf(` + return composeConfig( + testAccCheckAWSCodeArtifactAuthorizationTokenBaseConfig(rName), + ` data "aws_codeartifact_authorization_token" "test" { domain = aws_codeartifact_domain.test.domain } @@ -94,8 +95,9 @@ data "aws_codeartifact_authorization_token" "test" { } func testAccCheckAWSCodeArtifactAuthorizationTokenOwnerConfig(rName string) string { - return testAccCheckAWSCodeArtifactAuthorizationTokenBaseConfig(rName) + - fmt.Sprintf(` + return composeConfig( + testAccCheckAWSCodeArtifactAuthorizationTokenBaseConfig(rName), + ` data "aws_codeartifact_authorization_token" "test" { domain = aws_codeartifact_domain.test.domain domain_owner = aws_codeartifact_domain.test.owner @@ -104,8 +106,9 @@ data "aws_codeartifact_authorization_token" "test" { } func testAccCheckAWSCodeArtifactAuthorizationTokenDurationConfig(rName string) string { - return testAccCheckAWSCodeArtifactAuthorizationTokenBaseConfig(rName) + - fmt.Sprintf(` + return composeConfig( + testAccCheckAWSCodeArtifactAuthorizationTokenBaseConfig(rName), + ` data "aws_codeartifact_authorization_token" "test" { domain = aws_codeartifact_domain.test.domain duration_seconds = 900 diff --git a/aws/data_source_aws_codeartifact_repository_endpoint_test.go b/aws/data_source_aws_codeartifact_repository_endpoint_test.go index 17f3a1bd904..6e7e0ed6d24 100644 --- a/aws/data_source_aws_codeartifact_repository_endpoint_test.go +++ b/aws/data_source_aws_codeartifact_repository_endpoint_test.go @@ -102,12 +102,12 @@ data "aws_codeartifact_repository_endpoint" "test" { func testAccCheckAWSCodeArtifactRepositoryEndpointOwnerConfig(rName string) string { return composeConfig( testAccCheckAWSCodeArtifactRepositoryEndpointBaseConfig(rName), - fmt.Sprintf(` + ` data "aws_codeartifact_repository_endpoint" "test" { domain = aws_codeartifact_domain.test.domain repository = aws_codeartifact_repository.test.repository domain_owner = aws_codeartifact_domain.test.owner format = "npm" } -`)) +`) } diff --git a/aws/data_source_aws_directory_service_directory_test.go b/aws/data_source_aws_directory_service_directory_test.go index 248ab8e778c..a8c01c95314 100644 --- a/aws/data_source_aws_directory_service_directory_test.go +++ b/aws/data_source_aws_directory_service_directory_test.go @@ -197,7 +197,8 @@ data "aws_directory_service_directory" "test-microsoft-ad" { } func testAccDataSourceDirectoryServiceDirectoryConfig_connector() string { - return composeConfig(testAccAvailableAZsNoOptInConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), + ` resource "aws_directory_service_directory" "test" { name = "corp.notexample.com" password = "SuperSecretPassw0rd" @@ -254,5 +255,5 @@ resource "aws_subnet" "test" { data "aws_directory_service_directory" "test-ad-connector" { directory_id = aws_directory_service_directory.connector.id } -`)) +`) } diff --git a/aws/data_source_aws_docdb_engine_version_test.go b/aws/data_source_aws_docdb_engine_version_test.go index 83a3fc203b1..a0bdb8111c7 100644 --- a/aws/data_source_aws_docdb_engine_version_test.go +++ b/aws/data_source_aws_docdb_engine_version_test.go @@ -103,15 +103,15 @@ data "aws_docdb_engine_version" "test" { } func testAccAWSDocDBEngineVersionDataSourcePreferredConfig() string { - return fmt.Sprintf(` + return ` data "aws_docdb_engine_version" "test" { preferred_versions = ["34.6.1", "3.6.0", "2.6.0"] } -`) +` } func testAccAWSDocDBEngineVersionDataSourceDefaultOnlyConfig() string { - return fmt.Sprintf(` + return ` data "aws_docdb_engine_version" "test" {} -`) +` } diff --git a/aws/data_source_aws_ebs_snapshot_ids_test.go b/aws/data_source_aws_ebs_snapshot_ids_test.go index 27aacc24149..1bca667a475 100644 --- a/aws/data_source_aws_ebs_snapshot_ids_test.go +++ b/aws/data_source_aws_ebs_snapshot_ids_test.go @@ -71,7 +71,7 @@ func TestAccDataSourceAwsEbsSnapshotIds_empty(t *testing.T) { } func testAccDataSourceAwsEbsSnapshotIdsConfig_basic() string { - return composeConfig(testAccAvailableAZsNoOptInConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` resource "aws_ebs_volume" "test" { availability_zone = data.aws_availability_zones.available.names[0] size = 1 @@ -84,7 +84,7 @@ resource "aws_ebs_snapshot" "test" { data "aws_ebs_snapshot_ids" "test" { owners = ["self"] } -`)) +`) } func testAccDataSourceAwsEbsSnapshotIdsConfig_sorted1(rName string) string { diff --git a/aws/data_source_aws_ec2_spot_price_test.go b/aws/data_source_aws_ec2_spot_price_test.go index 516989087f9..9fa7ede1b6c 100644 --- a/aws/data_source_aws_ec2_spot_price_test.go +++ b/aws/data_source_aws_ec2_spot_price_test.go @@ -1,7 +1,6 @@ package aws import ( - "fmt" "regexp" "testing" @@ -67,7 +66,7 @@ func testAccPreCheckAwsEc2SpotPrice(t *testing.T) { } func testAccAwsEc2SpotPriceDataSourceConfig() string { - return testAccAvailableAZsNoOptInConfig() + fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` data "aws_region" "current" {} data "aws_ec2_instance_type_offering" "test" { @@ -91,7 +90,7 @@ data "aws_ec2_spot_price" "test" { } func testAccAwsEc2SpotPriceDataSourceFilterConfig() string { - return testAccAvailableAZsNoOptInConfig() + fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` data "aws_region" "current" {} data "aws_ec2_instance_type_offering" "test" { diff --git a/aws/data_source_aws_instance_test.go b/aws/data_source_aws_instance_test.go index d2d0c4b7910..ae488ca058f 100644 --- a/aws/data_source_aws_instance_test.go +++ b/aws/data_source_aws_instance_test.go @@ -575,8 +575,8 @@ data "aws_instance" "test" { } // filter on tag, populate more attributes -var testAccInstanceDataSourceConfig_AzUserData = testAccAvailableAZsNoOptInDefaultExcludeConfig() + - testAccLatestAmazonLinuxHvmEbsAmiConfig() + fmt.Sprintf(` +var testAccInstanceDataSourceConfig_AzUserData = composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id availability_zone = data.aws_availability_zones.available.names[0] @@ -738,7 +738,7 @@ data "aws_instance" "test" { ` func testAccInstanceDataSourceConfig_privateIP(rName string) string { - return testAccLatestAmazonLinuxHvmEbsAmiConfig() + testAccAwsInstanceVpcConfigBasic(rName) + fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfigBasic(rName), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.micro" @@ -753,7 +753,7 @@ data "aws_instance" "test" { } func testAccInstanceDataSourceConfig_secondaryPrivateIPs(rName string) string { - return testAccLatestAmazonLinuxHvmEbsAmiConfig() + testAccAwsInstanceVpcConfigBasic(rName) + fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfigBasic(rName), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.micro" @@ -799,7 +799,7 @@ data "aws_instance" "test" { } func testAccInstanceDataSourceConfig_VPC(rName string) string { - return testAccLatestAmazonLinuxHvmEbsAmiConfig() + testAccAwsInstanceVpcConfigBasic(rName) + fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfigBasic(rName), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.small" @@ -869,10 +869,10 @@ data "aws_instance" "test" { } func testAccInstanceDataSourceConfig_VPCSecurityGroups(rName string) string { - return testAccLatestAmazonLinuxHvmEbsAmiConfig() + - testAccAwsInstanceVpcConfigBasic(rName) + - testAccAwsInstanceVpcSecurityGroupConfig(rName) + - fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), + testAccAwsInstanceVpcConfigBasic(rName), + testAccAwsInstanceVpcSecurityGroupConfig(rName), + ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.micro" @@ -945,7 +945,8 @@ data "aws_instance" "test" { } func testAccInstanceDataSourceConfig_creditSpecification(rName string) string { - return testAccLatestAmazonLinuxHvmEbsAmiConfig() + testAccAwsInstanceVpcConfigBasic(rName) + fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), + testAccAwsInstanceVpcConfigBasic(rName), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.micro" diff --git a/aws/data_source_aws_neptune_engine_version_test.go b/aws/data_source_aws_neptune_engine_version_test.go index bf3f6f61f28..fd3f3b46e6a 100644 --- a/aws/data_source_aws_neptune_engine_version_test.go +++ b/aws/data_source_aws_neptune_engine_version_test.go @@ -105,15 +105,15 @@ data "aws_neptune_engine_version" "test" { } func testAccAWSNeptuneEngineVersionDataSourcePreferredConfig() string { - return fmt.Sprintf(` + return ` data "aws_neptune_engine_version" "test" { preferred_versions = ["85.9.12", "1.0.3.0", "1.0.2.2"] } -`) +` } func testAccAWSNeptuneEngineVersionDataSourceDefaultOnlyConfig() string { - return fmt.Sprintf(` + return ` data "aws_neptune_engine_version" "test" {} -`) +` } diff --git a/aws/data_source_aws_rds_engine_version_test.go b/aws/data_source_aws_rds_engine_version_test.go index b7c0c1814df..ae24f8358fb 100644 --- a/aws/data_source_aws_rds_engine_version_test.go +++ b/aws/data_source_aws_rds_engine_version_test.go @@ -131,27 +131,27 @@ data "aws_rds_engine_version" "test" { } func testAccAWSRDSEngineVersionDataSourceUpgradeTargetsConfig() string { - return fmt.Sprintf(` + return ` data "aws_rds_engine_version" "test" { engine = "mysql" version = "5.7.17" } -`) +` } func testAccAWSRDSEngineVersionDataSourcePreferredConfig() string { - return fmt.Sprintf(` + return ` data "aws_rds_engine_version" "test" { engine = "mysql" preferred_versions = ["85.9.12", "5.7.19", "5.7.17"] } -`) +` } func testAccAWSRDSEngineVersionDataSourceDefaultOnlyConfig() string { - return fmt.Sprintf(` + return ` data "aws_rds_engine_version" "test" { engine = "mysql" } -`) +` } diff --git a/aws/data_source_aws_rds_orderable_db_instance_test.go b/aws/data_source_aws_rds_orderable_db_instance_test.go index 68e1863c473..0e7cacd6829 100644 --- a/aws/data_source_aws_rds_orderable_db_instance_test.go +++ b/aws/data_source_aws_rds_orderable_db_instance_test.go @@ -310,7 +310,7 @@ data "aws_rds_orderable_db_instance" "test" { } func testAccAWSRdsOrderableDbInstanceDataSourceConfig_supportsEnhancedMonitoring() string { - return fmt.Sprintf(` + return ` data "aws_rds_orderable_db_instance" "test" { engine = "mysql" license_model = "general-public-license" @@ -320,11 +320,11 @@ data "aws_rds_orderable_db_instance" "test" { preferred_engine_versions = ["5.6.35", "5.6.41", "5.6.44"] preferred_instance_classes = ["db.t2.small", "db.t3.medium", "db.t3.large"] } -`) +` } func testAccAWSRdsOrderableDbInstanceDataSourceConfig_supportsIAMDatabaseAuthentication() string { - return fmt.Sprintf(` + return ` data "aws_rds_orderable_db_instance" "test" { engine = "mysql" license_model = "general-public-license" @@ -334,11 +334,11 @@ data "aws_rds_orderable_db_instance" "test" { preferred_engine_versions = ["5.6.35", "5.6.41", "5.6.44"] preferred_instance_classes = ["db.t2.small", "db.t3.medium", "db.t3.large"] } -`) +` } func testAccAWSRdsOrderableDbInstanceDataSourceConfig_supportsIops() string { - return fmt.Sprintf(` + return ` data "aws_rds_orderable_db_instance" "test" { engine = "mysql" license_model = "general-public-license" @@ -347,11 +347,11 @@ data "aws_rds_orderable_db_instance" "test" { preferred_engine_versions = ["8.0.20", "8.0.19", "8.0.17"] preferred_instance_classes = ["db.t3.small", "db.t2.xlarge", "db.t2.small"] } -`) +` } func testAccAWSRdsOrderableDbInstanceDataSourceConfig_supportsKerberosAuthentication() string { - return fmt.Sprintf(` + return ` data "aws_rds_orderable_db_instance" "test" { engine = "postgres" license_model = "postgresql-license" @@ -361,11 +361,11 @@ data "aws_rds_orderable_db_instance" "test" { preferred_engine_versions = ["12.3", "11.1", "10.13"] preferred_instance_classes = ["db.m5.xlarge", "db.r5.large", "db.t3.large"] } -`) +` } func testAccAWSRdsOrderableDbInstanceDataSourceConfig_supportsPerformanceInsights() string { - return fmt.Sprintf(` + return ` data "aws_rds_orderable_db_instance" "test" { engine = "mysql" license_model = "general-public-license" @@ -374,11 +374,11 @@ data "aws_rds_orderable_db_instance" "test" { preferred_engine_versions = ["5.6.35", "5.6.41", "5.6.44"] preferred_instance_classes = ["db.t2.small", "db.t3.medium", "db.t3.large"] } -`) +` } func testAccAWSRdsOrderableDbInstanceDataSourceConfig_supportsStorageAutoscaling() string { - return fmt.Sprintf(` + return ` data "aws_rds_orderable_db_instance" "test" { engine = "mysql" license_model = "general-public-license" @@ -387,11 +387,11 @@ data "aws_rds_orderable_db_instance" "test" { preferred_engine_versions = ["8.0.20", "8.0.19", "5.7.30"] preferred_instance_classes = ["db.t3.medium", "db.t2.large", "db.t3.xlarge"] } -`) +` } func testAccAWSRdsOrderableDbInstanceDataSourceConfig_supportsStorageEncryption() string { - return fmt.Sprintf(` + return ` data "aws_rds_orderable_db_instance" "test" { engine = "mysql" license_model = "general-public-license" @@ -401,5 +401,5 @@ data "aws_rds_orderable_db_instance" "test" { preferred_engine_versions = ["5.6.35", "5.6.41", "5.6.44"] preferred_instance_classes = ["db.t2.small", "db.t3.medium", "db.t3.large"] } -`) +` } diff --git a/aws/data_source_aws_route_test.go b/aws/data_source_aws_route_test.go index 4ca660b0a1a..6772660cdca 100644 --- a/aws/data_source_aws_route_test.go +++ b/aws/data_source_aws_route_test.go @@ -250,7 +250,7 @@ data "aws_route" "test" { } func testAccAWSRouteDataSourceConfigLocalGatewayID() string { - return fmt.Sprintf(` + return ` data "aws_ec2_local_gateways" "all" {} data "aws_ec2_local_gateway" "first" { id = tolist(data.aws_ec2_local_gateways.all.ids)[0] @@ -286,5 +286,5 @@ data "aws_route" "by_local_gateway_id" { local_gateway_id = data.aws_ec2_local_gateway.first.id depends_on = [aws_route.test] } -`) +` } diff --git a/aws/data_source_aws_workspaces_workspace_test.go b/aws/data_source_aws_workspaces_workspace_test.go index 969bd4655b1..2e8a910fe6b 100644 --- a/aws/data_source_aws_workspaces_workspace_test.go +++ b/aws/data_source_aws_workspaces_workspace_test.go @@ -1,7 +1,6 @@ package aws import ( - "fmt" "regexp" "testing" @@ -90,7 +89,7 @@ func TestAccDataSourceAwsWorkspacesWorkspace_workspaceIDAndDirectoryIDConflict(t func testAccDataSourceWorkspacesWorkspaceConfig_byWorkspaceID(rName string) string { return composeConfig( testAccAwsWorkspacesWorkspaceConfig_Prerequisites(rName), - fmt.Sprintf(` + ` resource "aws_workspaces_workspace" "test" { bundle_id = data.aws_workspaces_bundle.test.id directory_id = aws_workspaces_directory.test.id @@ -112,13 +111,13 @@ resource "aws_workspaces_workspace" "test" { data "aws_workspaces_workspace" "test" { workspace_id = aws_workspaces_workspace.test.id } -`)) +`) } func testAccDataSourceWorkspacesWorkspaceConfig_byDirectoryID_userName(rName string) string { return composeConfig( testAccAwsWorkspacesWorkspaceConfig_Prerequisites(rName), - fmt.Sprintf(` + ` resource "aws_workspaces_workspace" "test" { bundle_id = data.aws_workspaces_bundle.test.id directory_id = aws_workspaces_directory.test.id @@ -143,15 +142,15 @@ data "aws_workspaces_workspace" "test" { depends_on = [aws_workspaces_workspace.test] } -`)) +`) } func testAccDataSourceAwsWorkspacesWorkspaceConfig_workspaceIDAndDirectoryIDConflict() string { - return fmt.Sprintf(` + return ` data "aws_workspaces_workspace" "test" { workspace_id = "ws-cj5xcxsz5" directory_id = "d-9967252f57" user_name = "Administrator" } -`) +` } diff --git a/aws/resource_aws_apigatewayv2_integration_test.go b/aws/resource_aws_apigatewayv2_integration_test.go index 6ff3061b65e..b70a53689c4 100644 --- a/aws/resource_aws_apigatewayv2_integration_test.go +++ b/aws/resource_aws_apigatewayv2_integration_test.go @@ -776,7 +776,7 @@ resource "aws_apigatewayv2_integration" "test" { } func testAccAWSAPIGatewayV2IntegrationConfig_httpProxy(rName string) string { - return testAccAWSAPIGatewayV2IntegrationConfig_apiHttp(rName) + fmt.Sprintf(` + return composeConfig(testAccAWSAPIGatewayV2IntegrationConfig_apiHttp(rName), ` resource "aws_apigatewayv2_integration" "test" { api_id = aws_apigatewayv2_api.test.id integration_type = "HTTP_PROXY" @@ -790,7 +790,7 @@ resource "aws_apigatewayv2_integration" "test" { func testAccAWSAPIGatewayV2IntegrationConfig_vpcLinkHttp(rName string) string { return composeConfig( testAccAWSAPIGatewayV2IntegrationConfig_vpcLinkHttpBase(rName), - fmt.Sprintf(` + ` resource "aws_apigatewayv2_integration" "test" { api_id = aws_apigatewayv2_api.test.id integration_type = "HTTP_PROXY" @@ -806,13 +806,13 @@ resource "aws_apigatewayv2_integration" "test" { server_name_to_verify = "www.example.com" } } -`)) +`) } func testAccAWSAPIGatewayV2IntegrationConfig_vpcLinkHttpUpdated(rName string) string { return composeConfig( testAccAWSAPIGatewayV2IntegrationConfig_vpcLinkHttpBase(rName), - fmt.Sprintf(` + ` resource "aws_apigatewayv2_integration" "test" { api_id = aws_apigatewayv2_api.test.id integration_type = "HTTP_PROXY" @@ -827,7 +827,7 @@ resource "aws_apigatewayv2_integration" "test" { server_name_to_verify = "www.example.org" } } -`)) +`) } func testAccAWSAPIGatewayV2IntegrationConfig_vpcLinkWebSocket(rName string) string { diff --git a/aws/resource_aws_autoscaling_group_test.go b/aws/resource_aws_autoscaling_group_test.go index 90008081638..1be61745c12 100644 --- a/aws/resource_aws_autoscaling_group_test.go +++ b/aws/resource_aws_autoscaling_group_test.go @@ -2242,8 +2242,7 @@ func TestAccAWSAutoScalingGroup_launchTempPartitionNum(t *testing.T) { } func testAccAWSAutoScalingGroupConfig_autoGeneratedName() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -2270,8 +2269,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_namePrefix() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -2299,8 +2298,8 @@ resource "aws_autoscaling_group" "test" { } func testAccAWSAutoScalingGroupConfig_terminationPoliciesEmpty() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -2328,8 +2327,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_terminationPoliciesExplicitDefault() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -2358,8 +2357,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_terminationPoliciesUpdate() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -2695,8 +2694,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfigWithAZ() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` resource "aws_vpc" "default" { cidr_block = "10.0.0.0/16" tags = { @@ -2741,8 +2740,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfigWithVPCIdent() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` resource "aws_vpc" "default" { cidr_block = "10.0.0.0/16" tags = { @@ -2833,8 +2832,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_withServiceLinkedRoleARN() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -2866,8 +2865,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_withMaxInstanceLifetime() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -2895,8 +2894,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_withMaxInstanceLifetime_update() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -2924,8 +2923,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoscalingMetricsCollectionConfig_allMetricsCollected() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -2971,8 +2970,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoscalingMetricsCollectionConfig_updatingMetricsCollected() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -3010,8 +3009,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_pre() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` resource "aws_vpc" "default" { cidr_block = "10.0.0.0/16" @@ -3100,8 +3099,8 @@ resource "aws_security_group" "tf_test_self" { } func testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_post() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` resource "aws_vpc" "default" { cidr_block = "10.0.0.0/16" @@ -3192,8 +3191,8 @@ resource "aws_security_group" "tf_test_self" { } func testAccAWSAutoScalingGroupConfig_ALB_TargetGroup_post_duo() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` resource "aws_vpc" "default" { cidr_block = "10.0.0.0/16" @@ -3624,8 +3623,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_classicVpcZoneIdentifier() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` resource "aws_autoscaling_group" "test" { min_size = 0 max_size = 0 @@ -3652,8 +3651,8 @@ resource "aws_launch_configuration" "test" { } func testAccAWSAutoScalingGroupConfig_withLaunchTemplate() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -3684,8 +3683,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_withLaunchTemplate_toLaunchConfig() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -3718,8 +3717,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_withLaunchTemplate_toLaunchTemplateName() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] @@ -3760,8 +3759,8 @@ resource "aws_autoscaling_group" "bar" { } func testAccAWSAutoScalingGroupConfig_withLaunchTemplate_toLaunchTemplateVersion() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` data "aws_ami" "test_ami" { most_recent = true owners = ["amazon"] diff --git a/aws/resource_aws_autoscaling_notification_test.go b/aws/resource_aws_autoscaling_notification_test.go index ccd3639d698..d1a462a0d10 100644 --- a/aws/resource_aws_autoscaling_notification_test.go +++ b/aws/resource_aws_autoscaling_notification_test.go @@ -324,7 +324,7 @@ resource "aws_autoscaling_notification" "example" { } func testAccASGNotificationConfig_pagination() string { - return testAccLatestAmazonLinuxHvmEbsAmiConfig() + fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_sns_topic" "user_updates" { name = "user-updates-topic" } diff --git a/aws/resource_aws_datasync_location_fsx_windows_file_system_test.go b/aws/resource_aws_datasync_location_fsx_windows_file_system_test.go index 7754948fe82..2b517e4379b 100644 --- a/aws/resource_aws_datasync_location_fsx_windows_file_system_test.go +++ b/aws/resource_aws_datasync_location_fsx_windows_file_system_test.go @@ -286,7 +286,7 @@ func testAccWSDataSyncLocationFsxWindowsImportStateIdFunc(resourceName string) r } func testAccAWSDataSyncLocationFsxWindowsConfig() string { - return testAccAwsFsxWindowsFileSystemConfigSecurityGroupIds1() + fmt.Sprintf(` + return composeConfig(testAccAwsFsxWindowsFileSystemConfigSecurityGroupIds1(), ` resource "aws_datasync_location_fsx_windows_file_system" "test" { fsx_filesystem_arn = aws_fsx_windows_file_system.test.arn user = "SomeUser" diff --git a/aws/resource_aws_db_instance_test.go b/aws/resource_aws_db_instance_test.go index fc086b55d1b..44d828c26db 100644 --- a/aws/resource_aws_db_instance_test.go +++ b/aws/resource_aws_db_instance_test.go @@ -3079,7 +3079,7 @@ func testAccAWSDBInstanceConfig_orderableClassSQLServerEx() string { } func testAccAWSDBInstanceConfig_basic() string { - return composeConfig(testAccAWSDBInstanceConfig_orderableClassMysql(), fmt.Sprintf(` + return composeConfig(testAccAWSDBInstanceConfig_orderableClassMysql(), ` resource "aws_db_instance" "bar" { allocated_storage = 10 backup_retention_period = 0 @@ -3097,11 +3097,11 @@ resource "aws_db_instance" "bar" { # validation error). maintenance_window = "Fri:09:00-Fri:09:30" } -`)) +`) } func testAccAWSDBInstanceConfig_namePrefix() string { - return composeConfig(testAccAWSDBInstanceConfig_orderableClassMysql(), fmt.Sprintf(` + return composeConfig(testAccAWSDBInstanceConfig_orderableClassMysql(), ` resource "aws_db_instance" "test" { allocated_storage = 10 engine = data.aws_rds_orderable_db_instance.test.engine @@ -3112,11 +3112,11 @@ resource "aws_db_instance" "test" { skip_final_snapshot = true username = "root" } -`)) +`) } func testAccAWSDBInstanceConfig_generatedName() string { - return composeConfig(testAccAWSDBInstanceConfig_orderableClassMysql(), fmt.Sprintf(` + return composeConfig(testAccAWSDBInstanceConfig_orderableClassMysql(), ` resource "aws_db_instance" "test" { allocated_storage = 10 engine = data.aws_rds_orderable_db_instance.test.engine @@ -3126,7 +3126,7 @@ resource "aws_db_instance" "test" { skip_final_snapshot = true username = "root" } -`)) +`) } func testAccAWSDBInstanceConfig_KmsKeyId(rInt int) string { @@ -3190,7 +3190,7 @@ resource "aws_db_instance" "bar" { } func testAccAWSDBInstanceConfig_WithCACertificateIdentifier() string { - return composeConfig(testAccAWSDBInstanceConfig_orderableClassMysql(), fmt.Sprintf(` + return composeConfig(testAccAWSDBInstanceConfig_orderableClassMysql(), ` data "aws_rds_certificate" "latest" { latest_valid_till = true } @@ -3206,7 +3206,7 @@ resource "aws_db_instance" "bar" { skip_final_snapshot = true username = "foo" } -`)) +`) } func testAccAWSDBInstanceConfig_WithOptionGroup(rName string) string { diff --git a/aws/resource_aws_docdb_subnet_group_test.go b/aws/resource_aws_docdb_subnet_group_test.go index 8b174854571..e76712840c0 100644 --- a/aws/resource_aws_docdb_subnet_group_test.go +++ b/aws/resource_aws_docdb_subnet_group_test.go @@ -313,7 +313,7 @@ resource "aws_docdb_subnet_group" "foo" { } func testAccDocDBSubnetGroupConfig_namePrefix() string { - return composeConfig(testAccAvailableAZsNoOptInConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` resource "aws_vpc" "test" { cidr_block = "10.1.0.0/16" @@ -345,11 +345,11 @@ resource "aws_subnet" "b" { resource "aws_docdb_subnet_group" "test" { name_prefix = "tf_test-" subnet_ids = [aws_subnet.a.id, aws_subnet.b.id] -}`)) +}`) } func testAccDocDBSubnetGroupConfig_generatedName() string { - return composeConfig(testAccAvailableAZsNoOptInConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` resource "aws_vpc" "test" { cidr_block = "10.1.0.0/16" @@ -380,5 +380,5 @@ resource "aws_subnet" "b" { resource "aws_docdb_subnet_group" "test" { subnet_ids = [aws_subnet.a.id, aws_subnet.b.id] -}`)) +}`) } diff --git a/aws/resource_aws_ec2_transit_gateway_route_test.go b/aws/resource_aws_ec2_transit_gateway_route_test.go index 62206492456..cb5b9941bc6 100644 --- a/aws/resource_aws_ec2_transit_gateway_route_test.go +++ b/aws/resource_aws_ec2_transit_gateway_route_test.go @@ -234,7 +234,7 @@ func testAccCheckAWSEc2TransitGatewayRouteDisappears(transitGateway *ec2.Transit } func testAccAWSEc2TransitGatewayRouteConfigDestinationCidrBlock() string { - return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), ` resource "aws_vpc" "test" { cidr_block = "10.0.0.0/16" @@ -278,5 +278,5 @@ resource "aws_ec2_transit_gateway_route" "test_blackhole" { blackhole = true transit_gateway_route_table_id = aws_ec2_transit_gateway.test.association_default_route_table_id } -`)) +`) } diff --git a/aws/resource_aws_ec2_transit_gateway_vpc_attachment_test.go b/aws/resource_aws_ec2_transit_gateway_vpc_attachment_test.go index 3b63247c1ed..47a5799d9d4 100644 --- a/aws/resource_aws_ec2_transit_gateway_vpc_attachment_test.go +++ b/aws/resource_aws_ec2_transit_gateway_vpc_attachment_test.go @@ -583,7 +583,7 @@ func testAccCheckAWSEc2TransitGatewayVpcAttachmentNotRecreated(i, j *ec2.Transit } func testAccAWSEc2TransitGatewayVpcAttachmentConfig() string { - return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), ` resource "aws_vpc" "test" { cidr_block = "10.0.0.0/16" @@ -609,7 +609,7 @@ resource "aws_ec2_transit_gateway_vpc_attachment" "test" { transit_gateway_id = aws_ec2_transit_gateway.test.id vpc_id = aws_vpc.test.id } -`)) +`) } func testAccAWSEc2TransitGatewayVpcAttachmentConfigApplianceModeSupport(appModeSupport string) string { @@ -770,7 +770,7 @@ resource "aws_ec2_transit_gateway_vpc_attachment" "test" { } func testAccAWSEc2TransitGatewayVpcAttachmentConfigSubnetIds1() string { - return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), ` resource "aws_vpc" "test" { cidr_block = "10.0.0.0/16" @@ -798,11 +798,11 @@ resource "aws_ec2_transit_gateway_vpc_attachment" "test" { transit_gateway_id = aws_ec2_transit_gateway.test.id vpc_id = aws_vpc.test.id } -`)) +`) } func testAccAWSEc2TransitGatewayVpcAttachmentConfigSubnetIds2() string { - return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), ` resource "aws_vpc" "test" { cidr_block = "10.0.0.0/16" @@ -830,7 +830,7 @@ resource "aws_ec2_transit_gateway_vpc_attachment" "test" { transit_gateway_id = aws_ec2_transit_gateway.test.id vpc_id = aws_vpc.test.id } -`)) +`) } func testAccAWSEc2TransitGatewayVpcAttachmentConfigTags1(tagKey1, tagValue1 string) string { @@ -903,7 +903,7 @@ resource "aws_ec2_transit_gateway_vpc_attachment" "test" { } func testAccAWSEc2TransitGatewayVpcAttachmentConfigTransitGatewayDefaultRouteTableAssociationAndPropagationDisabled() string { - return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), ` resource "aws_vpc" "test" { cidr_block = "10.0.0.0/16" @@ -934,7 +934,7 @@ resource "aws_ec2_transit_gateway_vpc_attachment" "test" { transit_gateway_id = aws_ec2_transit_gateway.test.id vpc_id = aws_vpc.test.id } -`)) +`) } func testAccAWSEc2TransitGatewayVpcAttachmentConfigTransitGatewayDefaultRouteTableAssociation(transitGatewayDefaultRouteTableAssociation bool) string { diff --git a/aws/resource_aws_eip_association_test.go b/aws/resource_aws_eip_association_test.go index 7f6e01078b1..7cf7249ffd9 100644 --- a/aws/resource_aws_eip_association_test.go +++ b/aws/resource_aws_eip_association_test.go @@ -452,7 +452,7 @@ resource "aws_eip_association" "test" { func testAccAWSEIPAssociationConfig_instance() string { return composeConfig( testAccLatestAmazonLinuxHvmEbsAmiConfig(), - fmt.Sprintf(` + ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.small" @@ -464,7 +464,7 @@ resource "aws_eip_association" "test" { allocation_id = aws_eip.test.id instance_id = aws_instance.test.id } -`)) +`) } const testAccAWSEIPAssociationConfig_networkInterface = ` diff --git a/aws/resource_aws_elb_attachment_test.go b/aws/resource_aws_elb_attachment_test.go index 01ab322824d..841ff13894a 100644 --- a/aws/resource_aws_elb_attachment_test.go +++ b/aws/resource_aws_elb_attachment_test.go @@ -111,7 +111,7 @@ func testAccAWSELBAttachmentCheckInstanceCount(conf *elb.LoadBalancerDescription // add one attachment func testAccAWSELBAttachmentConfig1() string { - return testAccLatestAmazonLinuxHvmEbsAmiConfig() + fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` data "aws_availability_zones" "available" { state = "available" @@ -146,7 +146,7 @@ resource "aws_elb_attachment" "foo1" { // add a second attachment func testAccAWSELBAttachmentConfig2() string { - return testAccLatestAmazonLinuxHvmEbsAmiConfig() + fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` data "aws_availability_zones" "available" { state = "available" @@ -191,7 +191,7 @@ resource "aws_elb_attachment" "foo2" { // swap attachments between resources func testAccAWSELBAttachmentConfig3() string { - return testAccLatestAmazonLinuxHvmEbsAmiConfig() + fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` data "aws_availability_zones" "available" { state = "available" @@ -236,7 +236,7 @@ resource "aws_elb_attachment" "foo2" { // destroy attachments func testAccAWSELBAttachmentConfig4() string { - return fmt.Sprintf(` + return ` data "aws_availability_zones" "available" { state = "available" @@ -256,5 +256,5 @@ resource "aws_elb" "test" { lb_protocol = "http" } } -`) +` } diff --git a/aws/resource_aws_emr_cluster_test.go b/aws/resource_aws_emr_cluster_test.go index bf6b9b161a6..44392bbf04a 100644 --- a/aws/resource_aws_emr_cluster_test.go +++ b/aws/resource_aws_emr_cluster_test.go @@ -1644,9 +1644,9 @@ func testAccAWSEmrComposeConfig(mapPublicIPOnLaunch bool, config ...string) stri } func testAccAWSEmrClusterConfigCurrentPartition() string { - return fmt.Sprintf(` + return ` data "aws_partition" "current" {} -`) +` } func testAccAWSEmrClusterConfig_bootstrap(r string) string { diff --git a/aws/resource_aws_fsx_windows_file_system_test.go b/aws/resource_aws_fsx_windows_file_system_test.go index 295656f8821..981fb52ba89 100644 --- a/aws/resource_aws_fsx_windows_file_system_test.go +++ b/aws/resource_aws_fsx_windows_file_system_test.go @@ -1045,7 +1045,7 @@ resource "aws_fsx_windows_file_system" "test" { } func testAccAwsFsxWindowsFileSystemConfigSubnetIds2() string { - return testAccAwsFsxWindowsFileSystemConfigBase() + fmt.Sprintf(` + return composeConfig(testAccAwsFsxWindowsFileSystemConfigBase(), ` resource "aws_fsx_windows_file_system" "test" { active_directory_id = aws_directory_service_directory.test.id skip_final_backup = true diff --git a/aws/resource_aws_glue_data_catalog_encryption_settings_test.go b/aws/resource_aws_glue_data_catalog_encryption_settings_test.go index 7d87f869835..e258ee7df5a 100644 --- a/aws/resource_aws_glue_data_catalog_encryption_settings_test.go +++ b/aws/resource_aws_glue_data_catalog_encryption_settings_test.go @@ -137,7 +137,7 @@ resource "aws_glue_data_catalog_encryption_settings" "test" { } func testAccAWSDataCatalogEncryptionSettingsNonEncryptedConfig() string { - return fmt.Sprintf(` + return ` resource "aws_glue_data_catalog_encryption_settings" "test" { data_catalog_encryption_settings { connection_password_encryption { @@ -149,5 +149,5 @@ resource "aws_glue_data_catalog_encryption_settings" "test" { } } } -`) +` } diff --git a/aws/resource_aws_instance_test.go b/aws/resource_aws_instance_test.go index baf2b92e375..a95a1505937 100644 --- a/aws/resource_aws_instance_test.go +++ b/aws/resource_aws_instance_test.go @@ -3496,13 +3496,13 @@ func testAccInstanceConfigBasic() string { testAccLatestAmazonLinuxHvmEbsAmiConfig(), // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-classic-platform.html#ec2-classic-instance-types testAccAvailableEc2InstanceTypeForRegion("t1.micro", "m1.small", "t3.micro", "t2.micro"), - fmt.Sprintf(` + ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = data.aws_ec2_instance_type_offering.available.instance_type # Explicitly no tags so as to test creation without tags. } -`)) +`) } func testAccInstanceConfigAtLeastOneOtherEbsVolume(rName string) string { @@ -3536,7 +3536,7 @@ resource "aws_instance" "test" { } func testAccInstanceConfigWithUserDataBase64(rName string) string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfig(rName, false), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfig(rName, false), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id subnet_id = aws_subnet.test.id @@ -3544,11 +3544,11 @@ resource "aws_instance" "test" { instance_type = "t2.small" user_data_base64 = base64encode("hello world") } -`)) +`) } func testAccInstanceConfigWithSmallInstanceType(rName string) string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfig(rName, false), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfig(rName, false), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id subnet_id = aws_subnet.test.id @@ -3559,11 +3559,11 @@ resource "aws_instance" "test" { Name = "tf-acctest" } } -`)) +`) } func testAccInstanceConfigUpdateInstanceType(rName string) string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfig(rName, false), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfig(rName, false), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id subnet_id = aws_subnet.test.id @@ -3574,11 +3574,11 @@ resource "aws_instance" "test" { Name = "tf-acctest" } } -`)) +`) } func testAccInstanceGP2IopsDevice() string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.medium" @@ -3588,11 +3588,11 @@ resource "aws_instance" "test" { volume_size = 11 } } -`)) +`) } func testAccInstanceGP2WithIopsValue() string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.medium" @@ -3604,11 +3604,11 @@ resource "aws_instance" "test" { iops = 10 } } -`)) +`) } func testAccInstanceConfigRootInstanceStore() string { - return composeConfig(testAccLatestAmazonLinuxHvmInstanceStoreAmiConfig(), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmInstanceStoreAmiConfig(), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-instance-store.id @@ -3617,13 +3617,13 @@ resource "aws_instance" "test" { # tflint-ignore: aws_instance_previous_type instance_type = "m3.medium" } -`)) +`) } func testAccInstanceConfigNoAMIEphemeralDevices() string { return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAvailableEc2InstanceTypeForRegion("t3.micro", "t2.micro"), - fmt.Sprintf(` + ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = data.aws_ec2_instance_type_offering.available.instance_type @@ -3643,7 +3643,7 @@ resource "aws_instance" "test" { no_device = true } } -`)) +`) } func testAccAwsEc2InstanceEbsRootDeviceBasic() string { @@ -3936,7 +3936,7 @@ resource "aws_instance" "test" { } func testAccCheckInstanceConfigTags() string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.small" @@ -3945,11 +3945,11 @@ resource "aws_instance" "test" { test = "test2" } } -`)) +`) } func testAccInstanceConfigEbsBlockDeviceKmsKeyArn() string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_kms_key" "test" { deletion_window_in_days = 7 } @@ -3973,11 +3973,11 @@ resource "aws_instance" "test" { volume_size = 12 } } -`)) +`) } func testAccInstanceConfigRootBlockDeviceKmsKeyArn(rName string) string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfig(rName, false), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAwsInstanceVpcConfig(rName, false), ` resource "aws_kms_key" "test" { deletion_window_in_days = 7 } @@ -3993,11 +3993,11 @@ resource "aws_instance" "test" { kms_key_id = aws_kms_key.test.arn } } -`)) +`) } func testAccCheckInstanceConfigWithAttachedVolume() string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.medium" @@ -4028,11 +4028,11 @@ resource "aws_volume_attachment" "test" { volume_id = aws_ebs_volume.test.id instance_id = aws_instance.test.id } -`)) +`) } func testAccCheckInstanceConfigNoVolumeTags() string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id @@ -4066,7 +4066,7 @@ resource "aws_instance" "test" { virtual_name = "ephemeral0" } } -`)) +`) } var testAccCheckInstanceConfigEBSBlockDeviceInvalidIops = composeConfig(testAccAwsEc2InstanceAmiWithEbsRootVolume, ` @@ -4100,7 +4100,7 @@ resource "aws_instance" "test" { `) func testAccCheckInstanceConfigWithVolumeTags() string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id @@ -4138,11 +4138,11 @@ resource "aws_instance" "test" { Name = "acceptance-test-volume-tag" } } -`)) +`) } func testAccCheckInstanceConfigWithVolumeTagsUpdate() string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id @@ -4181,11 +4181,11 @@ resource "aws_instance" "test" { Environment = "dev" } } -`)) +`) } func testAccCheckInstanceConfigTagsUpdate() string { - return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), fmt.Sprintf(` + return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = "t2.small" @@ -4194,7 +4194,7 @@ resource "aws_instance" "test" { test2 = "test3" } } -`)) +`) } func testAccInstanceConfigWithoutInstanceProfile(rName string) string { @@ -5016,7 +5016,7 @@ data "aws_ami" "amzn-ami-minimal-hvm-instance-store" { // describes the latest Amazon Linux AMI using PV virtualization and an EBS root device. // The data source is named 'amzn-ami-minimal-pv-ebs'. func testAccLatestAmazonLinuxPvEbsAmiConfig() string { - return fmt.Sprintf(` + return ` data "aws_ami" "amzn-ami-minimal-pv-ebs" { most_recent = true owners = ["amazon"] @@ -5031,14 +5031,14 @@ data "aws_ami" "amzn-ami-minimal-pv-ebs" { values = ["ebs"] } } -`) +` } // testAccLatestAmazonLinuxPvInstanceStoreAmiConfig returns the configuration for a data source that // describes the latest Amazon Linux AMI using PV virtualization and an instance store root device. // The data source is named 'amzn-ami-minimal-pv-ebs'. func testAccLatestAmazonLinuxPvInstanceStoreAmiConfig() string { - return fmt.Sprintf(` + return ` data "aws_ami" "amzn-ami-minimal-pv-instance-store" { most_recent = true owners = ["amazon"] @@ -5053,7 +5053,7 @@ data "aws_ami" "amzn-ami-minimal-pv-instance-store" { values = ["instance-store"] } } -`) +` } // testAccLatestWindowsServer2016CoreAmiConfig returns the configuration for a data source that diff --git a/aws/resource_aws_lambda_code_signing_config_test.go b/aws/resource_aws_lambda_code_signing_config_test.go index 49ca6ed7eeb..f2cd480ab52 100644 --- a/aws/resource_aws_lambda_code_signing_config_test.go +++ b/aws/resource_aws_lambda_code_signing_config_test.go @@ -114,7 +114,7 @@ func TestAccAWSLambdaCodeSigningConfig_UpdatePublishers(t *testing.T) { } func testAccAWSLambdaCodeSigningConfigUpdatePublishers() string { - return fmt.Sprintf(` + return ` resource "aws_signer_signing_profile" "test1" { platform_id = "AWSLambda-SHA384-ECDSA" } @@ -129,11 +129,11 @@ resource "aws_lambda_code_signing_config" "code_signing_config" { aws_signer_signing_profile.test1.version_arn ] } -}`) +}` } func testAccAWSLambdaCodeSigningConfigUpdatePolicy() string { - return fmt.Sprintf(` + return ` resource "aws_signer_signing_profile" "test1" { platform_id = "AWSLambda-SHA384-ECDSA" } @@ -153,11 +153,11 @@ resource "aws_lambda_code_signing_config" "code_signing_config" { policies { untrusted_artifact_on_deployment = "Enforce" } -}`) +}` } func testAccAWSLambdaCodeSigningConfigBasic() string { - return fmt.Sprintf(` + return ` resource "aws_signer_signing_profile" "test1" { platform_id = "AWSLambda-SHA384-ECDSA" } @@ -179,7 +179,7 @@ resource "aws_lambda_code_signing_config" "code_signing_config" { } description = "Code Signing Config for test account" -}`) +}` } func testAccCheckAwsCodeSigningConfigExists(n string, mapping *lambda.GetCodeSigningConfigOutput) resource.TestCheckFunc { diff --git a/aws/resource_aws_neptune_cluster_test.go b/aws/resource_aws_neptune_cluster_test.go index 1c93cbb8e89..b7de72447ef 100644 --- a/aws/resource_aws_neptune_cluster_test.go +++ b/aws/resource_aws_neptune_cluster_test.go @@ -570,11 +570,11 @@ func testAccCheckAWSNeptuneClusterSnapshot(rName string) resource.TestCheckFunc } func testAccAWSNeptuneClusterConfigBase() string { - return composeConfig(testAccAvailableAZsNoOptInConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` locals { availability_zone_names = slice(data.aws_availability_zones.available.names, 0, min(3, length(data.aws_availability_zones.available.names))) } -`)) +`) } func testAccAWSNeptuneClusterConfig(rName string) string { diff --git a/aws/resource_aws_neptune_subnet_group_test.go b/aws/resource_aws_neptune_subnet_group_test.go index 6c865f48e03..492398e35d0 100644 --- a/aws/resource_aws_neptune_subnet_group_test.go +++ b/aws/resource_aws_neptune_subnet_group_test.go @@ -274,7 +274,7 @@ resource "aws_neptune_subnet_group" "foo" { } func testAccNeptuneSubnetGroupConfig_namePrefix() string { - return composeConfig(testAccAvailableAZsNoOptInConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` resource "aws_vpc" "test" { cidr_block = "10.1.0.0/16" @@ -307,11 +307,11 @@ resource "aws_neptune_subnet_group" "test" { name_prefix = "tf_test-" subnet_ids = [aws_subnet.a.id, aws_subnet.b.id] } -`)) +`) } func testAccNeptuneSubnetGroupConfig_generatedName() string { - return composeConfig(testAccAvailableAZsNoOptInConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` resource "aws_vpc" "test" { cidr_block = "10.1.0.0/16" @@ -343,5 +343,5 @@ resource "aws_subnet" "b" { resource "aws_neptune_subnet_group" "test" { subnet_ids = [aws_subnet.a.id, aws_subnet.b.id] } -`)) +`) } diff --git a/aws/resource_aws_network_acl_rule_test.go b/aws/resource_aws_network_acl_rule_test.go index 9823023ed00..92c3cad51f7 100644 --- a/aws/resource_aws_network_acl_rule_test.go +++ b/aws/resource_aws_network_acl_rule_test.go @@ -680,7 +680,7 @@ resource "aws_network_acl_rule" "test" { } func testAccAWSNetworkAclRuleConfigIpv6VpcAssignGeneratedIpv6CidrBlockUpdate() string { - return fmt.Sprintf(` + return ` resource "aws_vpc" "test" { assign_generated_ipv6_cidr_block = true cidr_block = "10.3.0.0/16" @@ -707,11 +707,11 @@ resource "aws_network_acl_rule" "test" { rule_number = 150 to_port = 22 } -`) +` } func testAccAWSNetworkAclRuleConfigIpv6VpcNotAssignGeneratedIpv6CidrBlockUpdate() string { - return fmt.Sprint(` + return ` resource "aws_vpc" "test" { assign_generated_ipv6_cidr_block = false cidr_block = "10.3.0.0/16" @@ -727,7 +727,7 @@ resource "aws_network_acl" "test" { tags = { Name = "tf-acc-test-network-acl-rule-ipv6-not-enabled" } -}`) +}` } func testAccAWSNetworkAclRuleImportStateIdFunc(resourceName, resourceProtocol string) resource.ImportStateIdFunc { diff --git a/aws/resource_aws_network_interface_test.go b/aws/resource_aws_network_interface_test.go index 3d0b34ee889..b43d5a2665c 100644 --- a/aws/resource_aws_network_interface_test.go +++ b/aws/resource_aws_network_interface_test.go @@ -626,7 +626,7 @@ func testAccCheckAWSENIMakeExternalAttachment(n string, conf *ec2.NetworkInterfa } func testAccAWSENIConfig() string { - return testAccAvailableAZsNoOptInConfig() + fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` resource "aws_vpc" "test" { cidr_block = "172.16.0.0/16" enable_dns_hostnames = true @@ -714,7 +714,7 @@ resource "aws_security_group" "test" { } func testAccAWSENIIPV6Config(rName string) string { - return testAccAWSENIIPV6ConfigBase(rName) + fmt.Sprintf(` + return composeConfig(testAccAWSENIIPV6ConfigBase(rName), ` resource "aws_network_interface" "test" { subnet_id = aws_subnet.test.id private_ips = ["172.16.10.100"] @@ -726,7 +726,7 @@ resource "aws_network_interface" "test" { } func testAccAWSENIIPV6MultipleConfig(rName string) string { - return testAccAWSENIIPV6ConfigBase(rName) + fmt.Sprintf(` + return composeConfig(testAccAWSENIIPV6ConfigBase(rName), ` resource "aws_network_interface" "test" { subnet_id = aws_subnet.test.id private_ips = ["172.16.10.100"] @@ -750,7 +750,7 @@ resource "aws_network_interface" "test" { } func testAccAWSENIConfigUpdatedDescription() string { - return testAccAvailableAZsNoOptInConfig() + fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` resource "aws_vpc" "test" { cidr_block = "172.16.0.0/16" enable_dns_hostnames = true @@ -825,7 +825,7 @@ resource "aws_network_interface" "test" { } func testAccAWSENIConfigWithNoPrivateIPs() string { - return testAccAvailableAZsNoOptInConfig() + fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` resource "aws_vpc" "test" { cidr_block = "172.16.0.0/16" enable_dns_hostnames = true @@ -855,7 +855,7 @@ resource "aws_network_interface" "test" { func testAccAWSENIConfigWithAttachment() string { return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAvailableEc2InstanceTypeForRegion("t3.micro", "t2.micro"), - testAccAvailableAZsNoOptInConfig(), fmt.Sprintf(` + testAccAvailableAZsNoOptInConfig(), ` resource "aws_vpc" "test" { cidr_block = "172.16.0.0/16" enable_dns_hostnames = true @@ -917,13 +917,13 @@ resource "aws_network_interface" "test" { Name = "test_interface" } } -`)) +`) } func testAccAWSENIConfigExternalAttachment() string { return composeConfig(testAccLatestAmazonLinuxHvmEbsAmiConfig(), testAccAvailableEc2InstanceTypeForRegion("t3.micro", "t2.micro"), - testAccAvailableAZsNoOptInConfig(), fmt.Sprintf(` + testAccAvailableAZsNoOptInConfig(), ` resource "aws_vpc" "test" { cidr_block = "172.16.0.0/16" enable_dns_hostnames = true @@ -980,7 +980,7 @@ resource "aws_network_interface" "test" { Name = "test_interface" } } -`)) +`) } func testAccAWSENIConfigPrivateIpsCount(privateIpsCount int) string { diff --git a/aws/resource_aws_route_table_test.go b/aws/resource_aws_route_table_test.go index fca6681a0e2..9424da8b107 100644 --- a/aws/resource_aws_route_table_test.go +++ b/aws/resource_aws_route_table_test.go @@ -1991,7 +1991,7 @@ resource "aws_route_table" "test" { // See https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html#nat-instance-ami. // The data source is named 'amzn-ami-nat-instance'. func testAccLatestAmazonNatInstanceAmiConfig() string { - return fmt.Sprintf(` + return ` data "aws_ami" "amzn-ami-nat-instance" { most_recent = true owners = ["amazon"] @@ -2001,5 +2001,5 @@ data "aws_ami" "amzn-ami-nat-instance" { values = ["amzn-ami-vpc-nat-*"] } } -`) +` } diff --git a/aws/resource_aws_route_test.go b/aws/resource_aws_route_test.go index 6a949b2f002..ebcea685091 100644 --- a/aws/resource_aws_route_test.go +++ b/aws/resource_aws_route_test.go @@ -601,7 +601,7 @@ func testAccAWSRouteImportStateIdFunc(resourceName string) resource.ImportStateI } func testAccAWSRouteBasicConfig() string { - return fmt.Sprintf(` + return ` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" @@ -627,11 +627,11 @@ resource "aws_route" "bar" { destination_cidr_block = "10.3.0.0/16" gateway_id = aws_internet_gateway.foo.id } -`) +` } func testAccAWSRouteConfigIpv6InternetGateway() string { - return fmt.Sprintf(` + return ` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" assign_generated_ipv6_cidr_block = true @@ -662,13 +662,13 @@ resource "aws_route" "igw" { destination_ipv6_cidr_block = "::/0" gateway_id = aws_internet_gateway.foo.id } -`) +` } func testAccAWSRouteConfigIpv6NetworkInterface() string { - return testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.router-network.availability_zone", "t2.small", "t3.small") + - testAccLatestAmazonLinuxHvmEbsAmiConfig() + - fmt.Sprintf(` + return composeConfig( + testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.router-network.availability_zone", "t2.small", "t3.small"), + testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_vpc" "examplevpc" { cidr_block = "10.100.0.0/16" enable_dns_hostnames = true @@ -775,9 +775,9 @@ resource "aws_route" "internal-default-route-ipv6" { } func testAccAWSRouteConfigIpv6Instance() string { - return testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.router-network.availability_zone", "t2.small", "t3.small") + - testAccLatestAmazonLinuxHvmEbsAmiConfig() + - fmt.Sprintf(` + return composeConfig( + testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.router-network.availability_zone", "t2.small", "t3.small"), + testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_vpc" "examplevpc" { cidr_block = "10.100.0.0/16" enable_dns_hostnames = true @@ -873,9 +873,9 @@ resource "aws_route" "internal-default-route-ipv6" { } func testAccAWSRouteConfigIpv6InstanceExpanded() string { - return testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.router-network.availability_zone", "t2.small", "t3.small") + - testAccLatestAmazonLinuxHvmEbsAmiConfig() + - fmt.Sprintf(` + return composeConfig( + testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.router-network.availability_zone", "t2.small", "t3.small"), + testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` resource "aws_vpc" "examplevpc" { cidr_block = "10.100.0.0/16" enable_dns_hostnames = true @@ -971,7 +971,7 @@ resource "aws_route" "internal-default-route-ipv6" { } func testAccAWSRouteConfigIpv6PeeringConnection() string { - return fmt.Sprintf(` + return ` resource "aws_vpc" "foo" { cidr_block = "10.0.0.0/16" assign_generated_ipv6_cidr_block = true @@ -1001,11 +1001,11 @@ resource "aws_route" "pc" { destination_ipv6_cidr_block = aws_vpc.bar.ipv6_cidr_block vpc_peering_connection_id = aws_vpc_peering_connection.foo.id } -`) +` } func testAccAWSRouteConfigIpv6() string { - return fmt.Sprintf(` + return ` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" assign_generated_ipv6_cidr_block = true @@ -1028,11 +1028,11 @@ resource "aws_route" "bar" { destination_ipv6_cidr_block = "::/0" egress_only_gateway_id = aws_egress_only_internet_gateway.foo.id } -`) +` } func testAccAWSRouteConfigIpv6Expanded() string { - return fmt.Sprintf(` + return ` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" assign_generated_ipv6_cidr_block = true @@ -1055,11 +1055,11 @@ resource "aws_route" "bar" { destination_ipv6_cidr_block = "::0/0" egress_only_gateway_id = aws_egress_only_internet_gateway.foo.id } -`) +` } func testAccAWSRouteBasicConfigChangeCidr() string { - return fmt.Sprintf(` + return ` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" @@ -1085,13 +1085,13 @@ resource "aws_route" "bar" { destination_cidr_block = "10.2.0.0/16" gateway_id = aws_internet_gateway.foo.id } -`) +` } func testAccAWSRouteNoopChange() string { - return testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.test.availability_zone", "t2.nano", "t3.nano") + - testAccLatestAmazonLinuxHvmEbsAmiConfig() + - fmt.Sprint(` + return composeConfig( + testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.test.availability_zone", "t2.nano", "t3.nano"), + testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` data "aws_availability_zones" "available" { state = "available" @@ -1138,7 +1138,7 @@ resource "aws_instance" "nat" { } func testAccAWSRouteWithVPCEndpoint() string { - return fmt.Sprintf(` + return ` data "aws_region" "current" {} resource "aws_vpc" "foo" { @@ -1175,11 +1175,11 @@ resource "aws_vpc_endpoint" "baz" { service_name = "com.amazonaws.${data.aws_region.current.name}.s3" route_table_ids = [aws_route_table.foo.id] } -`) +` } func testAccAWSRouteNewRouteTable() string { - return fmt.Sprintf(` + return ` resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" @@ -1233,12 +1233,12 @@ resource "aws_route" "bar" { destination_cidr_block = "10.4.0.0/16" gateway_id = aws_internet_gateway.bar.id } -`) +` } func testAccAWSRouteConfigTransitGatewayIDDestinatationCidrBlock() string { - return testAccAvailableAZsNoOptInDefaultExcludeConfig() + - fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), + ` # IncorrectState: Transit Gateway is not available in availability zone usw2-az4 resource "aws_vpc" "test" { @@ -1327,7 +1327,7 @@ resource "aws_route" "test" { } func testAccAWSRouteResourceConfigLocalGatewayID() string { - return fmt.Sprintf(` + return ` data "aws_ec2_local_gateways" "all" {} data "aws_ec2_local_gateway" "first" { id = tolist(data.aws_ec2_local_gateways.all.ids)[0] @@ -1357,7 +1357,7 @@ resource "aws_route" "test" { destination_cidr_block = "172.16.1.0/24" local_gateway_id = data.aws_ec2_local_gateway.first.id } -`) +` } func testAccAWSRouteResourceConfigVpcEndpointId(rName string) string { diff --git a/aws/resource_aws_signer_signing_profile_permission_test.go b/aws/resource_aws_signer_signing_profile_permission_test.go index badcabb0b53..bdf705cb991 100644 --- a/aws/resource_aws_signer_signing_profile_permission_test.go +++ b/aws/resource_aws_signer_signing_profile_permission_test.go @@ -123,7 +123,7 @@ func TestAccAWSSignerSigningProfilePermission_StatementPrefix(t *testing.T) { profileResourceName := "aws_signer_signing_profile.test_sp" rString := acctest.RandString(53) profileName := fmt.Sprintf("tf_acc_spp_%s", rString) - statementNamePrefix := fmt.Sprintf("tf_acc_spp_statement_") + statementNamePrefix := "tf_acc_spp_statement_" //var conf signer.GetSigningProfileOutput var sppconf signer.ListProfilePermissionsOutput diff --git a/aws/resource_aws_signer_signing_profile_test.go b/aws/resource_aws_signer_signing_profile_test.go index 14d144bcb1b..cac5db06eed 100644 --- a/aws/resource_aws_signer_signing_profile_test.go +++ b/aws/resource_aws_signer_signing_profile_test.go @@ -46,7 +46,7 @@ func TestAccAWSSignerSigningProfile_basic(t *testing.T) { func TestAccAWSSignerSigningProfile_GenerateNameWithNamePrefix(t *testing.T) { resourceName := "aws_signer_signing_profile.test_sp" - namePrefix := fmt.Sprintf("tf_acc_sp_basic_") + namePrefix := "tf_acc_sp_basic_" var conf signer.GetSigningProfileOutput @@ -89,7 +89,7 @@ func TestAccAWSSignerSigningProfile_GenerateName(t *testing.T) { func TestAccAWSSignerSigningProfile_tags(t *testing.T) { resourceName := "aws_signer_signing_profile.test_sp" - namePrefix := fmt.Sprintf("tf_acc_sp_basic_") + namePrefix := "tf_acc_sp_basic_" var conf signer.GetSigningProfileOutput @@ -119,7 +119,7 @@ func TestAccAWSSignerSigningProfile_tags(t *testing.T) { func TestAccAWSSignerSigningProfile_SignatureValidityPeriod(t *testing.T) { resourceName := "aws_signer_signing_profile.test_sp" - namePrefix := fmt.Sprintf("tf_acc_sp_basic_") + namePrefix := "tf_acc_sp_basic_" var conf signer.GetSigningProfileOutput @@ -185,10 +185,10 @@ func testAccAWSSignerSigningProfileConfig(namePrefix string) string { } func testAccAWSSignerSigningProfileConfigGenerateName() string { - return fmt.Sprintf(` + return ` resource "aws_signer_signing_profile" "test_sp" { platform_id = "AWSLambda-SHA384-ECDSA" -}`) +}` } func testAccAWSSignerSigningProfileConfigProvidedName(profileName string) string { @@ -226,7 +226,7 @@ resource "aws_signer_signing_profile" "test_sp" { } func testAccAWSSignerSigningProfileUpdateSVP() string { - return fmt.Sprintf(` + return ` resource "aws_signer_signing_profile" "test_sp" { platform_id = "AWSLambda-SHA384-ECDSA" @@ -235,18 +235,18 @@ resource "aws_signer_signing_profile" "test_sp" { type = "MONTHS" } } -`) +` } func testAccAWSSignerSigningProfileUpdateTags() string { - return fmt.Sprintf(` + return ` resource "aws_signer_signing_profile" "test_sp" { platform_id = "AWSLambda-SHA384-ECDSA" tags = { "tag1" = "prod" } } -`) +` } func baseAccAWSSignerSigningProfileConfig(namePrefix string) string { diff --git a/aws/resource_aws_vpn_gateway_test.go b/aws/resource_aws_vpn_gateway_test.go index 18c9b5ccaf6..b6397b0fdac 100644 --- a/aws/resource_aws_vpn_gateway_test.go +++ b/aws/resource_aws_vpn_gateway_test.go @@ -614,7 +614,7 @@ resource "aws_vpn_gateway" "test2" { ` func testAccVpnGatewayConfigWithAZ() string { - return composeConfig(testAccAvailableAZsNoOptInConfig(), fmt.Sprintf(` + return composeConfig(testAccAvailableAZsNoOptInConfig(), ` resource "aws_vpc" "test" { cidr_block = "10.1.0.0/16" @@ -631,7 +631,7 @@ resource "aws_vpn_gateway" "test" { Name = "terraform-testacc-vpn-gateway-with-az" } } -`)) +`) } const testAccVpnGatewayConfigWithASN = ` diff --git a/aws/resource_aws_xray_encryption_config_test.go b/aws/resource_aws_xray_encryption_config_test.go index b3f2a62f0d0..98f5290bd23 100644 --- a/aws/resource_aws_xray_encryption_config_test.go +++ b/aws/resource_aws_xray_encryption_config_test.go @@ -76,11 +76,11 @@ func testAccCheckXrayEncryptionConfigExists(n string, EncryptionConfig *xray.Enc } func testAccAWSXrayEncryptionConfigBasicConfig() string { - return fmt.Sprintf(` + return ` resource "aws_xray_encryption_config" "test" { type = "NONE" } -`) +` } func testAccAWSXrayEncryptionConfigWithKeyConfig() string { diff --git a/staticcheck.conf b/staticcheck.conf index 6f10b6ed746..0f022090118 100644 --- a/staticcheck.conf +++ b/staticcheck.conf @@ -1,6 +1,5 @@ checks = [ "all", - "-S1039", "-SA1019", "-ST1000", "-ST1003",