Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongoatlas_cluster fails to create - invalid enumeration value M2 was specified #160

Closed
StewartSnow opened this issue Mar 3, 2020 · 2 comments

Comments

@StewartSnow
Copy link

StewartSnow commented Mar 3, 2020

Hi,
We're having a problem deploying a simple M2 cluster with the following configuration. We get the error:

mongodbatlas_cluster.atlas_cluster: error creating MongoDB Cluster: POST https://cloud.mongodb.com/api/atlas/v1.0/groups/
5e5e3a35d474757c8d98b41d/clusters: 400 (request "Bad Request") An invalid enumeration value M2 was specified.

We're using 0.4.1 version of the provider and terraform v0.12.21

resource "mongodbatlas_cluster" "atlas_cluster" {
  project_id   = "${mongodbatlas_project.atlas_project.id}"
  name         = "${var.project}-cluster"
  num_shards   = 1
  backup_enabled = true

  replication_factor           = 3 // default
  mongo_db_major_version       = "4.2"
  cluster_type                 = "REPLICASET"

  // Provider Settings "block"
  provider_name               = "AWS"
  disk_size_gb                = 100 # this is the minimum & default
  provider_volume_type        = "STANDARD"
  provider_region_name        = "US_EAST_1"
  provider_instance_size_name = "M2" 
}

We've been through everything that we can think of, but can't figure it out, any advice??

@StewartSnow
Copy link
Author

Resolved - for others similarly confused. The solution was as follows:

The documentation mentions somewhere that the TENANT type (which is for multi-tenant usage), is also necessary (seems rather confusing to us), that specifically for M2 and M5 instance sizes, you need to use this value instead of a provider name, and then specify the target provider using the backing_provider_name property....

This is all down to the mongo atlas api behaviour, not the terraform provider

backing_provider_name       = "AWS"
  provider_name               = "TENANT" // this is a real gotcha - needs to be TENANT for M2 & M5 instances....
  disk_size_gb                = 100      # this is the minimum & default
  provider_region_name        = "US_EAST_1"
  provider_instance_size_name = "M2"

@themantissa
Copy link
Collaborator

@StewartSnow did want to let you know we added a shared/multi-tenant example in the clusters doc to help. https://www.terraform.io/docs/providers/mongodbatlas/r/cluster.html#example-aws-shared-tier-cluster. Appreciated your submitting how it can be confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants