Skip to content

[Bug]: mongodbatlas_project_ip_access_list resource gets automatically imported to TF state if it already exists #3815

@alacasse25

Description

@alacasse25

Is there an existing issue for this?

  • I have searched the existing issues

Provider Version

2.1.0

Terraform Version

v1.8.5

Terraform Edition

Terraform Open Source (OSS)

Current Behavior

Hey guys,

We recently had an issue where we accidently deleted the IP whitelist of our MongoDB project by tearing down an old environment. Later down the road, we found out that all of our TF states were referencing the exact same mongodbatlas_project_ip_access_list resource. Our environments were creating the resource on the same project and the resource got automatically imported into each of their TF states. We weren't aware of the behavior and were quite surprised that we didn't get a 409 instead.

For example, when doing the same manipulations as described below, but on a mongodbatlas_database_user resource we get the following error: POST: HTTP 409 Conflict (Error code: "USER_ALREADY_EXISTS") which is what we would have expected from the mongodbatlas_project_ip_access_list resource.

Thanks for the help :)

Terraform configuration to reproduce the issue

resource "mongodbatlas_project_ip_access_list" "whitelist_all" {
  project_id = "your_mongodb_project_id"
  cidr_block = "0.0.0.0/0"
}

Steps To Reproduce

  1. Create a blank project that will only manage a mongodbatlas_project_ip_access_list resource
  2. TF apply
  3. Delete your TF state
  4. Rerun the TF apply
  5. The resource will be added to your TF state even if it was already existing
    • We would have expected a 409.

Logs

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions