From 4de03327a10f5598adfcb3e296e4a5c012482300 Mon Sep 17 00:00:00 2001 From: PacoDw <__pm@outlook.com> Date: Thu, 9 Jul 2020 12:55:44 -0500 Subject: [PATCH 1/4] doc: updated backup_policy resource explaining on how I can implement at least one policy item --- ...vider_snapshot_backup_policy.html.markdown | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown b/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown index e9240b343c..0aa41fe772 100644 --- a/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown +++ b/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown @@ -8,7 +8,7 @@ description: |- # mongodbatlas_cloud_provider_snapshot_backup_policy -`mongodbatlas_cloud_provider_snapshot_backup_policy` provides a resource that enables you to view and modify the snapshot schedule and retention settings for an Atlas cluster with Cloud Backup enabled. A default policy is created automatically when Cloud Backup is enabled for the cluster. +`mongodbatlas_cloud_provider_snapshot_backup_policy` provides a resource that enables you to view and modify the snapshot schedule and retention settings for an Atlas cluster with Cloud Backup enabled. A default policy is created automatically when Cloud Backup is enabled for the cluster. -> **NOTE:** Groups and projects are synonymous terms. You may find `groupId` in the official documentation. @@ -73,6 +73,47 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { } ``` +## Example Usage implementing at least one Policy Item + +```hcl +resource "mongodbatlas_cluster" "my_cluster" { + project_id = "" + name = "clusterTest" + disk_size_gb = 5 + + //Provider Settings "block" + provider_name = "AWS" + provider_region_name = "EU_CENTRAL_1" + provider_instance_size_name = "M10" + provider_backup_enabled = true // must be enabled in order to use cloud_provider_snapshot_backup_policy resource + provider_disk_iops = 100 + provider_encrypt_ebs_volume = false +} + +resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { + project_id = mongodbatlas_cluster.my_cluster.project_id + cluster_name = mongodbatlas_cluster.my_cluster.name + + reference_hour_of_day = 3 + reference_minute_of_hour = 45 + restore_window_days = 4 + + + policies { + id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.id + + policy_item { + id = 5f0747cad187d8609a72f546 + frequency_interval = 1 + frequency_type = "hourly" + retention_unit = "days" + retention_value = 1 + } + } +} +``` +-> **NOTE:** By default, MongoDB Atlas automatically creates a four schedule for each cluster if you want to remove and keep at least one, you can implement the above example. When the cluster is created, we need to note that `snapshot_backup_policy` information is created in its state as well, so you can choose the `policy_item` that you want to keep or remove before creating the `mongodbatlas_cloud_provider_snapshot_backup_policy` resource.Also, if the `mongodbatlas_cloud_provider_snapshot_backup_policy` resource has been created with its four default schedules, you can remove the policy is needed just removing it on the configuration. + ## Argument Reference * `project_id` - (Required) The unique identifier of the project for the Atlas cluster. From 21c394f395d8b87afd17ef55ccacefdd1683435a Mon Sep 17 00:00:00 2001 From: PacoDw <__pm@outlook.com> Date: Fri, 10 Jul 2020 09:22:04 -0500 Subject: [PATCH 2/4] chore: added more examples about on how modify the policy items --- ...vider_snapshot_backup_policy.html.markdown | 157 +++++++++++++++++- 1 file changed, 155 insertions(+), 2 deletions(-) diff --git a/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown b/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown index 0aa41fe772..1d671b81db 100644 --- a/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown +++ b/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown @@ -48,6 +48,7 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { retention_unit = "days" retention_value = 1 } + policy_item { id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.1.id frequency_interval = 1 @@ -55,6 +56,7 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { retention_unit = "days" retention_value = 2 } + policy_item { id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.2.id frequency_interval = 4 @@ -62,6 +64,7 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { retention_unit = "weeks" retention_value = 3 } + policy_item { id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.3.id frequency_interval = 5 @@ -72,8 +75,11 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { } } ``` +# Examples Modifying Polices +When Cloud Backup is enabled for a cluster MongoDB Atlas automatically creates a default Cloud Backup schedule for the cluster with four policy items; hourly, daily, weekly, and monthly. Because of this default creation this provider automatically saves the Cloud Backup Snapshot Policy into the Terraform state. If the default works well for you then you do not need to do anything other than create a cluster with Cloud Backup enabled and your Terraform state will have this information if you need it. However, if you want the policy to be different than the default simply follow the next examples. -## Example Usage implementing at least one Policy Item +## Example Usage - Create a Cluster and Modify the 4 Default Policies Simultaneously +This cluster has already been created and is here as an example ```hcl resource "mongodbatlas_cluster" "my_cluster" { @@ -104,15 +110,162 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { policy_item { id = 5f0747cad187d8609a72f546 + frequency_interval = 4 + frequency_type = "weekly" + retention_unit = "days" + retention_value = 3 + } + } +} +``` + +-> **NOTE:** This is the id MongoDB Atlas returns for the policy item we want to keep. Here it is hard coded because you need to either use the actual value from the Terraform state or look to map the policy item you want to keep to it's placement in the state file array that was imported in when the cluster was originally created. + +Summarized: to use the state file value for a policy item you need to determine the array placement # of the same frequency_type you want to keep. With this Terraform configuration the anothers policy items will be removed. + +~> **IMPORTANT:** For example in the state file we are using the weekly policy is the third policy in the array so it could be referred to with `mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.2.id` instead of the hard coded value, but it's not recommended when the cluster presents changes or make `terraform refresh` due to once this will applied, the cluster state will remove the rest of the items, so the posicion of the array will change to position 0. + +## Example Usage - Create a Cluster and Modify 3 Default Policies and Remove 1 Default Policy Simultaneously + +```hcl +resource "mongodbatlas_cluster" "my_cluster" { + project_id = "" + name = "clusterTest" + disk_size_gb = 5 + + //Provider Settings "block" + provider_name = "AWS" + provider_region_name = "EU_CENTRAL_1" + provider_instance_size_name = "M10" + provider_backup_enabled = true // must be enabled in order to use cloud_provider_snapshot_backup_policy resource + provider_disk_iops = 100 + provider_encrypt_ebs_volume = false +} + +resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { + project_id = mongodbatlas_cluster.my_cluster.project_id + cluster_name = mongodbatlas_cluster.my_cluster.name + + reference_hour_of_day = 3 + reference_minute_of_hour = 45 + restore_window_days = 4 + + + policies { + id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.id + + policy_item { + id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.0.id frequency_interval = 1 frequency_type = "hourly" retention_unit = "days" retention_value = 1 } + + policy_item { + id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.1.id + frequency_interval = 1 + frequency_type = "daily" + retention_unit = "days" + retention_value = 2 + } + + # Item removed + # policy_item { + # id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.2.id + # frequency_interval = 4 + # frequency_type = "weekly" + # retention_unit = "weeks" + # retention_value = 3 + # } + + policy_item { + id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.3.id + frequency_interval = 5 + frequency_type = "monthly" + retention_unit = "months" + retention_value = 4 + } } } ``` --> **NOTE:** By default, MongoDB Atlas automatically creates a four schedule for each cluster if you want to remove and keep at least one, you can implement the above example. When the cluster is created, we need to note that `snapshot_backup_policy` information is created in its state as well, so you can choose the `policy_item` that you want to keep or remove before creating the `mongodbatlas_cloud_provider_snapshot_backup_policy` resource.Also, if the `mongodbatlas_cloud_provider_snapshot_backup_policy` resource has been created with its four default schedules, you can remove the policy is needed just removing it on the configuration. + +-> **NOTE:** (See text in first example for more details on the default.) If you want the Cloud Backup Snapshot Policy to vary in the number of policies from the default when creating the cluster, perhaps you want to remove one policy item and modify the remaining three, simply follow this example here to remove a policy and modify three. + +~> **IMPORTANT:** If we decide to remove item 2 as our above example marked with `#` we need to consider that once the cluster being modified or makes a `terraform refresh` the item 2 will be replaced with the 3, so it could cause inconsistency. We recommend using hardcoded id value to handle these situations. (See text in the first example for more details on it) + + + +## Example Usage - Remove 3 Default Policies Items After the Cluster Has Already Been Created + +```hcl +resource "mongodbatlas_cluster" "my_cluster" { + project_id = "" + name = "clusterTest" + disk_size_gb = 5 + + //Provider Settings "block" + provider_name = "AWS" + provider_region_name = "EU_CENTRAL_1" + provider_instance_size_name = "M10" + provider_backup_enabled = true // must be enabled in order to use cloud_provider_snapshot_backup_policy resource + provider_disk_iops = 100 + provider_encrypt_ebs_volume = false +} + +resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { + project_id = mongodbatlas_cluster.my_cluster.project_id + cluster_name = mongodbatlas_cluster.my_cluster.name + + reference_hour_of_day = 3 + reference_minute_of_hour = 45 + restore_window_days = 4 + + + policies { + id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.id + + # Item removed + # policy_item { + # id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.0.id + # frequency_interval = 1 + # frequency_type = "hourly" + # retention_unit = "days" + # retention_value = 1 + # } + + # Item removed + # policy_item { + # id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.1.id + # frequency_interval = 1 + # frequency_type = "daily" + # retention_unit = "days" + # retention_value = 2 + # } + + # Item removed + # policy_item { + # id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.2.id + # frequency_interval = 4 + # frequency_type = "weekly" + # retention_unit = "weeks" + # retention_value = 3 + # } + + policy_item { + id = 5f0747cad187d8609a72f546 + frequency_interval = 5 + frequency_type = "monthly" + retention_unit = "months" + retention_value = 4 + } + } +} +``` + +-> **NOTE:** (See text in first example for more details on the default.) If you want the Cloud Backup Snapshot Policy to vary in number of policies for a cluster that was already created/imported, perhaps you want to remove three policy items and modify the remaining policy, simply follow the above example here. + +~> **IMPORTANT:** Note in this example we decided to remove the first 3 items so we can't use `mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.3.id` this sentence to retrieve the monthly id value of the cluster state due to once the cluster being modified or makes a `terraform refresh` will cause that the three items will remove from the state, so we will get an error due to the index 3 doesn't exists any more and our monthly policy item is moved to the first place of the array.(See text in the first example for more details on it) ## Argument Reference From 6db9067927f427e6b28600644a0399119485302f Mon Sep 17 00:00:00 2001 From: PacoDw <__pm@outlook.com> Date: Tue, 14 Jul 2020 10:35:10 -0500 Subject: [PATCH 3/4] chore: changed by requested changes --- ...vider_snapshot_backup_policy.html.markdown | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown b/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown index 1d671b81db..a190f2814a 100644 --- a/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown +++ b/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown @@ -12,7 +12,11 @@ description: |- -> **NOTE:** Groups and projects are synonymous terms. You may find `groupId` in the official documentation. -## Example Usage + +# Examples Modifying Polices +When Cloud Backup is enabled for a cluster MongoDB Atlas automatically creates a default Cloud Backup schedule for the cluster with four policy items; hourly, daily, weekly, and monthly. Because of this default creation this provider automatically saves the Cloud Backup Snapshot Policy into the Terraform state. If the default works well for you then you do not need to do anything other than create a cluster with Cloud Backup enabled and your Terraform state will have this information if you need it. However, if you want the policy to be different than the default simply follow the next examples. + +## Example Usage - Create a Cluster and Modify the 4 Default Policies Simultaneously ```hcl resource "mongodbatlas_cluster" "my_cluster" { @@ -75,11 +79,8 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { } } ``` -# Examples Modifying Polices -When Cloud Backup is enabled for a cluster MongoDB Atlas automatically creates a default Cloud Backup schedule for the cluster with four policy items; hourly, daily, weekly, and monthly. Because of this default creation this provider automatically saves the Cloud Backup Snapshot Policy into the Terraform state. If the default works well for you then you do not need to do anything other than create a cluster with Cloud Backup enabled and your Terraform state will have this information if you need it. However, if you want the policy to be different than the default simply follow the next examples. -## Example Usage - Create a Cluster and Modify the 4 Default Policies Simultaneously -This cluster has already been created and is here as an example +## Example Usage - Create a Cluster and change that clusters default backup policy in the same Terraform apply run ```hcl resource "mongodbatlas_cluster" "my_cluster" { @@ -121,8 +122,6 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { -> **NOTE:** This is the id MongoDB Atlas returns for the policy item we want to keep. Here it is hard coded because you need to either use the actual value from the Terraform state or look to map the policy item you want to keep to it's placement in the state file array that was imported in when the cluster was originally created. -Summarized: to use the state file value for a policy item you need to determine the array placement # of the same frequency_type you want to keep. With this Terraform configuration the anothers policy items will be removed. - ~> **IMPORTANT:** For example in the state file we are using the weekly policy is the third policy in the array so it could be referred to with `mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.2.id` instead of the hard coded value, but it's not recommended when the cluster presents changes or make `terraform refresh` due to once this will applied, the cluster state will remove the rest of the items, so the posicion of the array will change to position 0. ## Example Usage - Create a Cluster and Modify 3 Default Policies and Remove 1 Default Policy Simultaneously @@ -190,13 +189,13 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { } ``` --> **NOTE:** (See text in first example for more details on the default.) If you want the Cloud Backup Snapshot Policy to vary in the number of policies from the default when creating the cluster, perhaps you want to remove one policy item and modify the remaining three, simply follow this example here to remove a policy and modify three. +-> **NOTE:** If you want the Cloud Backup Snapshot Policy to vary in the number of policies from the default when creating the cluster, perhaps you want to remove one policy item and modify the remaining three, simply follow this example here to remove a policy and modify three. ~> **IMPORTANT:** If we decide to remove item 2 as our above example marked with `#` we need to consider that once the cluster being modified or makes a `terraform refresh` the item 2 will be replaced with the 3, so it could cause inconsistency. We recommend using hardcoded id value to handle these situations. (See text in the first example for more details on it) - ## Example Usage - Remove 3 Default Policies Items After the Cluster Has Already Been Created +If you want the Cloud Backup Snapshot Policy to vary in number of policies for a cluster that was already created/imported, perhaps you want to remove three policy items and modify the remaining policy, simply follow the next example here. ```hcl resource "mongodbatlas_cluster" "my_cluster" { @@ -263,9 +262,7 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { } ``` --> **NOTE:** (See text in first example for more details on the default.) If you want the Cloud Backup Snapshot Policy to vary in number of policies for a cluster that was already created/imported, perhaps you want to remove three policy items and modify the remaining policy, simply follow the above example here. - -~> **IMPORTANT:** Note in this example we decided to remove the first 3 items so we can't use `mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.3.id` this sentence to retrieve the monthly id value of the cluster state due to once the cluster being modified or makes a `terraform refresh` will cause that the three items will remove from the state, so we will get an error due to the index 3 doesn't exists any more and our monthly policy item is moved to the first place of the array.(See text in the first example for more details on it) +~> **Note:** Note in this example we decided to remove the first 3 items so we can't use `mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.3.id` this sentence to retrieve the monthly id value of the cluster state due to once the cluster being modified or makes a `terraform refresh` will cause that the three items will remove from the state, so we will get an error due to the index 3 doesn't exists any more and our monthly policy item is moved to the first place of the array.(See text in the first example for more details on it) ## Argument Reference From c3d96f90ef25c48c2cfcfd7f775d65f41942462a Mon Sep 17 00:00:00 2001 From: Melissa Plunkett Date: Wed, 22 Jul 2020 16:14:25 -0500 Subject: [PATCH 4/4] Update cloud_provider_snapshot_backup_policy.html.markdown Modified PR branch to quicken pace of completion so we can proceed with repo move. --- ...vider_snapshot_backup_policy.html.markdown | 62 +++---------------- 1 file changed, 9 insertions(+), 53 deletions(-) diff --git a/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown b/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown index a190f2814a..a62cdc17e5 100644 --- a/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown +++ b/website/docs/r/cloud_provider_snapshot_backup_policy.html.markdown @@ -12,9 +12,8 @@ description: |- -> **NOTE:** Groups and projects are synonymous terms. You may find `groupId` in the official documentation. - -# Examples Modifying Polices -When Cloud Backup is enabled for a cluster MongoDB Atlas automatically creates a default Cloud Backup schedule for the cluster with four policy items; hourly, daily, weekly, and monthly. Because of this default creation this provider automatically saves the Cloud Backup Snapshot Policy into the Terraform state. If the default works well for you then you do not need to do anything other than create a cluster with Cloud Backup enabled and your Terraform state will have this information if you need it. However, if you want the policy to be different than the default simply follow the next examples. +# Examples - Modifying Polices +When Cloud Backup is enabled for a cluster MongoDB Atlas automatically creates a default Cloud Backup schedule for the cluster with four policy items; hourly, daily, weekly, and monthly. Because of this default creation this provider automatically saves the Cloud Backup Snapshot Policy into the Terraform state when a cluster is created/modified to use Cloud Backup. If the default works well for you then you do not need to do anything other than create a cluster with Cloud Backup enabled and your Terraform state will have this information if you need it. However, if you want the policy to be different than the default we've provided some examples to help below. ## Example Usage - Create a Cluster and Modify the 4 Default Policies Simultaneously @@ -41,7 +40,8 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { reference_minute_of_hour = 45 restore_window_days = 4 - + //Keep all 4 default policies but modify the units and values + //Could also just reflect the policy defaults here for later management policies { id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.id @@ -80,49 +80,7 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { } ``` -## Example Usage - Create a Cluster and change that clusters default backup policy in the same Terraform apply run - -```hcl -resource "mongodbatlas_cluster" "my_cluster" { - project_id = "" - name = "clusterTest" - disk_size_gb = 5 - - //Provider Settings "block" - provider_name = "AWS" - provider_region_name = "EU_CENTRAL_1" - provider_instance_size_name = "M10" - provider_backup_enabled = true // must be enabled in order to use cloud_provider_snapshot_backup_policy resource - provider_disk_iops = 100 - provider_encrypt_ebs_volume = false -} - -resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { - project_id = mongodbatlas_cluster.my_cluster.project_id - cluster_name = mongodbatlas_cluster.my_cluster.name - - reference_hour_of_day = 3 - reference_minute_of_hour = 45 - restore_window_days = 4 - - - policies { - id = mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.id - - policy_item { - id = 5f0747cad187d8609a72f546 - frequency_interval = 4 - frequency_type = "weekly" - retention_unit = "days" - retention_value = 3 - } - } -} -``` - --> **NOTE:** This is the id MongoDB Atlas returns for the policy item we want to keep. Here it is hard coded because you need to either use the actual value from the Terraform state or look to map the policy item you want to keep to it's placement in the state file array that was imported in when the cluster was originally created. - -~> **IMPORTANT:** For example in the state file we are using the weekly policy is the third policy in the array so it could be referred to with `mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.2.id` instead of the hard coded value, but it's not recommended when the cluster presents changes or make `terraform refresh` due to once this will applied, the cluster state will remove the rest of the items, so the posicion of the array will change to position 0. +~> **IMPORTANT:** `policies.#.policy_item.#.id` is obtained when the cluster is created. The example here shows the default order of the default policy when Cloud Backup is enabled (provider_backup_enabled is set to true). The default policy is viewable in the Terraform State file. ## Example Usage - Create a Cluster and Modify 3 Default Policies and Remove 1 Default Policy Simultaneously @@ -191,11 +149,9 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { -> **NOTE:** If you want the Cloud Backup Snapshot Policy to vary in the number of policies from the default when creating the cluster, perhaps you want to remove one policy item and modify the remaining three, simply follow this example here to remove a policy and modify three. -~> **IMPORTANT:** If we decide to remove item 2 as our above example marked with `#` we need to consider that once the cluster being modified or makes a `terraform refresh` the item 2 will be replaced with the 3, so it could cause inconsistency. We recommend using hardcoded id value to handle these situations. (See text in the first example for more details on it) - +~> **IMPORTANT:** If we decide to remove the 3rd item, as in our above example marked with `#`, we need to consider that once the cluster is modified or `terraform refresh` is run the item `2` in the array will be replaced with content of the 4th item, so it could cause an inconsistency. This may be avoided by using hardcoded id values which will better handle this situation. (See below for an example of a hardcoded value) -## Example Usage - Remove 3 Default Policies Items After the Cluster Has Already Been Created -If you want the Cloud Backup Snapshot Policy to vary in number of policies for a cluster that was already created/imported, perhaps you want to remove three policy items and modify the remaining policy, simply follow the next example here. +## Example Usage - Remove 3 Default Policies Items After the Cluster Has Already Been Created and Modify One Policy ```hcl resource "mongodbatlas_cluster" "my_cluster" { @@ -262,7 +218,7 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { } ``` -~> **Note:** Note in this example we decided to remove the first 3 items so we can't use `mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.3.id` this sentence to retrieve the monthly id value of the cluster state due to once the cluster being modified or makes a `terraform refresh` will cause that the three items will remove from the state, so we will get an error due to the index 3 doesn't exists any more and our monthly policy item is moved to the first place of the array.(See text in the first example for more details on it) +-> **NOTE:** In this example we decided to remove the first 3 items so we can't use `mongodbatlas_cluster.my_cluster.snapshot_backup_policy.0.policies.0.policy_item.3.id` to retrieve the monthly id value of the cluster state due to once the cluster being modified or makes a `terraform refresh` will cause that the three items will remove from the state, so we will get an error due to the index 3 doesn't exists any more and our monthly policy item is moved to the first place of the array. So we use `5f0747cad187d8609a72f546`, which is an example of an id MongoDB Atlas returns for the policy item we want to keep. Here it is hard coded because you need to either use the actual value from the Terraform state or look to map the policy item you want to keep to it's current placement in the state file array. ## Argument Reference @@ -279,7 +235,7 @@ resource "mongodbatlas_cloud_provider_snapshot_backup_policy" "test" { #### Policy Item * `policies.#.policy_item` - (Required) Array of backup policy items. -* `policies.#.policy_item.#.id` - (Required) Unique identifier of the backup policy item. `policies.#.policy_item.#.id` is a value obtained via the mongodbatlas_cluster resource. provider_backup_enabled of the mongodbatlas_cluster resource must be set to true. See the example above for how to refer to the mongodbatlas_cluster resource forpolicies.#.policy_item.#.id +* `policies.#.policy_item.#.id` - (Required) Unique identifier of the backup policy item. `policies.#.policy_item.#.id` is a value obtained via the mongodbatlas_cluster resource. provider_backup_enabled of the mongodbatlas_cluster resource must be set to true. See the example above for how to refer to the mongodbatlas_cluster resource for policies.#.policy_item.#.id * `policies.#.policy_item.#.frequency_interval` - (Required) Desired frequency of the new backup policy item specified by frequencyType. * `policies.#.policy_item.#.frequency_type` - (Required) Frequency associated with the backup policy item. One of the following values: hourly, daily, weekly or monthly. * `policies.#.policy_item.#.retention_unit` - (Required) Scope of the backup policy item: days, weeks, or months.