My context
Trying to deploy azure cosmosdb (MongoDB) with Terraform.
I need to configure database shared throughput.
My issues
I can't figure out how to do this, I don't even know if it is supported.
I tried this:
resource "azurerm_cosmosdb_account" "cosmosdb" {
  name                                  = "mycosmosdb1
  resource_group_name                   = "rg1"
  location                              = "westeurope"
  offer_type                            = "Standard"
  kind                                  = "MongoDB"      
  mongo_server_version                  = "4.2"
   capacity {
     total_throughput_limit = 1000
   }
  capabilities {
    name = "EnableMongo"
  }
  capabilities {
    name = "DisableRateLimitingResponses"
  }
}
resource "azurerm_cosmosdb_mongo_database" "cosmosdb_mongo_database" {
  name = "db1"
  resource_group_name = azurerm_cosmosdb_account.cosmosdb.resource_group_name
  account_name        = azurerm_cosmosdb_account.cosmosdb.name
}
resource "azurerm_cosmosdb_mongo_collection" "cosmosdb_mongo_collection" {
  database_name       = "db1"
  name                = "col1"
  resource_group_name = azurerm_cosmosdb_account.cosmosdb.resource_group_name
  account_name        = azurerm_cosmosdb_account.cosmosdb.name
  index {
    keys   = ["_id"]
    unique = false
  }
}
But no impact.
What I need
- Is it currently supported by azurerm ?
- How I can do this?
Thank you
 
                        
In the configuration you provided you have set up the throughput in the wrong resource. To configure shared throughput for a database, you should not use
azurerm_cosmosdb_account, but a different resource.To configure shared throughput for a CosmosDB MongoDB database, you should set the
throughputattribute in theazurerm_cosmosdb_mongo_databaseresource. Thethroughputsetting is not part of theazurerm_cosmosdb_accountresource.My terraform configuration:
Output: