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

On upgrade from 0.4.1 to 0.4.2 start getting errors #174

Closed ozlevka-work closed 4 years ago

ozlevka-work commented 4 years ago

Terraform version: 0.12.23
Go runtime version: go1.12.13 provider.aws v2.53.0 provider.mongodbatlas v0.4.2

When create mongodbatlas_network_container receiving error: Error: error creating MongoDB Network Peering Container: POST https://cloud.mongodb.com/api/atlas/v1.0/groups/[project id]/containers: 400 (request "Bad Request") An invalid enumeration value us_west_2 was specified.

on main.tf line 25, in resource "mongodbatlas_network_container" "container": 25: resource "mongodbatlas_network_container" "container" {

Error: error creating MongoDB Cluster: POST https://cloud.mongodb.com/api/atlas/v1.0/groups/[project id]/clusters: 400 (request "Bad Request") An invalid enumeration value us_west_2 was specified.

themantissa commented 4 years ago

@ozlevka-work I'm assuming this is a side effect of https://github.com/terraform-providers/terraform-provider-mongodbatlas/pull/158, we had to remove the array of regions as it was turning out that changes are happening at a rate we can't keep up with so we are depending on the underlying API now to error. If you change us_west_2 to US_WEST_2 that will work.

fyi @PacoDw and @shum

ozlevka-work commented 4 years ago

@themantissa , thank you very much. Your suggestion works for me.

But I can't use same variable for mogodbatlas and aws providers. I forced to separate region definition: atlas_region_name = upper(replace(var.region_name,"-","_")) It's a little uncomfortable and looks ugly path. I suggest fixing it in some way

themantissa commented 4 years ago

@ozlevka-work thank you for the feedback. We attempted to do the conversion within the provider but that resulted in the undesired behavior of being behind the Atlas platform on support. You'll need to use Amazon style conventions for AWS resources and Atlas style (https://docs.atlas.mongodb.com/cloud-providers-regions/) for Atlas regions. Please feel free to suggest changes on this at our feedback site: https://feedback.mongodb.com/forums/924145-atlas