Skip to content

Commit 18fe32f

Browse files
committed
group num_shard tests
1 parent f33ed40 commit 18fe32f

File tree

4 files changed

+48
-24
lines changed

4 files changed

+48
-24
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"configuration_file_error": "failed to parse Terraform config file",
33
"replication_specs_missing_region_configs": "replication_specs must have at least one region_configs",
4-
"missing_replication_specs": "must have at least one replication_specs",
5-
"num_shards_not_numerical": "setting num_shards: failed to evaluate number"
4+
"missing_replication_specs": "must have at least one replication_specs"
65
}

internal/convert/testdata/adv2v2/num_shards.in.tf

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
resource "mongodbatlas_advanced_cluster" "geo" {
1+
resource "mongodbatlas_advanced_cluster" "numerical_num_shards" {
22
project_id = var.project_id
33
name = "geo"
44
cluster_type = "GEOSHARDED"
@@ -39,7 +39,7 @@ resource "mongodbatlas_advanced_cluster" "geo" {
3939
}
4040
}
4141

42-
resource "mongodbatlas_advanced_cluster" "geo" {
42+
resource "mongodbatlas_advanced_cluster" "numerical_num_shards_and_disk_size_gb" {
4343
project_id = var.project_id
4444
name = "geo"
4545
cluster_type = "GEOSHARDED"
@@ -58,3 +58,22 @@ resource "mongodbatlas_advanced_cluster" "geo" {
5858
}
5959
}
6060
}
61+
62+
resource "mongodbatlas_advanced_cluster" "variable_num_shards" {
63+
project_id = var.project_id
64+
name = "geo"
65+
cluster_type = "GEOSHARDED"
66+
replication_specs {
67+
zone_name = "Zone 1"
68+
num_shards = var.num_shards # unresolved num_shards
69+
region_configs {
70+
provider_name = "AWS"
71+
region_name = "US_EAST_1"
72+
priority = 7
73+
electable_specs {
74+
node_count = 3
75+
instance_size = "M10"
76+
}
77+
}
78+
}
79+
}

internal/convert/testdata/adv2v2/num_shards.out.tf

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
resource "mongodbatlas_advanced_cluster" "geo" {
1+
resource "mongodbatlas_advanced_cluster" "numerical_num_shards" {
22
project_id = var.project_id
33
name = "geo"
44
cluster_type = "GEOSHARDED"
@@ -105,7 +105,7 @@ resource "mongodbatlas_advanced_cluster" "geo" {
105105
# Updated by atlas-cli-plugin-terraform, please review the changes.
106106
}
107107

108-
resource "mongodbatlas_advanced_cluster" "geo" {
108+
resource "mongodbatlas_advanced_cluster" "numerical_num_shards_and_disk_size_gb" {
109109
project_id = var.project_id
110110
name = "geo"
111111
cluster_type = "GEOSHARDED"
@@ -144,3 +144,27 @@ resource "mongodbatlas_advanced_cluster" "geo" {
144144

145145
# Updated by atlas-cli-plugin-terraform, please review the changes.
146146
}
147+
148+
resource "mongodbatlas_advanced_cluster" "variable_num_shards" {
149+
project_id = var.project_id
150+
name = "geo"
151+
cluster_type = "GEOSHARDED"
152+
replication_specs = [
153+
for i in range(var.num_shards) : {
154+
zone_name = "Zone 1"
155+
region_configs = [
156+
{
157+
provider_name = "AWS"
158+
region_name = "US_EAST_1"
159+
priority = 7
160+
electable_specs = {
161+
node_count = 3
162+
instance_size = "M10"
163+
}
164+
}
165+
]
166+
}
167+
]
168+
169+
# Updated by atlas-cli-plugin-terraform, please review the changes.
170+
}

internal/convert/testdata/adv2v2/num_shards_not_numerical.in.tf

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)