Skip to content

Commit cc13817

Browse files
evertsdmartinstibbeZuhairahmedthemantissa
authored
Release staging v1.5.0 (#887)
* INTMDB-405: [Terraform] Add cluster label to advanced clusters (#857) * Update CHANGELOG.md (#849) * INTMDB-405: Add default label if none supplied * Add test for default label exising * Flatten nested IF statement * Relying on atlas api for unit validation on alert configuration (#862) * INTMDB-334: privatelink endpoint service configurable timeout (#859) * Made timeout for privatelink endpoint service configurable * Updated context to be with timeout, added documentation on how the timeout works * Updated documentation to have proper default timeout of 2h * INTMDB-373: Add new notification parameters to the mongodbatlas_alert_config resource (#877) * Add support for MS Teams SDK webhook * make fmt * Update documentation add Webhook * Update docs * Update to v0.18 * encryption_at_rest M10+ limit doc update (#886) * INTMDB-224: [Terraform] Support AtlasGov with Terraform (#865) * Add Gov variables workflow and test case * Change test pre check to handle gov env variables * Adjust env variable test validation * Add provider parameter for Gov cloud and region_usage_restrictions to datasources * Update project government test update docs * INTMDB-370 -- PIT Restore Example (#870) * INTMDB-369: Updated validation logic for cloud_backup_snapshot_restore_job (#813) * Updated validation logic for cloud_backup_snapshot_restore_job * Fixed lint errors * Updated test-upgrade v110 to use pit restore * Fixed var name in example for pit ts * Updated v110 example to use cloud backup snapshot resource with pit and valid instructions * Removed changes to v110 example and created a v146 example * Fixed the v110 example to work with disk_size requirements and added link to new examples on the tf docs. * Fixed documentation and moved example * Moved example again, and fixed links in documentation * Fixed formatting on example * Fixed formatting to account for removal of disk size * Correct example in test to use arrays and minGram parameter error (#891) * INTMDB-378: Add link for How To Guide for existing container ID (#883) * Add link for How To Guide for existing container ID * Document corrections * 3 remaining doc updates * Update CHANGELOG.md * Update CHANGELOG.md * INTMDB-314 Cluster Tenant Upgrade (#874) * Initial commit for cluster upgrade * Updated to use a custom customizeDiff func * Setting cluster_id and resource ID to the updated values in the case of a cluster upgrade * Updated logic for determining whether upgrade is required * Removed conflation on willUpgrade and tenant changes. Added error checking * Updated cluster docs to denote upgrade support * Added an example tenant upgrade * Fixed formatting issues * Added code to upgrade advanced_cluster * Moved example again, for some reason * Moved examples, got advanced-cluster tenantUpgrade working * Fixed linter issues with advanced cluster * removed unnecessary explicit setting of cluster_id * Updated new examples to work with tf 0.13 * Update website/docs/r/advanced_cluster.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/advanced_cluster.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/advanced_cluster.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Update website/docs/r/cluster.html.markdown Co-authored-by: Melissa Plunkett <[email protected]> * Addressed some criticisms of new tenant-upgrade examples * Applied suggested docs changes for cluster tenant upgrade * Apply suggestions from code review Applied docs changes suggested for advanced-cluster tenant upgrade readme Co-authored-by: Melissa Plunkett <[email protected]> * Updated cluster tenant upgrade readme to match that of the advanced cluster * Addressed last remaining README suggestions for new examples * Fixed naming on variables and re-pausing cluster after upgrade if necessary * Reduced nested ifs in cluster update * No longer attempting to unpause tenant tier clusters prior to upgrade. Any updates fail * Fixed linter error on bool init Co-authored-by: Melissa Plunkett <[email protected]> * Update CHANGELOG.md Co-authored-by: martinstibbe <[email protected]> Co-authored-by: Zuhair Ahmed <[email protected]> Co-authored-by: Melissa Plunkett <[email protected]>
1 parent 35719a2 commit cc13817

File tree

51 files changed

+973
-201
lines changed

Some content is hidden

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

51 files changed

+973
-201
lines changed

.github/workflows/automated-test-acceptances.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,47 @@ jobs:
8383
PAGER_DUTY_SERVICE_KEY: ${{ secrets.PAGER_DUTY_SERVICE_KEY }}
8484
MONGODB_ATLAS_API_KEYS_IDS: ${{ secrets.MONGODB_ATLAS_API_KEYS_IDS }}
8585
run: make testacc
86+
87+
acceptance-tests-gov:
88+
if: ${{ github.event.label.name == 'run-testacc-gov' }}
89+
needs: [ authorize ]
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: Checkout
93+
uses: actions/checkout@v3
94+
- name: Set up Go
95+
uses: actions/setup-go@v3
96+
with:
97+
go-version: 1.18
98+
- name: Acceptance Tests Gov
99+
env:
100+
SKIP_TEST_EXTERNAL_CREDENTIALS: ${{ secrets.SKIP_TEST_EXTERNAL_CREDENTIALS }}
101+
SKIP_TEST_IMPORT: ${{ secrets.SKIP_TEST_IMPORT }}
102+
SKIP_TEST: ${{ secrets.SKIP_TEST }}
103+
MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_KEY_GOV }}
104+
MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_KEY_GOV }}
105+
MONGODB_ATLAS_PROJECT_ID: ${{ secrets.MONGODB_ATLAS_PROJECT_ID_GOV }}
106+
MONGODB_ATLAS_ORG_ID: ${{ secrets.MONGODB_ATLAS_ORG_ID_GOV }}
107+
MONGODB_ATLAS_DB_USERNAME: ${{ secrets.MONGODB_ATLAS_DB_USERNAME }}
108+
MONGODB_ATLAS_TEAMS_IDS: ${{ secrets.MONGODB_ATLAS_TEAMS_IDS }}
109+
MONGODB_ATLAS_LDAP_HOSTNAME: ${{ secrets.MONGODB_ATLAS_LDAP_HOSTNAME }}
110+
MONGODB_ATLAS_LDAP_USERNAME: ${{ secrets.MONGODB_ATLAS_LDAP_USERNAME }}
111+
MONGODB_ATLAS_LDAP_PASSWORD: ${{ secrets.MONGODB_ATLAS_LDAP_PASSWORD }}
112+
MONGODB_ATLAS_LDAP_CA_CERTIFICATE: ${{ secrets.MONGODB_ATLAS_LDAP_CA_CERTIFICATE }}
113+
MONGODB_ATLAS_LDAP_PORT: ${{ secrets.MONGODB_ATLAS_LDAP_PORT }}
114+
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
115+
AWS_VPC_ID: ${{ secrets.AWS_VPC_ID }}
116+
AWS_VPC_CIDR_BLOCK: ${{ secrets.AWS_VPC_CIDR_BLOCK }}
117+
AWS_REGION: ${{ secrets.AWS_REGION_GOV }}
118+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
119+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
120+
AWS_CUSTOMER_MASTER_KEY_ID: ${{ secrets.AWS_CUSTOMER_MASTER_KEY_ID }}
121+
CA_CERT: ${{ secrets.CA_CERT }}
122+
MONGODB_ATLAS_ENABLE_BETA: ${{ secrets.MONGODB_ATLAS_ENABLE_BETA }}
123+
ACCTEST_TIMEOUT: ${{ secrets.ACCTEST_TIMEOUT }}
124+
PAGER_DUTY_SERVICE_KEY: ${{ secrets.PAGER_DUTY_SERVICE_KEY }}
125+
MONGODB_ATLAS_API_KEYS_IDS: ${{ secrets.MONGODB_ATLAS_API_KEYS_IDS }}
126+
MONGODB_ATLAS_BASE_URL: ${{ secrets.MONGODB_ATLAS_BASE_URL }}
127+
MONGODB_ATLAS_PROJECT_OWNER_ID_GOV: ${{ secrets.MONGODB_ATLAS_PROJECT_OWNER_ID_GOV }}
128+
run: make testaccgov
129+

CHANGELOG.md

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,62 @@
1+
## [v1.5.0](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v1.5.0) (2022-11-01)
2+
3+
[Full Changelog](https://github.com/mongodb/terraform-provider-mongodbatlas/compare/v1.4.6...v1.5.0)
4+
5+
**Fixed**
6+
7+
- INTMDB-224 Support AtlasGov with Terraform [\#865](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/865)
8+
- INTMDB-314 Feature add: Add ability to upgrade shared/TENANT tiers for clusters and advanced clusters [\#874](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/874)
9+
- INTMDB-326 Review code/tests and docs for resource_mongodbatlas_search_index [\#891](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/891)
10+
- INTMDB-334 Determine best path forward for GCP PSC timeouts and implement [\#859](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/859)
11+
- INTMDB-364 Add support for serverless private endpoints (AWS) [\#314](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/314)
12+
- INTMDB-370 Docs not complete for cloud_backup_snapshot_restore_job [\#870](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/870)
13+
- INTMDB-373 Add new notification parameters to the mongodbatlas_alert_config resource [\#883](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/883)
14+
- INTMDB-377 Release 1.5 (both pre and then GA) [\#](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/)
15+
- INTMDB-378 Document for users how to get a pre-existing container id [\#883](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/883)
16+
- INTMDB-394 MS Teams alert support in terraform provider is missing [\#](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/)
17+
- INTMDB-405 Add cluster label to advanced clusters [\#857](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/857)
18+
- INTMDB-406 MILLION_RPU unit isn't supported by provider #854 [\#854](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/854)
19+
- INTMDB-403 Update third_party_integration.markdown [\#851](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/851)
20+
21+
**Closed issues:**
22+
- MS Teams alert support in terraform provider is missing [\#827](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/827)
23+
- MILLION_RPU unit isn't supported by provider not_stale [\#854](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/854)
24+
25+
**Merged pull requests:**
26+
- Chore(deps): Bump octokit/request-action from 2.1.6 to 2.1.7 [\#868](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/868)
27+
- Docs: fix custom_dns_configuration_cluster_aws [\#860](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/860)
28+
- INTMDB-403: Update third_party_integration.markdown [\#851](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/851)
29+
- INTMDB-404: mongodbatlas_advanced_cluster doc updates [\#852](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/852)
30+
- Docs: fix custom_dns_configuration_cluster_aws [\#860](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/860)
31+
- Relying on atlas api for unit validation on alert configuration [\#862](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/862)
32+
- INTMD-428: doc update to "mongodbatlas_projects" [\#869](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/869)
33+
- Adding a github actions to automatically close stale issues/PRs based on CLOUDP-79100 [\#872](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/872)
34+
- Chore(deps): Bump github.com/gruntwork-io/terratest from 0.40.22 to 0.40.24 [\#875](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/875)
35+
- Update cluster.html.markdown [\#878](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/878)
36+
- INTMDB-378: Add link for How To Guide for existing container ID [\#883](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/883)
37+
- Encryption_at_rest M10+ limit doc update [\#886](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/886)
38+
- Add APIx1 CODEOWNER [\#894](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/894)
39+
- Chore(deps): Bump golangci/golangci-lint-action from 3.2.0 to 3.3.0 [\#897](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/897)
40+
141
## [v1.4.6](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/v1.4.6) (2022-09-19)
242

343
[Full Changelog](https://github.com/mongodb/terraform-provider-mongodbatlas/compare/v1.4.5...v1.4.6)
444

545
**Fixed**
6-
- INTMDB-387 - [Terraform] Enable Azure NVME for Atlas Dedicated clusters [\#833](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/833)
7-
- INTMDB-342 - [Terraform] Update TestAccDataSourceMongoDBAtlasPrivateEndpointRegionalMode_basic test to use a new project to prevent conflicts [\#837](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/837)
8-
- INTMDB-347 - [Terraform] cloud_backup is not being correctly imported - issue [\#768](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/768)
9-
- INTMDB-354 - [Terraform] Update docs around what requires an API key access list [\#834](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/834)
46+
- INTMDB-387 - Enable Azure NVME for Atlas Dedicated clusters [\#833](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/833)
47+
- INTMDB-342 - Update TestAccDataSourceMongoDBAtlasPrivateEndpointRegionalMode_basic test to use a new project to prevent conflicts [\#837](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/837)
48+
- INTMDB-347 - Cloud_backup is not being correctly imported - issue [\#768](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/768)
49+
- INTMDB-354 - Update docs around what requires an API key access list [\#834](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/834)
1050
- INTMDB-363 - [Updated Feature] Add serverless backup to mongodbatlas_serverless_instance [\#830](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/830)
11-
- INTMDB-379 - [Terraform] Release 1.4.6 (both pre and then GA)
12-
- INTMDB-381 - [Terraform] Customer is unable to disable backup auto export [\#823](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/823)
13-
- INTMDB-383 - [Terraform] Update the BYOK/encryption at rest resource [\#805](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/805)
51+
- INTMDB-379 - Release 1.4.6 (both pre and then GA)
52+
- INTMDB-381 - Customer is unable to disable backup auto export [\#823](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/823)
53+
- INTMDB-383 - Update the BYOK/encryption at rest resource [\#805](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/805)
1454
- INTMDB-385 - use_org_and_group_names_in_export_prefix is not working for a customer
15-
- INTMDB-386 - [Terraform] Add new role types to invitation verification [\#840](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/840)
16-
- INTMDB-371 - [Terraform] Timeout when creating privatelink_endpoint [\#806](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/806)
17-
- INTMDB-372 - [Terraform] Fix failing test for testAccMongoDBAtlasAlertConfigurationConfigWithMatchers [\#836](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/836)
18-
- INTMDB-358 - [terraform] Upgrade to go1.18 [\#835](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/835)
19-
- INTMDB-391 - [Terraform] Doc Fix for teams.html.markdown [\#838](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/838)
55+
- INTMDB-386 - Add new role types to invitation verification [\#840](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/840)
56+
- INTMDB-371 - Timeout when creating privatelink_endpoint [\#806](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/806)
57+
- INTMDB-372 - Fix failing test for testAccMongoDBAtlasAlertConfigurationConfigWithMatchers [\#836](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/836)
58+
- INTMDB-358 - Upgrade to go1.18 [\#835](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/835)
59+
- INTMDB-391 - Doc Fix for teams.html.markdown [\#838](https://github.com/mongodb/terraform-provider-mongodbatlas/pull/838)
2060

2161
**Closed issues:**
2262
- importing existing cluster does not populate backup status #768 [\#768](https://github.com/mongodb/terraform-provider-mongodbatlas/issues/768)

GNUmakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ testacc: fmtcheck
3939
@$(eval VERSION=acc)
4040
TF_ACC=1 go test $(TEST) -v -parallel 20 $(TESTARGS) -timeout $(ACCTEST_TIMEOUT) -cover -ldflags="$(LINKER_FLAGS)"
4141

42+
.PHONY: testaccgov
43+
testaccgov: fmtcheck
44+
@$(eval VERSION=acc)
45+
TF_ACC=1 go test $(TEST) -run 'TestAccResourceMongoDBAtlasGovProject_CreateWithProjectOwner' -v -parallel 1 "$(TESTARGS) -timeout $(ACCTEST_TIMEOUT) -cover -ldflags=$(LINKER_FLAGS) "
46+
4247
.PHONY: fmt
4348
fmt:
4449
@echo "==> Fixing source code with gofmt..."
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# MongoDB Atlas Provider -- Advanced Cluster Tenant Upgrade
2+
This example creates a project and cluster. It is intended to show how to upgrade from shared, aka tenant, to dedicated tier.
3+
4+
Variables Required:
5+
- `atlas_org_id`: ID of the Atlas organization
6+
- `public_key`: Atlas public key
7+
- `private_key`: Atlas private key
8+
- `provider_name`: Name of provider to use for cluster (TENANT, AWS, GCP)
9+
- `backing_provider_name`: If provider_name is tenant, the backing provider (AWS, GCP)
10+
- `provider_instance_size_name`: Size of the cluster (Shared: M0, M2, M5, Dedicated: M10+.)
11+
12+
For this example, first we'll start out on the shared tier, then upgrade to a dedicated tier.
13+
14+
Utilize the following to execute a working example, replacing the org id, public and private key with your values:
15+
16+
Apply with the following `terraform.tfvars` to first create a shared tier cluster:
17+
```
18+
atlas_org_id = "627a9687f7f7f7f774de306f14"
19+
public_key = <REDACTED>
20+
private_key = <REDACTED>
21+
provider_name = "TENANT"
22+
backing_provider_name = "AWS"
23+
provider_instance_size_name = "M2"
24+
```
25+
26+
Apply with the following `terraform.tfvars` to upgrade the shared tier cluster you just created to dedicated tier:
27+
```
28+
atlas_org_id = "627a9687f7f7f7f774de306f14"
29+
public_key = <REDACTED>
30+
private_key = <REDACTED>
31+
provider_name = "GCP"
32+
provider_instance_size_name = "M10"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
provider "mongodbatlas" {
2+
public_key = var.public_key
3+
private_key = var.private_key
4+
}
5+
6+
resource "mongodbatlas_advanced_cluster" "cluster" {
7+
project_id = mongodbatlas_project.project.id
8+
name = "ClusterToUpgrade"
9+
cluster_type = "REPLICASET"
10+
11+
replication_specs {
12+
num_shards = 1
13+
14+
region_configs {
15+
electable_specs {
16+
instance_size = var.provider_instance_size_name
17+
}
18+
provider_name = var.provider_name
19+
backing_provider_name = var.backing_provider_name
20+
region_name = "US_EAST_1"
21+
priority = 7
22+
}
23+
}
24+
}
25+
26+
resource "mongodbatlas_project" "project" {
27+
name = "TenantUpgradeTest"
28+
org_id = var.atlas_org_id
29+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
variable "atlas_org_id" {
2+
description = "Atlas organization id"
3+
default = ""
4+
}
5+
variable "public_key" {
6+
description = "Public API key to authenticate to Atlas"
7+
}
8+
variable "private_key" {
9+
description = "Private API key to authenticate to Atlas"
10+
}
11+
variable "provider_name" {
12+
description = "Atlas cluster provider name"
13+
default = "AWS"
14+
}
15+
variable "backing_provider_name" {
16+
description = "Atlas cluster backing provider name"
17+
default = null
18+
}
19+
variable "provider_instance_size_name" {
20+
description = "Atlas cluster provider instance name"
21+
default = "M10"
22+
}
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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# MongoDB Atlas Provider -- Cloud Backup Snapshot
2+
This example creates a project, 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+
10+
In order to utilize the backup restore job via point in time, fist you need a backup with which to restore.
11+
This example has been configured to only create the backup restore if `point_in_time_utc_seconds` is a non-zero number.
12+
As such, utilize the following example `terraform.tfvars` and pseudo-code to execute a workign example:
13+
14+
Example `terraform.tfvars`
15+
```
16+
org_id = "627a9687f7f7f7f774de306f14"
17+
project_name = "cloud_backup_snapshot_v110"
18+
cluster_name = "v110-cluster"
19+
point_in_time_utc_seconds = 0
20+
```
21+
22+
- Run `terraform apply`
23+
- Update `point_in_time_utc_seconds` to the [current epoch time](https://www.epoch101.com/)
24+
- Run `terraform apply`
25+
26+
You'll now have a project, cluster, backup snapshot, and restore job pointing to specific point in time which to restore.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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_cluster" "cluster_test" {
9+
project_id = mongodbatlas_project.project_test.id
10+
name = var.cluster_name
11+
12+
# Provider Settings "block"
13+
provider_name = "AWS"
14+
provider_region_name = "US_EAST_1"
15+
provider_instance_size_name = "M10"
16+
cloud_backup = true # enable cloud provider snapshots
17+
pit_enabled = true
18+
}
19+
20+
21+
resource "mongodbatlas_cloud_backup_snapshot" "test" {
22+
project_id = mongodbatlas_cluster.cluster_test.project_id
23+
cluster_name = mongodbatlas_cluster.cluster_test.name
24+
description = "My description"
25+
retention_in_days = "1"
26+
}
27+
28+
resource "mongodbatlas_cloud_backup_snapshot_restore_job" "test" {
29+
count = (var.point_in_time_utc_seconds == 0 ? 0 : 1)
30+
project_id = mongodbatlas_cloud_backup_snapshot.test.project_id
31+
cluster_name = mongodbatlas_cloud_backup_snapshot.test.cluster_name
32+
snapshot_id = mongodbatlas_cloud_backup_snapshot.test.id
33+
34+
delivery_type_config {
35+
point_in_time = true
36+
target_cluster_name = mongodbatlas_cluster.cluster_test.name
37+
target_project_id = mongodbatlas_cluster.cluster_test.project_id
38+
point_in_time_utc_seconds = var.point_in_time_utc_seconds
39+
}
40+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
variable "project_name" {
2+
description = "Atlas project name"
3+
default = ""
4+
}
5+
variable "org_id" {
6+
description = "The organization ID"
7+
default = ""
8+
}
9+
variable "cluster_name" {
10+
description = "Cluster name"
11+
default = ""
12+
}
13+
variable "point_in_time_utc_seconds" {
14+
description = "Point in time timestamp for snapshot_restore_job"
15+
default = 0
16+
}

0 commit comments

Comments
 (0)