Skip to content

Commit f4909b7

Browse files
authored
tests/provider: Standardize remaining alternate provider testing and refactor testAccProviderFactories for broad usage (#15904)
Reference: #8316 Reference: #15737 Reference: #15791 This change set continues the work of #15877, bringing a consistent pattern for cross-region and cross-account testing and removing previously deprecated provider-level test functions. The `testAccProviderFactories` global variable is now generically for every test that only requires a single provider and prevents the previous issues where extraneous gRPC plugins were extraneously created (sometimes causing `ulimit` issues, but broadly a performance fix to remove them). This also removes the temporary `testAccProviderFactoriesCur()` and `testAccProviderFactoriesEc2Classic()` functions, since anything only requiring a single provider can use `ProviderFactories: testAccProviderFactories` or `Providers: testAccProviders` (for now, its deprecated in the SDK and we'll be updating these everywhere to `ProviderFactories` anyways). This should mean that other existing EC2-Classic and special service region testing should not require changes to that particular field in future change sets that continue this effort. After this, we are off to the races to remove the problematic environment variable handling causing issues across the provider acceptance testing. Output from acceptance testing (CUR testing done in standalone account): ``` --- PASS: TestAccDataSourceAwsCurReportDefinition_additional (21.63s) --- PASS: TestAccDataSourceAwsCurReportDefinition_basic (18.93s) --- PASS: TestAccDataSourceAwsRoute53ResolverRule_basic (59.47s) --- PASS: TestAccDataSourceAwsRoute53ResolverRule_ResolverEndpointIdWithTags (265.34s) --- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (158.62s) --- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (159.67s) --- PASS: TestAccAWSCodePipeline_multiregion_basic (37.37s) --- PASS: TestAccAWSCodePipeline_multiregion_Update (58.07s) --- PASS: TestAccAWSCodePipeline_multiregion_ConvertSingleRegion (81.33s) --- PASS: TestAccAwsCurReportDefinition_athena (18.30s) --- PASS: TestAccAwsCurReportDefinition_basic (23.58s) --- PASS: TestAccAwsCurReportDefinition_overwrite (18.10s) --- PASS: TestAccAwsCurReportDefinition_parquet (18.67s) --- PASS: TestAccAwsCurReportDefinition_refresh (21.62s) --- PASS: TestAccAwsCurReportDefinition_textOrCsv (21.45s) --- PASS: TestAccAWSDbSubnetGroupDataSource_basic (66.22s) --- PASS: TestAccAWSDbSubnetGroupDataSource_nonexistent (3.06s) --- PASS: TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount (1998.47s) --- PASS: TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewaySingleAccount (1957.89s) --- PASS: TestAccAwsDxGatewayAssociation_basicTransitGatewayCrossAccount (865.40s) --- PASS: TestAccAwsDxGatewayAssociation_basicTransitGatewaySingleAccount (1186.07s) --- PASS: TestAccAwsDxGatewayAssociation_basicVpnGatewayCrossAccount (1530.51s) --- PASS: TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount (1633.65s) --- PASS: TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount (1697.33s) --- PASS: TestAccAwsDxGatewayAssociation_V0StateUpgrade (1187.97s) --- PASS: TestAccAwsDxGatewayAssociationProposal_AllowedPrefixes (138.31s) --- PASS: TestAccAwsDxGatewayAssociationProposal_basicTransitGateway (227.10s) --- PASS: TestAccAwsDxGatewayAssociationProposal_basicVpnGateway (68.42s) --- PASS: TestAccAwsDxGatewayAssociationProposal_disappears (64.49s) --- SKIP: TestAccAwsDxHostedPrivateVirtualInterface_AccepterTags (0.00s) --- SKIP: TestAccAwsDxHostedPrivateVirtualInterface_basic (0.00s) --- SKIP: TestAccAwsDxHostedPublicVirtualInterface_AccepterTags (0.00s) --- SKIP: TestAccAwsDxHostedPublicVirtualInterface_basic (0.00s) --- PASS: TestAccAwsDxHostedTransitVirtualInterface_serial (0.00s) --- SKIP: TestAccAwsDxHostedTransitVirtualInterface_serial/accepterTags (0.00s) --- SKIP: TestAccAwsDxHostedTransitVirtualInterface_serial/basic (0.00s) --- PASS: TestAccAWSDynamoDbGlobalTable_basic (84.93s) --- PASS: TestAccAWSDynamoDbGlobalTable_multipleRegions (102.52s) --- PASS: TestAccAWSEbsSnapshotCopy_withRegions (75.67s) --- PASS: TestAccAwsRamResourceShareAccepter_basic (36.70s) --- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_PrimarySecondaryClusters (1969.60s) --- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_ReplicationSourceIdentifier (1819.35s) --- PASS: TestAccAWSRDSCluster_ReplicationSourceIdentifier_KmsKeyId (1691.11s) --- PASS: TestAccAWSRedshiftCluster_snapshotCopy (631.18s) --- PASS: TestAccAWSRedshiftSecurityGroup_basic (11.11s) --- PASS: TestAccAWSRedshiftSecurityGroup_ingressCidr (11.10s) --- PASS: TestAccAWSRedshiftSecurityGroup_ingressSecurityGroup (12.47s) --- PASS: TestAccAWSRedshiftSecurityGroup_updateIngressCidr (23.94s) --- PASS: TestAccAWSRedshiftSecurityGroup_updateIngressSecurityGroup (27.22s) --- PASS: TestAccAWSRoute53VpcAssociationAuthorization_basic (99.00s) --- PASS: TestAccAWSRoute53VpcAssociationAuthorization_disappears (94.43s) --- PASS: TestAccAWSRoute53ZoneAssociation_CrossAccount (124.58s) --- PASS: TestAccAWSRoute53ZoneAssociation_CrossRegion (157.69s) --- PASS: TestAccAWSS3Bucket_Replication (145.26s) --- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlTranslation (86.49s) --- PASS: TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessControlTranslation (84.75s) --- PASS: TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError (22.79s) --- PASS: TestAccAWSS3Bucket_ReplicationSchemaV2 (174.11s) --- PASS: TestAccAWSS3Bucket_ReplicationWithoutPrefix (65.38s) --- PASS: TestAccAWSS3Bucket_ReplicationWithoutStorageClass (85.05s) --- PASS: TestAccAWSS3Bucket_SameRegionReplicationSchemaV2 (73.58s) --- PASS: TestAccAWSSubnet_ignoreTags (86.24s) --- PASS: TestAccAWSVPCPeeringConnection_accept (144.21s) --- PASS: TestAccAWSVPCPeeringConnection_basic (65.98s) --- PASS: TestAccAWSVPCPeeringConnection_failedState (12.38s) --- PASS: TestAccAWSVPCPeeringConnection_options (117.22s) --- PASS: TestAccAWSVPCPeeringConnection_optionsNoAutoAccept (29.07s) --- PASS: TestAccAWSVPCPeeringConnection_peerRegionAutoAccept (29.13s) --- PASS: TestAccAWSVPCPeeringConnection_plan (52.19s) --- PASS: TestAccAWSVPCPeeringConnection_region (70.00s) --- PASS: TestAccAWSVPCPeeringConnection_tags (150.89s) --- PASS: TestAccAWSVPCPeeringConnectionAccepter_differentRegionDifferentAccount (68.06s) --- PASS: TestAccAWSVPCPeeringConnectionAccepter_differentRegionSameAccount (83.92s) --- PASS: TestAccAWSVPCPeeringConnectionAccepter_sameRegionDifferentAccount (64.85s) --- PASS: TestAccAWSVPCPeeringConnectionAccepter_sameRegionSameAccount (56.44s) --- PASS: TestAccAWSVpcPeeringConnectionOptions_basic (70.42s) --- PASS: TestAccAWSVpcPeeringConnectionOptions_differentRegionSameAccount (75.28s) --- PASS: TestAccAWSVpcPeeringConnectionOptions_sameRegionDifferentAccount (41.96s) --- FAIL: TestAccDataSourceAwsRoute53ResolverRule_SharedByMe (227.22s) --- FAIL: TestAccDataSourceAwsRoute53ResolverRule_SharedWithMe (228.00s) data_source_aws_route53_resolver_rule_test.go:101: Step 1/1 error: Error running apply: 2020/10/28 22:02:11 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0 Error: Error associating principal with RAM resource share: UnknownResourceException: Organization o-upyv668dz5 could not be found. --- FAIL: TestAccAWSEc2TransitGatewayVpcAttachment_SharedTransitGateway (221.84s) resource_aws_ec2_transit_gateway_vpc_attachment_test.go:215: Step 1/2 error: Error running apply: 2020/10/28 22:02:10 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0 Error: Error associating principal with RAM resource share: UnknownResourceException: Organization o-upyv668dz5 could not be found. Error: error associating RAM Resource Share: OperationNotPermittedException: The resource you are attempting to share can only be shared within your AWS Organization. This error may also occur if you have not enabled sharing with your AWS organization, or that onboarding process is still in progress. --- FAIL: TestAccAWSEc2TransitGatewayVpcAttachmentAccepter_Tags (201.45s) --- FAIL: TestAccAWSEc2TransitGatewayVpcAttachmentAccepter_TransitGatewayDefaultRouteTableAssociationAndPropagation (211.45s) --- FAIL: TestAccAWSEc2TransitGatewayVpcAttachmentAccepter_basic (221.42s) resource_aws_ec2_transit_gateway_vpc_attachment_accepter_test.go:135: Step 1/4 error: Error running apply: 2020/10/28 22:02:11 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0 Error: error associating RAM Resource Share: OperationNotPermittedException: The resource you are attempting to share can only be shared within your AWS Organization. This error may also occur if you have not enabled sharing with your AWS organization, or that onboarding process is still in progress. Error: Error associating principal with RAM resource share: OperationNotPermittedException: The resource you are attempting to share can only be shared within your AWS Organization. This error may also occur if you have not enabled sharing with your AWS organization, or that onboarding process is still in progress. ```
1 parent 3663a90 commit f4909b7

31 files changed

+105
-189
lines changed

aws/cur_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,3 @@ func testAccGetCurRegion() string {
9797

9898
return testAccCurRegion
9999
}
100-
101-
// testAccProviderFactoriesCur initializes providers for Cost and Usage Reporting testing.
102-
//
103-
// Deprecated: This will be replaced with testAccProviderFactories when it only returns the "aws" provider
104-
func testAccProviderFactoriesCur() map[string]func() (*schema.Provider, error) {
105-
return testAccProviderFactoriesInit(nil, []string{ProviderNameAws})
106-
}

aws/data_source_aws_cur_report_definition_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestAccDataSourceAwsCurReportDefinition_basic(t *testing.T) {
1818

1919
resource.ParallelTest(t, resource.TestCase{
2020
PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) },
21-
ProviderFactories: testAccProviderFactoriesCur(),
21+
ProviderFactories: testAccProviderFactories,
2222
CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy,
2323
Steps: []resource.TestStep{
2424
{
@@ -48,7 +48,7 @@ func TestAccDataSourceAwsCurReportDefinition_additional(t *testing.T) {
4848

4949
resource.ParallelTest(t, resource.TestCase{
5050
PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) },
51-
ProviderFactories: testAccProviderFactoriesCur(),
51+
ProviderFactories: testAccProviderFactories,
5252
CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy,
5353
Steps: []resource.TestStep{
5454
{

aws/data_source_aws_db_subnet_group_test.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ import (
77

88
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
10-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1110
)
1211

1312
func TestAccAWSDbSubnetGroupDataSource_basic(t *testing.T) {
14-
var providers []*schema.Provider
1513
rName := acctest.RandomWithPrefix("tf-acc-test")
1614
resourceName := "aws_db_subnet_group.test"
1715
dataSourceName := "data.aws_db_subnet_group.test"
1816

1917
resource.ParallelTest(t, resource.TestCase{
2018
PreCheck: func() { testAccPreCheck(t) },
21-
ProviderFactories: testAccProviderFactories(&providers),
19+
ProviderFactories: testAccProviderFactories,
2220
Steps: []resource.TestStep{
2321
{
2422
Config: testAccAWSDBSubnetGroupDataSourceConfig(rName),
@@ -36,11 +34,9 @@ func TestAccAWSDbSubnetGroupDataSource_basic(t *testing.T) {
3634
}
3735

3836
func TestAccAWSDbSubnetGroupDataSource_nonexistent(t *testing.T) {
39-
var providers []*schema.Provider
40-
4137
resource.ParallelTest(t, resource.TestCase{
4238
PreCheck: func() { testAccPreCheck(t) },
43-
ProviderFactories: testAccProviderFactories(&providers),
39+
ProviderFactories: testAccProviderFactories,
4440
Steps: []resource.TestStep{
4541
{
4642
Config: testAccAWSDBSubnetGroupDataSourceConfig_NonExistent,

aws/data_source_aws_route53_resolver_rule_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func TestAccDataSourceAwsRoute53ResolverRule_SharedByMe(t *testing.T) {
104104
testAccAlternateAccountPreCheck(t)
105105
testAccPreCheckAWSRoute53Resolver(t)
106106
},
107-
ProviderFactories: testAccProviderFactories(&providers),
107+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
108108
Steps: []resource.TestStep{
109109
{
110110
Config: testAccDataSourceAwsRoute53ResolverRule_sharedByMe(rName),
@@ -141,7 +141,7 @@ func TestAccDataSourceAwsRoute53ResolverRule_SharedWithMe(t *testing.T) {
141141
testAccAlternateAccountPreCheck(t)
142142
testAccPreCheckAWSRoute53Resolver(t)
143143
},
144-
ProviderFactories: testAccProviderFactories(&providers),
144+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
145145
Steps: []resource.TestStep{
146146
{
147147
Config: testAccDataSourceAwsRoute53ResolverRule_sharedWithMe(rName),

aws/ec2_classic_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,3 @@ func testAccGetEc2ClassicRegion() string {
7575

7676
return testAccGetRegion()
7777
}
78-
79-
// testAccProviderFactoriesEc2Classic initializes providers for EC2-Classic testing.
80-
//
81-
// Deprecated: This will be replaced with testAccProviderFactories when it only returns the "aws" provider
82-
func testAccProviderFactoriesEc2Classic() map[string]func() (*schema.Provider, error) {
83-
return testAccProviderFactoriesInit(nil, []string{ProviderNameAws})
84-
}

aws/provider_test.go

+8-40
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,19 @@ var TestAccSkip = func(t *testing.T, message string) {
5454
t.Skip(message)
5555
}
5656

57-
// testAccProviders is a static map of provider types and their associated provider instance.
57+
// testAccProviders is a static map containing only the main provider instance.
5858
//
5959
// Deprecated: Terraform Plugin SDK version 2 uses TestCase.ProviderFactories
6060
// but supports this value in TestCase.Providers for backwards compatibility.
6161
// In the future Providers: testAccProviders will be changed to
6262
// ProviderFactories: testAccProviderFactories
6363
var testAccProviders map[string]*schema.Provider
6464

65-
// testAccProviderFactories initializes and returns Provider slice elements of a provider type and function that returns the provider instance
65+
// testAccProviderFactories is a static map containing only the main provider instance
6666
//
67-
// Using this function will initialize all listed provider types as gRPC
68-
// plugins for every test, which is inefficient and can cause ulimit issues.
69-
//
70-
// Deprecated: Use specific ProviderFactories functions such as testAccProviderFactoriesEc2Classic instead.
71-
// In the future this will be changed to return only the aws provider and not accept a parameter.
72-
var testAccProviderFactories func(providers *[]*schema.Provider) map[string]func() (*schema.Provider, error)
67+
// Use other testAccProviderFactories functions, such as testAccProviderFactoriesAlternate,
68+
// for tests requiring special provider configurations.
69+
var testAccProviderFactories map[string]func() (*schema.Provider, error)
7370

7471
// testAccProvider is the "main" provider instance
7572
//
@@ -79,24 +76,15 @@ var testAccProviderFactories func(providers *[]*schema.Provider) map[string]func
7976
// testAccPreCheck(t) must be called before using this provider instance.
8077
var testAccProvider *schema.Provider
8178

82-
// testAccProviderFunc is a function that returns the "main" provider instance
83-
//
84-
// Deprecated: Use testAccAwsRegionProviderFunc instead.
85-
// In the future this will be changed to be compatible with ProviderFactories.
86-
var testAccProviderFunc func() *schema.Provider
87-
8879
func init() {
8980
testAccProvider = Provider()
81+
9082
testAccProviders = map[string]*schema.Provider{
9183
ProviderNameAws: testAccProvider,
9284
}
93-
testAccProviderFactories = func(providers *[]*schema.Provider) map[string]func() (*schema.Provider, error) {
94-
return testAccProviderFactoriesInit(providers, []string{
95-
ProviderNameAws,
96-
ProviderNameAwsAlternate,
97-
})
85+
testAccProviderFactories = map[string]func() (*schema.Provider, error){
86+
ProviderNameAws: func() (*schema.Provider, error) { return testAccProvider, nil },
9887
}
99-
testAccProviderFunc = func() *schema.Provider { return testAccProvider }
10088
}
10189

10290
// testAccProviderFactoriesInit creates ProviderFactories for the provider under testing.
@@ -615,17 +603,6 @@ func testAccAlternateAccountPreCheck(t *testing.T) {
615603
}
616604
}
617605

618-
// Deprecated: Use testAccMultipleRegionPreCheck instead
619-
func testAccAlternateRegionPreCheck(t *testing.T) {
620-
if testAccGetRegion() == testAccGetAlternateRegion() {
621-
t.Fatal("AWS_DEFAULT_REGION and AWS_ALTERNATE_REGION must be set to different values for acceptance tests")
622-
}
623-
624-
if testAccGetPartition() != testAccGetAlternateRegionPartition() {
625-
t.Fatalf("AWS_ALTERNATE_REGION partition (%s) does not match AWS_DEFAULT_REGION partition (%s)", testAccGetAlternateRegionPartition(), testAccGetPartition())
626-
}
627-
}
628-
629606
func testAccEC2VPCOnlyPreCheck(t *testing.T) {
630607
client := testAccProvider.Meta().(*AWSClient)
631608
platforms := client.supportedplatforms
@@ -674,15 +651,6 @@ func testAccMultipleRegionPreCheck(t *testing.T, regions int) {
674651
}
675652
}
676653

677-
// Deprecated: Use testAccMultipleRegionPreCheck instead.
678-
func testAccMultipleRegionsPreCheck(t *testing.T) {
679-
if partition, ok := endpoints.PartitionForRegion(endpoints.DefaultPartitions(), testAccGetRegion()); ok {
680-
if len(partition.Regions()) < 2 {
681-
t.Skip("skipping tests; partition only includes a single region")
682-
}
683-
}
684-
}
685-
686654
// testAccRegionPreCheck checks that the test region is the specified region.
687655
func testAccRegionPreCheck(t *testing.T, region string) {
688656
if testAccGetRegion() != region {

aws/resource_aws_cloudfront_distribution_test.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/aws/aws-sdk-go/service/cloudfront"
1313
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
1414
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
15-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1615
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
1716
"github.com/terraform-providers/terraform-provider-aws/aws/internal/tfawsresource"
1817
)
@@ -757,13 +756,12 @@ func TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Heade
757756

758757
func TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn(t *testing.T) {
759758
var distribution cloudfront.Distribution
760-
var providers []*schema.Provider
761759
resourceName := "aws_cloudfront_distribution.test"
762760
retainOnDelete := testAccAWSCloudFrontDistributionRetainOnDeleteFromEnv()
763761

764762
resource.ParallelTest(t, resource.TestCase{
765763
PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck("cloudfront", t) },
766-
ProviderFactories: testAccProviderFactories(&providers),
764+
ProviderFactories: testAccProviderFactories,
767765
CheckDestroy: testAccCheckCloudFrontDistributionDestroy,
768766
Steps: []resource.TestStep{
769767
{
@@ -789,13 +787,12 @@ func TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn(t *tes
789787
// Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/7773
790788
func TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate(t *testing.T) {
791789
var distribution cloudfront.Distribution
792-
var providers []*schema.Provider
793790
resourceName := "aws_cloudfront_distribution.test"
794791
retainOnDelete := testAccAWSCloudFrontDistributionRetainOnDeleteFromEnv()
795792

796793
resource.ParallelTest(t, resource.TestCase{
797794
PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck("cloudfront", t) },
798-
ProviderFactories: testAccProviderFactories(&providers),
795+
ProviderFactories: testAccProviderFactories,
799796
CheckDestroy: testAccCheckCloudFrontDistributionDestroy,
800797
Steps: []resource.TestStep{
801798
{

aws/resource_aws_codepipeline_test.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,10 @@ func TestAccAWSCodePipeline_multiregion_basic(t *testing.T) {
296296
resource.ParallelTest(t, resource.TestCase{
297297
PreCheck: func() {
298298
testAccPreCheck(t)
299-
testAccMultipleRegionsPreCheck(t)
300-
testAccAlternateRegionPreCheck(t)
299+
testAccMultipleRegionPreCheck(t, 2)
301300
testAccPreCheckAWSCodePipeline(t, testAccGetAlternateRegion())
302301
},
303-
ProviderFactories: testAccProviderFactories(&providers),
302+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
304303
CheckDestroy: testAccCheckAWSCodePipelineDestroy,
305304
Steps: []resource.TestStep{
306305
{
@@ -343,11 +342,10 @@ func TestAccAWSCodePipeline_multiregion_Update(t *testing.T) {
343342
resource.ParallelTest(t, resource.TestCase{
344343
PreCheck: func() {
345344
testAccPreCheck(t)
346-
testAccMultipleRegionsPreCheck(t)
347-
testAccAlternateRegionPreCheck(t)
345+
testAccMultipleRegionPreCheck(t, 2)
348346
testAccPreCheckAWSCodePipeline(t, testAccGetAlternateRegion())
349347
},
350-
ProviderFactories: testAccProviderFactories(&providers),
348+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
351349
CheckDestroy: testAccCheckAWSCodePipelineDestroy,
352350
Steps: []resource.TestStep{
353351
{
@@ -404,11 +402,10 @@ func TestAccAWSCodePipeline_multiregion_ConvertSingleRegion(t *testing.T) {
404402
resource.ParallelTest(t, resource.TestCase{
405403
PreCheck: func() {
406404
testAccPreCheck(t)
407-
testAccMultipleRegionsPreCheck(t)
408-
testAccAlternateRegionPreCheck(t)
405+
testAccMultipleRegionPreCheck(t, 2)
409406
testAccPreCheckAWSCodePipeline(t, testAccGetAlternateRegion())
410407
},
411-
ProviderFactories: testAccProviderFactories(&providers),
408+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
412409
CheckDestroy: testAccCheckAWSCodePipelineDestroy,
413410
Steps: []resource.TestStep{
414411
{

aws/resource_aws_cur_report_definition_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestAccAwsCurReportDefinition_basic(t *testing.T) {
1919

2020
resource.ParallelTest(t, resource.TestCase{
2121
PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) },
22-
ProviderFactories: testAccProviderFactoriesCur(),
22+
ProviderFactories: testAccProviderFactories,
2323
CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy,
2424
Steps: []resource.TestStep{
2525
{
@@ -54,7 +54,7 @@ func TestAccAwsCurReportDefinition_textOrCsv(t *testing.T) {
5454

5555
resource.ParallelTest(t, resource.TestCase{
5656
PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) },
57-
ProviderFactories: testAccProviderFactoriesCur(),
57+
ProviderFactories: testAccProviderFactories,
5858
CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy,
5959
Steps: []resource.TestStep{
6060
{
@@ -92,7 +92,7 @@ func TestAccAwsCurReportDefinition_parquet(t *testing.T) {
9292

9393
resource.ParallelTest(t, resource.TestCase{
9494
PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) },
95-
ProviderFactories: testAccProviderFactoriesCur(),
95+
ProviderFactories: testAccProviderFactories,
9696
CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy,
9797
Steps: []resource.TestStep{
9898
{
@@ -129,7 +129,7 @@ func TestAccAwsCurReportDefinition_athena(t *testing.T) {
129129

130130
resource.ParallelTest(t, resource.TestCase{
131131
PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) },
132-
ProviderFactories: testAccProviderFactoriesCur(),
132+
ProviderFactories: testAccProviderFactories,
133133
CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy,
134134
Steps: []resource.TestStep{
135135
{
@@ -167,7 +167,7 @@ func TestAccAwsCurReportDefinition_refresh(t *testing.T) {
167167

168168
resource.ParallelTest(t, resource.TestCase{
169169
PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) },
170-
ProviderFactories: testAccProviderFactoriesCur(),
170+
ProviderFactories: testAccProviderFactories,
171171
CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy,
172172
Steps: []resource.TestStep{
173173
{
@@ -205,7 +205,7 @@ func TestAccAwsCurReportDefinition_overwrite(t *testing.T) {
205205

206206
resource.ParallelTest(t, resource.TestCase{
207207
PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) },
208-
ProviderFactories: testAccProviderFactoriesCur(),
208+
ProviderFactories: testAccProviderFactories,
209209
CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy,
210210
Steps: []resource.TestStep{
211211
{

aws/resource_aws_dx_gateway_association_proposal_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func TestAccAwsDxGatewayAssociationProposal_basicVpnGateway(t *testing.T) {
9292
testAccPreCheck(t)
9393
testAccAlternateAccountPreCheck(t)
9494
},
95-
ProviderFactories: testAccProviderFactories(&providers),
95+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
9696
CheckDestroy: testAccCheckAwsDxGatewayAssociationProposalDestroy,
9797
Steps: []resource.TestStep{
9898
{
@@ -130,7 +130,7 @@ func TestAccAwsDxGatewayAssociationProposal_basicTransitGateway(t *testing.T) {
130130
testAccPreCheck(t)
131131
testAccAlternateAccountPreCheck(t)
132132
},
133-
ProviderFactories: testAccProviderFactories(&providers),
133+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
134134
CheckDestroy: testAccCheckAwsDxGatewayAssociationProposalDestroy,
135135
Steps: []resource.TestStep{
136136
{
@@ -168,7 +168,7 @@ func TestAccAwsDxGatewayAssociationProposal_disappears(t *testing.T) {
168168
testAccPreCheck(t)
169169
testAccAlternateAccountPreCheck(t)
170170
},
171-
ProviderFactories: testAccProviderFactories(&providers),
171+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
172172
CheckDestroy: testAccCheckAwsDxGatewayAssociationProposalDestroy,
173173
Steps: []resource.TestStep{
174174
{
@@ -195,7 +195,7 @@ func TestAccAwsDxGatewayAssociationProposal_AllowedPrefixes(t *testing.T) {
195195
testAccPreCheck(t)
196196
testAccAlternateAccountPreCheck(t)
197197
},
198-
ProviderFactories: testAccProviderFactories(&providers),
198+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
199199
CheckDestroy: testAccCheckAwsDxGatewayAssociationProposalDestroy,
200200
Steps: []resource.TestStep{
201201
{

aws/resource_aws_dx_gateway_association_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func TestAccAwsDxGatewayAssociation_basicVpnGatewayCrossAccount(t *testing.T) {
261261
testAccPreCheck(t)
262262
testAccAlternateAccountPreCheck(t)
263263
},
264-
ProviderFactories: testAccProviderFactories(&providers),
264+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
265265
CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy,
266266
Steps: []resource.TestStep{
267267
{
@@ -340,7 +340,7 @@ func TestAccAwsDxGatewayAssociation_basicTransitGatewayCrossAccount(t *testing.T
340340
testAccPreCheck(t)
341341
testAccAlternateAccountPreCheck(t)
342342
},
343-
ProviderFactories: testAccProviderFactories(&providers),
343+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
344344
CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy,
345345
Steps: []resource.TestStep{
346346
{
@@ -441,7 +441,7 @@ func TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount(t *tes
441441
testAccPreCheck(t)
442442
testAccAlternateAccountPreCheck(t)
443443
},
444-
ProviderFactories: testAccProviderFactories(&providers),
444+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
445445
CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy,
446446
Steps: []resource.TestStep{
447447
{

aws/resource_aws_dx_hosted_private_virtual_interface_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestAccAwsDxHostedPrivateVirtualInterface_basic(t *testing.T) {
3636
testAccPreCheck(t)
3737
testAccAlternateAccountPreCheck(t)
3838
},
39-
ProviderFactories: testAccProviderFactories(&providers),
39+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
4040
CheckDestroy: testAccCheckAwsDxHostedPrivateVirtualInterfaceDestroy,
4141
Steps: []resource.TestStep{
4242
{
@@ -94,7 +94,7 @@ func TestAccAwsDxHostedPrivateVirtualInterface_AccepterTags(t *testing.T) {
9494
testAccPreCheck(t)
9595
testAccAlternateAccountPreCheck(t)
9696
},
97-
ProviderFactories: testAccProviderFactories(&providers),
97+
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
9898
CheckDestroy: testAccCheckAwsDxHostedPrivateVirtualInterfaceDestroy,
9999
Steps: []resource.TestStep{
100100
{

0 commit comments

Comments
 (0)