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

Adding 16 whitelist entries at the same time causes an error #252

Closed sergiocastrogom closed 4 years ago

sergiocastrogom commented 4 years ago

Steps to Reproduce

  1. Create a new project.
  2. Create a .tf file to add 16 whitelist entries. I have used the below:

`provider "mongodbatlas" { public_key = "xxxx" private_key = "xxxx" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist1" { project_id = "xxxx" cidr_block = "10.0.0.0/8" comment = "whitelist CIDR block1" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist2" { project_id = "xxxx" cidr_block = "130.99.0.0/16" comment = "whitelist CIDR block2" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist3" { project_id = "xxxx" cidr_block = "136.229.0.0/16" comment = "whitelist CIDR block3" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist4" { project_id = "xxxx" cidr_block = "143.122.0.0/16" comment = "whitelist CIDR block4" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist5" { project_id = "xxxx" cidr_block = "165.152.0.0/16" comment = "whitelist CIDR block5" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist6" { project_id = "xxxx" cidr_block = "169.4.0.0/14" comment = "whitelist CIDR block6" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist7" { project_id = "xxxx" cidr_block = "169.8.0.0/13" comment = "whitelist CIDR block7" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist8" { project_id = "xxxx" cidr_block = "172.16.0.0/12" comment = "whitelist CIDR block8" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist9" { project_id = "xxxx" cidr_block = "192.28.0.0/18" comment = "whitelist CIDR block9" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist10" { project_id = "xxxx" cidr_block = "192.28.64.0/19" comment = "whitelist CIDR block10" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist11" { project_id = "xxxx" cidr_block = "192.28.96.0/22" comment = "whitelist CIDR block11" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist12" { project_id = "xxxx" cidr_block = "192.43.235.0/24" comment = "whitelist CIDR block12" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist13" { project_id = "xxxx" cidr_block = "202.237.244.0/24" comment = "whitelist CIDR block13" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist14" { project_id = "xxxx" cidr_block = "204.126.212.0/23" comment = "3M whitelist CIDR block14" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist15" { project_id = "xxxx" cidr_block = "204.221.11.0/24" comment = "whitelist CIDR block15" }

resource "mongodbatlas_project_ip_whitelist" "cckm_project_whitelist16" { project_id = "xxxx" cidr_block = "205.153.108.0/22" comment = "whitelist CIDR block16" } `

  1. terraform init-validate-appply

After completing the above, some IP whitelist entries are created, but the process fails with the output below from Terraform:

Error: Provider produced inconsistent result after apply When applying changes to mongodbatlas_project_ip_whitelist.cckm_project_whitelist8, provider "registry.terraform.io/-/mongodbatlas" produced an unexpected new value for was present, but now absent. This is a bug in the provider, which should be reported in the provider's own issue tracker.

If you retry terraform apply, the remaining IP whitelist entries are created successfully.

I have used * provider.mongodbatlas: version = "~> 0.6" and Terraform v0.12.24 in my test.

themantissa commented 4 years ago

Thank you @sergiocastrogom - I'll ensure we get some eyes on this.

themantissa commented 4 years ago

@sergiocastrogom investigation confirmed the issue. We will schedule engineering time to address - the PR will link to this issue once ready so you can follow progress. Thanks!