Skip to content
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

Fail to destroy Cosmos DB account since unable to list write keys #2697

Closed
torumakabe opened this issue Jan 17, 2019 · 1 comment
Closed

Comments

@torumakabe
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

  • Terraform v0.11.11
  • AzureRM v1.21.0

Description

Sometimes I got error when I delete Cosmos DB account. Not always. The error tend to occur in multi-region configuration it need long operation time. After I get the error and wait several minutes, I can see that the db account has been deleted on Azure Portal. So after that, terraform destroy command complete successfully.

Affected Resource(s)

  • azurerm_cosmosdb_account

Terraform Configuration Files

provider "azurerm" {
  version = "=1.21.0"
}

resource "azurerm_resource_group" "shared" {
  name     = "${var.my_prefix}-my-${var.my_chap}-rg"
  location = "${var.my_resource_group_location}"
}

resource "azurerm_cosmosdb_account" "shared" {
  name                = "${var.my_prefix}-my-${var.my_chap}-db"
  location            = "${azurerm_resource_group.shared.location}"
  resource_group_name = "${azurerm_resource_group.shared.name}"
  offer_type          = "Standard"
  kind                = "MongoDB"

  enable_automatic_failover = true

  consistency_policy {
    consistency_level       = "BoundedStaleness"
    max_interval_in_seconds = 10
    max_staleness_prefix    = 200
  }

  geo_location {
    location          = "${azurerm_resource_group.shared.location}"
    failover_priority = 0
  }

  geo_location {
    location          = "${var.my_failover_location}"
    failover_priority = 1
  }
}

Expected Behavior

Running terraform destroy should successfully delete the terraform provisioned Cosmos DB account on the first attempt.

Actual Behavior

Error: Error refreshing state: 1 error(s) occurred:

* azurerm_cosmosdb_account.shared: 1 error(s) occurred:

* azurerm_cosmosdb_account.shared: azurerm_cosmosdb_account.shared: [ERROR] Unable to List Write keys for CosmosDB Account my-db: documentdb.DatabaseAccountsClient#ListKeys: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="NotFound" Message="Entity with the specified id does not exist in the system.\r\nActivityId: myid, Microsoft.Azure.Documents.Common/2.1.0.0"

Steps to Reproduce

  1. terraform destroy
@ghost
Copy link

ghost commented Mar 5, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants