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: VPC Peering Atlas-GCP #17

Closed aliciaalcalde closed 5 years ago

aliciaalcalde commented 5 years ago

Good afternoon,

I try to create VPC Peering between Atlas and GCP:

resource "mongodbatlas_project" "project" {
  name   = var.project_name
  org_id = var.org_id
}
resource "mongodbatlas_network_container" "container" {
  project_id       = mongodbatlas_project.project.id
  atlas_cidr_block = "10.8.0.0/18"
  provider_name    = "GCP"
  depends_on       = ["mongodbatlas_project.project"]
}

resource "mongodbatlas_network_peering" "main_peering" {
  project_id        = mongodbatlas_project.project.id
  container_id      = mongodbatlas_network_container.container.id
  provider_name     = "GCP"
  gcp_project_id    = var.gcp_project_id
  network_name      = var.gcp_main_network_name
  depends_on       = ["mongodbatlas_network_container.container"]
}

It return this error: Error: error creating MongoDB Network Peering Connection: POST https://cloud.mongodb.com/api/atlas/v1.0/groups/xxxxxxxx/peers: 500 (request "Internal Server Error") Unexpected error.

Thank you,

PacoDw commented 5 years ago

Hello @aliciaalcalde thanks for your review, please just change mongodbatlas_network_container.container.id to mongodbatlas_network_container.container.container_id because id is only for terraform purposes while container_id is used through the terraform resources.

Let us know if it works or if you find another issue.