Skip to content

Commit 4694c60

Browse files
lantolimarcosuma
andauthored
doc: Docs improvements for preview provider 2.0.0 (#3147)
* TF format * reference migration guide in Move section * start best-practices * typo * resource doc changes * fix link * refactor doc changes. * revert some copied changes. * minor fix. * small changes * apply feedback * changelog * changelog mention * aws lambda mention * change aws lambda mention * add recommendation in adv_config * get back current cluster note --------- Co-authored-by: Marco Suma <[email protected]>
1 parent 3b542ee commit 4694c60

File tree

4 files changed

+168
-14
lines changed

4 files changed

+168
-14
lines changed

.changelog/3147.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
```release-note:enhancement
2+
resource/mongodbatlas_advanced_cluster: Available as Preview of MongoDB Atlas Provider 2.0.0
3+
```
4+
5+
```release-note:enhancement
6+
data-source/mongodbatlas_advanced_cluster: Available as Preview of MongoDB Atlas Provider 2.0.0
7+
```
8+
9+
```release-note:enhancement
10+
data-source/mongodbatlas_advanced_clusters: Available as Preview of MongoDB Atlas Provider 2.0.0
11+
```

docs/guides/1.29.0-upgrade-guide.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ The Terraform MongoDB Atlas Provider version 1.29.0 has a number of new and exci
1212
- If you are already using `mongodbatlas_advanced_cluster`, you can continue doing so with no changes.
1313
- If you need to migrate from `mongodbatlas_cluster` to `mongodbatlas_advanced_cluster`, see the [Migration Guide: Cluster to Advanced Cluster](cluster-to-advanced-cluster-migration-guide).
1414

15+
- You can now use AWS Lambda connections with the `mongodbatlas_stream_connection` resource. To learn more, see the [mongodbatlas_stream_connection](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/stream_connection) resource documentation.
16+
17+
1.29.0 also includes general improvements, bug fixes and several key documentation updates. See the [CHANGELOG](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/CHANGELOG.md) for more specific information.
18+
1519
## Helpful Links
1620

1721
* [Report bugs](https://github.com/mongodb/terraform-provider-mongodbatlas/issues)

docs/resources/advanced_cluster (preview provider 2.0.0).md

Lines changed: 81 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ replication_specs {
3838
}
3939
```
4040
goes to:
41-
```
41+
```terraform
4242
replication_specs = [
4343
{
4444
region_configs = [
@@ -137,7 +137,7 @@ The process to migrate from current `mongodbatlas_advanced_cluster` to the one i
137137

138138
## Important notes
139139

140-
More information on considerations for using advanced clusters please see [Considerations](https://docs.atlas.mongodb.com/reference/api/cluster-advanced/create-one-cluster-advanced/#considerations)
140+
Please refer to our [Considerations and Best Practices](#considerations-and-best-practices) section for additional guidance on this resource.
141141

142142
~> **IMPORTANT:** We recommend all new MongoDB Atlas Terraform users start with the [`mongodbatlas_advanced_cluster`](advanced_cluster) resource. Key differences between [`mongodbatlas_cluster`](cluster) and [`mongodbatlas_advanced_cluster`](advanced_cluster) include support for [Multi-Cloud Clusters](https://www.mongodb.com/blog/post/introducing-multicloud-clusters-on-mongodb-atlas), [Asymmetric Sharding](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/advanced-cluster-new-sharding-schema), and [Independent Scaling of Analytics Node Tiers](https://www.mongodb.com/blog/post/introducing-ability-independently-scale-atlas-analytics-node-tiers). For existing [`mongodbatlas_cluster`](cluster) resource users see our [Migration Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/cluster-to-advanced-cluster-migration-guide).
143143

@@ -616,7 +616,7 @@ This parameter defaults to false.
616616
* `mongo_db_major_version` - (Optional) Version of the cluster to deploy. Atlas supports all the MongoDB versions that have **not** reached [End of Live](https://www.mongodb.com/legal/support-policy/lifecycles) for M10+ clusters. If omitted, Atlas deploys the cluster with the default version. For more details, see [documentation](https://www.mongodb.com/docs/atlas/reference/faq/database/#which-versions-of-mongodb-do-service-clusters-use-). Atlas always deploys the cluster with the latest stable release of the specified version. If you set a value to this parameter and set `version_release_system` `CONTINUOUS`, the resource returns an error. Either clear this parameter or set `version_release_system`: `LTS`.
617617
* `pinned_fcv` - (Optional) Pins the Feature Compatibility Version (FCV) to the current MongoDB version with a provided expiration date. To unpin the FCV the `pinned_fcv` attribute must be removed. This operation can take several minutes as the request processes through the MongoDB data plane. Once FCV is unpinned it will not be possible to downgrade the `mongo_db_major_version`. It is advised that updates to `pinned_fcv` are done isolated from other cluster changes. If a plan contains multiple changes, the FCV change will be applied first. If FCV is unpinned past the expiration date the `pinned_fcv` attribute must be removed. The following [knowledge hub article](https://kb.corp.mongodb.com/article/000021785/) and [FCV documentation](https://www.mongodb.com/docs/atlas/tutorial/major-version-change/#manage-feature-compatibility--fcv--during-upgrades) can be referenced for more details. See [below](#pinned_fcv).
618618
* `pit_enabled` - (Optional) Flag that indicates if the cluster uses Continuous Cloud Backup.
619-
* `replication_specs` - List of settings that configure your cluster regions. This attribute has one object per shard representing node configurations in each shard. For replica sets there is only one object representing node configurations. If for each replication_spec `num_shards` is configured with a value greater than 1 (using deprecated sharding configurations), then each object represents a zone with one or more shards. See [below](#replication_specs)
619+
* `replication_specs` - List of settings that configure your cluster regions. This attribute has one object per shard representing node configurations in each shard. For replica sets there is only one object representing node configurations. If for each `replication_specs` a `num_shards` is configured with a value greater than 1 (using deprecated sharding configurations), then each object represents a zone with one or more shards. The `replication_specs` configuration for all shards within the same zone must be the same, with the exception of `instance_size` and `disk_iops` that can scale independently. Note that independent `disk_iops` values are only supported for AWS provisioned IOPS, or Azure regions that support Extended IOPS. See [below](#replication_specs).
620620
* `root_cert_type` - (Optional) - Certificate Authority that MongoDB Atlas clusters use. You can specify ISRGROOTX1 (for ISRG Root X1).
621621
* `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.
622622
* `version_release_system` - (Optional) - Release cadence that Atlas uses for this cluster. This parameter defaults to `LTS`. If you set this field to `CONTINUOUS`, you must omit the `mongo_db_major_version` field. Atlas accepts:
@@ -662,7 +662,7 @@ bi_connector_config = {
662662

663663
-> **NOTE:** Prior to setting these options please ensure you read https://docs.atlas.mongodb.com/cluster-config/additional-options/.
664664

665-
-> **NOTE:** This argument has been changed to type list make sure you have the proper syntax. The list can have only one item maximum.
665+
-> **NOTE:** Once you set some `advanced_configuration` attributes, we recommended to explicitly set those attributes to their intended value instead of removing them from the configuration. For example, if you set `javascript_enabled` to `false`, and later you want to go back to the default value (true), you must set it back to `true` instead of removing it.
666666

667667
Include **desired options** within advanced_configuration:
668668

@@ -677,13 +677,11 @@ Include **desired options** within advanced_configuration:
677677
* `default_read_concern` - (Optional) [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.
678678
* `default_write_concern` - (Optional) [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/).
679679
* `fail_index_key_too_long` - (Optional) 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).
680-
* `javascript_enabled` - (Optional) When true, the cluster allows execution of operations that perform server-side executions of JavaScript. When false, the cluster disables execution of those operations.
680+
* `javascript_enabled` - (Optional) When true (default), the cluster allows execution of operations that perform server-side executions of JavaScript. When false, the cluster disables execution of those operations.
681681
* `minimum_enabled_tls_protocol` - (Optional) Sets the minimum Transport Layer Security (TLS) version the cluster accepts for incoming connections. Valid values are:
682-
683682
- TLS1_0
684683
- TLS1_1
685684
- TLS1_2
686-
687685
* `no_table_scan` - (Optional) When true, the cluster disables the execution of any query that requires a collection scan to return results. When false, the cluster allows the execution of those operations.
688686
* `oplog_size_mb` - (Optional) The custom oplog size of the cluster. Without a value that indicates that the cluster uses the default oplog size calculated by Atlas.
689687
* `oplog_min_retention_hours` - (Optional) Minimum retention window for cluster's oplog expressed in hours. A value of null indicates that the cluster uses the default minimum oplog window that MongoDB Cloud calculates.
@@ -842,6 +840,7 @@ lifecycle {
842840
ignore_changes = [
843841
replication_specs[0].region_configs[0].electable_specs.disk_size_gb,
844842
replication_specs[0].region_configs[0].electable_specs.instance_size,
843+
replication_specs[0].region_configs[0].electable_specs.disk_iops // instance_size change can affect disk_iops in case that you are using it
845844
]
846845
}
847846
```
@@ -865,6 +864,7 @@ lifecycle {
865864
ignore_changes = [
866865
replication_specs[0].region_configs[0].analytics_specs.disk_size_gb,
867866
replication_specs[0].region_configs[0].analytics_specs.instance_size,
867+
replication_specs[0].region_configs[0].analytics_specs.disk_iops // instance_size change can affect disk_iops in case that you are using it
868868
]
869869
}
870870
```
@@ -941,4 +941,77 @@ moved {
941941
}
942942
```
943943

944-
More information about moving resources can be found in the Terraform documentation [here](https://developer.hashicorp.com/terraform/language/moved) and [here](https://developer.hashicorp.com/terraform/language/modules/develop/refactoring).
944+
More information about moving resources can be found in our [Migration Guide](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/cluster-to-advanced-cluster-migration-guide) and in the Terraform documentation [here](https://developer.hashicorp.com/terraform/language/moved) and [here](https://developer.hashicorp.com/terraform/language/modules/develop/refactoring).
945+
946+
## Considerations and Best Practices
947+
948+
### "known after apply" verbosity
949+
950+
When making changes to your cluster, it is expected that your Terraform plan might show `known after apply` entries in attributes that have not been modified and does not have any side effects. The reason why this is happening is because some of the changes you make can affect other values of the cluster, hence the provider plugin will show the inability to know the future value until MongoDB Atlas provides those value in the response. As an example, a change in `instance_size` can affect `disk_iops`. This behaviour is related to how [Terraform Plugin Framework](https://developer.hashicorp.com/terraform/plugin/framework) behaves when the resource schema makes use of computed attributes.
951+
952+
If you want to reduce the `known after apply` verbosity in Terraform plan output, explicitly declare expected values for those attributes in your configuration where possible. This approach gives Terraform more information upfront, resulting in clearer, more predictable plan output.
953+
954+
### Remove or disable functionality
955+
956+
To disable or remove functionalities, we recommended to explicitly set those attributes to their intended value instead of removing them from the configuration. This will ensure no ambiguity in what the final terraform resource state will be. For example, if you have a `read_only_specs` block in your cluster definition like this one:
957+
```terraform
958+
...
959+
region_configs = [
960+
{
961+
read_only_specs = {
962+
instance_size = "M10"
963+
node_count = 1
964+
}
965+
electable_specs = {
966+
instance_size = "M10"
967+
node_count = 3
968+
}
969+
provider_name = "AWS"
970+
priority = 7
971+
region_name = "US_WEST_1"
972+
}
973+
]
974+
...
975+
```
976+
and your intention is to delete the read-only nodes, you should set the `node_count` attribute to `0` instead of removing the block:
977+
```terraform
978+
...
979+
region_configs = [
980+
{
981+
read_only_specs = {
982+
instance_size = "M10"
983+
node_count = 0
984+
}
985+
electable_specs = {
986+
instance_size = "M10"
987+
node_count = 3
988+
}
989+
provider_name = "AWS"
990+
priority = 7
991+
region_name = "US_WEST_1"
992+
}
993+
]
994+
...
995+
```
996+
Similarly, if you have compute and disk auto-scaling enabled:
997+
```terraform
998+
...
999+
auto_scaling = {
1000+
disk_gb_enabled = true
1001+
compute_enabled = true
1002+
compute_scale_down_enabled = true
1003+
compute_min_instance_size = "M30"
1004+
compute_max_instance_size = "M50"
1005+
}
1006+
...
1007+
```
1008+
and you want to disable them, you should set the `disk_gb_enabled` and `compute_enabled` attributes to `false` instead of removing the block:
1009+
```terraform
1010+
...
1011+
auto_scaling = {
1012+
disk_gb_enabled = false
1013+
compute_enabled = false
1014+
compute_scale_down_enabled = false
1015+
}
1016+
...
1017+
```

0 commit comments

Comments
 (0)