Terraform trying to access the deleted resource

93 Views Asked by At

my tf plan stage is failing with the message - error reading MongoDB ClusterAdvanced (mongoatlas) - 401 (request "") You are not authorized for this resource.[0m .

The cluster was deleted from the Mongo Atlas console directly and the tf is trying to access the same resource . I am using the tf deployment in Azure devops with multiple modules. one of the module is the Mongo Atlas .

Below is from the tf state file we can see the Mongo Atlas resource. I tried to destroy the resource, refresh the state but nothing works and brings the same error message. How do I resolve this please.

  ```"module": "module.mongo_db_atlas",
  "mode": "managed",
  "type": "mongodbatlas_advanced_cluster",
  "name": "mongodbatlas",
  "provider": "provider[\"registry.terraform.io/mongodb/mongodbatlas\"]",
  "instances": [
        ],
        "cluster_id": "",
        "cluster_type": "REPLICASET",
        "connection_strings": [
          {
            "private": "",
            "private_endpoint": [],
          }
        ],
        "create_date": "",
        "disk_size_gb": 8,
        "labels": [],
        "mongo_db_major_version": "4.4",
        "mongo_db_version": "4.4.25",
        "name": "mongoatlas",
        "project_id": "sample id"```
0

There are 0 best solutions below