Skip to content

update the documentation and examples for adding the replication spec… #357

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

Merged
merged 3 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions examples/Atlas_Database_Users/atlas_cluster.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
resource "mongodbatlas_cluster" "cluster" {
project_id = mongodbatlas_project.project1.id
name = "MongoDB_Atlas"
num_shards = 1
mongo_db_major_version = "4.4"
replication_factor = 3

cluster_type = "REPLICASET"
replication_specs {
num_shards = 1
regions_config {
region_name = var.region
electable_nodes = 3
priority = 7
read_only_nodes = 0
}
}
//Provider Settings "block"
provider_backup_enabled = true
auto_scaling_disk_gb_enabled = true
Expand All @@ -14,7 +21,6 @@ resource "mongodbatlas_cluster" "cluster" {
provider_volume_type = "STANDARD"
provider_instance_size_name = "M10"
provider_encrypt_ebs_volume = true
provider_region_name = var.region
}
output "atlasclusterstring" {
value = mongodbatlas_cluster.cluster.connection_strings
Expand Down
16 changes: 11 additions & 5 deletions examples/aws-atlas-privatelink/atlas-cluster.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
resource "mongodbatlas_cluster" "cluster-atlas" {
project_id = var.atlasprojectid
name = "cluster-atlas"
num_shards = 1
replication_factor = 3
provider_backup_enabled = true
auto_scaling_disk_gb_enabled = true
mongo_db_major_version = "4.2"

cluster_type = "REPLICASET"
replication_specs {
num_shards = 1
regions_config {
region_name = var.atlas_region
electable_nodes = 3
priority = 7
read_only_nodes = 0
}
}
//Provider settings
provider_name = "AWS"
disk_size_gb = 10
provider_disk_iops = 100
provider_volume_type = "STANDARD"
provider_encrypt_ebs_volume = true
provider_instance_size_name = "M10"
provider_region_name = var.atlas_region
}
output "atlasclusterstring" {
value = mongodbatlas_cluster.cluster-atlas.connection_strings
}
output "plstring" {
value = lookup(mongodbatlas_cluster.cluster-atlas.connection_strings[0].aws_private_link_srv, aws_vpc_endpoint.ptfe_service.id)
}
}
18 changes: 12 additions & 6 deletions examples/mongodbatlas-azure-vnet-peering/atlas.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ provider "mongodbatlas" {
}
# Create the mongodb atlas Azure cluster
resource "mongodbatlas_cluster" "azure-cluster" {
project_id = var.project_id
name = var.name
num_shards = 1

replication_factor = 3
project_id = var.project_id
name = var.name
cluster_type = "REPLICASET"
replication_specs {
num_shards = 1
regions_config {
region_name = var.provider_region_name
electable_nodes = 3
priority = 7
read_only_nodes = 0
}
}
backup_enabled = false
auto_scaling_disk_gb_enabled = true
mongo_db_major_version = "4.2"
Expand All @@ -18,7 +25,6 @@ resource "mongodbatlas_cluster" "azure-cluster" {
provider_name = "AZURE"
provider_disk_type_name = var.provider_disk_type_name
provider_instance_size_name = var.provider_instance_size_name
provider_region_name = var.provider_region_name
}

# Create the peering connection request
Expand Down
14 changes: 10 additions & 4 deletions examples/starter/atlas_cluster.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
resource "mongodbatlas_cluster" "cluster" {
project_id = mongodbatlas_project.project.id
name = "mongodb-atlas"
num_shards = 1
mongo_db_major_version = var.mongodbversion
replication_factor = 3

cluster_type = "REPLICASET"
replication_specs {
num_shards = 1
regions_config {
region_name = var.region
electable_nodes = 3
priority = 7
read_only_nodes = 0
}
}
//Provider Settings "block"
provider_backup_enabled = true
auto_scaling_disk_gb_enabled = true
Expand All @@ -14,7 +21,6 @@ resource "mongodbatlas_cluster" "cluster" {
provider_volume_type = "STANDARD"
provider_instance_size_name = "M10"
provider_encrypt_ebs_volume = true
provider_region_name = var.region
}
output "atlasclusterstring" {
value = mongodbatlas_cluster.cluster.connection_strings
Expand Down
2 changes: 1 addition & 1 deletion examples/starter/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ variable "private_key" {
variable "dbuser" {
description = "MongoDB Atlas Database User"
}
variable "dbuser_password" {
variable "dbuser_password" {
description = "MongoDB Atlas Database User Password"
}
variable "database_name" {
Expand Down
16 changes: 11 additions & 5 deletions website/docs/d/cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ resource "mongodbatlas_cluster" "test" {
project_id = "<YOUR-PROJECT-ID>"
name = "cluster-test"
disk_size_gb = 100
num_shards = 1

replication_factor = 3
cluster_type = "REPLICASET"
replication_specs {
num_shards = 1
regions_config {
region_name = "US_EAST_1"
electable_nodes = 3
priority = 7
read_only_nodes = 0
}
}
provider_backup_enabled = true
auto_scaling_disk_gb_enabled = true

Expand All @@ -35,7 +42,6 @@ resource "mongodbatlas_cluster" "test" {
provider_volume_type = "STANDARD"
provider_encrypt_ebs_volume = true
provider_instance_size_name = "M40"
provider_region_name = "US_EAST_1"
}

data "mongodbatlas_cluster" "test" {
Expand Down Expand Up @@ -100,7 +106,7 @@ In addition to all arguments above, the following attributes are exported:
* `provider_encrypt_ebs_volume` - Indicates whether the Amazon EBS encryption is enabled. This feature encrypts the server’s root volume for both data at rest within the volume and data moving between the volume and the instance.
* `provider_region_name` - Indicates Physical location of your MongoDB cluster. The region you choose can affect network latency for clients accessing your databases. Requires the Atlas Region name, see the reference list for [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/), [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/).
* `provider_volume_type` - Indicates the type of the volume. The possible values are: `STANDARD` and `PROVISIONED`.
* `replication_factor` - Number of replica set members. Each member keeps a copy of your databases, providing high availability and data redundancy. The possible values are 3, 5, or 7. The default value is 3.
* `replication_factor` - (Deprecated) Number of replica set members. Each member keeps a copy of your databases, providing high availability and data redundancy. The possible values are 3, 5, or 7. The default value is 3.
* `provider_auto_scaling_compute_min_instance_size` - (Optional) Minimum instance size to which your cluster can automatically scale.
* `provider_auto_scaling_compute_max_instance_size` - (Optional) Maximum instance size to which your cluster can automatically scale.

Expand Down
16 changes: 11 additions & 5 deletions website/docs/d/clusters.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ resource "mongodbatlas_cluster" "test" {
project_id = "<YOUR-PROJECT-ID>"
name = "cluster-test"
disk_size_gb = 100
num_shards = 1

replication_factor = 3
cluster_type = "REPLICASET"
replication_specs {
num_shards = 1
regions_config {
region_name = "US_EAST_1"
electable_nodes = 3
priority = 7
read_only_nodes = 0
}
}
provider_backup_enabled = true
auto_scaling_disk_gb_enabled = true

Expand All @@ -35,7 +42,6 @@ resource "mongodbatlas_cluster" "test" {
provider_volume_type = "STANDARD"
provider_encrypt_ebs_volume = true
provider_instance_size_name = "M40"
provider_region_name = "US_EAST_1"
}

data "mongodbatlas_clusters" "test" {
Expand Down Expand Up @@ -103,7 +109,7 @@ In addition to all arguments above, the following attributes are exported:
* `provider_volume_type` - Indicates the type of the volume. The possible values are: `STANDARD` and `PROVISIONED`.
* `provider_auto_scaling_compute_min_instance_size` - (Optional) Minimum instance size to which your cluster can automatically scale.
* `provider_auto_scaling_compute_max_instance_size` - (Optional) Maximum instance size to which your cluster can automatically scale.
* `replication_factor` - Number of replica set members. Each member keeps a copy of your databases, providing high availability and data redundancy. The possible values are 3, 5, or 7. The default value is 3.
* `replication_factor` - (Deprecated) Number of replica set members. Each member keeps a copy of your databases, providing high availability and data redundancy. The possible values are 3, 5, or 7. The default value is 3.

* `replication_specs` - Configuration for cluster regions. See [Replication Spec](#replication-spec) below for more details.

Expand Down
48 changes: 33 additions & 15 deletions website/docs/r/cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ description: |-
resource "mongodbatlas_cluster" "cluster-test" {
project_id = "<YOUR-PROJECT-ID>"
name = "cluster-test"
num_shards = 1

replication_factor = 3
cluster_type = "REPLICASET"
replication_specs {
num_shards = 1
regions_config {
region_name = "US_EAST_1"
electable_nodes = 3
priority = 7
read_only_nodes = 0
}
}
provider_backup_enabled = true
auto_scaling_disk_gb_enabled = true
mongo_db_major_version = "4.2"
Expand All @@ -42,7 +49,6 @@ resource "mongodbatlas_cluster" "cluster-test" {
provider_volume_type = "STANDARD"
provider_encrypt_ebs_volume = true
provider_instance_size_name = "M40"
provider_region_name = "US_EAST_1"
}
```

Expand All @@ -52,9 +58,16 @@ resource "mongodbatlas_cluster" "cluster-test" {
resource "mongodbatlas_cluster" "test" {
project_id = "<YOUR-PROJECT-ID>"
name = "test"
num_shards = 1

replication_factor = 3
cluster_type = "REPLICASET"
replication_specs {
num_shards = 1
regions_config {
region_name = "US_EAST_1"
electable_nodes = 3
priority = 7
read_only_nodes = 0
}
}
provider_backup_enabled = true
auto_scaling_disk_gb_enabled = true
mongo_db_major_version = "4.2"
Expand All @@ -63,7 +76,6 @@ resource "mongodbatlas_cluster" "test" {
provider_name = "AZURE"
provider_disk_type_name = "P6"
provider_instance_size_name = "M30"
provider_region_name = "US_EAST_2"
}
```

Expand All @@ -73,9 +85,16 @@ resource "mongodbatlas_cluster" "test" {
resource "mongodbatlas_cluster" "test" {
project_id = "<YOUR-PROJECT-ID>"
name = "test"
num_shards = 1

replication_factor = 3
cluster_type = "REPLICASET"
replication_specs {
num_shards = 1
regions_config {
region_name = "US_EAST_1"
electable_nodes = 3
priority = 7
read_only_nodes = 0
}
}
provider_backup_enabled = true
auto_scaling_disk_gb_enabled = true
mongo_db_major_version = "4.2"
Expand All @@ -84,7 +103,6 @@ resource "mongodbatlas_cluster" "test" {
provider_name = "GCP"
disk_size_gb = 40
provider_instance_size_name = "M30"
provider_region_name = "US_EAST_4"
}
```

Expand Down Expand Up @@ -240,7 +258,7 @@ But in order to explicitly change `provider_instance_size_name` comment the `lif
* The default value is false. M10 and above only.

* `bi_connector` - (Optional) Specifies BI Connector for Atlas configuration on this cluster. BI Connector for Atlas is only available for M10+ clusters. See [BI Connector](#bi-connector) below for more details.
* `cluster_type` - (Optional) Specifies the type of the cluster that you want to modify. You cannot convert a sharded cluster deployment to a replica set deployment.
* `cluster_type` - (Required) Specifies the type of the cluster that you want to modify. You cannot convert a sharded cluster deployment to a replica set deployment.

-> **WHEN SHOULD YOU USE CLUSTERTYPE?**
When you set replication_specs, when you are deploying Global Clusters or when you are deploying non-Global replica sets and sharded clusters.
Expand Down Expand Up @@ -283,11 +301,11 @@ But in order to explicitly change `provider_instance_size_name` comment the `lif
* `provider_region_name` - (Optional) Physical location of your MongoDB cluster. The region you choose can affect network latency for clients accessing your databases. Requires the **Atlas region name**, see the reference list for [AWS](https://docs.atlas.mongodb.com/reference/amazon-aws/), [GCP](https://docs.atlas.mongodb.com/reference/google-gcp/), [Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/).
Do not specify this field when creating a multi-region cluster using the replicationSpec document or a Global Cluster with the replicationSpecs array.
* `provider_volume_type` - (AWS - Optional) The type of the volume. The possible values are: `STANDARD` and `PROVISIONED`. `PROVISIONED` required if setting IOPS higher than the default instance IOPS.
* `replication_factor` - (Optional) Number of replica set members. Each member keeps a copy of your databases, providing high availability and data redundancy. The possible values are 3, 5, or 7. The default value is 3.
* `replication_factor` - (Deprecated) Number of replica set members. Each member keeps a copy of your databases, providing high availability and data redundancy. The possible values are 3, 5, or 7. The default value is 3.
* `provider_auto_scaling_compute_min_instance_size` - (Optional) Minimum instance size to which your cluster can automatically scale (e.g., M10). Required if `autoScaling.compute.scaleDownEnabled` is `true`.
* `provider_auto_scaling_compute_max_instance_size` - (Optional) Maximum instance size to which your cluster can automatically scale (e.g., M40). Required if `autoScaling.compute.enabled` is `true`.

* `replication_specs` - (Optional) Configuration for cluster regions. See [Replication Spec](#replication-spec) below for more details.
* `replication_specs` - Configuration for cluster regions. See [Replication Spec](#replication-spec) below for more details.

### Multi-Region Cluster

Expand Down