From e0ba4d4d5c696d5a0258b4d89b8369f6bdc2c054 Mon Sep 17 00:00:00 2001
From: Tigran Muradyan <tigran@dasmeta.com>
Date: Thu, 4 Apr 2024 18:11:42 +0400
Subject: [PATCH 1/2] fix(DMVP-3881): upgrade/cleanup mongo-atlas

---
 modules/mongodb-atlas/backup.tf    | 46 +-----------------------------
 modules/mongodb-atlas/variables.tf |  8 +-----
 modules/mongodb-atlas/versions.tf  |  2 +-
 3 files changed, 3 insertions(+), 53 deletions(-)

diff --git a/modules/mongodb-atlas/backup.tf b/modules/mongodb-atlas/backup.tf
index d41dd7d3..67a40657 100644
--- a/modules/mongodb-atlas/backup.tf
+++ b/modules/mongodb-atlas/backup.tf
@@ -47,48 +47,4 @@ resource "mongodbatlas_cloud_backup_schedule" "backup" {
       retention_value    = var.policy_item_monthly.retention_value
     }
   }
-}
-
-resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "backup" {
-  count = var.use_cloud_provider_snapshot_backup_policy ? 1 : 0
-
-  cluster_name             = "von-poll-production"
-  project_id               = "60f4858701216b7daa451896"
-  reference_hour_of_day    = 11
-  reference_minute_of_hour = 10
-  restore_window_days      = 4
-  update_snapshots         = false
-
-  policies {
-    id = "60f48c80c65bed025f2b1e25"
-
-    policy_item {
-      frequency_interval = 1
-      frequency_type     = "hourly"
-      id                 = "60f48c80c65bed025f2b1e26"
-      retention_unit     = "days"
-      retention_value    = 1
-    }
-    policy_item {
-      frequency_interval = 1
-      frequency_type     = "daily"
-      id                 = "60f48c80c65bed025f2b1e27"
-      retention_unit     = "days"
-      retention_value    = 2
-    }
-    policy_item {
-      frequency_interval = 4
-      frequency_type     = "weekly"
-      id                 = "60f48c80c65bed025f2b1e28"
-      retention_unit     = "weeks"
-      retention_value    = 3
-    }
-    policy_item {
-      frequency_interval = 5
-      frequency_type     = "monthly"
-      id                 = "60f48c80c65bed025f2b1e29"
-      retention_unit     = "months"
-      retention_value    = 4
-    }
-  }
-}
+}
\ No newline at end of file
diff --git a/modules/mongodb-atlas/variables.tf b/modules/mongodb-atlas/variables.tf
index 056fa582..83f16357 100644
--- a/modules/mongodb-atlas/variables.tf
+++ b/modules/mongodb-atlas/variables.tf
@@ -197,16 +197,10 @@ variable "policy_item_monthly" {
   }
 }
 
-variable "use_cloud_provider_snapshot_backup_policy" {
-  type        = bool
-  default     = false
-  description = "mongodbatlas_cloud_provider_snapshot_backup_policy is deprecated, but make use_cloud_provider_snapshot_backup_policy true to use this resource."
-}
-
 variable "use_cloud_backup_schedule" {
   type        = bool
   default     = false
-  description = "As use_cloud_provider_snapshot_backup_policy is deprecated, this resource should be used, but it can't be used with the other one, so only one of these must be true."
+  description = "Whether to enable automated backups."
 }
 
 variable "cloud_backup" {
diff --git a/modules/mongodb-atlas/versions.tf b/modules/mongodb-atlas/versions.tf
index aaf2a1c1..14b2e52b 100644
--- a/modules/mongodb-atlas/versions.tf
+++ b/modules/mongodb-atlas/versions.tf
@@ -4,7 +4,7 @@ terraform {
   required_providers {
     mongodbatlas = {
       source  = "mongodb/mongodbatlas"
-      version = ">= 1.2"
+      version = "~> 1.15.2"
     }
 
     aws = {

From 8796021da2db20917de4475c947e5df12686d93b Mon Sep 17 00:00:00 2001
From: Tigran Muradyan <tigran@dasmeta.com>
Date: Mon, 8 Apr 2024 17:31:56 +0400
Subject: [PATCH 2/2] fix(DMVP-3881): cleanup

---
 modules/ingress/tests/basic/README.md            | 2 +-
 modules/ingress/tests/multiple-domains/README.md | 2 +-
 modules/mongodb-atlas/README.md                  | 8 +++-----
 modules/mongodb-atlas/backup.tf                  | 2 +-
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/modules/ingress/tests/basic/README.md b/modules/ingress/tests/basic/README.md
index feaa7f97..d9d0c054 100644
--- a/modules/ingress/tests/basic/README.md
+++ b/modules/ingress/tests/basic/README.md
@@ -13,7 +13,7 @@
 
 | Name | Version |
 |------|---------|
-| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.67.0 |
+| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.41 |
 
 ## Modules
 
diff --git a/modules/ingress/tests/multiple-domains/README.md b/modules/ingress/tests/multiple-domains/README.md
index 13cf53c5..91dc9e5b 100644
--- a/modules/ingress/tests/multiple-domains/README.md
+++ b/modules/ingress/tests/multiple-domains/README.md
@@ -13,7 +13,7 @@
 
 | Name | Version |
 |------|---------|
-| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.67.0 |
+| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.0 |
 
 ## Modules
 
diff --git a/modules/mongodb-atlas/README.md b/modules/mongodb-atlas/README.md
index c8f2db7f..080a3f4c 100644
--- a/modules/mongodb-atlas/README.md
+++ b/modules/mongodb-atlas/README.md
@@ -73,14 +73,14 @@ mongodbatlas_cloud_provider_snapshot_backup_policy resource requires access thro
 |------|---------|
 | <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | > 0.15.0 |
 | <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.72 |
-| <a name="requirement_mongodbatlas"></a> [mongodbatlas](#requirement\_mongodbatlas) | >= 1.2 |
+| <a name="requirement_mongodbatlas"></a> [mongodbatlas](#requirement\_mongodbatlas) | ~> 1.15.2 |
 
 ## Providers
 
 | Name | Version |
 |------|---------|
 | <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.72 |
-| <a name="provider_mongodbatlas"></a> [mongodbatlas](#provider\_mongodbatlas) | >= 1.2 |
+| <a name="provider_mongodbatlas"></a> [mongodbatlas](#provider\_mongodbatlas) | ~> 1.15.2 |
 | <a name="provider_random"></a> [random](#provider\_random) | n/a |
 
 ## Modules
@@ -96,7 +96,6 @@ No modules.
 | [mongodbatlas_alert_configuration.main](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/alert_configuration) | resource |
 | [mongodbatlas_auditing.audit](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/auditing) | resource |
 | [mongodbatlas_cloud_backup_schedule.backup](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/cloud_backup_schedule) | resource |
-| [mongodbatlas_cloud_provider_snapshot_backup_policy.backup](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/cloud_provider_snapshot_backup_policy) | resource |
 | [mongodbatlas_cluster.main](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/cluster) | resource |
 | [mongodbatlas_database_user.user](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/database_user) | resource |
 | [mongodbatlas_network_peering.mongo_peers](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/network_peering) | resource |
@@ -146,8 +145,7 @@ No modules.
 | <a name="input_provider_region_name"></a> [provider\_region\_name](#input\_provider\_region\_name) | Cloud service provider on which the server for a multi-tenant cluster is provisioned, valid for only when instanceSizeName is M2 or M5. | `string` | `null` | no |
 | <a name="input_schedule_restore_window_days"></a> [schedule\_restore\_window\_days](#input\_schedule\_restore\_window\_days) | Number of days back in time you can restore to with point-in-time accuracy. | `number` | `1` | no |
 | <a name="input_teams"></a> [teams](#input\_teams) | n/a | <pre>list(object({<br>    team_id    = string<br>    role_names = list(string)<br>  }))</pre> | `[]` | no |
-| <a name="input_use_cloud_backup_schedule"></a> [use\_cloud\_backup\_schedule](#input\_use\_cloud\_backup\_schedule) | As use\_cloud\_provider\_snapshot\_backup\_policy is deprecated, this resource should be used, but it can't be used with the other one, so only one of these must be true. | `bool` | `false` | no |
-| <a name="input_use_cloud_provider_snapshot_backup_policy"></a> [use\_cloud\_provider\_snapshot\_backup\_policy](#input\_use\_cloud\_provider\_snapshot\_backup\_policy) | mongodbatlas\_cloud\_provider\_snapshot\_backup\_policy is deprecated, but make use\_cloud\_provider\_snapshot\_backup\_policy true to use this resource. | `bool` | `false` | no |
+| <a name="input_use_cloud_backup_schedule"></a> [use\_cloud\_backup\_schedule](#input\_use\_cloud\_backup\_schedule) | Whether to enable automated backups. | `bool` | `false` | no |
 | <a name="input_users"></a> [users](#input\_users) | MongoDB Atlas users list, roles and scopes. | `list` | <pre>[<br>  {<br>    "roles": [<br>      {<br>        "database_name": "development",<br>        "role_name": "readWrite"<br>      }<br>    ],<br>    "scopes": [<br>      {<br>        "name": "cluster",<br>        "type": "CLUSTER"<br>      }<br>    ],<br>    "username": "alice"<br>  }<br>]</pre> | no |
 | <a name="input_with_default_alerts_settings"></a> [with\_default\_alerts\_settings](#input\_with\_default\_alerts\_settings) | It allows users to disable the creation of the default alert settings. | `bool` | `true` | no |
 
diff --git a/modules/mongodb-atlas/backup.tf b/modules/mongodb-atlas/backup.tf
index 67a40657..f1003598 100644
--- a/modules/mongodb-atlas/backup.tf
+++ b/modules/mongodb-atlas/backup.tf
@@ -47,4 +47,4 @@ resource "mongodbatlas_cloud_backup_schedule" "backup" {
       retention_value    = var.policy_item_monthly.retention_value
     }
   }
-}
\ No newline at end of file
+}