akshaykarle / terraform-provider-mongodbatlas

Terraform provider for MongoDB Atlas
Mozilla Public License 2.0
122 stars 54 forks source link

mongodb_ip_whitelist creation fails #20

Closed fbreckle closed 6 years ago

fbreckle commented 6 years ago

Hi,

the creation of a mongodbatlas_ip_whitelist in my project fails.

I get the following output:

Terraform will perform the following actions:

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.

Enter a value: yes

module.mongodbatlas-project.mongodbatlas_ip_whitelist.whitelist: Creating... cidr_block: "" => "1.2.3.4/32" comment: "" => "{comment}" group: "" => "{group-id}" ip_address: "" => ""

Error: Error applying plan:

1 error(s) occurred:

Terraform does not automatically rollback in the face of errors. Instead, your Terraform state file has been partially updated with any resources that successfully completed. Please address the error above and apply again to incrementally change your infrastructure.

Makefile:16: recipe for target 'apply' failed make: *** [apply] Error 1

I had a quick look at the go-mongodbatlas library but didnt find any obvious issues. I'm not a Go expert by any means, though. My Go version is go1.10.2 linux/amd64 My Terraform version is v0.11.7

akshaykarle commented 6 years ago

Hey @fbreckle, it seems that the mongo atlas API is returning a 500 which is bad. Can you contact their support and see what they have to say? I don't think there is anything I can do in the provider to fix this. I'll close this ticket now, but if you they say it is something on the API request made by the provider feel free to re-open and I can take a look. Thank you!

fbreckle commented 6 years ago

As a followup, in case anyone finds this, the problem was that my comment was too long. The mongodb atlas API doc does not mention any length limits (the website limits to 80 chars, though) and the API call returns a rather unhelpful Internal Server Error "Unexpected Error".

akshaykarle commented 6 years ago

Thanks for that info, I'll try updating the provider to have this in the validation so that terraform breaks with a better error if the API doesn't handle it gracefully.