terraform-provider-mongodbatlas: terraform plan and apply fails after upgrading this module to 0.5.0

I have a MongoDB cluster managed with Terraform, with no backup enabled:

resource "mongodbatlas_cluster" "this" {
  project_id                   = "<project-id>"
  provider_name                = "AWS"
  provider_region_name         = "US-EAST-1"
  name                         = "MyCluster"
  provider_instance_size_name  = "M10"
  auto_scaling_disk_gb_enabled = true
  backup_enabled               = false
  mongo_db_major_version       = "4.2"
}

The cluster was created using an earlier version of this module, but when running plan or apply with the new version, I get:

Error: error getting a Cloud Provider Snapshot Backup Policy for the cluster(MyCluster): GET https://cloud.mongodb.com/api/atlas/v1.0/groups/<project-id>/clusters/MyCluster/backup/schedule: 404 (request "Not Found") No backup configuration exists for cluster <cluster-id> in group <project-id>.

It appears that relevant API returns HTTP 404 if no cloud provider snapshots are available, which will be also the case when I would decide to add a cloud provider snapshot later.

My current work-around is not to upgrade to the new version.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 16 (4 by maintainers)

Most upvoted comments

@borfig per your comment “It appears that relevant API returns HTTP 404 if no cloud provider snapshots are available, which will be also the case when I would decide to add a cloud provider snapshot later.” The later part of the statement is not true, if you add cloud provider backup later you automatically get a default policy (see the underlying API here - only a GET/PATCH - https://docs.atlas.mongodb.com/reference/api/snapshot-schedule/). This made this a particularly tricky resources to bring into terraform.

Thank you for working w/ us to resolve this!

@PacoDw the proposed fix works in my case

@borfig I’m happy to hear that, thank you so much for all 😃

I am using Terraform v0.12.23 Here is the relevant grep plugin.terraform-provider-mongodbatlas output (our Terraform file is huge…) mongodbatlas.txt