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

Problem using Cross Region Replica Set in GCP #188

Closed jwillker closed 4 years ago

jwillker commented 4 years ago

What I expected to happen:

Create a Cluster in GCP with Cross region enabled

What happened

Error 500

mongodbatlas_cluster.test: Creating...

Error: error creating MongoDB Cluster: POST https://cloud.mongodb.com/api/atlas/v1.0/groups/5bXXXXX2/clusters: 500 (request "Internal Server Error") Unexpected error.

  on mongo.tf line 6, in resource "mongodbatlas_cluster" "test":
   6: resource "mongodbatlas_cluster" "test" {

My terraform file:

provider "mongodbatlas" {}

resource "mongodbatlas_cluster" "test" {
  project_id   = "XXXXXXXX"
  name         = "gcp-test"
  num_shards   = 1

  backup_enabled               = true
  auto_scaling_disk_gb_enabled = true
  mongo_db_major_version       = "3.6"
  cluster_type                 = "REPLICASET"

  //Provider Settings "block"
  provider_name               = "GCP"
  disk_size_gb                = 10
  provider_instance_size_name = "M30"

  replication_specs {
    num_shards = 1
    regions_config {
      region_name     = "US_EAST_1"
      electable_nodes = 3
      priority        = 7
      read_only_nodes = 0
    }
    regions_config {
      region_name     = "US_EAST_4"
      electable_nodes = 2
      priority        = 6
      read_only_nodes = 0
    }
  }

  advanced_configuration = {
    javascript_enabled                   = true
    minimum_enabled_tls_protocol         = "TLS1_2"
    fail_index_key_too_long              = true
    oplog_size_mb                        = "990"
  }
}

My local configuration:

I have tried the example in https://www.terraform.io/docs/providers/mongodbatlas/r/cluster.html#example-gcp-cluster and work for me.

Did I do something wrong?

themantissa commented 4 years ago

Hi @JohnWillker - our ability to support here is limited as I do not have access (this is for issues regarding the provider), please reach out to MongoDB Atlas support directly for the best experience.

I can say looking at this that I believe it is
backup_enabled = true which is no longer supported with new cluster creation. We are in progress with updating all of the Terraform documentation but if you change your backup from that to provider_backup_enabled = true you should be able to proceed.

themantissa commented 4 years ago

Assuming this answered the question - closing.

jwillker commented 4 years ago

Assuming this answered the question - closing.

Sorry for taking a long time to answer.

Not this not solving my problem I have changed the backup_enabled to provider_backup_enabled and the same error occurs.

themantissa commented 4 years ago

@JohnWillker - no worries, my turn to take a while as I was OOO. Support will always be faster than I can be :) Also realized your EAST_1 region should probably be EASTERN_US if I am guessing correctly - the GCP to Atlas region name chart is here: https://docs.atlas.mongodb.com/reference/google-gcp/#google-gcp

jwillker commented 4 years ago

EASTERN_US

Yep, now its works, thank you so much!