【发布时间】:2021-11-06 01:03:18
【问题描述】:
我正在尝试将自动缩放设置添加到 cosmos db,但它不允许 shard_key 值为 null。因为现在我们没有 shard_key 但仍想使用自动缩放功能。我可以在 azure 门户中看到,当我在门户中导入没有 shard_key 创建的资源时,该值显示为 null,但在创建时我无法做到。
resource "azurerm_cosmosdb_mongo_collection" "collections" {
name = "dbCollName"
resource_group_name = azurerm_cosmosdb_account.cosmosdb.resource_group_name
account_name = local.account_name
database_name = "dbName"
shard_key = null
autoscale_settings = {
max_throughput = 4000
}
}
【问题讨论】:
-
你只能创建一个没有分片键的固定大小的集合。如果您计划需要扩展此集合,则需要在创建它之前决定一个分片键,因为一旦创建它就无法更改它。
-
Azure 门户和 ARM 模板允许对高达 10K RU 的非分片集合进行自动缩放。虽然我现在了解分片键的重要性,但我们在应用中没有它
标签: azure azure-cosmosdb terraform-provider-azure