Possibility to change 'frequency_type' of snapshot backup policy item via Terraform
I’m facing an issue about Snapshot Backup Policy creation/modification via Terraform ( FYI, I open a case to the support of MongoDB https://support.mongodb.com/case/00668262). Let me explain :
When I want to create a MongoAtlas Cluster via terraform, I want to apply a custom Snahsphot Backup Policy with ONLY 2 items during the creation of the cluster :
N° Item Frequency type Frequency Retention
0 Daily 1 7 Days
1 Weekly 1 (Saturday) 4 weeks
However, during the creation of the mongo atlas cluster, I can see an error
Error: Error applying plan:
1 error occurred:
* module.cluster_contrib.module.dpjmongoatlas.module.tfmodule-gcp-mongo-atlas-cluster.mongodbatlas_cloud_provider_snapshot_backup_policy.snapshot_backup: 1 error occurred:
* mongodbatlas_cloud_provider_snapshot_backup_policy.snapshot_backup: error updating a Cloud Provider Snapshot Backup Policy: PATCH <a rel="nofollow noreferrer" href="https://cloud.mongodb.com/api/atlas/v1.0/groups/XXXXXXXXXXXXXXXXX/clusters/contrib/backup/schedule">https://cloud.mongodb.com/api/atlas/v1.0/groups/XXXXXXXXXXXXXXXXX/clusters/contrib/backup/schedule</a>: 400 (request "Bad Request") The frequency type of a policy item must not be changed.
Indeed, during the creation of the MongoAtlas cluster, MongoAtlas apply the default Snapshot Backup Policy first (with 4 items hourly, daily, weekly, monthly) and after try to apply the custom snapshot backup policy I want (described in the terraform code). But, as we can see above, it seems impossible to change the frequency_type of an existing policy’s item…
To resume clearly with this spreadsheet :
N° Item Frequencytype of default policy Frequencytype of custom policy I want COMMENT
0 Hourly Daily KO (because The frequency type of a policy item must not be changed)
1 Daily Weekly KO (because The frequency type of a policy item must not be changed)
2 Weekly NOTHING
3 Monthly NOTHING
Can we purpose a evolution to have the possibilty to modify the frequency_type of an existing policy item via Terraform/API?
Thank you for posting your feedback. Based on this and other feedback we've updated the documentation with better examples of how to modify the backup policy, which will go out with our next release. However you can see the PR here: https://github.com/mongodb/terraform-provider-mongodbatlas/pull/259/files. If you have a chance to check it out we'd appreciate feedback!