在Mongo Atlas中将IP列入白名单时,terraform返回500错误

时间:2020-02-19 16:09:59

标签: terraform mongodb-atlas

当我尝试在Mongo Atlas中通过Terraform将IP列入白名单时,间歇性地出现以下错误;

mongodbatlas_project_ip_whitelist.test[2]:

发生1个错误:

mongodbatlas_project_ip_whitelist.test.2: error creating project IP whitelist

POST https://cloud.mongodb.com/api/atlas/v1.0/groups/5e4652ed55385542bbfeb88c/whitelist

 500 (request "Internal Server Error") Unexpected error.

mongodbatlas_project_ip_whitelist.test[0]: 1 error(s) occurred:

mongodbatlas_project_ip_whitelist.test.0: error creating project IP whitelist

开机自检

https://cloud.mongodb.com/api/atlas/v1.0/groups/5e4652ed55385542bbfeb88c/whitelist

500 (request "Internal Server Error") Unexpected error.

我使用的Terraform脚本:

resource "mongodbatlas_project_ip_whitelist" "mongo_whitelist" {   
   project_id = "${var.mongo_projectkey}"   
   count = "${length(var.mongo_atlas_inbound_whitelist)}"   
   cidr_block = "${var.mongo_atlas_inbound_whitelist[count.index]}" 
}

请问有什么主意吗?

1 个答案:

答案 0 :(得分:0)

使用计数元参数时,这似乎是0.3.1 Terraform MongoDB Atlas Provider中的错误。

MongoDB Atlas Terraform提供程序的0.4.0版本似乎已修复,该版本也对mongodbatlas_project_ip_whitelist资源也进行了许多其他更改。

我刚刚将版本从0.3.1升级到了0.4.0:

terraform init -upgrade=true

这可以解决问题。