This repository contains the Atlas CLI plugin for Terraform's MongoDB Atlas Provider.
It has the following commands to help with your Terraform configurations:
- clusterToAdvancedCluster: Convert a
mongodbatlas_cluster
Terraform configuration tomongodbatlas_advanced_cluster
(preview provider v2).
Install the Atlas CLI if you haven't done it yet.
Install the plugin by running:
atlas plugin install github.com/mongodb-labs/atlas-cli-plugin-terraform
Note: In order to use the Preview for MongoDB Atlas Provider v2 of mongodbatlas_advanced_cluster
, you need to set the environment variable MONGODB_ATLAS_PREVIEW_PROVIDER_V2_ADVANCED_CLUSTER
to true
.
If you want to convert a Terraform configuration from mongodbatlas_cluster
to mongodbatlas_advanced_cluster
, use the following command:
atlas terraform clusterToAdvancedCluster --file in.tf --output out.tf
you can also use shorter aliases, e.g.:
atlas tf clu2adv -f in.tf -o out.tf
If you want to overwrite the output file if it exists, or even use the same output file as the input file, use the --replaceOutput true
or the -r
flag.
You can use the --watch true
or the -w
flag to keep the plugin running and watching for changes in the input file. You can have input and output files open in an editor and see easily how changes to the input file affect the output file.
- The plugin doesn't support
regions_config
withoutelectable_nodes
as there can be some issues withpriority
when they only haveanalytics_nodes
and/orelectable_nodes
. priority
is required inregions_config
and must be a numeric literal expression between 7 and 1, e.g.var.priority
is not supported. This is to allow reordering them by descending priority as this is expected inmongodbatlas_advanced_cluster
.num_shards
inreplication_specs
must be a numeric literal expression, e.g.var.num_shards
is not supported. This is to allow creating areplication_specs
element per shard inmongodbatlas_advanced_cluster
.dynamic
blocks to generatereplication_specs
,regions_config
, etc. are not supported.
See our CONTRIBUTING.md guide.
MongoDB Atlas CLI is released under the Apache 2.0 license. See LICENSE.md