Skip to content
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

doc: Adds migration guides to transition out of Serverless and Shared-tier clusters #2746

Merged
merged 23 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
78df901
wip: migration guides
oarbusi Oct 29, 2024
5aa2213
add details on 1.22 guide
oarbusi Oct 29, 2024
b4ff40d
remove guide, will be in resource docs
oarbusi Oct 29, 2024
d995b5b
wip: correct details on 1.22 guide
oarbusi Oct 29, 2024
251b8af
added migration guide for serverless to flex and serverless to dedicated
cveticm Oct 30, 2024
946a842
added migration guide for shared-tier to flex
cveticm Oct 31, 2024
026c32e
added migration guide for serverless to free
cveticm Oct 31, 2024
6b43379
implementing review feedback
cveticm Nov 4, 2024
d8e929a
implementing feedback to guide
cveticm Nov 4, 2024
ade2baf
changes to migration guide
cveticm Nov 7, 2024
7ef130c
Adjustments to migration guides
cveticm Nov 8, 2024
2336fa2
put URL instead of placeholder
oarbusi Nov 18, 2024
4a43066
move post before pre autoconversion guides, clarify serverless to ded…
oarbusi Nov 20, 2024
b694469
pr comment
oarbusi Nov 20, 2024
c5f4719
pr comments
oarbusi Nov 20, 2024
80b84ec
Update docs/guides/1.22.0-upgrade-guide.md
oarbusi Nov 20, 2024
a9d5c75
Update docs/guides/serverless-shared-migration-guide.md
oarbusi Nov 20, 2024
619faf2
Update docs/guides/1.22.0-upgrade-guide.md
oarbusi Nov 20, 2024
6fd06e6
Update docs/guides/serverless-shared-migration-guide.md
oarbusi Nov 20, 2024
1a50e3f
Update docs/guides/serverless-shared-migration-guide.md
oarbusi Nov 20, 2024
78ecdde
Update docs/guides/serverless-shared-migration-guide.md
oarbusi Nov 20, 2024
3d2a257
Update docs/guides/serverless-shared-migration-guide.md
oarbusi Nov 21, 2024
e162b5e
Update docs/guides/serverless-shared-migration-guide.md
oarbusi Nov 21, 2024
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
30 changes: 30 additions & 0 deletions docs/guides/1.22.0-upgrade-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
page_title: "Upgrade Guide 1.22.0"
---

# MongoDB Atlas Provider 1.22.0: Upgrade and Information Guide

The Terraform MongoDB Atlas Provider version 1.22.0 has a number of new and exciting features.

## New Resources, Data Sources, and Features

- You can now manage Flex Clusters with the new `mongodbatlas_flex_cluster` resource and corresponding data sources. The feature is available as a preview feature. To learn more, please review `mongodbatlas_flex_cluster` [resource documentation](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/flex_cluster).

## Deprecations and removals

- `continuous_backup_enabled` attribute is deprecated in `mongodbatlas_serverless_instance` resource and data sources. If your workload requires this feature, we recommend switching to Atlas Dedicated clusters. To learn more, see the [Migration Guide: Transition out of Serverless Instances and Shared-tier clusters](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/serverless-shared-migration-guide).
- `auto_indexing` attribute is deprecated in `mongodbatlas_serverless_instance` resource and data sources. If your workload requires this feature, we recommend switching to Atlas Dedicated clusters. To learn more, please see the [Migration Guide: Transition out of Serverless Instances and Shared-tier clusters](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/serverless-shared-migration-guide).
- `mongodbatlas_privatelink_endpoint_serverless` resource is deprecated. If your workload requires this feature, we recommend switching to Atlas Dedicated clusters. To learn more, please see the [Migration Guide: Transition out of Serverless Instances and Shared-tier clusters](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/serverless-shared-migration-guide).
- `mongodbatlas_privatelink_endpoint_service_serverless` resource, `mongodbatlas_privatelink_endpoint_service_serverless` and `mongodbatlas_privatelink_endpoints_service_serverless` data sources are deprecated. If your workload requires this feature, we recommend switching to Atlas Dedicated clusters. To learn more, please see the [Migration Guide: Transition out of Serverless Instances and Shared-tier clusters](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/guides/serverless-shared-migration-guide).

## Terraform MongoDB Atlas modules

You can now leverage our [Terraform Modules](https://registry.terraform.io/namespaces/terraform-mongodbatlas-modules) to easily get started with MongoDB Atlas and critical features like [Push-based log export](https://registry.terraform.io/modules/terraform-mongodbatlas-modules/push-based-log-export/mongodbatlas/latest), [Private Endpoints](https://registry.terraform.io/modules/terraform-mongodbatlas-modules/private-endpoint/mongodbatlas/latest), etc.

## Helpful Links

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

* [Request Features](https://feedback.mongodb.com/forums/924145-atlas?category_id=370723)

* [Contact Support](https://docs.atlas.mongodb.com/support/) covered by MongoDB Atlas support plans, Developer and above.
267 changes: 267 additions & 0 deletions docs/guides/serverless-shared-migration-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
---
page_title: "Migration Guide: Transition out of Serverless Instances and Shared-tier clusters"
---

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting that migration guide for Flex-to-Dedicated will be included as a part of CLOUDP-278908, as noted here.

# Migration Guide: Transition out of Serverless Instances and Shared-tier clusters

The goal of this guide is to help users transition from Serverless Instances and Shared-tier clusters (M2/M5) to Free, Flex or Dedicated Clusters.

Starting in January 2025, all Shared-tier clusters (in both `mongodbatlas_cluster` and `mongodbatlas_advanced_cluster`) will automatically convert to Flex clusters. Similarly, in March 2025 all Serverless instances (`mongodb_serverless_instance`) will be converted into Free/Flex/Dedicated clusters, [depending on your existing configuration](https://www.mongodb.com/docs/atlas/flex-migration/).
If a Serverless instance has $0 MRR, it automatically converts into a Free cluster. Else, if it does not fit the constraints of a Flex cluster, it will convert into a Dedicated cluster, resulting in downtime and workload disruption. Otherwise, it will convert to a Flex cluster.
Some of these conversions will result in configuration drift in Terraform.


You can migrate from Serverless instances and Shared-tier clusters manually before March 2025.
oarbusi marked this conversation as resolved.
Show resolved Hide resolved

**--> NOTE:** We recommend waiting until March 2025 or later for Serverless instances and Shared-tier clusters to autoconvert.

For Shared-tier clusters, we are working on enhancing the User Experience such that Terraform Atlas Providers users can make even fewer required changes to their scripts from what is shown below. More updates to come over the next few months. For more details reach out to: [email protected]

### Jump to:
- [Shared-tier to Flex](#from-shared-tier-clusters-to-flex)
- [Serverless to Free](#from-serverless-to-free)
- [Serverless to Flex](#from-serverless-to-flex)
- [Serverless to Dedicated](#from-serverless-to-dedicated)

## From Shared-tier clusters to Flex

### Post-Autoconversion Migration Procedure

Shared-tier clusters will automatically convert in January 2025 to Flex clusters in Atlas, retaining all data. We recommend to migrate to `mongodbatlas_flex_cluster` resource once the autoconversion is done.

The following steps explain how to move your exising Shared-tier cluster resource to the new `mongodbatlas_flex_cluster` resource and does not affect the underlying cluster infrastructure:

1. Find the import IDs of the Flex clusters: `{PROJECT_ID}-{CLUSTER_NAME}`, such as `664619d870c247237f4b86a6-flexClusterName`
2. Add an import block per cluster to one of your `.tf` files:
```terraform
import {
to = mongodbatlas_flex_cluster.this
id = "664619d870c247237f4b86a6-flexClusterName" # from step 1
}
```
3. Run `terraform plan -generate-config-out=flex_cluster.tf`. This should generate a `flex_cluster.tf` file with your Flex cluster in it.
4. Run `terraform apply`. You should see the resource(s) imported: `Apply complete! Resources: 1 imported, 0 added, 0 changed, 0 destroyed.`
5. Remove the "default" fields. Many fields of this resource are optional. Look for fields with a `null` or `0` value.
6. Re-use existing [Terraform expressions](https://developer.hashicorp.com/terraform/language/expressions). All fields in the generated configuration have static values. Look in your previous configuration for:
- variables, for example: `var.project_id`
- Terraform keywords, for example: `for_each`, `count`, and `depends_on`
7. Update the references from your previous cluster resource: `mongodbatlas_advanced_cluster.this.X` or `mongodbatlas_cluster.this.X` to the new `mongodbatlas_flex_cluster.this.X`.
8. Update any shared-tier data source blocks to refer to `mongodbatlas_flex_cluster`.
9. Replace your existing clusters with the ones from `flex_cluster.tf` and run

`terraform state rm mongodbatlas_advanced_cluster.this`

or `terraform state rm mongodbatlas_cluster.this`.

Without this step, Terraform creates a plan to delete your existing cluster.

10. Remove the import block created in step 2.
11. Re-run `terraform plan` to ensure you have no planned changes: `No changes. Your infrastructure matches the configuration.`

### Pre-Autoconversion Migration Procedure

**NOTE:** We recommend waiting until March 2025 or later for Shared-tier clusters to autoconvert. Manually doing the migration can cause downtime and workload disruption.
oarbusi marked this conversation as resolved.
Show resolved Hide resolved

1. Create a new Flex Cluster directly from your `.tf` file, e.g.:

```terraform
resource "mongodbatlas_flex_cluster" "this" {
project_id = var.project_id
name = "flexClusterName"
provider_settings = {
backing_provider_name = "AWS"
region_name = "US_EAST_1"
}
termination_protection_enabled = true
}
```
2. Run `terraform apply` to create the new resource.
3. Migrate data from your Shared-tier cluster to the Flex cluster using `mongodump` and `mongostore`.

Please see the following guide on how to retrieve data from one cluster and store it in another cluster: [Convert a Serverless Instance to a Dedicated Cluster](https://www.mongodb.com/docs/atlas/tutorial/convert-serverless-to-dedicated/)

Verify that your data is present within the Flex cluster before proceeding.
4. Delete the Shared-tier cluster by running a destroy command against it.

For *mongodbatlas_advanced_cluster*:

`terraform destroy -target=mongodbatlas_advanced_cluster.this`

For *mongodbatlas_cluster*:

`terraform destroy -target=mongodbatlas_cluster.this`

5. Remove the resource block for the Shared-tier cluster from your `.tf` file.

## From Serverless to Free

**Please ensure your Serverless instance meets the following requirements to migrate to Free:**
- $0 MRR

### Post-Autoconversion Migration Procedure
marcosuma marked this conversation as resolved.
Show resolved Hide resolved

Given your Serverless Instance has $0 MRR, it will automatically convert in March 2025 into a Free cluster in Atlas, retaining all data.

The following steps resolve the configuration drift in Terraform without affecting the underlying cluster infrastructure:

1. Find the import IDs of the Free clusters: `{PROJECT_ID}-{CLUSTER_NAME}`, such as `664619d870c247237f4b86a6-freeClusterName`
2. Add an import block per cluster to one of your `.tf` files:
```terraform
import {
to = mongodbatlas_advanced_cluster.this
id = "664619d870c247237f4b86a6-freeClusterName" # from step 1
}
```
3. Run `terraform plan -generate-config-out=free_cluster.tf`. This should generate a `free_cluster.tf` file with your Free cluster in it.
4. Run `terraform apply`. You should see the resource(s) imported: `Apply complete! Resources: 1 imported, 0 added, 0 changed, 0 destroyed.`
5. Remove the "default" fields. Many fields of this resource are optional. Look for fields with a `null` or `0` value.
6. Re-use existing [Terraform expressions](https://developer.hashicorp.com/terraform/language/expressions). All fields in the generated configuration have static values. Look in your previous configuration for:
- variables, for example: `var.project_id`
- Terraform keywords, for example: `for_each`, `count`, and `depends_on`
7. Update the references from your previous cluster resource: `mongodbatlas_serverless_instance.this.X` to the new `mongodbatlas_advanced_cluster.this.X`.
8. Update any shared-tier data source blocks to refer to `mongodbatlas_advanced_cluster`.
9. Replace your existing clusters with the ones from `free_cluster.tf` and run `terraform state rm mongodbatlas_serverless_instance.this`. Without this step, Terraform creates a plan to delete your existing cluster.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we considered the remove+import solution instead?

10. Remove the import block created in step 2.
11. Re-run `terraform plan` to ensure you have no planned changes: `No changes. Your infrastructure matches the configuration.`

### Pre-Autoconversion Migration Procedure

marcosuma marked this conversation as resolved.
Show resolved Hide resolved
**NOTE:** We recommend waiting until March 2025 or later for Serverless instances to autoconvert. Manually doing the migration can cause downtime and workload disruption.

1. Create a new Free Cluster directly from your `.tf` file, e.g.:

```terraform
resource "mongodbatlas_advanced_cluster" "this" {
project_id = var.atlas_project_id
name = "freeClusterName"
cluster_type = "REPLICASET"

replication_specs {
region_configs {
electable_specs {
instance_size = "M0"
}
provider_name = "TENANT"
backing_provider_name = "AWS"
region_name = "US_EAST_1"
priority = 7
}
}
}
```
2. Run `terraform apply` to create the new resource.
3. Migrate data from your Serverless Instance to the Free cluster using `mongodump` and `mongostore`.

Please see the following guide on how to retrieve data from one cluster and store it in another cluster: [Convert a Serverless Instance to a Dedicated Cluster](https://www.mongodb.com/docs/atlas/tutorial/convert-serverless-to-dedicated/)

Verify that your data is present within the Free cluster before proceeding.
4. Delete the Serverless Instance by running a destroy command against the Serverless Instance:

`terraform destroy -target=mongodbatlas_serverless_instance.this`

5. Remove the resource block for the Serverless Instance from your `.tf` file.

## From Serverless to Flex

**Please ensure your Serverless instance meets the following requirements to migrate to Flex:**
- <= 5GB of data
- no privatelink or continuous backup
- < 500 ops/sec consistently.

### Post-Autoconversion Migration Procedure

Given your Serverless Instance fits the constraints of a Flex cluster, it will automatically convert in March 2025 into a Flex cluster in Atlas, retaining all data. We recommend to migrate to `mongodbatlas_flex_cluster` resource once the autoconversion is done.

The following steps explain how to move your exising Serverless instance resource to the new `mongodbatlas_flex_cluster` resource and does not affect the underlying cluster infrastructure:

1. Find the import IDs of the Flex clusters: `{PROJECT_ID}-{CLUSTER_NAME}`, such as `664619d870c247237f4b86a6-flexClusterName`
2. Add an import block per cluster to one of your `.tf` files:
```terraform
import {
to = mongodbatlas_flex_cluster.this
id = "664619d870c247237f4b86a6-flexClusterName" # from step 1
}
```
3. Run `terraform plan -generate-config-out=flex_cluster.tf`. This should generate a `flex_cluster.tf` file with your Flex cluster in it.
4. Run `terraform apply`. You should see the resource(s) imported: `Apply complete! Resources: 1 imported, 0 added, 0 changed, 0 destroyed.`
5. Remove the "default" fields. Many fields of this resource are optional. Look for fields with a `null` or `0` value.
6. Re-use existing [Terraform expressions](https://developer.hashicorp.com/terraform/language/expressions). All fields in the generated configuration have static values. Look in your previous configuration for:
- variables, for example: `var.project_id`
- Terraform keywords, for example: `for_each`, `count`, and `depends_on`
7. Update the references from your previous cluster resource: `mongodbatlas_serverless_instance.this.X` to the new `mongodbatlas_flex_cluster.this.X`.
8. Update any shared-tier data source blocks to refer to `mongodbatlas_flex_cluster`.
9. Replace your existing clusters with the ones from `flex_cluster.tf` and run `terraform state rm mongodbatlas_serverless_instance.this`. Without this step, Terraform creates a plan to delete your existing cluster.
10. Remove the import block created in step 2.
11. Re-run `terraform plan` to ensure you have no planned changes: `No changes. Your infrastructure matches the configuration.`

### Pre-Autoconversion Migration Procedure

**NOTE:** We recommend waiting until March 2025 or later for Serverless instances to autoconvert. Manual migration can cause downtime and workload disruption.

1. Create a new Flex Cluster directly from your `.tf` file, e.g.:

```terraform
resource "mongodbatlas_flex_cluster" "this" {
project_id = var.project_id
name = "flexClusterName"
provider_settings = {
backing_provider_name = "AWS"
region_name = "US_EAST_1"
}
termination_protection_enabled = true
}
```
2. Run `terraform apply` to create the new resource.
3. Migrate data from your Serverless Instance to the Flex cluster using `mongodump` and `mongostore`.

Please see the following guide on how to retrieve data from one cluster and store it in another cluster: [Convert a Serverless Instance to a Dedicated Cluster](https://www.mongodb.com/docs/atlas/tutorial/convert-serverless-to-dedicated/)

Verify that your data is present within the Flex cluster before proceeding.
4. Delete the Serverless Instance by running a destroy command against it:

`terraform destroy -target=mongodbatlas_serverless_instance.this`

5. You may now safely remove the resource block for the Serverless Instance from your `.tf` file.
cveticm marked this conversation as resolved.
Show resolved Hide resolved

## From Serverless to Dedicated

**Please note your Serverless instance will need to migrate to Decidated if it meets the following requirements:**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

official doc

- \>= 5GB of data
- needs privatelink or continuous backup
- \> 500 ops/sec consistently.

You cannot migrate from Serverless to Dedicated using the Terraform provider.

### Pre-Autoconversion Migration Procedure
marcosuma marked this conversation as resolved.
Show resolved Hide resolved
marcosuma marked this conversation as resolved.
Show resolved Hide resolved

**NOTE:** In early 2025, we will release a UI-based tool for migrating your workloads from Serverless instances to Dedicated clusters. This tool will ensure correct migration with little downtime. You won't need to change connection strings.

To migrate from Serverless to Dedicated prior to early 2025, please see the following guide: [Convert a Serverless Instance to a Dedicated Cluster](https://www.mongodb.com/docs/atlas/tutorial/convert-serverless-to-dedicated/). **NOTE:** Manual migration can cause downtime and workload disruption.

### Post-Autoconversion Migration Procedure

**NOTE:** Auto-conversion from Serverless to Dedicated will cause downtime and workload disruption. This guide is only valid after the auto-conversion is done.

Given your Serverless Instance doesn't fit the constraints of a Flex cluster, it will automatically convert in March 2025 into a Dedicated cluster in Atlas, retaining all data.
marcosuma marked this conversation as resolved.
Show resolved Hide resolved

The following steps resolve the configuration drift in Terraform and does not affect the underlying cluster infrastructure:

1. Find the import IDs of the Dedicated clusters: `{PROJECT_ID}-{CLUSTER_NAME}`, such as `664619d870c247237f4b86a6-advancedClusterName`
2. Add an import block per cluster to one of your `.tf` files:
```terraform
import {
to = mongodbatlas_advanced_cluster.this
id = "664619d870c247237f4b86a6-advancedClusterName" # from step 1
}
```
3. Run `terraform plan -generate-config-out=dedicated_cluster.tf`. This should generate a `dedicated_cluster.tf` file with your Dedicated cluster in it.
4. Run `terraform apply`. You should see the resource(s) imported: `Apply complete! Resources: 1 imported, 0 added, 0 changed, 0 destroyed.`
5. Remove the "default" fields. Many fields of this resource are optional. Look for fields with a `null` or `0` value.
6. Re-use existing [Terraform expressions](https://developer.hashicorp.com/terraform/language/expressions). All fields in the generated configuration have static values. Look in your previous configuration for:
- variables, for example: `var.project_id`
- Terraform keywords, for example: `for_each`, `count`, and `depends_on`
7. Update the references from your previous cluster resource: `mongodbatlas_serverless_instance.this.X` to the new `mongodbatlas_advanced_cluster.this.X`.
8. Update any shared-tier data source blocks to refer to `mongodbatlas_advanced_cluster`.
9. Replace your existing clusters with the ones from `dedicated_cluster.tf` and run `terraform state rm mongodbatlas_serverless_instance.this`. Without this step, Terraform creates a plan to delete your existing cluster.
10. Remove the import block created in step 2.
11. Re-run `terraform plan` to ensure you have no planned changes: `No changes. Your infrastructure matches the configuration.`