Skip to content

Commit 9a54420

Browse files
committed
test files for clu2adv
1 parent a4e0c70 commit 9a54420

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
locals {
2+
replication_specs_list = [
3+
{
4+
zone_name = "zone1"
5+
region_name = "US_EAST_1"
6+
},
7+
{
8+
zone_name = "zone2"
9+
region_name = "US_WEST_2"
10+
}
11+
]
12+
}
13+
14+
resource "mongodbatlas_cluster" "one_config" {
15+
project_id = "123"
16+
name = "cluster"
17+
provider_name = "AWS"
18+
provider_instance_size_name = "M10"
19+
disk_size_gb = 10
20+
auto_scaling_disk_gb_enabled = true
21+
dynamic "replication_specs" {
22+
for_each = local.replication_specs_list
23+
content {
24+
num_shards = 2
25+
zone_name = replication_specs.value.zone_name
26+
regions_config {
27+
region_name = replication_specs.value.region_name
28+
priority = 7
29+
electable_nodes = 3
30+
}
31+
}
32+
}
33+
}
34+
35+
resource "mongodbatlas_cluster" "multiple_config" {
36+
project_id = "123"
37+
name = "cluster"
38+
provider_name = "AWS"
39+
provider_instance_size_name = "M10"
40+
disk_size_gb = 10
41+
auto_scaling_disk_gb_enabled = true
42+
dynamic "replication_specs" {
43+
for_each = local.replication_specs_list
44+
content {
45+
num_shards = 2
46+
zone_name = replication_specs.value.zone_name
47+
regions_config {
48+
region_name = replication_specs.value.region_name
49+
priority = 7
50+
electable_nodes = 2
51+
}
52+
regions_config {
53+
region_name = replication_specs.value.region_name
54+
priority = 6
55+
electable_nodes = 1
56+
read_only_nodes = 4
57+
}
58+
}
59+
}
60+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
locals {
2+
replication_specs_list = [
3+
{
4+
zone_name = "zone1"
5+
region_name = "US_EAST_1"
6+
},
7+
{
8+
zone_name = "zone2"
9+
region_name = "US_WEST_2"
10+
}
11+
]
12+
}
13+
14+
resource "mongodbatlas_advanced_cluster" "one_config" {
15+
project_id = "123"
16+
name = "cluster"
17+
replication_specs = flatten([
18+
for spec in local.replication_specs_list : [
19+
for i in range(2) : {
20+
zone_name = spec.zone_name
21+
region_configs = [
22+
{
23+
provider_name = "AWS"
24+
region_name = spec.region_name
25+
priority = 7
26+
electable_specs = {
27+
node_count = 3
28+
instance_size = "M10"
29+
disk_size_gb = 10
30+
}
31+
auto_scaling = {
32+
disk_gb_enabled = true
33+
}
34+
}
35+
]
36+
}
37+
]
38+
])
39+
40+
# Generated by atlas-cli-plugin-terraform.
41+
# Please review the changes and confirm that references to this resource are updated.
42+
}
43+
44+
resource "mongodbatlas_advanced_cluster" "multiple_config" {
45+
project_id = "123"
46+
name = "cluster"
47+
replication_specs = flatten([
48+
for spec in local.replication_specs_list : [
49+
for i in range(2) : {
50+
zone_name = spec.zone_name
51+
region_configs = [
52+
{
53+
provider_name = "AWS"
54+
region_name = spec.region_name
55+
priority = 7
56+
electable_specs = {
57+
node_count = 2
58+
instance_size = "M10"
59+
disk_size_gb = 10
60+
}
61+
auto_scaling = {
62+
disk_gb_enabled = true
63+
}
64+
},
65+
{
66+
provider_name = "AWS"
67+
region_name = spec.region_name
68+
priority = 6
69+
electable_specs = {
70+
node_count = 1
71+
instance_size = "M10"
72+
disk_size_gb = 10
73+
}
74+
read_only_specs = {
75+
node_count = 4
76+
instance_size = "M10"
77+
disk_size_gb = 10
78+
}
79+
auto_scaling = {
80+
disk_gb_enabled = true
81+
}
82+
}
83+
]
84+
}
85+
]
86+
])
87+
88+
# Generated by atlas-cli-plugin-terraform.
89+
# Please review the changes and confirm that references to this resource are updated.
90+
}

0 commit comments

Comments
 (0)