mongodb / terraform-provider-mongodbatlas

Terraform MongoDB Atlas Provider: Deploy, update, and manage MongoDB Atlas infrastructure as code through HashiCorp Terraform
https://registry.terraform.io/providers/mongodb/mongodbatlas
Mozilla Public License 2.0
241 stars 167 forks source link

Can't create a new cluster (M2/M5) after 0.6.2 version #265

Closed tolik-u closed 4 years ago

tolik-u commented 4 years ago

When trying to run TF apply (with the same code that worked on 0.6.1) we get an error:

Error: error creating MongoDB Cluster: POST https://cloud.mongodb.com/api/atlas/v1.0/groups/${CLUSTERID}/clusters: 400 (request "Bad Request") Invalid attribute providerSettings specified.

  on ../tfmodules/mongodb-atlas/main.tf line 49, in resource "mongodbatlas_cluster" "cluster":
  49: resource "mongodbatlas_cluster" "cluster" {

After forcing the provider version to previous, 0.6.1, apply works as expected.

I suppose the problem came from here https://github.com/terraform-providers/terraform-provider-mongodbatlas/pull/255 but it's huge, so I'm not sure.

polmabri commented 4 years ago

I get the same error with the following test configuration and provider version 0.6.2:

provider "mongodbatlas" {
  version = "0.6.2"
  public_key  = "xxx"
  private_key = "yyy"
}

resource "mongodbatlas_cluster" "cluster-test" {
  project_id              = "zzz"
  name                    = "cluster-test-global"
  //M2 must be 2, M5 must be 5
  disk_size_gb            = "2"

  //Provider Settings "block"
  provider_name = "TENANT"
  backing_provider_name = "AWS"
  provider_region_name = "US_EAST_1"
  provider_instance_size_name = "M2"

  //These must be the following values
  mongo_db_major_version = "4.2"
  auto_scaling_disk_gb_enabled = "false"
}

0.6.1 works fine!

themantissa commented 4 years ago

Thank you both for the quick reports. @tolik-u can you provide an example of your cluster config? Is it also an M2/M5?

themantissa commented 4 years ago

Confirmed issues with M2/M5 creation.

coderGo93 commented 4 years ago

Hello @tolik-u , thanks for the issue, I made changes on branch fix-265, could you please test it again? so I can be sure if it's working or not. FYI: I tested with similar config as @polmabri

tolik-u commented 4 years ago

@themantissa Mine was a dynamic config, full of variables, but yes, the cluster I tried to create was M2.

tolik-u commented 4 years ago

@coderGo93 OK thanks I'll test it again and report

tolik-u commented 4 years ago

@coderGo93I just realized it's not a built version, sorry, I can't test it right now, I'll be waiting for a release, thank you!

themantissa commented 4 years ago

No worries @tolik-u ! I tested this morning with #267 and both M2 and M5 successful. - creation and destroy.

themantissa commented 4 years ago

@tolik-u we've released a preview version that should allow you to test if this fixes the issue. If you can confirm we'd appreciate it. https://github.com/mongodb/terraform-provider-mongodbatlas/releases/tag/0.6.4