Skip to content

Problem destroying network peering container #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aliciaalcalde opened this issue Sep 17, 2019 · 2 comments · Fixed by #38
Closed

Problem destroying network peering container #30

aliciaalcalde opened this issue Sep 17, 2019 · 2 comments · Fixed by #38

Comments

@aliciaalcalde
Copy link

aliciaalcalde commented Sep 17, 2019

Good morning,

I try to destroy my Atlas stack:

provider "mongodbatlas" {
  public_key = "xxxxxx"
  private_key  = "yyyyy"
}

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 = var.atlas_cidr
  provider_name    = "GCP"
  depends_on       = ["mongodbatlas_project.project"]
}


resource "null_resource" "atlas_private_mode" {
  provisioner "local-exec" {
    command = <<EOF
      curl --user  "xxxxxx:yyyyyyy" --digest --header "Accept: application/json" \
      --header "Content-Type: application/json" \
      --include \
      --request PATCH "https://cloud.mongodb.com/api/atlas/v1.0/groups/${mongodbatlas_project.project.id}/privateIpMode?pretty=true" \
      --data '{"enabled" : true}'
    EOF
  }
  depends_on = ["mongodbatlas_project.project"]
}

resource "mongodbatlas_cluster" "cluster" {
  project_id                   = mongodbatlas_project.project.id
  name                         = var.cluster_name

  backup_enabled               = var.backup_enabled
  auto_scaling_disk_gb_enabled = true
  mongo_db_major_version       = var.mongodb_version

  //Provider Settings "block"
  provider_name               = "GCP"
  disk_size_gb                = var.size_gb
  provider_instance_size_name = var.instance_type
  provider_region_name        = var.region

  depends_on                  = ["mongodbatlas_project.project"]
}

It shows this error:

Error: error deleting MongoDB Network Peering Container (5d7ba8a9c56c98b9eec8448d): DELETE https://cloud.mongodb.com/api/atlas/v1.0/groups/5d7ba8a7f2a30b18d0bcc33b/containers/5d7ba8a9c56c98b9eec8448d: 409 (request "Conflict") Cannot modify in use containers. The container still contained resources.

It isn't any cluster or network parameter in the Atlas console. Finally, I have to remove this resource manually from terraform tfstate.

Thank you,

@PacoDw
Copy link
Contributor

PacoDw commented Sep 18, 2019

Thank you so much for your review. Let me check this to resolve this issue as soon as possible.

@PacoDw
Copy link
Contributor

PacoDw commented Sep 24, 2019

Hello, @aliciaalcalde , the issue was attended with the pr 38, and you can test it on the branch networkContainer.
If you have another comment or concern plz let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants