@@ -97,6 +97,9 @@ const (
97
97
// Provider name for third configuration testing
98
98
ProviderNameThird = "awsthird"
99
99
100
+ // Provider name for fourth configuration testing
101
+ ProviderNameFourth = "awsfourth"
102
+
100
103
ResourcePrefix = "tf-acc-test"
101
104
102
105
CertificateIssueTimeout = 5 * time .Minute
@@ -284,6 +287,8 @@ func ProtoV5FactoriesMultipleRegions(ctx context.Context, t *testing.T, n int) m
284
287
return protoV5ProviderFactoriesInit (ctx , ProviderName , ProviderNameAlternate )
285
288
case 3 :
286
289
return protoV5ProviderFactoriesInit (ctx , ProviderName , ProviderNameAlternate , ProviderNameThird )
290
+ case 4 :
291
+ return protoV5ProviderFactoriesInit (ctx , ProviderName , ProviderNameAlternate , ProviderNameThird , ProviderNameFourth )
287
292
default :
288
293
t .Fatalf ("invalid number of Region configurations: %d" , n )
289
294
}
@@ -917,6 +922,10 @@ func ThirdRegion() string {
917
922
return envvar .GetWithDefault (envvar .ThirdRegion , endpoints .UsEast2RegionID )
918
923
}
919
924
925
+ func FourthRegion () string {
926
+ return envvar .GetWithDefault (envvar .FourthRegion , endpoints .UsWest1RegionID )
927
+ }
928
+
920
929
func Partition () string {
921
930
return names .PartitionForRegion (Region ()).ID ()
922
931
}
@@ -941,6 +950,10 @@ func thirdRegionPartition() string {
941
950
return names .PartitionForRegion (ThirdRegion ()).ID ()
942
951
}
943
952
953
+ func fourthRegionPartition () string {
954
+ return names .PartitionForRegion (FourthRegion ()).ID ()
955
+ }
956
+
944
957
func PreCheckAlternateAccount (t * testing.T ) {
945
958
t .Helper ()
946
959
@@ -961,6 +974,17 @@ func PreCheckThirdAccount(t *testing.T) {
961
974
}
962
975
}
963
976
977
+ // add fourth region
978
+ func PreCheckFourthAccount (t * testing.T ) {
979
+ t .Helper ()
980
+
981
+ envvar .SkipIfAllEmpty (t , []string {envvar .FourthProfile , envvar .FourthAccessKeyId }, "credentials for running acceptance testing in fourth AWS account" )
982
+
983
+ if os .Getenv (envvar .FourthAccessKeyId ) != "" {
984
+ envvar .SkipIfEmpty (t , envvar .FourthSecretAccessKey , "static credentials value when using " + envvar .FourthAccessKeyId )
985
+ }
986
+ }
987
+
964
988
func PreCheckPartitionHasService (t * testing.T , serviceID string ) {
965
989
t .Helper ()
966
990
@@ -1002,6 +1026,28 @@ func PreCheckMultipleRegion(t *testing.T, regions int) {
1002
1026
if Partition () != thirdRegionPartition () {
1003
1027
t .Fatalf ("%s partition (%s) does not match %s partition (%s)" , envvar .ThirdRegion , thirdRegionPartition (), envvar .DefaultRegion , Partition ())
1004
1028
}
1029
+
1030
+ if regions == 4 {
1031
+ if fourthRegionPartition () == endpoints .AwsUsGovPartitionID || Partition () == endpoints .AwsUsGovPartitionID {
1032
+ t .Skipf ("wanted %d regions, partition (%s) only has 2 regions" , regions , Partition ())
1033
+ }
1034
+
1035
+ if Region () == FourthRegion () {
1036
+ t .Fatalf ("%s and %s must be set to different values for acceptance tests" , envvar .DefaultRegion , envvar .FourthRegion )
1037
+ }
1038
+
1039
+ if AlternateRegion () == FourthRegion () {
1040
+ t .Fatalf ("%s and %s must be set to different values for acceptance tests" , envvar .AlternateRegion , envvar .FourthRegion )
1041
+ }
1042
+
1043
+ if ThirdRegion () == FourthRegion () {
1044
+ t .Fatalf ("%s and %s must be set to different values for acceptance tests" , envvar .ThirdRegion , envvar .FourthRegion )
1045
+ }
1046
+
1047
+ if Partition () != fourthRegionPartition () {
1048
+ t .Fatalf ("%s partition (%s) does not match %s partition (%s)" , envvar .FourthRegion , fourthRegionPartition (), envvar .DefaultRegion , Partition ())
1049
+ }
1050
+ }
1005
1051
}
1006
1052
1007
1053
if partition , ok := endpoints .PartitionForRegion (endpoints .DefaultPartitions (), Region ()); ok {
@@ -1047,6 +1093,15 @@ func PreCheckThirdRegion(t *testing.T, regions ...string) {
1047
1093
}
1048
1094
}
1049
1095
1096
+ // PreCheckFourthRegion checks that the fourth test region is one of the specified AWS Regions.
1097
+ func PreCheckFourthRegion (t * testing.T , regions ... string ) {
1098
+ t .Helper ()
1099
+
1100
+ if curr := FourthRegion (); ! slices .Contains (regions , curr ) {
1101
+ t .Skipf ("skipping tests; %s (%s) not supported. Supported: [%s]" , envvar .FourthRegion , curr , strings .Join (regions , ", " ))
1102
+ }
1103
+ }
1104
+
1050
1105
// PreCheckPartition checks that the test partition is the specified partition.
1051
1106
func PreCheckPartition (t * testing.T , partition string ) {
1052
1107
t .Helper ()
0 commit comments