Skip to content

Commit 0ec0ed7

Browse files
committed
update clu2adv doc
1 parent e27d5a4 commit 0ec0ed7

File tree

3 files changed

+19
-50
lines changed

3 files changed

+19
-50
lines changed

README.md

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This repository contains the Atlas CLI plugin for [Terraform's MongoDB Atlas Pro
99
The plugin provides the following commands to help with your Terraform configurations:
1010

1111
### 1. clusterToAdvancedCluster (clu2adv)
12-
Convert `mongodbatlas_cluster` resources to `mongodbatlas_advanced_cluster` format for Provider 2.0.0.
12+
Convert `mongodbatlas_cluster` resources to `mongodbatlas_advanced_cluster` Provider 2.0.0 schema.0.0.
1313

1414
**Quick Start:**
1515
```bash
@@ -18,10 +18,10 @@ atlas terraform clusterToAdvancedCluster --file in.tf --output out.tf
1818
atlas tf clu2adv -f in.tf -o out.tf
1919
```
2020

21-
[📖 Full Documentation](./docs/command_clu2adv.md) | [Dynamic Blocks Guide](./docs/guide_clu2adv_dynamic_block.md)
21+
[📖 Full Documentation](./docs/command_clu2adv.md) | [🔄 Migration Guide: Cluster to Advanced Cluster](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/cluster-to-advanced-cluster-migration-guide)
2222

2323
### 2. advancedClusterToV2 (adv2v2)
24-
Convert legacy `mongodbatlas_advanced_cluster` configurations to the new Provider 2.0.0 format with simplified structure.
24+
Convert previous `mongodbatlas_advanced_cluster` configurations to the new Provider 2.0.0 schema with simplified structure.
2525

2626
**Quick Start:**
2727
```bash
@@ -51,37 +51,6 @@ If you want to see the list of installed plugins or check if this plugin is inst
5151
atlas plugin list
5252
```
5353

54-
## Provider 2.0.0 Preview
55-
56-
**Note**: To use the **Preview for MongoDB Atlas Provider 2.0.0**, set the environment variable:
57-
```bash
58-
export MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER=true
59-
```
60-
61-
## Quick Migration Guide
62-
63-
### From mongodbatlas_cluster to mongodbatlas_advanced_cluster
64-
1. Use `clu2adv` to convert your existing cluster configurations
65-
2. Review the converted output, especially dynamic blocks
66-
3. Test in a development environment
67-
4. Apply to production
68-
69-
[Learn more →](./docs/command_clu2adv.md)
70-
71-
### From Legacy to Provider 2.0.0 Format
72-
1. Use `adv2v2` to update your advanced cluster configurations
73-
2. Verify the flattened `replication_specs` structure
74-
3. Check that `region_configs` is now `config`
75-
4. Test thoroughly before production deployment
76-
77-
[Learn more →](./docs/command_adv2v2.md)
78-
79-
## Examples
80-
81-
Find example conversions in the test data directories:
82-
- [clu2adv examples](https://github.com/mongodb-labs/atlas-cli-plugin-terraform/tree/main/internal/convert/testdata/clu2adv)
83-
- [adv2v2 examples](https://github.com/mongodb-labs/atlas-cli-plugin-terraform/tree/main/internal/convert/testdata/adv2v2)
84-
8554
## Feedback
8655

8756
If you find any issues or have any suggestions, please open an [issue](https://github.com/mongodb-labs/atlas-cli-plugin-terraform/issues) in this repository.
@@ -92,4 +61,4 @@ See our [CONTRIBUTING.md](CONTRIBUTING.md) guide.
9261

9362
## License
9463

95-
MongoDB Atlas CLI is released under the Apache 2.0 license. See [LICENSE.md](LICENSE.md)
64+
MongoDB Atlas CLI is released under the Apache 2.0 license. See [LICENSE.md](LICENSE.md)

docs/command_adv2v2.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Convert mongodbatlas_advanced_cluster to Provider 2.0.0 Format
1+
# Convert mongodbatlas_advanced_cluster to Provider 2.0.0 schema
22

3-
This command helps you migrate `mongodbatlas_advanced_cluster` configurations from the legacy SDKv2 format to the new Provider 2.0.0 format.
3+
advancedClusterToV2 (adv2v2) command helps you migrate previous `mongodbatlas_advanced_cluster` configurations to the new Provider 2.0.0 schema.
44

55
## Background
66

@@ -12,7 +12,7 @@ MongoDB Atlas Provider 2.0.0 introduces a new, cleaner structure for `mongodbatl
1212

1313
## Usage
1414

15-
To convert a Terraform configuration from the legacy `mongodbatlas_advanced_cluster` format to the Provider 2.0.0 format, use the following command:
15+
To convert a Terraform configuration from the previous `mongodbatlas_advanced_cluster` schema to the Provider 2.0.0 schema, use the following command:
1616

1717
```bash
1818
atlas terraform advancedClusterToV2 --file in.tf --output out.tf
@@ -25,9 +25,9 @@ atlas tf adv2v2 -f in.tf -o out.tf
2525

2626
### Command Options
2727

28-
- `--file` or `-f`: Input file path containing the legacy `mongodbatlas_advanced_cluster` configuration
28+
- `--file` or `-f`: Input file path containing the `mongodbatlas_advanced_cluster` configuration
2929
- `--output` or `-o`: Output file path for the converted Provider 2.0.0 configuration
30-
- `--replaceOutput` or `-r`: Overwrite the output file if it exists
30+
- `--replaceOutput` or `-r`: Overwrite the output file if it exists, or even use the same output file as the input file
3131
- `--watch` or `-w`: Keep the plugin running and watching for changes in the input file
3232

3333
## Examples
@@ -454,7 +454,7 @@ replication_specs = concat(
454454

455455
3. **Variable references transformation**: The converter updates variable references (e.g., `replication_specs.value` to `spec`), but complex nested references should be reviewed.
456456

457-
4. **Block ordering**: The Provider 2.0.0 format may handle block ordering differently. Ensure any dependencies on block order are maintained.
457+
4. **Block ordering**: The Provider 2.0.0 schema may handle block ordering differently. Ensure any dependencies on block order are maintained.
458458

459459
### General Limitations
460460

@@ -476,4 +476,4 @@ If you encounter use cases not yet supported, please send us [feedback](https://
476476
You can find more examples of dynamic block conversions in the [test data directory](https://github.com/mongodb-labs/atlas-cli-plugin-terraform/tree/main/internal/convert/testdata/adv2v2), particularly:
477477
- `dynamic_replication_specs.in.tf` / `.out.tf`
478478
- `dynamic_region_configs.in.tf` / `.out.tf`
479-
- `dynamic_tags_labels.in.tf` / `.out.tf`
479+
- `dynamic_tags_labels.in.tf` / `.out.tf`

docs/command_clu2adv.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# Convert mongodbatlas_cluster to mongodbatlas_advanced_cluster
22

3-
This command helps you migrate from `mongodbatlas_cluster` to `mongodbatlas_advanced_cluster` (preview provider 2.0.0).
3+
clusterToAdvancedCluster (clu2adv) command helps you migrate from `mongodbatlas_cluster` to `mongodbatlas_advanced_cluster` Provider 2.0.0 schema.
44

55
## Usage
66

77
You can find more information in the [Migration Guide: Cluster to Advanced Cluster](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/cluster-to-advanced-cluster-migration-guide).
88

9-
**Note**: In order to use the **Preview for MongoDB Atlas Provider 2.0.0** of `mongodbatlas_advanced_cluster`, you need to set the environment variable `MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER` to `true`.
10-
119
If you want to convert a Terraform configuration from `mongodbatlas_cluster` to `mongodbatlas_advanced_cluster`, use the following command:
1210
```bash
1311
atlas terraform clusterToAdvancedCluster --file in.tf --output out.tf
@@ -22,9 +20,9 @@ atlas tf clu2adv -f in.tf -o out.tf
2220

2321
- `--file` or `-f`: Input file path containing the `mongodbatlas_cluster` configuration
2422
- `--output` or `-o`: Output file path for the converted `mongodbatlas_advanced_cluster` configuration
25-
- `--includeMoved` or `-m`: Include the `moved blocks` in the output file
2623
- `--replaceOutput` or `-r`: Overwrite the output file if it exists, or even use the same output file as the input file
2724
- `--watch` or `-w`: Keep the plugin running and watching for changes in the input file
25+
- `--includeMoved` or `-m`: Include the `moved blocks` in the output file
2826

2927
## Examples
3028

@@ -55,7 +53,8 @@ dynamic "tags" {
5553

5654
### Dynamic blocks in regions_config
5755

58-
You can use `dynamic` blocks for `regions_config`. The plugin assumes that `for_each` has an expression which is evaluated to a `list` or `set` of objects. See the [dynamic blocks guide](./guide_clu2adv_dynamic_block.md) to learn more about some limitations.
56+
You can use `dynamic` blocks for `regions_config`. The plugin assumes that `for_each` has an expression which is evaluated to a `list` of objects.
57+
5958
This is an example of how to use dynamic blocks in `regions_config`:
6059
```hcl
6160
replication_specs {
@@ -75,7 +74,8 @@ replication_specs {
7574

7675
### Dynamic blocks in replication_specs
7776

78-
You can use `dynamic` blocks for `replication_specs`. The plugin assumes that `for_each` has an expression which is evaluated to a `list` of objects. See the [dynamic blocks guide](./guide_clu2adv_dynamic_block.md) to learn more about some limitations.
77+
You can use `dynamic` blocks for `replication_specs`. The plugin assumes that `for_each` has an expression which is evaluated to a `list` of objects.
78+
7979
This is an example of how to use dynamic blocks in `replication_specs`:
8080
```hcl
8181
dynamic "replication_specs" {
@@ -102,9 +102,9 @@ If you need to use the plugin for `dynamic` block use cases not yet supported, p
102102

103103
#### Dynamic block and individual blocks in the same resource
104104

105-
Dynamic block and individual blocks for `regions_config` or `replication_specs` are not supported at the same time. The recommended way to handle this is to remove the individual `regions_config` or `replication_specs` blocks and use a local variable to add the individual block information to the variable you're using in the `for_each` expression, using [concat](https://developer.hashicorp.com/terraform/language/functions/concat) if you're using a list or [setunion](https://developer.hashicorp.com/terraform/language/functions/setunion) for sets.
105+
Dynamic block and individual blocks for `regions_config` or `replication_specs` are not supported at the same time. The recommended way to handle this is to remove the individual `regions_config` or `replication_specs` blocks and use a local `list` variable to add the individual block information to the variable you're using in the `for_each` expression, using [concat](https://developer.hashicorp.com/terraform/language/functions/concat).
106106

107-
Let's see an example with `regions_config`, it is the same for `replication_specs`. In the original configuration file, the `mongodb_cluster` resource is used inside a module that receives the `regions_config` elements in a `list` variable and we want to add an additional `region_config` with a read-only node.
107+
Let's see an example with `regions_config`, it is the same idea for `replication_specs`. In the original configuration file, the `mongodb_cluster` resource is used inside a module that receives the `regions_config` elements in a `list` variable and we want to add an additional `regions_config` with a read-only node.
108108
```hcl
109109
variable "replication_specs" {
110110
type = object({

0 commit comments

Comments
 (0)