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

Creation/updating azurerm_cosmosdb_table for Serverless CosmosDB returns errors #9417

Closed
MrImpossibru opened this issue Nov 23, 2020 · 5 comments · Fixed by #9749
Closed

Comments

@MrImpossibru
Copy link

MrImpossibru commented Nov 23, 2020

Hello,

There is an error during creation/updating azurerm_cosmosdb_table resources for Serverless CosmosDB account.

azurerm version = 2.37.0

Error reading Throughput on Cosmos Table "table" (Account: "account") ID: documentdb.TableResourcesClient#GetTableThroughput: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Message: {"code":"BadRequest","message":"Reading or replacing offers is not supported for serverless accounts.\r\nActivityId: aab95b5c-fa8c-4bc2-949b-c9eb161a28a4, Microsoft.Azure.Documents.Common/2.11.0"}, Request URI: /offers, RequestStats: , SDK: Microsoft.Azure.Documents.Common/2.11.0"

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

Affected Resource(s)

  • azurerm_cosmosdb_table

Terraform Configuration Files

resource "azurerm_cosmosdb_account" "db" {
  name                = "${var.projectname}${var.tenant}${var.stage}"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
  offer_type          = "Standard"
  kind                = "GlobalDocumentDB"

  capabilities {
    name = "EnableTable"
  }

  capabilities {
    name = "EnableServerless"
  }
  
  consistency_policy {
    consistency_level       = "Session"
  }

  geo_location {
    location          = azurerm_resource_group.rg.location
    failover_priority = 0
  }
}

resource "azurerm_cosmosdb_table" "tables" {
  for_each = toset(["table1", "table2"])

  name                = each.value
  resource_group_name = azurerm_resource_group.rg.name
  account_name        = azurerm_cosmosdb_account.db.name
}

Output

Error reading Throughput on Cosmos Table "table1" (Account: "account0") ID: documentdb.TableResourcesClient#GetTableThroughput: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Message: {"code":"BadRequest","message":"Reading or replacing offers is not supported for serverless accounts.\r\nActivityId: aab95b5c-fa8c-4bc2-949b-c9eb161a28a4, Microsoft.Azure.Documents.Common/2.11.0"}, Request URI: /offers, RequestStats: , SDK: Microsoft.Azure.Documents.Common/2.11.0"

Expected Behaviour

it works without an error

Actual Behaviour

It doesn't work. Error is returnded.

Steps to Reproduce

  1. terraform plan / 'terraform apply'
@MrImpossibru MrImpossibru changed the title azurerm_cosmosdb_table for Serverless CosmosDB Creation/updating azurerm_cosmosdb_table for Serverless CosmosDB returns errors Nov 23, 2020
@ilmax
Copy link
Contributor

ilmax commented Nov 23, 2020

@MasterKolka this is related to #8175 and the fix is the same was submitted to fix that issue.

@ghost
Copy link

ghost commented Jan 8, 2021

This has been released in version 2.42.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.42.0"
}
# ... other configuration ...

@OisinKyne
Copy link

Hi there.

This fix has allowed serverless mongo cosmos dbs to be created once, which wasn't possible before this fix. But re-running terraform apply or terraform destroy after creation returns this same error, so I suspect there are more places in the code calling throughput on azurerm_cosmosdb_mongo_collection than just the post-creation step.

This is using version 2.42.0

Error reading Throughput on Cosmos Mongo Collection "boilerplate-db-cosmos-mongo-collection" (Account: "boilerplate-db-cosmos-account", Database: "boilerplate-db-cosmos-mongo"): documentdb.MongoDBResourcesClient#GetMongoDBCollectionThroughput: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Message: {\"code\":\"BadRequest\",\"message\":\"Reading or replacing offers is not supported for serverless accounts.\\r\\nActivityId: a361c415-ad15-4baf-8f82-*********, Microsoft.Azure.Documents.Common/2.11.0\"}, Request URI: /offers, RequestStats: , SDK: Microsoft.Azure.Documents.Common/2.11.0"

@nomoarbleh
Copy link

Hello,

Encountering the same issue as @OisinKyne after upgrading to 2.42.0 and creating a new CosmosDB account from scratch.

Error: Error reading Throughput on Cosmos Mongo Collection "xxx" (Account: "xxx", Database: "xxx"): documentdb.MongoDBResourcesClient#GetMongoDBCollectionThroughput: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Message: {\"code\":\"BadRequest\",\"message\":\"Reading or replacing offers is not supported for serverless accounts.\\r\\nActivityId: xxx, Microsoft.Azure.Documents.Common/2.11.0\"}, Request URI: /offers, RequestStats: , SDK: Microsoft.Azure.Documents.Common/2.11.0"

But I think there is already an open issue for this here #9697, which wasn't part of the 2.42.0 release.

@ghost
Copy link

ghost commented Jan 27, 2021

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 as resolved and limited conversation to collaborators Jan 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants