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

azurerm_cosmosdb_account fails with documentdb.DatabaseAccountsClient#CheckNameExists: Failure responding to request: StatusCode=500 #7173

Closed
ferhaty89 opened this issue Jun 2, 2020 · 17 comments · Fixed by #7189
Labels
service/cosmosdb upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR
Milestone

Comments

@ferhaty89
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.12.9
azurerm v2.10.0

Affected Resource(s)

  • azurerm_cosmosdb_account

Terraform Configuration Files

resource "random_integer" "ri" {
  min = 10000
  max = 99999
}

resource "azurerm_cosmosdb_account" "this" {
  name                = "${local.location}${local.subscription}xxx"
  location            = "${local.location}"
  resource_group_name = "${local.location}-${local.subscription}-${local.owner}-rg"
  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          = var.db_failover_location
    failover_priority = 1
  }

  geo_location {
    prefix            = "${local.location}${local.subscription}xxx-${random_integer.ri.result}-customid"
    location          = "${local.location}"
    failover_priority = 0
  }

  tags = "${module.tag.tags}"

}

Debug Output

Panic Output

Expected Behavior

Provider creates CosmosDB account

Actual Behavior

Provider does not create CosmosDB account and fails with the following message.

Error: Error checking if CosmosDB Account "xxx" already exists (Resource Group "xxx"): documentdb.DatabaseAccountsClient#CheckNameExists: Failure responding to request: StatusCode=500 -- Original Error: autorest/azure: error response cannot be parsed: "" error: EOF

  on cosmosdb.tf line 1, in resource "azurerm_cosmosdb_account" "this":
   1: resource "azurerm_cosmosdb_account" "this" {

Steps to Reproduce

  1. terraform apply

Important Factoids

Running in Azure Westeurope

References

@MatthewSwarbrick
Copy link

This started happening for me today. Started with a completely clean slate using the examples pulled from the documentation. This was in North Europe. I tried deploying to UK South to see if it was a region thing but seems to fail regardless.

Terraform:

resource "azurerm_cosmosdb_account" "db" {
  name = "my-cmdb-resource-name"
  location = "North Europe"
  resource_group_name = azurerm_resource_group.main.name
  offer_type = "Standard"
  kind = "GlobalDocumentDB"
  tags = local.tags

  consistency_policy {
    consistency_level = "Session"
  }

  geo_location {
    location = "North Europe"
    failover_priority = 0
  }
}

Terraform version: 0.12.26
AzureRM: 2.11.0

@SeanSteefel
Copy link

I am using TF 0.12.26 with AzureRM 2.10 and experiancing same issue --- fails on previous success IaC executions.

@kensykora
Copy link

kensykora commented Jun 2, 2020

Here's the output I'm getting, might open up a support case with Microsoft -- I doubt this is an azurerm provider issue since it's throwing a 500 error. Not much terraform can do about it.

Our resources are also in West Europe like others above.

Edit: I've opened a support case with Microsoft on this -- Request 120060224009612

2020-06-02T16:51:55.462-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: [DEBUG] AzureRM Request: 
2020-06-02T16:51:55.462-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: HEAD /providers/Microsoft.DocumentDB/databaseAccountNames/ads-paas-dev-gwe-cosmos-74364?api-version=2015-04-08 HTTP/1.1
2020-06-02T16:51:55.462-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: Host: management.azure.com
2020-06-02T16:51:55.462-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: User-Agent: Go/go1.14.2 (amd64-windows) go-autorest/v14.0.0 Azure-SDK-For-Go/v41.2.0 documentdb/2015-04-08 HashiCorp Terraform/0.12.26 (+https://www.terraform.io) Terraform Plugin SDK/1.6.0 terraform-provider-azurerm/2.10.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
2020-06-02T16:51:55.462-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: X-Ms-Correlation-Request-Id: 0bb0e0fd-da9f-6764-572a-0458fd88612a
2020-06-02T16:51:55.462-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe:
2020-06-02T16:51:55.462-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe:
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: [DEBUG] AzureRM Response for https://management.azure.com/providers/Microsoft.DocumentDB/databaseAccountNames/ads-paas-dev-gwe-cosmos-74364?api-version=2015-04-08:
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: HTTP/2.0 500 Internal Server Error
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: Content-Length: 323
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: Cache-Control: no-store, no-cache
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: Date: Tue, 02 Jun 2020 21:51:38 GMT
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: Pragma: no-cache
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: Server: Microsoft-HTTPAPI/2.0
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: Strict-Transport-Security: max-age=31536000; includeSubDomains
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: X-Content-Type-Options: nosniff
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: X-Ms-Correlation-Request-Id: 0bb0e0fd-da9f-6764-572a-0458fd88612a
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: X-Ms-Failure-Cause: service
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: X-Ms-Ratelimit-Remaining-Tenant-Reads: 11998
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: X-Ms-Request-Id: 55c72b0c-e78b-467b-b270-547b440fb4d6
2020-06-02T16:51:55.734-0500 [DEBUG] plugin.terraform-provider-azurerm_v2.10.0_x5.exe: X-Ms-Routing-Request-Id: CANADAEAST:20200602T215139Z:55c72b0c-e78b-467b-b270-547b440fb4d6

@kensykora
Copy link

Microsoft has indicated it might be a known issue.

@nara
Copy link

nara commented Jun 3, 2020

i am getting same error.

Terraform v0.12.26
provider.azurerm v2.3.0

@srinivasansharath
Copy link

I am also getting the same issues..

Terraform v0.12.24
provider.azurerm v2.8.0 v2.9.0 v2.10.0 v.2.11.0 v2.12.0 (all these versions)

Was working until 1am (UST) 2nd June 2020, suddenly stopped working there after.

@xtellurian
Copy link

Seeing the same thing in Australia Southeast

@tombuildsstuff tombuildsstuff added the upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR label Jun 3, 2020
@arkiaconsulting
Copy link

arkiaconsulting commented Jun 3, 2020

Seeing this in France Central as well.
Terraform v0.12.26

  • provider.azurerm v2.12.0

@tombuildsstuff tombuildsstuff added this to the v2.13.0 milestone Jun 3, 2020
@Alexei-B
Copy link

Alexei-B commented Jun 3, 2020

I have raised a Microsoft support request and the Cosmos product team are apparently looking into this as a possible Azure side issue.

@madonnaz
Copy link

madonnaz commented Jun 3, 2020

Same issue in Central US and West US

Error checking if CosmosDB Account "" already exists
documentdb.DatabaseAccountsClient#CheckNameExists: Failure responding to request: StatusCode=500

@ferhaty89
Copy link
Author

ferhaty89 commented Jun 3, 2020

FYI. I've been able to get the CosmosDB account by downgrading to azurerm v1.31.0 (which ignores the 500 error). It's not a pretty workaround but it works for the time being.

@jackofallops
Copy link
Member

Upstream issue raised: Azure/azure-sdk-for-go#9891
We'll prepare a similar workaround for the 500 status.

@markjbrown
Copy link

We have identified the root cause for this and are actively working on a hot fix to the issue. ETA should be tomorrow.

Thanks.

@markjbrown
Copy link

We've deployed the fix for this and the issue is resolved.

@vaughanh1
Copy link

As suggested by the above link, I have tested the hotfix of azurerm version 2.12.0, and it is working.

@ghost
Copy link

ghost commented Jun 4, 2020

This has been released in version 2.13.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.13.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Jul 3, 2020

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 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Jul 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/cosmosdb upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR
Projects
None yet