Skip to content

Commit 8e129d8

Browse files
committed
rename consts
1 parent 4c3fc75 commit 8e129d8

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

internal/hcl/hcl.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ import (
1111
)
1212

1313
const (
14-
resourceType = "resource"
15-
cluster = "mongodbatlas_cluster"
16-
advCluster = "mongodbatlas_advanced_cluster"
17-
strReplicationSpecs = "replication_specs"
18-
strRegionConfigs = "region_configs"
19-
strElectableSpecs = "electable_specs"
20-
strProviderRegionName = "provider_region_name"
21-
strRegionName = "region_name"
22-
strProviderName = "provider_name"
23-
strBackingProviderName = "backing_provider_name"
24-
strProviderInstanceSizeName = "provider_instance_size_name"
25-
strInstanceSize = "instance_size"
26-
strClusterType = "cluster_type"
27-
strPriority = "priority"
28-
29-
errFreeCluster = "free cluster (because no " + strReplicationSpecs + ")"
14+
resourceType = "resource"
15+
cluster = "mongodbatlas_cluster"
16+
advCluster = "mongodbatlas_advanced_cluster"
17+
nameReplicationSpecs = "replication_specs"
18+
nameRegionConfigs = "region_configs"
19+
nameElectableSpecs = "electable_specs"
20+
nameProviderRegionName = "provider_region_name"
21+
nameRegionName = "region_name"
22+
nameProviderName = "provider_name"
23+
nameBackingProviderName = "backing_provider_name"
24+
nameProviderInstanceSizeName = "provider_instance_size_name"
25+
nameInstanceSize = "instance_size"
26+
nameClusterType = "cluster_type"
27+
namePriority = "priority"
28+
29+
errFreeCluster = "free cluster (because no " + nameReplicationSpecs + ")"
3030
)
3131

3232
// ClusterToAdvancedCluster transforms all mongodbatlas_cluster definitions in a
@@ -63,36 +63,36 @@ func ClusterToAdvancedCluster(config []byte) ([]byte, error) {
6363
}
6464

6565
func isFreeTier(body *hclwrite.Body) bool {
66-
return body.FirstMatchingBlock(strReplicationSpecs, nil) == nil
66+
return body.FirstMatchingBlock(nameReplicationSpecs, nil) == nil
6767
}
6868

6969
func fillFreeTier(body *hclwrite.Body) error {
7070
const (
7171
valClusterType = "REPLICASET"
7272
valPriority = 7
7373
)
74-
body.SetAttributeValue(strClusterType, cty.StringVal(valClusterType))
74+
body.SetAttributeValue(nameClusterType, cty.StringVal(valClusterType))
7575
regionConfig := hclwrite.NewEmptyFile()
7676
regionConfigBody := regionConfig.Body()
7777
setAttrInt(regionConfigBody, "priority", valPriority)
78-
if err := moveAttribute(strProviderRegionName, strRegionName, body, regionConfigBody, errFreeCluster); err != nil {
78+
if err := moveAttribute(nameProviderRegionName, nameRegionName, body, regionConfigBody, errFreeCluster); err != nil {
7979
return err
8080
}
81-
if err := moveAttribute(strProviderName, strProviderName, body, regionConfigBody, errFreeCluster); err != nil {
81+
if err := moveAttribute(nameProviderName, nameProviderName, body, regionConfigBody, errFreeCluster); err != nil {
8282
return err
8383
}
84-
if err := moveAttribute(strBackingProviderName, strBackingProviderName, body, regionConfigBody, errFreeCluster); err != nil {
84+
if err := moveAttribute(nameBackingProviderName, nameBackingProviderName, body, regionConfigBody, errFreeCluster); err != nil {
8585
return err
8686
}
8787
electableSpec := hclwrite.NewEmptyFile()
88-
if err := moveAttribute(strProviderInstanceSizeName, strInstanceSize, body, electableSpec.Body(), errFreeCluster); err != nil {
88+
if err := moveAttribute(nameProviderInstanceSizeName, nameInstanceSize, body, electableSpec.Body(), errFreeCluster); err != nil {
8989
return err
9090
}
91-
regionConfigBody.SetAttributeRaw(strElectableSpecs, tokensObject(electableSpec))
91+
regionConfigBody.SetAttributeRaw(nameElectableSpecs, tokensObject(electableSpec))
9292

9393
replicationSpec := hclwrite.NewEmptyFile()
94-
replicationSpec.Body().SetAttributeRaw(strRegionConfigs, tokensArrayObject(regionConfig))
95-
body.SetAttributeRaw(strReplicationSpecs, tokensArrayObject(replicationSpec))
94+
replicationSpec.Body().SetAttributeRaw(nameRegionConfigs, tokensArrayObject(regionConfig))
95+
body.SetAttributeRaw(nameReplicationSpecs, tokensArrayObject(replicationSpec))
9696
return nil
9797
}
9898

0 commit comments

Comments
 (0)