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
244 stars 172 forks source link

An invalid enumeration value M5 was specified. #318

Closed sonic1981 closed 4 years ago

sonic1981 commented 4 years ago

Terraform CLI and Terraform MongoDB Atlas Provider Version

provider "mongodbatlas" {
    version = "= 0.6.5"
    public_key = var.publicKey
    private_key  = var.privateKey
}

Terraform Configuration File

data "mongodbatlas_project" "proj" {
  name                          = "Snapshot"
}

resource "mongodbatlas_cluster" "clu" {

  project_id                    = data.mongodbatlas_project.proj.id
  name                          = "clustername"
  provider_name                 = "AWS"
  num_shards                    = 1
  provider_instance_size_name   = "M5"

  provider_region_name          = "EU_WEST_1"

}

Steps to Reproduce

  1. terraform init
  2. terraform apply

Expected Behavior

Should be possible to create a M5 tier cluster.

Actual Behavior

400 (request "Bad Request") An invalid enumeration value M5 was specified.

Additional Context

The documentation for this provider states:

provider_instance_size_name - (Required) Atlas provides different instance sizes, each with a default storage capacity and RAM size. The instance size you select is used for all the data-bearing servers in your cluster. See Create a Cluster providerSettings.instanceSizeName for valid values and default resources. Note free tier (M0) creation is not supported by the Atlas API and hence not supported by this provider.)

source

so I understood this to mean I can't create a M0 cluster. Yet the minimum cluster I can seemingly create is M10

nikhil-mongo commented 4 years ago

@sonic1981 Apart from M0, all other cluster tiers can be created using Terraform. Please use the below sample to create an M5 cluster and refer this in the documentation.

resource "mongodbatlas_cluster" "cluster-atlas" {
  project_id                   = mongodbatlas_project.aws_atlas.id
  name                         = "cluster-atlas"
  mongo_db_major_version       = "4.2"
  //Provider settings
  auto_scaling_disk_gb_enabled = "false"
  backing_provider_name        = "AWS"
  provider_name               = "TENANT"
  disk_size_gb                = 5
  provider_instance_size_name = "M5"
  provider_region_name        = var.atlas_region
}
themantissa commented 4 years ago

Closing a the question was answered and the answer ack'ed, Thank you both!