Skip to content

Commit ff3e830

Browse files
committed
autoscaling test
1 parent 6c32a9e commit ff3e830

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
resource "mongodbatlas_cluster" "autoscaling" {
2+
project_id = var.project_id
3+
name = var.cluster_name
4+
disk_size_gb = 100
5+
num_shards = 1
6+
7+
cluster_type = "REPLICASET"
8+
replication_specs {
9+
num_shards = 1
10+
regions_config {
11+
region_name = "US_WEST_2"
12+
electable_nodes = 3
13+
priority = 7
14+
read_only_nodes = 0
15+
}
16+
}
17+
cloud_backup = true
18+
auto_scaling_disk_gb_enabled = true
19+
auto_scaling_compute_enabled = true
20+
auto_scaling_compute_scale_down_enabled = true
21+
22+
//Provider Settings "block"
23+
provider_name = "AWS"
24+
provider_auto_scaling_compute_min_instance_size = "M10"
25+
provider_auto_scaling_compute_max_instance_size = "M40"
26+
provider_instance_size_name = "M20"
27+
28+
lifecycle { // To simulate if there a new instance size name to avoid scale cluster down to original value
29+
# Note that provider_instance_size_name won't exist in advanced_cluster so it's an error to refer to it,
30+
# but plugin doesn't help here.
31+
ignore_changes = [provider_instance_size_name]
32+
}
33+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
resource "mongodbatlas_advanced_cluster" "autoscaling" {
2+
project_id = var.project_id
3+
name = var.cluster_name
4+
cluster_type = "REPLICASET"
5+
backup_enabled = true
6+
7+
lifecycle { // To simulate if there a new instance size name to avoid scale cluster down to original value
8+
# Note that provider_instance_size_name won't exist in advanced_cluster so it's an error to refer to it,
9+
# but plugin doesn't help here.
10+
ignore_changes = [provider_instance_size_name]
11+
}
12+
13+
replication_specs = [{
14+
region_configs = [{
15+
region_name = "US_WEST_2"
16+
priority = 7
17+
provider_name = "AWS"
18+
auto_scaling = {
19+
disk_gb_enabled = true
20+
compute_enabled = true
21+
compute_min_instance_size = "M10"
22+
compute_max_instance_size = "M40"
23+
compute_scale_down_enabled = true
24+
}
25+
electable_specs = {
26+
node_count = 3
27+
instance_size = "M20"
28+
disk_size_gb = 100
29+
}
30+
}]
31+
}]
32+
33+
# Generated by atlas-cli-plugin-terraform.
34+
# Please confirm that all references to this resource are updated.
35+
}

0 commit comments

Comments
 (0)