@@ -203,25 +203,38 @@ func replicaSetAWSProviderTestCase(t *testing.T, isAcc bool) resource.TestCase {
203
203
CheckDestroy : acc .CheckDestroyCluster ,
204
204
Steps : []resource.TestStep {
205
205
{
206
- Config : configReplicaSetAWSProvider (t , isAcc , ReplicaSetAWSConfig {
206
+ Config : configAWSProvider (t , isAcc , ReplicaSetAWSConfig {
207
207
ProjectID : projectID ,
208
208
ClusterName : clusterName ,
209
+ ClusterType : "REPLICASET" ,
209
210
DiskSizeGB : 60 ,
210
211
NodeCountElectable : 3 ,
211
212
WithAnalyticsSpecs : true ,
212
213
}),
213
214
Check : checkReplicaSetAWSProvider (isAcc , projectID , clusterName , 60 , 3 , true , true ),
214
215
},
215
216
{
216
- Config : configReplicaSetAWSProvider (t , isAcc , ReplicaSetAWSConfig {
217
+ Config : configAWSProvider (t , isAcc , ReplicaSetAWSConfig {
217
218
ProjectID : projectID ,
218
219
ClusterName : clusterName ,
220
+ ClusterType : "REPLICASET" ,
219
221
DiskSizeGB : 50 ,
220
222
NodeCountElectable : 5 ,
221
223
WithAnalyticsSpecs : false , // removed as part of other updates, computed value is expected to be the same
222
224
}),
223
225
Check : checkReplicaSetAWSProvider (isAcc , projectID , clusterName , 50 , 5 , true , true ),
224
226
},
227
+ { // testing transition from replica set to sharded cluster
228
+ Config : configAWSProvider (t , isAcc , ReplicaSetAWSConfig {
229
+ ProjectID : projectID ,
230
+ ClusterName : clusterName ,
231
+ ClusterType : "SHARDED" ,
232
+ DiskSizeGB : 50 ,
233
+ NodeCountElectable : 5 ,
234
+ WithAnalyticsSpecs : false ,
235
+ }),
236
+ Check : checkReplicaSetAWSProvider (isAcc , projectID , clusterName , 50 , 5 , true , true ),
237
+ },
225
238
acc .TestStepImportCluster (resourceName , "replication_specs" , "retain_backups_enabled" ),
226
239
},
227
240
}
@@ -1772,12 +1785,13 @@ func checkKeyValueBlocksPreviewProviderV2(isAcc, includeDataSources bool, blockN
1772
1785
type ReplicaSetAWSConfig struct {
1773
1786
ProjectID string
1774
1787
ClusterName string
1788
+ ClusterType string
1775
1789
DiskSizeGB int
1776
1790
NodeCountElectable int
1777
1791
WithAnalyticsSpecs bool
1778
1792
}
1779
1793
1780
- func configReplicaSetAWSProvider (t * testing.T , isAcc bool , configInfo ReplicaSetAWSConfig ) string {
1794
+ func configAWSProvider (t * testing.T , isAcc bool , configInfo ReplicaSetAWSConfig ) string {
1781
1795
t .Helper ()
1782
1796
analyticsSpecs := ""
1783
1797
if configInfo .WithAnalyticsSpecs {
@@ -1791,24 +1805,24 @@ func configReplicaSetAWSProvider(t *testing.T, isAcc bool, configInfo ReplicaSet
1791
1805
resource "mongodbatlas_advanced_cluster" "test" {
1792
1806
project_id = %[1]q
1793
1807
name = %[2]q
1794
- cluster_type = "REPLICASET"
1808
+ cluster_type = %[3]q
1795
1809
retain_backups_enabled = "true"
1796
- disk_size_gb = %[3 ]d
1810
+ disk_size_gb = %[4 ]d
1797
1811
1798
1812
replication_specs {
1799
1813
region_configs {
1800
1814
electable_specs {
1801
1815
instance_size = "M10"
1802
- node_count = %[4 ]d
1816
+ node_count = %[5 ]d
1803
1817
}
1804
- %[5 ]s
1818
+ %[6 ]s
1805
1819
provider_name = "AWS"
1806
1820
priority = 7
1807
1821
region_name = "US_WEST_2"
1808
1822
}
1809
1823
}
1810
1824
}
1811
- ` , configInfo .ProjectID , configInfo .ClusterName , configInfo .DiskSizeGB , configInfo .NodeCountElectable , analyticsSpecs )) + dataSourcesTFOldSchema
1825
+ ` , configInfo .ProjectID , configInfo .ClusterName , configInfo .ClusterType , configInfo . DiskSizeGB , configInfo .NodeCountElectable , analyticsSpecs )) + dataSourcesTFOldSchema
1812
1826
}
1813
1827
1814
1828
func checkReplicaSetAWSProvider (isAcc bool , projectID , name string , diskSizeGB , nodeCountElectable int , checkDiskSizeGBInnerLevel , checkExternalID bool ) resource.TestCheckFunc {
0 commit comments