-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Converts clusters with one replication_specs, regions_config and shard #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
ff3e830
4c429be
f499c7e
e61ef7a
b0eec80
94b9f26
e9b3be5
eb66610
df32933
7443f59
2f168be
f25dc82
7508260
95d6b5d
bef160d
f0794b4
e009ab9
198ead9
f0b08b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
resource "mongodbatlas_cluster" "autoscaling" { | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
disk_size_gb = 100 | ||
num_shards = 1 | ||
cluster_type = "REPLICASET" | ||
|
||
replication_specs { | ||
num_shards = 1 | ||
regions_config { | ||
region_name = "US_WEST_2" | ||
electable_nodes = 3 | ||
priority = 7 | ||
read_only_nodes = 0 | ||
} | ||
} | ||
cloud_backup = true | ||
auto_scaling_disk_gb_enabled = true | ||
auto_scaling_compute_enabled = false | ||
auto_scaling_compute_scale_down_enabled = local.scale_down | ||
|
||
//Provider Settings "block" | ||
provider_name = "AWS" | ||
provider_auto_scaling_compute_min_instance_size = "M10" | ||
provider_auto_scaling_compute_max_instance_size = "M40" | ||
provider_instance_size_name = "M20" | ||
|
||
lifecycle { // To simulate if there a new instance size name to avoid scale cluster down to original value | ||
# Note that provider_instance_size_name won't exist in advanced_cluster so it's an error to refer to it, | ||
# but plugin doesn't help here. | ||
ignore_changes = [provider_instance_size_name] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
resource "mongodbatlas_advanced_cluster" "autoscaling" { | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
cluster_type = "REPLICASET" | ||
|
||
|
||
|
||
lifecycle { // To simulate if there a new instance size name to avoid scale cluster down to original value | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer having lifecycle at the end, but understand it is because we are appending to the resource block? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. correct, when the functionality is done, we can try to improve these formatting issues There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've created this ticket: CLOUDP-299208 |
||
# Note that provider_instance_size_name won't exist in advanced_cluster so it's an error to refer to it, | ||
# but plugin doesn't help here. | ||
ignore_changes = [provider_instance_size_name] | ||
} | ||
backup_enabled = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note that they are some empty lines that are added where replication_specs and regions_config were, and new attributes are added at the end of current resource , in this case after will see if it can be improved in following PRs |
||
replication_specs = [{ | ||
region_configs = [{ | ||
provider_name = "AWS" | ||
region_name = "US_WEST_2" | ||
priority = 7 | ||
auto_scaling = { | ||
disk_gb_enabled = true | ||
compute_enabled = false | ||
compute_min_instance_size = "M10" | ||
compute_max_instance_size = "M40" | ||
compute_scale_down_enabled = local.scale_down | ||
} | ||
electable_specs = { | ||
node_count = 3 | ||
instance_size = "M20" | ||
disk_size_gb = 100 | ||
} | ||
}] | ||
}] | ||
|
||
# Generated by atlas-cli-plugin-terraform. | ||
# Please confirm that all references to this resource are updated. | ||
} |
Uh oh!
There was an error while loading. Please reload this page.