Skip to content

Commit 1343855

Browse files
martinstibbemaasthaandreaangiolilloZuhairahmedevertsd
authored
Release staging v.1.10.0 (#1225)
* fix: microsoft_teams_webhook_url keeps updating on every apply (#1148) * INTMDB-783: Point in Time Restore is not enabled when should_copy_oplogs is set to true, when copying backups to other regions (#1150) * Rebase v1.10.0 (#1156) * INTMDB-710: Serverless Instance wants to do an in-place update on every run (#1152) * INTMDB-694: Add PrivateEndpoint.srvShardOptimizedConnectionString to cluster (#1157) * INTMDB-780: analyzer argument in Atlas search index is required (issue #1132) (#1158) * INTMDB-809: upgrade atlas go-client to v0.26.0 (#1164) * INTMDB-809: upgrade atlas go-client * Update go.mod * remain doc updates * INTMDB-801: [Terraform] Create new TF Federated Database Instance resources and data sources (#1163) * INTMDB-408: Remove Deprecated Resources - cloud_provider resources, private_ip_mode, NEW_RELIC and FLOWDOCK in third_party_integration resource (#1159) * Remove deprecated resources * Deprecate additional related resource parameters * Add log message * Remove mongodbatlas_private_ip_mode * Add Full deprecation notice to Docs * more doc updates --------- Co-authored-by: Zuhair Ahmed <[email protected]> * INTMDB-466 - Added is_extended_storage_sizes_enabled (#1128) * Added is_extended_storage_sizes enabled * Fixed lint complaints * INTMDB-834: Address Follow Up comments in INTMDB-804 (#1181) * node_count docs update * INTMDB-804: [Terraform] Create new TF Data Lake Pipelines resource and data sources. (#1174) * INTMDB-805: [Terraform] Create new TF Data Lake Pipelines Run data sources only (not resource) (#1177) * INTMDB-803: [Terraform] Create a new Private Endpoint resource and data sources which supports Federated Database Instance and Online Archive (#1182) * INTMDB-806: Deprecate "mongodbatlas_data_lake" and "privatelink_endpoint_service_adl" (#1190) * Make aws field optional in federated_database_instance resource and upgrade aws provider (#1205) * INTMDB-835: Create resource mongodbatlas_cluster_outage_simulation (#1188) * Fix typos in docs for network peering resource imports (#1200) * Remove delete from create update (#1209) * INTMDB-781: [Terraform] Parameter Add: retainBackups in Cluster and Advanced_Cluster (#1210) * INTMDB-856: Add cloudProviderConfig to mongodbatlas_federated_database_instance (#1215) * INTMDB-655: PAK Resource Updates + Doc Cleanup + Deprecation Warnings (#1208) * Add project_assignment feature to permit assigning multiple projects to an API key * Add deprecation * lint * Add examples for project and org API key * Add additional multi project example * Update versions.tf * Add deprecation message create function to remove duplicated code * lint * Add new deprecation message * Bump terraform version * Update project_api_key.html.markdown * Update project.html.markdown * Update docs * Add validation of project_assignment parameter * Create README.md * Update README.md * Create PAK-upgrade-guide-1.10.0.html.markdown * Update PAK-upgrade-guide-1.10.0.html.markdown * Update project_api_key.html.markdown * Update website/docs/r/access_list_api_key.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/d/access_list_api_key.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update examples/atlas-api-key/create-and-assign-pak-together/README.md Co-authored-by: zach-carr <[email protected]> * Update examples/atlas-api-key/create-api-key-assign-to-multiple-projects/README.md Co-authored-by: zach-carr <[email protected]> * Update examples/atlas-api-key/README.md Co-authored-by: zach-carr <[email protected]> * Update website/docs/r/project.html.markdown Co-authored-by: Zuhair Ahmed <[email protected]> * Update examples/atlas-api-key/create-and-assign-pak-seperately/README.md Co-authored-by: zach-carr <[email protected]> * Update examples/atlas-api-key/create-and-assign-pak-seperately/README.md Co-authored-by: Zuhair Ahmed <[email protected]> * Update examples/atlas-api-key/create-and-assign-pak-seperately/README.md Co-authored-by: zach-carr <[email protected]> * Add additional deprecation note * Update README.md * Bump up SDK to v0.29.0 * Update README.md More details to Readme explaining that all API keys are Organization Keys to help users --------- Co-authored-by: Zuhair Ahmed <[email protected]> Co-authored-by: Melissa Plunkett <[email protected]> Co-authored-by: zach-carr <[email protected]> * INTMDB-533: Feature Add: Programmatically Create Organizations (#1176) * Initial version * Acceptance testing issue for org creation * Add initial examples of org creation * skip tests for moment on organization resource * Add documentation * typo * terraform fmt * lint * go mod tidy * Documentation updates PR feedback * update TF version * Update variables.tf * Add additional Readme to show how to apply 2 step example * Update docs * Update examples/atlas-organization/Readme.md Co-authored-by: Zuhair Ahmed <[email protected]> * Update examples/atlas-organization/Readme.md * Update examples/atlas-organization/organization-step-1/Readme.md * Update examples/atlas-organization/organization-step-2/Readme.md Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/organization.html.markdown * Update website/docs/d/organizations.html.markdown * Update go SDK add Org Update * Fix broken tests * Add isDeleted * Update go.sum --------- Co-authored-by: Zuhair Ahmed <[email protected]> Co-authored-by: Melissa Plunkett <[email protected]> * INTMDB-802: Create new TF Data Federation Query Limit resource and data sources (#1173) * INTMDB-802: Add data_source and resource for Federated Database Query Limit * INTMDB-802: update provider.go * INTMDB-802: Add AtlasDataFederation Query Limit resource * INTMDB-802: Add AtlasDataFederation Query Limit resource * Update data_source_mongodbatlas_federated_query_limit.go * Update resource_mongodbatlas_federated_query_limit.go * INTMDB-802: temp * INTMDB-802: Add example * INTMDB-802: Add example * INTMDB-802: minor * INTMDB-802: example fix * Acceptance tests * Acceptance tests * Fix docs * Update main.tf * Update mongodbatlas/resource_mongodbatlas_federated_query_limit.go Co-authored-by: Andrea Angiolillo <[email protected]> * Update mongodbatlas/resource_mongodbatlas_federated_query_limit.go Co-authored-by: Andrea Angiolillo <[email protected]> * Update mongodbatlas/data_source_mongodbatlas_federated_query_limit.go Co-authored-by: Andrea Angiolillo <[email protected]> * Update mongodbatlas/resource_mongodbatlas_federated_query_limit.go Co-authored-by: Andrea Angiolillo <[email protected]> * Update mongodbatlas/resource_mongodbatlas_federated_query_limit.go Co-authored-by: Andrea Angiolillo <[email protected]> * Update website/docs/d/federated_query_limit.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/d/federated_query_limit.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/federated_query_limit.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/federated_query_limit.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/federated_query_limit.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/d/federated_query_limits.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/federated_query_limit.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update federated_query_limit.html.markdown * Update federated_query_limit.html.markdown * Address PR comments * Address PR comments * Update website/docs/d/federated_query_limit.html.markdown Co-authored-by: Zuhair Ahmed <[email protected]> * Update website/docs/d/federated_query_limits.html.markdown Co-authored-by: Zuhair Ahmed <[email protected]> * Update examples/federated-database-query-limit/README.md Co-authored-by: Zuhair Ahmed <[email protected]> * Update examples/federated-database-query-limit/README.md Co-authored-by: Zuhair Ahmed <[email protected]> * Update examples/federated-database-query-limit/README.md Co-authored-by: Zuhair Ahmed <[email protected]> * Update federated_query_limit.html.markdown * Update federated_query_limits.html.markdown * Update README.md * Address PR comments * Address PR comments * Apply suggestions from code review Co-authored-by: zach-carr <[email protected]> * INTMDB-805: [Terraform] Create new TF Data Lake Pipelines Run data sources only (not resource) (#1177) * INTMDB-803: [Terraform] Create a new Private Endpoint resource and data sources which supports Federated Database Instance and Online Archive (#1182) * Fix AWS provider version and example * updated federated instance * Addressed Comments * Update mongodbatlas/data_source_mongodbatlas_federated_query_limits.go Co-authored-by: Andrea Angiolillo <[email protected]> * Update data_source_mongodbatlas_federated_query_limits.go --------- Co-authored-by: Andrea Angiolillo <[email protected]> Co-authored-by: Melissa Plunkett <[email protected]> Co-authored-by: Zuhair Ahmed <[email protected]> Co-authored-by: zach-carr <[email protected]> * Update .github_changelog_generator * Update CHANGELOG.md --------- Co-authored-by: maastha <[email protected]> Co-authored-by: Andrea Angiolillo <[email protected]> Co-authored-by: Zuhair Ahmed <[email protected]> Co-authored-by: Dosty Everts <[email protected]> Co-authored-by: Johanna Öjeling <[email protected]> Co-authored-by: Melissa Plunkett <[email protected]> Co-authored-by: zach-carr <[email protected]>
1 parent c168a8b commit 1343855

File tree

206 files changed

+11177
-3742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+11177
-3742
lines changed

.github/workflows/examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
terraform_version: ["0.13.0"]
20+
terraform_version: ["0.15.0"]
2121
steps:
2222
- uses: actions/checkout@v3
2323
with:

.github_changelog_generator

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
future-release=v1.9.0
2-
since-tag=v1.8.2
1+
future-release=v1.10.0
2+
since-tag=v1.9.0
33
date-format=%B %d, %Y
44
base=CHANGELOG.md

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## [v1.10.0](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v1.10.0) (June 10, 2023)
4+
5+
[Full Changelog](https://github.com/mongodb/terraform-provider-mongodbatlas/compare/v1.9.0...v1.10.0)
6+
7+
**Closed issues:**
8+
9+
- Online Archive: "Specified cloud provider is not supported in Data Lake Storage" but works in UI [\#1216](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/1216)
10+
- Asymmetric hardware is not supported by the provider [\#1214](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/1214)
11+
- `region` argument missing from `mongodbatlas_third_party_integration` for integration with PagerDuty [\#1180](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/1180)
12+
- Correct docs for importing network peering resources [\#1179](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/1179)
13+
- Terraform destroy produces a 500 \(UNEXPECTED\_ERROR\) on the underlying API call [\#1162](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/1162)
14+
- produced an unexpected new value: Root resource was present, but now │ absent [\#1160](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/1160)
15+
- Failed to respond to the plugin.\(\*GRPCProvider\).PlanResourceChange call [\#1136](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/1136)
16+
- Error: error creating MongoDB Cluster: unexpected EOF [\#674](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/674)
17+
318
## [v1.9.0](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v1.9.0) (2023-4-27)
419

520
[Full Changelog](https://github.com/mongodb/terraform-provider-mongodbatlas/compare/v1.8.2...v1.9.0)

examples/atlas-api-key/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# MongoDB Atlas Provider -- MongoDB Atlas Programmatic API Key Examples
2+
3+
In the Terraform MongoDB Atlas Provider v1.8.0 release, we introduced support for MongoDB Atlas Programmatic API Keys (PAK). While this was an exciting development, we quickly realized that some of our customers were facing challenges in optimally leveraging this resource. In response to this, we initiated several enhancements as part of the v1.10.0 release to refine the user experience with this resource. These enhancements encompassed both code revisions and documentation updates.
4+
5+
The most notable improvement among these as part of v1.10.0 release was the deprecation of the `api_keys` parameter from the `mongodbatlas_project` resource. We also extended the functionality of the `mongodbatlas_project_api_key` resource by incorporating the `project_assignment` parameter. This enhancement removes the necessity for users to create multiple `mongodbatlas_project` resource blocks just to assign keys. This update streamlines the process of assigning an API Key to multiple projects, making it less cumbersome and more manageable.
6+
7+
To further facilitate the transition, we've included in this atlas-api-key folder, three reference examples for Programmatic API Key (PAK) usage:
8+
9+
* "Create and Assign PAK Together" — this demonstrates how to create a PAK and assign it simultaneously.
10+
11+
* "Create and Assign PAK to Multiple Projects" — this shows how to create a PAK and assign it to several projects at once.
12+
13+
* "Create and Assign PAK Separately" (Deprecated) — this is an older method of creating and assigning PAKs, now deprecated but still available for reference.
14+
15+
Lastly, in MongoDB Atlas, all PAKs are Organization API keys. Once created, a PAK are linked at the organization level with an 'Organization Member' role. However, these Organization API keys can also be assigned to one or more projects within the organization. When a PAK is assigned to a specific project, it essentially takes on the 'Project Owner' role for that particular project. This enables the key to perform operations at the project level, in addition to the organization level. The flexibility of PAKs provides a powerful mechanism for fine-grained access and control, once their functioning is clearly understood.
16+
17+
Our hope is that these examples will provide clear guidance and help ease your transition to this new PAK workflow in our Terraform Provider.
18+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# MongoDB Atlas Provider -- Create and Assign PAK Separately (Deprecated)
2+
3+
Note this functionality has been deprecated and will be removed in v1.12.0. Instead suggest see examples for Create and Assign PAK Together + Create and Assign PAK to Multiple Projects.
4+
This example creates an organization API Key and access list, showing how to attach a CIDR block.
5+
6+
Variables Required to be set:
7+
- `project_id`: ID of the Atlas project
8+
- `org_id`: ID of Atlas organization
9+
- `public_key`: Atlas public key
10+
- `private_key`: Atlas private key
11+
12+
In this example, we will set up an organization API key and attach an access list to it.
13+
**Note:** in this example parameter api_keys is deprecated and will be removed in v1.12.0 release from codebase. Use `mongodbatlas_project_api_key` resource instead.
14+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
# Create Programmatic API Key
3+
resource "mongodbatlas_api_key" "orgKey1" {
4+
description = "orgKey2"
5+
org_id = var.org_id
6+
role_names = ["ORG_OWNER"]
7+
}
8+
9+
# Assign Newly Created Programmatic API Key to Project
10+
resource "mongodbatlas_project" "test2" {
11+
name = "testorgapikey"
12+
org_id = var.org_id
13+
14+
api_keys {
15+
api_key_id = mongodbatlas_api_key.orgKey1.api_key_id
16+
role_names = ["GROUP_OWNER"]
17+
}
18+
19+
/* ensure this assignment gets cleaned up if the organization key created with api_key is deleted. api_keys block would still need to be removed from the terraform config file */
20+
depends_on = [
21+
mongodbatlas_api_key.orgKey1
22+
]
23+
24+
}
25+
26+
# Add IP Access List Entry to Programmatic API Key
27+
resource "mongodbatlas_access_list_api_key" "test3" {
28+
org_id = var.org_id
29+
cidr_block = "0.0.0.0/1"
30+
api_key_id = mongodbatlas_api_key.orgKey1.api_key_id
31+
}
32+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
provider "mongodbatlas" {
2+
public_key = var.public_key
3+
private_key = var.private_key
4+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
variable "public_key" {
2+
description = "Public API key to authenticate to Atlas"
3+
}
4+
variable "private_key" {
5+
description = "Private API key to authenticate to Atlas"
6+
}
7+
variable "org_id" {
8+
description = "Atlas organization id"
9+
default = ""
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_providers {
3+
mongodbatlas = {
4+
source = "mongodb/mongodbatlas"
5+
}
6+
}
7+
required_version = ">= 0.13"
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# MongoDB Atlas Provider -- Create and Assign PAK together
2+
This example creates a project API Key and access list, showing how to attach a CIDR block.
3+
4+
Variables Required to be set:
5+
- `project_id`: ID of the Atlas project
6+
- `org_id`: ID of Atlas organization
7+
- `public_key`: Atlas public key
8+
- `private_key`: Atlas private key
9+
10+
In this example, we will set up a project API key and attach an access list to it.
11+
12+
13+
**Note:** in this example parameter role_names is deprecated and will be removed in v1.12.0 release from codebase. Use `project_assignment` parameter instead.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
# Create Programmatic API Key + Assign Programmatic API Key to Project
3+
resource "mongodbatlas_project_api_key" "test" {
4+
description = "test create and assign"
5+
project_id = var.project_id
6+
role_names = ["GROUP_OWNER"]
7+
}
8+
9+
# Add IP Access List Entry to Programmatic API Key
10+
resource "mongodbatlas_access_list_api_key" "test3" {
11+
org_id = var.org_id
12+
cidr_block = "0.0.0.0/1"
13+
api_key_id = mongodbatlas_project_api_key.test.api_key_id
14+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
provider "mongodbatlas" {
2+
public_key = var.public_key
3+
private_key = var.private_key
4+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
variable "public_key" {
2+
description = "Public API key to authenticate to Atlas"
3+
}
4+
variable "private_key" {
5+
description = "Private API key to authenticate to Atlas"
6+
}
7+
variable "project_id" {
8+
description = "Atlas project name"
9+
default = ""
10+
}
11+
variable "org_id" {
12+
description = "Atlas organization id"
13+
default = ""
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_providers {
3+
mongodbatlas = {
4+
source = "mongodb/mongodbatlas"
5+
}
6+
}
7+
required_version = ">= 0.13"
8+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# MongoDB Atlas Provider -- Create and Assign PAK to multiple projects
2+
This example creates a project API key and assigns it to multiple projects.
3+
4+
Variables Required to be set:
5+
- `project_id`: ID of the Atlas project that created the API key
6+
- `public_key`: Atlas public key
7+
- `private_key`: Atlas private key
8+
- `additional_project_id`: Additional project ID, used to assign the API key to more than one project at a time
9+
10+
In this example, we will set up a project API key and attach it to multiple projects.
11+
12+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
# Create Programmatic API Key + Assign Programmatic API Key to Project
3+
resource "mongodbatlas_project_api_key" "test" {
4+
description = "test create and assign"
5+
project_id = var.project_id
6+
7+
project_assignment {
8+
project_id = var.project_id
9+
role_names = ["GROUP_READ_ONLY", "GROUP_OWNER"]
10+
}
11+
project_assignment {
12+
project_id = var.additional_project_id
13+
role_names = ["GROUP_READ_ONLY"]
14+
}
15+
}
16+
17+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
provider "mongodbatlas" {
2+
public_key = var.public_key
3+
private_key = var.private_key
4+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
variable "public_key" {
2+
description = "Public API key to authenticate to Atlas"
3+
}
4+
variable "private_key" {
5+
description = "Private API key to authenticate to Atlas"
6+
}
7+
variable "project_id" {
8+
description = "Atlas project id"
9+
default = ""
10+
}
11+
variable "additional_project_id" {
12+
description = "Atlas project id"
13+
default = ""
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_providers {
3+
mongodbatlas = {
4+
source = "mongodb/mongodbatlas"
5+
}
6+
}
7+
required_version = ">= 0.13"
8+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# MongoDB Atlas Provider -- Cloud Backup Snapshot
2+
This example creates a project, advanced cluster, cloud provider snapshot, and a restore job for said snapshot. The cluster is configured to use cloud backup and point in time restore.
3+
4+
Variables Required:
5+
- `org_id`: ID of atlas organization
6+
- `project_name`: Name of the project
7+
- `cluster_name`: Name of the cluster
8+
- `point_in_time_utc_seconds`: Point in time to restore to, a number of seconds since unix epoch.
9+
- `retain_backups_enabled`: Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster.
10+
11+
In order to utilize the backup restore job via point in time, fist you need a backup with which to restore.
12+
This example has been configured to only create the backup restore if `point_in_time_utc_seconds` is a non-zero number.
13+
As such, utilize the following example `terraform.tfvars` and pseudo-code to execute a working example:
14+
15+
Example `terraform.tfvars`
16+
```
17+
org_id = "627a9687f7f7f7f774de306f14"
18+
project_name = "cloud_backup_snapshot_v110"
19+
cluster_name = "v110-cluster"
20+
point_in_time_utc_seconds = 0
21+
retain_backups_enabled = true
22+
```
23+
24+
- Run `terraform apply`
25+
- Update `point_in_time_utc_seconds` to the [current epoch time](https://www.epoch101.com/)
26+
- Run `terraform apply`
27+
28+
You'll now have a project, cluster, backup snapshot, and restore job pointing to specific point in time which to restore.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This will Create a Project, Cluster, cloud backup snapshot and restore job
2+
3+
resource "mongodbatlas_project" "project_test" {
4+
name = var.project_name
5+
org_id = var.org_id
6+
}
7+
8+
resource "mongodbatlas_advanced_cluster" "advanced_cluster_test" {
9+
project_id = mongodbatlas_project.project_test.id
10+
name = var.cluster_name
11+
cluster_type = "REPLICASET"
12+
13+
replication_specs {
14+
num_shards = 1
15+
16+
region_configs {
17+
electable_specs {
18+
instance_size = "M10"
19+
node_count = 3
20+
}
21+
22+
provider_name = "AWS"
23+
region_name = "US_EAST_1"
24+
priority = 7
25+
}
26+
}
27+
28+
backup_enabled = true # enable cloud backup snapshots
29+
pit_enabled = true # Flag that indicates whether the cluster uses continuous cloud backups
30+
retain_backups_enabled = var.retain_backups_enabled # keep the backup snapshots once the cluster is deleted
31+
}
32+
33+
resource "mongodbatlas_cloud_backup_snapshot" "test" {
34+
project_id = mongodbatlas_advanced_cluster.advanced_cluster_test.project_id
35+
cluster_name = mongodbatlas_advanced_cluster.advanced_cluster_test.name
36+
description = "My description"
37+
retention_in_days = "1"
38+
}
39+
40+
resource "mongodbatlas_cloud_backup_snapshot_restore_job" "test" {
41+
count = (var.point_in_time_utc_seconds == 0 ? 0 : 1)
42+
project_id = mongodbatlas_cloud_backup_snapshot.test.project_id
43+
cluster_name = mongodbatlas_cloud_backup_snapshot.test.cluster_name
44+
snapshot_id = mongodbatlas_cloud_backup_snapshot.test.id
45+
46+
delivery_type_config {
47+
point_in_time = true
48+
target_cluster_name = mongodbatlas_advanced_cluster.advanced_cluster_test.name
49+
target_project_id = mongodbatlas_advanced_cluster.advanced_cluster_test.project_id
50+
point_in_time_utc_seconds = var.point_in_time_utc_seconds
51+
}
52+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
variable "project_name" {
2+
description = "Atlas project name"
3+
default = "ProjectTest0"
4+
}
5+
variable "org_id" {
6+
description = "The organization ID"
7+
}
8+
variable "cluster_name" {
9+
description = "Cluster name"
10+
default = "ClusterTest0"
11+
}
12+
variable "point_in_time_utc_seconds" {
13+
description = "Point in time timestamp for snapshot_restore_job"
14+
default = 0
15+
}
16+
17+
variable "retain_backups_enabled" {
18+
description = "Flag that indicates whether to retain backup snapshots for the deleted dedicated cluster"
19+
default = true
20+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_providers {
3+
mongodbatlas = {
4+
source = "mongodb/mongodbatlas"
5+
}
6+
}
7+
required_version = ">= 0.13"
8+
}

examples/atlas-backup-snapshot-restore-job/point-in-time/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ resource "mongodbatlas_cluster" "cluster_test" {
1515
provider_instance_size_name = "M10"
1616
cloud_backup = true # enable cloud provider snapshots
1717
pit_enabled = true
18+
retain_backups_enabled = true # keep the backup snapshopts once the cluster is deleted
1819
}
1920

2021

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
terraform {
22
required_providers {
33
mongodbatlas = {
4-
source = "mongodb/mongodbatlas"
5-
version = "~> 1.4.6"
4+
source = "mongodb/mongodbatlas"
65
}
76
}
87
required_version = ">= 0.13"
9-
}
8+
}

0 commit comments

Comments
 (0)