Terraform v0.11.14
provider.azurerm: version = "~> 1.30.1"
azurerm_cosmosdb_account
We are using standard azurerm_cosmosdb_account
resource and everything was working till this morning.
Cosmos DB account is created.
Apply fails with an error:
azurerm_cosmosdb_account.cosmosdb_account: 1 error occurred:
azurerm_cosmosdb_account.cosmosdb_account: Error checking if CosmosDB Account "xxx-ab-745dr" already exists (Resource Group "RG123_745dr_AB"): documentdb.DatabaseAccountsClient#CheckNameExists: Failure responding to request: StatusCode=500 -- Original Error: autorest/azure: error response cannot be parsed: "" error: EOF
Im also seeing this issue. My configuration was working fine yesterday and today im also getting the error. As im still testing terraform i have deleted my CosmosDB, deleted my state file and deleted .terraform directory, re-ran terroform init
then on terraform apply
it errors. Details below
Terraform (and AzureRM Provider) Version
Terraform v0.12.3
provider.azurerm: version = "= 1.30.1"
Please note, im getting the same error if i use provider.azurerm:version = "1.30.0"
Error:
Error: Error checking if CosmosDB Account "mycosomsdbaccountname" already exists (Resource Group "myresourcegroupname"): documentdb.DatabaseAccountsClient#CheckNameExists: Failure responding to request: StatusCode=500 -- Original Error: autorest/azure: error response cannot be parsed: "" error: EOF
on cosmosdb.tf line 2, in resource "azurerm_cosmosdb_account" "trade_cosmosdb_account_single_region":
2: resource "azurerm_cosmosdb_account" "trade_cosmosdb_account_single_region" {
Error occurs running this example:
terraform {
required_version = "=0.12.3"
}
provider "azurerm" {
version = "=1.30.1"
}
resource "azurerm_resource_group" "mytestresourcegroup" {
name = "mytestresourcegroupblaasddde"
location = "West Europe"
}
resource "azurerm_cosmosdb_account" "trade_cosmosdb_account_single_region" {
name = "mysuperrandomcosmosname"
location = "${azurerm_resource_group.mytestresourcegroup.location}"
resource_group_name = "${azurerm_resource_group.mytestresourcegroup.name}"
offer_type = "Standard"
kind = "GlobalDocumentDB"
enable_automatic_failover = "false"
consistency_policy {
consistency_level = "Session"
}
geo_location {
location = "${azurerm_resource_group.mytestresourcegroup.location}"
failover_priority = 0
}
lifecycle {
prevent_destroy = true
}
}
I get the same error too. It was working as late as yesterday.
Error: Error checking if CosmosDB Account "<account_name>" already exists (Resource Group "<group_name>"): documentdb.DatabaseAccountsClient#CheckNameExists: Failure responding to request: StatusCode=500 -- Original Error: autorest/azure: error response cannot be parsed: "" error: EOF
on ../modules/cosmosdb_account/main.tf line 1, in resource "azurerm_cosmosdb_account" "db":
1: resource "azurerm_cosmosdb_account" "db" {
terraform version
Terraform v0.12.3
+ provider.azurerm v1.29.0
I have also seen the same issue today with provider.azurerm v1.30.1
I was upgrading to Terraform 0.12.3 from 0.12.2 either today or yesterday, so I will attemt an downgrade to Terraform 0.12.2 to see if that helps. Will keep you posted.
EDIT: Downgrade to Terraform 0.12.2 yielded the same error.
I'm seeing same issue on terraform v0.11.x/v1.30.1 as of yesterday as well. Also tried downgrading version of azurerm with no luck. It appears to be an issue with the API throwing a 500 error when checking if the name exists.
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: 2019/06/27 11:04:37 [DEBUG] AzureRM Response for https://management.azure.com/providers/Microsoft.DocumentDB/databaseAccountNames/<redacted>?api-version=2015-04-08:
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: HTTP/2.0 500 Internal Server Error
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: Content-Length: 273
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: Cache-Control: no-store, no-cache
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: Date: Thu, 27 Jun 2019 18:04:36 GMT
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: Pragma: no-cache
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: Server: Microsoft-HTTPAPI/2.0
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: Strict-Transport-Security: max-age=31536000; includeSubDomains
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: X-Content-Type-Options: nosniff
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: X-Ms-Correlation-Request-Id: d8e3e7f0-9a3d-f5c1-a878-2b05c839f47a
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: X-Ms-Failure-Cause: service
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: X-Ms-Ratelimit-Remaining-Tenant-Reads: 11999
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: X-Ms-Request-Id: 36d91a71-5253-4e53-96fa-1a6e717e9e34
2019-06-27T11:04:37.025-0700 [DEBUG] plugin.terraform-provider-azurerm_v1.29.0_x4: X-Ms-Routing-Request-Id: WESTUS:20190627T180437Z:36d91a71-5253-4e53-96fa-1a6e717e9e34
Even in the web console I can see the request getting a 500 error when it does a HEAD, but it appears the UI ignores the 500 and deployment through UI works as long as it's a unique name.
Request URL: https://management.azure.com/providers/Microsoft.DocumentDb/databaseAccountNames/<redacted>?api-version=2015-04-08&{}&_=1561658718948
Request Method: HEAD
Status Code: 500
Error is being thrown from azurerm code here which is using the azure go sdk documentdb client calling CheckNameExists
which calls the API here that is returning the 500 error.
FYI, no details yet, but Microsoft Support has acknowledged this problem and the the "Cosmos DB Engineering Team" is working on resolving it.
Is there any URL from microsoft known, where this issue can be tracked?
👋
As mentioned above this is a bug in the API which is sounds like the CosmosDB team are looking into - however in the interim we've raised a bug about it here.
Until this is fixed since this functionality only serves to raise a more helpful error - we've opened #3747 which will temporarily ignore a 500 being returned from this API - so that the CosmosDB resources can still be provisioned (but may return a less helpful error if they conflict with an existing resource) - which will ship in the 1.31 release later today.
Thanks!
This has been released in version 1.31.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 = "~> 1.31.0"
}
# ... other configuration ...
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!
Most helpful comment
👋
As mentioned above this is a bug in the API which is sounds like the CosmosDB team are looking into - however in the interim we've raised a bug about it here.
Until this is fixed since this functionality only serves to raise a more helpful error - we've opened #3747 which will temporarily ignore a 500 being returned from this API - so that the CosmosDB resources can still be provisioned (but may return a less helpful error if they conflict with an existing resource) - which will ship in the 1.31 release later today.
Thanks!