@@ -203,25 +203,38 @@ func replicaSetAWSProviderTestCase(t *testing.T, isAcc bool) resource.TestCase {
203203 CheckDestroy : acc .CheckDestroyCluster ,
204204 Steps : []resource.TestStep {
205205 {
206- Config : configReplicaSetAWSProvider (t , isAcc , ReplicaSetAWSConfig {
206+ Config : configAWSProvider (t , isAcc , ReplicaSetAWSConfig {
207207 ProjectID : projectID ,
208208 ClusterName : clusterName ,
209+ ClusterType : "REPLICASET" ,
209210 DiskSizeGB : 60 ,
210211 NodeCountElectable : 3 ,
211212 WithAnalyticsSpecs : true ,
212213 }),
213214 Check : checkReplicaSetAWSProvider (isAcc , projectID , clusterName , 60 , 3 , true , true ),
214215 },
215216 {
216- Config : configReplicaSetAWSProvider (t , isAcc , ReplicaSetAWSConfig {
217+ Config : configAWSProvider (t , isAcc , ReplicaSetAWSConfig {
217218 ProjectID : projectID ,
218219 ClusterName : clusterName ,
220+ ClusterType : "REPLICASET" ,
219221 DiskSizeGB : 50 ,
220222 NodeCountElectable : 5 ,
221223 WithAnalyticsSpecs : false , // removed as part of other updates, computed value is expected to be the same
222224 }),
223225 Check : checkReplicaSetAWSProvider (isAcc , projectID , clusterName , 50 , 5 , true , true ),
224226 },
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+ },
225238 acc .TestStepImportCluster (resourceName , "replication_specs" , "retain_backups_enabled" ),
226239 },
227240 }
@@ -1772,12 +1785,13 @@ func checkKeyValueBlocksPreviewProviderV2(isAcc, includeDataSources bool, blockN
17721785type ReplicaSetAWSConfig struct {
17731786 ProjectID string
17741787 ClusterName string
1788+ ClusterType string
17751789 DiskSizeGB int
17761790 NodeCountElectable int
17771791 WithAnalyticsSpecs bool
17781792}
17791793
1780- func configReplicaSetAWSProvider (t * testing.T , isAcc bool , configInfo ReplicaSetAWSConfig ) string {
1794+ func configAWSProvider (t * testing.T , isAcc bool , configInfo ReplicaSetAWSConfig ) string {
17811795 t .Helper ()
17821796 analyticsSpecs := ""
17831797 if configInfo .WithAnalyticsSpecs {
@@ -1791,24 +1805,24 @@ func configReplicaSetAWSProvider(t *testing.T, isAcc bool, configInfo ReplicaSet
17911805 resource "mongodbatlas_advanced_cluster" "test" {
17921806 project_id = %[1]q
17931807 name = %[2]q
1794- cluster_type = "REPLICASET"
1808+ cluster_type = %[3]q
17951809 retain_backups_enabled = "true"
1796- disk_size_gb = %[3 ]d
1810+ disk_size_gb = %[4 ]d
17971811
17981812 replication_specs {
17991813 region_configs {
18001814 electable_specs {
18011815 instance_size = "M10"
1802- node_count = %[4 ]d
1816+ node_count = %[5 ]d
18031817 }
1804- %[5 ]s
1818+ %[6 ]s
18051819 provider_name = "AWS"
18061820 priority = 7
18071821 region_name = "US_WEST_2"
18081822 }
18091823 }
18101824 }
1811- ` , configInfo .ProjectID , configInfo .ClusterName , configInfo .DiskSizeGB , configInfo .NodeCountElectable , analyticsSpecs )) + dataSourcesTFOldSchema
1825+ ` , configInfo .ProjectID , configInfo .ClusterName , configInfo .ClusterType , configInfo . DiskSizeGB , configInfo .NodeCountElectable , analyticsSpecs )) + dataSourcesTFOldSchema
18121826}
18131827
18141828func checkReplicaSetAWSProvider (isAcc bool , projectID , name string , diskSizeGB , nodeCountElectable int , checkDiskSizeGBInnerLevel , checkExternalID bool ) resource.TestCheckFunc {
0 commit comments