Skip to content

Commit 23daf4a

Browse files
committed
read only and analytics all params
1 parent 47e1981 commit 23daf4a

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

internal/convert/const_names.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ const (
2525
nComputeScaleDownEnabledSrc = "auto_scaling_compute_scale_down_enabled"
2626
nComputeMinInstanceSizeSrc = "provider_auto_scaling_compute_min_instance_size"
2727
nComputeMaxInstanceSizeSrc = "provider_auto_scaling_compute_max_instance_size"
28+
nEBSVolumeTypeSrc = "provider_volume_type"
29+
nDiskIOPSSrc = "provider_disk_iops"
2830
nDiskGBEnabled = "disk_gb_enabled"
2931
nComputeEnabled = "compute_enabled"
3032
nComputeScaleDownEnabled = "compute_scale_down_enabled"
3133
nComputeMinInstanceSize = "compute_min_instance_size"
3234
nComputeMaxInstanceSize = "compute_max_instance_size"
35+
nEBSVolumeType = "ebs_volume_type"
36+
nDiskIOPS = "disk_iops"
3337
nNodeCount = "node_count"
3438
nElectableNodes = "electable_nodes"
3539
nReadOnlyNodes = "read_only_nodes"

internal/convert/convert.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ func getElectableSpecs(configSrc *hclwrite.Block, root attrVals) (hclwrite.Token
183183
if root.opt[nDiskSizeGB] != nil {
184184
fileb.SetAttributeRaw(nDiskSizeGB, root.opt[nDiskSizeGB])
185185
}
186+
if root.opt[nEBSVolumeTypeSrc] != nil {
187+
fileb.SetAttributeRaw(nEBSVolumeType, root.opt[nEBSVolumeTypeSrc])
188+
}
189+
if root.opt[nDiskIOPSSrc] != nil {
190+
fileb.SetAttributeRaw(nDiskIOPS, root.opt[nDiskIOPSSrc])
191+
}
186192
return hcl.TokensObject(file), nil
187193
}
188194

@@ -202,6 +208,15 @@ func getReadOnlyAnalyticsOpt(countName string, configSrc *hclwrite.Block, root a
202208
}
203209
fileb.SetAttributeRaw(nNodeCount, count.Expr().BuildTokens(nil))
204210
fileb.SetAttributeRaw(nInstanceSize, root.req[nInstanceSizeSrc])
211+
if root.opt[nDiskSizeGB] != nil {
212+
fileb.SetAttributeRaw(nDiskSizeGB, root.opt[nDiskSizeGB])
213+
}
214+
if root.opt[nEBSVolumeTypeSrc] != nil {
215+
fileb.SetAttributeRaw(nEBSVolumeType, root.opt[nEBSVolumeTypeSrc])
216+
}
217+
if root.opt[nDiskIOPSSrc] != nil {
218+
fileb.SetAttributeRaw(nDiskIOPS, root.opt[nDiskIOPSSrc])
219+
}
205220
return hcl.TokensObject(file)
206221
}
207222

@@ -271,6 +286,8 @@ func popRootAttrs(body *hclwrite.Body) (attrVals, error) {
271286
nComputeMinInstanceSizeSrc,
272287
nComputeMaxInstanceSizeSrc,
273288
nComputeScaleDownEnabledSrc,
289+
nEBSVolumeTypeSrc,
290+
nDiskIOPSSrc,
274291
}
275292
req = make(map[string]hclwrite.Tokens)
276293
opt = make(map[string]hclwrite.Tokens)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
resource "mongodbatlas_cluster" "ar" {
2+
project_id = var.project_id
3+
name = "ar"
4+
cluster_type = "REPLICASET"
5+
provider_name = "AWS"
6+
provider_instance_size_name = "M10"
7+
disk_size_gb = 90
8+
provider_volume_type = "PROVISIONED"
9+
provider_disk_iops = 100
10+
replication_specs {
11+
num_shards = 1
12+
regions_config {
13+
region_name = "US_EAST_1"
14+
priority = 7
15+
electable_nodes = 3
16+
analytics_nodes = 2
17+
read_only_nodes = 1
18+
}
19+
}
20+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
resource "mongodbatlas_advanced_cluster" "ar" {
2+
project_id = var.project_id
3+
name = "ar"
4+
cluster_type = "REPLICASET"
5+
replication_specs = [{
6+
region_configs = [{
7+
provider_name = "AWS"
8+
region_name = "US_EAST_1"
9+
priority = 7
10+
electable_specs = {
11+
node_count = 3
12+
instance_size = "M10"
13+
disk_size_gb = 90
14+
ebs_volume_type = "PROVISIONED"
15+
disk_iops = 100
16+
}
17+
read_only_specs = {
18+
node_count = 1
19+
instance_size = "M10"
20+
disk_size_gb = 90
21+
ebs_volume_type = "PROVISIONED"
22+
disk_iops = 100
23+
}
24+
analytics_specs = {
25+
node_count = 2
26+
instance_size = "M10"
27+
disk_size_gb = 90
28+
ebs_volume_type = "PROVISIONED"
29+
disk_iops = 100
30+
}
31+
}]
32+
}]
33+
34+
# Generated by atlas-cli-plugin-terraform.
35+
# Please confirm that all references to this resource are updated.
36+
}

0 commit comments

Comments
 (0)