Skip to content

Commit

Permalink
feat: Support Independent Shard Scaling in advanced_cluster (#2492)
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinBettati authored Aug 13, 2024
2 parents 68244f2 + 47aeb06 commit 35faac0
Show file tree
Hide file tree
Showing 71 changed files with 5,091 additions and 1,064 deletions.
11 changes: 11 additions & 0 deletions .changelog/2420.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:note
resource/mongodbatlas_advanced_cluster: Deprecates `replication_specs.#.id`, `replication_specs.#.num_shards`, `disk_size_gb`, `advanced_configuration.0.default_read_concern`, and `advanced_configuration.0.fail_index_key_too_long`. To learn more, see the [1.18.0 Migration Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/1.18.0-upgrade-guide).
```

```release-note:note
data-source/mongodbatlas_advanced_cluster: Deprecates `replication_specs.#.id`, `replication_specs.#.num_shards`, `disk_size_gb`, `advanced_configuration.0.default_read_concern`, and `advanced_configuration.0.fail_index_key_too_long`. To learn more, see the [1.18.0 Migration Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/1.18.0-upgrade-guide).
```

```release-note:note
data-source/mongodbatlas_advanced_clusters: Deprecates `replication_specs.#.id`, `replication_specs.#.num_shards`, `disk_size_gb`, `advanced_configuration.0.default_read_concern`, and `advanced_configuration.0.fail_index_key_too_long`. To learn more, see the [1.18.0 Migration Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/1.18.0-upgrade-guide).
```
11 changes: 11 additions & 0 deletions .changelog/2450.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:note
resource/mongodbatlas_cluster: Deprecates resource in favour of `mongodbatlas_advanced_cluster`
```

```release-note:note
data-source/mongodbatlas_cluster: Deprecates data source in favour of `mongodbatlas_advanced_cluster`
```

```release-note:note
data-source/mongodbatlas_clusters: Deprecates data source in favour of `mongodbatlas_advanced_clusters`
```
3 changes: 3 additions & 0 deletions .changelog/2459.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/mongodbatlas_cloud_backup_schedule: Adds `copy_settings.#.zone_id` and deprecates `copy_settings.#.replication_spec_id` for referencing zones of a cluster. This enables referencing zones of clusters using independent shard scaling which no longer support `replication_spec.*.id`.
```
4 changes: 4 additions & 0 deletions .changelog/2464.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

```release-note:enhancement
data-source/mongodbatlas_cloud_backup_schedule: Adds new `use_zone_id_for_copy_settings` and `copy_settings.#.zone_id` attributes and deprecates `copy_settings.#.replication_spec_id`. These new attributes enable you to reference cluster zones using independent shard scaling, which no longer supports `replication_spec.*.id`
```
19 changes: 19 additions & 0 deletions .changelog/2478.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```release-note:enhancement
resource/mongodbatlas_advanced_cluster: Supports defining cluster shards with independent `replication_specs` objects. This feature enables defining independent scaled shards. To learn more, see the [Advanced Cluster New Sharding Schema Migration Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/advanced-cluster-new-sharding-schema).
```

```release-note:note
resource/mongodbatlas_advanced_cluster: Using this new version impacts the possibility of editing the definition of multi shard clusters in the Atlas UI. This impact is limited to the first weeks of August.
```

```release-note:enhancement
resource/mongodbatlas_advanced_cluster: Adds `replication_specs.*.zone_id` and `replication_specs.*.region_configs.*.(electable_specs|analytics_specs|read_only_specs).disk_size_gb` attributes. To learn more, see the [1.18.0 Migration Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/1.18.0-upgrade-guide) and resource documentation.
```

```release-note:enhancement
data-source/mongodbatlas_advanced_cluster: Adds `use_replication_spec_per_shard`, `replication_specs.*.zone_id`, and `replication_specs.*.region_configs.*.(electable_specs|analytics_specs|read_only_specs).disk_size_gb` attributes. To learn more, see the [1.18.0 Migration Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/1.18.0-upgrade-guide) and data source documentation.
```

```release-note:enhancement
data-source/mongodbatlas_advanced_clusters: Adds `use_replication_spec_per_shard`, `replication_specs.*.zone_id`, and `replication_specs.*.region_configs.*.(electable_specs|analytics_specs|read_only_specs).disk_size_gb` attributes. To learn more, see the [1.18.0 Migration Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/1.18.0-upgrade-guide) and data source documentation.
```
60 changes: 53 additions & 7 deletions docs/data-sources/advanced_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,54 @@ data "mongodbatlas_advanced_cluster" "example" {
}
```

## Example using latest sharding schema with independent shard scaling in the cluster

```terraform
resource "mongodbatlas_advanced_cluster" "example" {
project_id = "<YOUR-PROJECT-ID>"
name = "cluster-test"
backup_enabled = false
cluster_type = "SHARDED"
replication_specs { # Sharded cluster with 2 asymmetric shards (M30 and M40)
region_configs {
electable_specs {
instance_size = "M30"
disk_iops = 3000
node_count = 3
}
provider_name = "AWS"
priority = 7
region_name = "EU_WEST_1"
}
}
replication_specs {
region_configs {
electable_specs {
instance_size = "M40"
disk_iops = 3000
node_count = 3
}
provider_name = "AWS"
priority = 7
region_name = "EU_WEST_1"
}
}
}
data "mongodbatlas_advanced_cluster" "example" {
project_id = mongodbatlas_advanced_cluster.example.project_id
name = mongodbatlas_advanced_cluster.example.name
use_replication_spec_per_shard = true
}
```

## Argument Reference

* `project_id` - (Required) The unique ID for the project to create the database user.
* `name` - (Required) Name of the cluster as it appears in Atlas. Once the cluster is created, its name cannot be changed.
* `use_replication_spec_per_shard` - (Optional) Set this field to true to allow the data source to use the latest schema representing each shard with an individual `replication_specs` object. This enables representing clusters with independent shard scaling.

## Attributes Reference

Expand All @@ -47,13 +91,13 @@ In addition to all arguments above, the following attributes are exported:
* `id` - The cluster ID.
* `bi_connector_config` - Configuration settings applied to BI Connector for Atlas on this cluster. See [below](#bi_connector_config). **NOTE** Prior version of provider had parameter as `bi_connector`
* `cluster_type` - Type of the cluster that you want to create.
* `disk_size_gb` - Capacity, in gigabytes, of the host's root volume.
* `disk_size_gb` - Capacity, in gigabytes, of the host's root volume. **(DEPRECATED)** Use `replication_specs.#.region_config.#.(analytics_specs|electable_specs|read_only_specs).disk_size_gb` instead. To learn more, see the [Migration Guide](../guides/1.18.0-upgrade-guide.html.markdown).
* `encryption_at_rest_provider` - Possible values are AWS, GCP, AZURE or NONE.
* `tags` - Set that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the cluster. See [below](#tags).
* `labels` - Set that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the cluster. See [below](#labels). **DEPRECATED** Use `tags` instead.
* `labels` - Set that contains key-value pairs between 1 to 255 characters in length for tagging and categorizing the cluster. See [below](#labels). **(DEPRECATED.)** Use `tags` instead.
* `mongo_db_major_version` - Version of the cluster to deploy.
* `pit_enabled` - Flag that indicates if the cluster uses Continuous Cloud Backup.
* `replication_specs` - Configuration for cluster regions and the hardware provisioned in them. See [below](#replication_specs).
* `replication_specs` - List of settings that configure your cluster regions. If `use_replication_spec_per_shard = true`, this array has one object per shard representing node configurations in each shard. For replica sets there is only one object representing node configurations. See [below](#replication_specs).
* `root_cert_type` - Certificate Authority that MongoDB Atlas clusters use.
* `termination_protection_enabled` - Flag that indicates whether termination protection is enabled on the cluster. If set to true, MongoDB Cloud won't delete the cluster. If set to false, MongoDB Cloud will delete the cluster.
* `version_release_system` - Release cadence that Atlas uses for this cluster.
Expand Down Expand Up @@ -90,10 +134,11 @@ Key-value pairs that categorize the cluster. Each key and value has a maximum le

### replication_specs

* `num_shards` - Provide this value if you set a `cluster_type` of SHARDED or GEOSHARDED.
* `num_shards` - Provide this value if you set a `cluster_type` of `SHARDED` or `GEOSHARDED`. **(DEPRECATED.)** To learn more, see the [Migration Guide](../guides/1.18.0-upgrade-guide.html.markdown).
* `region_configs` - Configuration for the hardware specifications for nodes set for a given regionEach `region_configs` object describes the region's priority in elections and the number and type of MongoDB nodes that Atlas deploys to the region. Each `region_configs` object must have either an `analytics_specs` object, `electable_specs` object, or `read_only_specs` object. See [below](#region_configs)
* `container_id` - A key-value map of the Network Peering Container ID(s) for the configuration specified in `region_configs`. The Container ID is the id of the container either created programmatically by the user before any clusters existed in a project or when the first cluster in the region (AWS/Azure) or project (GCP) was created. The syntax is `"providerName:regionName" = "containerId"`. Example `AWS:US_EAST_1" = "61e0797dde08fb498ca11a71`.
* `zone_name` - Name for the zone in a Global Cluster.
* `zone_id` - Unique 24-hexadecimal digit string that identifies the zone in a Global Cluster. If clusterType is GEOSHARDED, this value indicates the zone that the given shard belongs to and can be used to configure Global Cluster backup policies.


### region_configs
Expand All @@ -110,12 +155,13 @@ Key-value pairs that categorize the cluster. Each key and value has a maximum le

### specs

* `disk_iops` - Target throughput (IOPS) desired for AWS storage attached to your cluster.
* `disk_iops` - Target IOPS (Input/Output Operations Per Second) desired for storage attached to this hardware. This parameter defaults to the cluster tier's standard IOPS value.
* `ebs_volume_type` - Type of storage you want to attach to your AWS-provisioned cluster.
* `STANDARD` volume types can't exceed the default IOPS rate for the selected volume size.
* `PROVISIONED` volume types must fall within the allowable IOPS range for the selected volume size.
* `instance_size` - Hardware specification for the instance sizes in this region.
* `node_count` - Number of nodes of the given type for MongoDB Atlas to deploy to the region.
* `disk_size_gb` - Storage capacity that the host's root volume possesses expressed in gigabytes. If disk size specified is below the minimum (10 GB), this parameter defaults to the minimum disk size value. Storage charge calculations depend on whether you choose the default value or a custom value. The maximum value for disk storage cannot exceed 50 times the maximum RAM for the selected cluster. If you require more storage space, consider upgrading your cluster to a higher tier.

### auto_scaling

Expand All @@ -134,9 +180,9 @@ Key-value pairs that categorize the cluster. Each key and value has a maximum le
* `compute_max_instance_size` - Maximum instance size to which your cluster can automatically scale (such as M40).
#### Advanced Configuration

* `default_read_concern` - [Default level of acknowledgment requested from MongoDB for read operations](https://docs.mongodb.com/manual/reference/read-concern/) set for this cluster. MongoDB 4.4 clusters default to [available](https://docs.mongodb.com/manual/reference/read-concern-available/).
* `default_read_concern` - [Default level of acknowledgment requested from MongoDB for read operations](https://docs.mongodb.com/manual/reference/read-concern/) set for this cluster. MongoDB 4.4 clusters default to [available](https://docs.mongodb.com/manual/reference/read-concern-available/). **(DEPRECATED.)** MongoDB 5.0 and later clusters default to `local`. To use a custom read concern level, please refer to your driver documentation.
* `default_write_concern` - [Default level of acknowledgment requested from MongoDB for write operations](https://docs.mongodb.com/manual/reference/write-concern/) set for this cluster. MongoDB 4.4 clusters default to [1](https://docs.mongodb.com/manual/reference/write-concern/).
* `fail_index_key_too_long` - When true, documents can only be updated or inserted if, for all indexed fields on the target collection, the corresponding index entries do not exceed 1024 bytes. When false, mongod writes documents that exceed the limit but does not index them.
* `fail_index_key_too_long` - When true, documents can only be updated or inserted if, for all indexed fields on the target collection, the corresponding index entries do not exceed 1024 bytes. When false, mongod writes documents that exceed the limit but does not index them. **(DEPRECATED.)** This parameter has been removed as of [MongoDB 4.4](https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.failIndexKeyTooLong).
* `javascript_enabled` - When true, the cluster allows execution of operations that perform server-side executions of JavaScript. When false, the cluster disables execution of those operations.
* `minimum_enabled_tls_protocol` - Sets the minimum Transport Layer Security (TLS) version the cluster accepts for incoming connections.Valid values are:

Expand Down
Loading

0 comments on commit 35faac0

Please sign in to comment.