@@ -166,6 +166,7 @@ func TestAccMockableAdvancedCluster_tenantUpgrade(t *testing.T) {
166166 Config : acc .ConvertAdvancedClusterToSchemaV2 (t , true , configTenantUpgraded (projectID , clusterName , defaultZoneName )),
167167 Check : checksTenantUpgraded (projectID , clusterName ),
168168 },
169+ acc .TestStepImportCluster (resourceName ),
169170 },
170171 })
171172}
@@ -358,6 +359,7 @@ func TestAccClusterAdvancedCluster_advancedConfig_oldMongoDBVersion(t *testing.T
358359 Config : configAdvanced (t , true , projectID , clusterName , "6.0" , processArgs20240530 , processArgsCipherConfig ),
359360 Check : checkAdvanced (true , clusterName , "TLS1_2" , processArgsCipherConfig ),
360361 },
362+ acc .TestStepImportCluster (resourceName ),
361363 },
362364 })
363365}
@@ -425,6 +427,7 @@ func TestAccClusterAdvancedCluster_advancedConfig(t *testing.T) {
425427 Config : configAdvanced (t , true , projectID , clusterNameUpdated , "" , processArgs20240530Updated , processArgsUpdatedCipherConfig ),
426428 Check : checkAdvanced (true , clusterNameUpdated , "TLS1_2" , processArgsUpdatedCipherConfig ),
427429 },
430+ acc .TestStepImportCluster (resourceName ),
428431 },
429432 })
430433}
@@ -469,6 +472,7 @@ func TestAccClusterAdvancedCluster_defaultWrite(t *testing.T) {
469472 Config : configAdvancedDefaultWrite (t , true , projectID , clusterNameUpdated , processArgsUpdated ),
470473 Check : checkAdvancedDefaultWrite (true , clusterNameUpdated , "majority" , "TLS1_2" ),
471474 },
475+ acc .TestStepImportCluster (resourceName ),
472476 },
473477 })
474478}
@@ -511,6 +515,7 @@ func TestAccClusterAdvancedClusterConfig_replicationSpecsAutoScaling(t *testing.
511515 acc .TestCheckResourceAttrSchemaV2 (true , resourceName , "replication_specs.0.region_configs.0.auto_scaling.0.compute_enabled" , "true" ),
512516 ),
513517 },
518+ acc .TestStepImportCluster (resourceName ),
514519 },
515520 })
516521}
@@ -552,6 +557,7 @@ func TestAccClusterAdvancedClusterConfig_replicationSpecsAnalyticsAutoScaling(t
552557 acc .TestCheckResourceAttrSchemaV2 (true , resourceName , "replication_specs.0.region_configs.0.analytics_auto_scaling.0.compute_enabled" , "true" ),
553558 ),
554559 },
560+ acc .TestStepImportCluster (resourceName ),
555561 },
556562 })
557563}
@@ -568,6 +574,7 @@ func TestAccClusterAdvancedClusterConfig_singleShardedTransitionToOldSchemaExpec
568574 Config : configGeoShardedOldSchema (t , true , projectID , clusterName , 1 , 1 , false ),
569575 Check : checkGeoShardedOldSchema (true , clusterName , 1 , 1 , true , true ),
570576 },
577+ acc .TestStepImportCluster (resourceName ),
571578 {
572579 Config : configGeoShardedOldSchema (t , true , projectID , clusterName , 1 , 2 , false ),
573580 ExpectError : regexp .MustCompile (advancedcluster .ErrorOperationNotPermitted ),
@@ -600,6 +607,7 @@ func TestAccClusterAdvancedCluster_withTags(t *testing.T) {
600607 Config : configWithKeyValueBlocks (t , true , orgID , projectName , clusterName , "tags" , acc .ClusterTagsMap3 ),
601608 Check : checkKeyValueBlocks (true , true , "tags" , acc .ClusterTagsMap3 ),
602609 },
610+ acc .TestStepImportCluster (resourceName ),
603611 },
604612 })
605613}
@@ -628,6 +636,7 @@ func TestAccClusterAdvancedCluster_withLabels(t *testing.T) {
628636 Config : configWithKeyValueBlocks (t , true , orgID , projectName , clusterName , "labels" , acc .ClusterLabelsMap3 ),
629637 Check : checkKeyValueBlocks (true , true , "labels" , acc .ClusterLabelsMap3 ),
630638 },
639+ acc .TestStepImportCluster (resourceName ),
631640 },
632641 })
633642}
@@ -671,6 +680,7 @@ func TestAccClusterAdvancedClusterConfig_selfManagedSharding(t *testing.T) {
671680 Check : resource .ComposeAggregateTestCheckFunc (checks ... ,
672681 ),
673682 },
683+ acc .TestStepImportCluster (resourceName ),
674684 {
675685 Config : configGeoShardedOldSchema (t , true , projectID , clusterName , 1 , 1 , false ),
676686 ExpectError : regexp .MustCompile ("CANNOT_MODIFY_GLOBAL_CLUSTER_MANAGEMENT_SETTING" ),
@@ -715,6 +725,7 @@ func TestAccMockableAdvancedCluster_symmetricShardedOldSchema(t *testing.T) {
715725 Config : configShardedOldSchemaMultiCloud (t , true , projectID , clusterName , 2 , "M20" , & configServerManagementModeAtlasManaged ),
716726 Check : checkShardedOldSchemaMultiCloud (true , clusterName , 2 , "M20" , false , & configServerManagementModeAtlasManaged ),
717727 },
728+ acc .TestStepImportCluster (resourceName , "replication_specs" ), // Import with old schema will NOT use `num_shards`
718729 },
719730 })
720731}
@@ -744,6 +755,7 @@ func symmetricGeoShardedOldSchemaTestCase(t *testing.T, isAcc bool) resource.Tes
744755 checkGeoShardedOldSchema (isAcc , clusterName , 3 , 3 , true , false ),
745756 acc .CheckIndependentShardScalingMode (resourceName , clusterName , "CLUSTER" )),
746757 },
758+ acc .TestStepImportCluster (resourceName , "replication_specs" ), // Import with old schema will NOT use `num_shards`
747759 },
748760 }
749761}
@@ -764,6 +776,7 @@ func TestAccMockableAdvancedCluster_symmetricShardedOldSchemaDiskSizeGBAtElectab
764776 Config : configShardedOldSchemaDiskSizeGBElectableLevel (t , true , projectID , clusterName , 55 ),
765777 Check : checkShardedOldSchemaDiskSizeGBElectableLevel (true , 55 ),
766778 },
779+ acc .TestStepImportCluster (resourceName , "replication_specs" ), // Import with old schema will NOT use `num_shards`
767780 },
768781 })
769782}
@@ -792,6 +805,7 @@ func TestAccClusterAdvancedClusterConfig_symmetricShardedNewSchemaToAsymmetricAd
792805 Config : configShardedNewSchema (t , true , orgID , projectName , clusterName , 55 , "M10" , "M20" , nil , nil , false , false ), // removes middle replication spec
793806 Check : checkShardedNewSchema (true , 55 , "M10" , "M20" , nil , nil , true , false ),
794807 },
808+ acc .TestStepImportCluster (resourceName ),
795809 },
796810 })
797811}
@@ -820,6 +834,7 @@ func asymmetricShardedNewSchemaTestCase(t *testing.T, isAcc bool) resource.TestC
820834 resource .TestCheckResourceAttr ("data.mongodbatlas_advanced_clusters.test-replication-specs-per-shard-false" , "results.#" , "0" ),
821835 acc .CheckIndependentShardScalingMode (resourceName , clusterName , "SHARD" )),
822836 },
837+ acc .TestStepImportCluster (resourceName ),
823838 },
824839 }
825840}
@@ -863,6 +878,7 @@ func TestAccClusterAdvancedClusterConfig_asymmetricGeoShardedNewSchemaAddingRemo
863878 Config : configGeoShardedNewSchema (t , true , projectID , clusterName , false ),
864879 Check : checkGeoShardedNewSchema (true , false ),
865880 },
881+ acc .TestStepImportCluster (resourceName ),
866882 },
867883 })
868884}
@@ -885,6 +901,7 @@ func TestAccClusterAdvancedClusterConfig_shardedTransitionFromOldToNewSchema(t *
885901 Config : configShardedTransitionOldToNewSchema (t , true , projectID , clusterName , true , false ),
886902 Check : checkShardedTransitionOldToNewSchema (true , true ),
887903 },
904+ acc .TestStepImportCluster (resourceName ),
888905 },
889906 })
890907}
@@ -905,6 +922,7 @@ func TestAccClusterAdvancedClusterConfig_geoShardedTransitionFromOldToNewSchema(
905922 Config : configGeoShardedTransitionOldToNewSchema (t , true , projectID , clusterName , true ),
906923 Check : checkGeoShardedTransitionOldToNewSchema (true , true ),
907924 },
925+ acc .TestStepImportCluster (resourceName ),
908926 },
909927 })
910928}
@@ -937,6 +955,7 @@ func TestAccAdvancedCluster_replicaSetScalingStrategyAndRedactClientLogData(t *t
937955 Config : configReplicaSetScalingStrategyAndRedactClientLogData (t , true , orgID , projectName , clusterName , "NODE_TYPE" , false ),
938956 Check : checkReplicaSetScalingStrategyAndRedactClientLogData (true , "NODE_TYPE" , false ),
939957 },
958+ acc .TestStepImportCluster (resourceName ),
940959 },
941960 })
942961}
@@ -965,6 +984,7 @@ func TestAccAdvancedCluster_replicaSetScalingStrategyAndRedactClientLogDataOldSc
965984 Config : configReplicaSetScalingStrategyAndRedactClientLogDataOldSchema (t , true , orgID , projectName , clusterName , "NODE_TYPE" , false ),
966985 Check : checkReplicaSetScalingStrategyAndRedactClientLogData (true , "NODE_TYPE" , false ),
967986 },
987+ acc .TestStepImportCluster (resourceName , "replication_specs" ), // Import with old schema will NOT use `num_shards`
968988 },
969989 })
970990}
@@ -994,6 +1014,7 @@ func TestAccClusterAdvancedCluster_priorityOldSchema(t *testing.T) {
9941014 Config : configPriority (t , true , projectID , clusterName , true , false ),
9951015 Check : acc .TestCheckResourceAttrSchemaV2 (true , resourceName , "replication_specs.0.region_configs.#" , "2" ),
9961016 },
1017+ acc .TestStepImportCluster (resourceName , "replication_specs" ), // Import with old schema will NOT use `num_shards`
9971018 },
9981019 })
9991020}
@@ -1044,6 +1065,7 @@ func TestAccClusterAdvancedCluster_biConnectorConfig(t *testing.T) {
10441065 Config : configBiConnectorConfig (t , true , projectID , clusterName , true ),
10451066 Check : checkTenantBiConnectorConfig (true , projectID , clusterName , true ),
10461067 },
1068+ acc .TestStepImportCluster (resourceName ),
10471069 },
10481070 })
10491071}
@@ -1096,6 +1118,7 @@ func TestAccClusterAdvancedCluster_pinnedFCVWithVersionUpgradeAndDowngrade(t *te
10961118 Config : configFCVPinning (t , orgID , projectName , clusterName , nil , "7.0" ),
10971119 Check : acc .CheckFCVPinningConfig (true , resourceName , dataSourceName , dataSourcePluralName , 7 , nil , nil ),
10981120 },
1121+ acc .TestStepImportCluster (resourceName ),
10991122 },
11001123 })
11011124}
@@ -1116,6 +1139,7 @@ func TestAccAdvancedCluster_oldToNewSchemaWithAutoscalingEnabled(t *testing.T) {
11161139 Config : configShardedTransitionOldToNewSchema (t , true , projectID , clusterName , true , true ),
11171140 Check : acc .CheckIndependentShardScalingMode (resourceName , clusterName , "SHARD" ),
11181141 },
1142+ acc .TestStepImportCluster (resourceName ),
11191143 },
11201144 })
11211145}
@@ -1140,6 +1164,7 @@ func TestAccAdvancedCluster_oldToNewSchemaWithAutoscalingDisabledToEnabled(t *te
11401164 Config : configShardedTransitionOldToNewSchema (t , true , projectID , clusterName , true , true ),
11411165 Check : acc .CheckIndependentShardScalingMode (resourceName , clusterName , "SHARD" ),
11421166 },
1167+ acc .TestStepImportCluster (resourceName ),
11431168 },
11441169 })
11451170}
0 commit comments