@@ -8,6 +8,21 @@ import (
88 "github.com/zclconf/go-cty/cty"
99)
1010
11+ const (
12+ resourceType = "resource"
13+ cluster = "mongodbatlas_cluster"
14+ advCluster = "mongodbatlas_advanced_cluster"
15+ valClusterType = "REPLICASET"
16+ valPriority = 7
17+ errFreeCluster = "free cluster (because no " + nRepSpecs + ")"
18+ errRepSpecs = "setting " + nRepSpecs
19+ )
20+
21+ type attrVals struct {
22+ req map [string ]hclwrite.Tokens
23+ opt map [string ]hclwrite.Tokens
24+ }
25+
1126// ClusterToAdvancedCluster transforms all mongodbatlas_cluster definitions in a
1227// Terraform configuration file into mongodbatlas_advanced_cluster schema v2 definitions.
1328// All other resources and data sources are left untouched.
@@ -192,50 +207,3 @@ func popRootAttrs(body *hclwrite.Body, errPrefix string) (attrVals, error) {
192207 }
193208 return attrVals {req : req , opt : opt }, nil
194209}
195-
196- type attrVals struct {
197- req map [string ]hclwrite.Tokens
198- opt map [string ]hclwrite.Tokens
199- }
200-
201- const (
202- resourceType = "resource"
203- cluster = "mongodbatlas_cluster"
204- advCluster = "mongodbatlas_advanced_cluster"
205-
206- nRepSpecs = "replication_specs"
207- nConfig = "region_configs"
208- nConfigSrc = "regions_config"
209- nElectableSpecs = "electable_specs"
210- nAutoScaling = "auto_scaling"
211- nRegionNameSrc = "provider_region_name"
212- nRegionName = "region_name"
213- nProviderName = "provider_name"
214- nBackingProviderName = "backing_provider_name"
215- nInstanceSizeSrc = "provider_instance_size_name"
216- nInstanceSize = "instance_size"
217- nClusterType = "cluster_type"
218- nPriority = "priority"
219- nNumShards = "num_shards"
220- nBackupEnabled = "backup_enabled"
221- nCloudBackup = "cloud_backup"
222- nDiskSizeGB = "disk_size_gb"
223- nDiskGBEnabledSrc = "auto_scaling_disk_gb_enabled"
224- nComputeEnabledSrc = "auto_scaling_compute_enabled"
225- nComputeScaleDownEnabledSrc = "auto_scaling_compute_scale_down_enabled"
226- nComputeMinInstanceSizeSrc = "provider_auto_scaling_compute_min_instance_size"
227- nComputeMaxInstanceSizeSrc = "provider_auto_scaling_compute_max_instance_size"
228- nDiskGBEnabled = "disk_gb_enabled"
229- nComputeEnabled = "compute_enabled"
230- nComputeScaleDownEnabled = "compute_scale_down_enabled"
231- nComputeMinInstanceSize = "compute_min_instance_size"
232- nComputeMaxInstanceSize = "compute_max_instance_size"
233- nNodeCount = "node_count"
234- nElectableNodes = "electable_nodes"
235-
236- valClusterType = "REPLICASET"
237- valPriority = 7
238-
239- errFreeCluster = "free cluster (because no " + nRepSpecs + ")"
240- errRepSpecs = "setting " + nRepSpecs
241- )
0 commit comments