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
240 stars 168 forks source link

Bug: Invalid attribute diskIOPS specified. #2

Closed aliciaalcalde closed 5 years ago

aliciaalcalde commented 5 years ago

Good morning,

I use Terraform v0.12.5 and I try to create a Atlas Mongodb cluster :

resource "mongodbatlas_cluster" "cluster" {
  project_id    = "XXXXX"
  name         = "cluster-test"
  disk_size_gb = 40
  num_shards   = 1
  replication_factor           = 3
  backup_enabled               = true
  provider_name               = "GCP"
  provider_disk_iops          = 1200
  provider_instance_size_name = "M30"
  provider_region_name        = "US_EAST_4"
}

It return this error: error creating MongoDB Cluster: POST https://cloud.mongodb.com/api/atlas/v1.0/groups/xxxxx/clusters: 400 (request "Bad Request") Invalid attribute diskIOPS specified.

I change remove provider_disk_iops and disk_size_gb but the error is always the same.

Thank you

themantissa commented 5 years ago

@aliciaalcalde we are looking into the cause and a fix. Thank you for filing the issue!

themantissa commented 5 years ago

I believe we've discovered the issue. GCP and Azure can have disk resized but not iops modified (it modifies in tandem with the size of disk). disk_iops is only for AWs. We'll update here when fixed.

PacoDw commented 5 years ago

Hello @aliciaalcalde, this issue was resolved with the pr #11, you can test it on the fix-#2 branch.

Let us know if you have any comments, thanks!

iainmullan commented 5 years ago

Hello,

I get the same errors when trying to create a cluster on AWS Shared tier, eg. M0, M2, M5

`resource "mongodbatlas_cluster" "cluster" { project_id = "${mongodbatlas_project.project.id}" name = "myapp-staging"

auto_scaling_disk_gb_enabled = false backup_enabled = false

provider_name = "TENANT" provider_instance_size_name = "M0" provider_region_name = "EU_WEST_1" } `

It seems there is an underlying default being applied, even for clusters that don't allow setting the iops. I tried setting the provider_disk_iops property to 0 / null / 100 but it is always refused by the API call. If I create the cluster manually and import to the dashboard, a subsequent tf state show doesn't mention the iops property.