Azure CosmosDB (DocumentDB) Table
This page shows how to write Terraform and Azure Resource Manager for CosmosDB (DocumentDB) Table and write them securely.
azurerm_cosmosdb_table (Terraform)
The Table in CosmosDB (DocumentDB) can be configured in Terraform with the resource name azurerm_cosmosdb_table. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_cosmosdb_table" "non-usage_autoscale" {
name = "tfex-cosmos-cassandra-keyspace"
resource_group_name = azurerm_cosmosdb_account.example.resource_group_name
account_name = azurerm_cosmosdb_account.example.name
autoscale_settings {
max_throughput = 4000
resource "azurerm_cosmosdb_table" "non-usage_autoscale" {
name = "tfex-cosmos-cassandra-keyspace"
resource_group_name = azurerm_cosmosdb_account.example.resource_group_name
account_name = azurerm_cosmosdb_account.example.name
autoscale_settings {
max_throughput = 4000
resource "azurerm_cosmosdb_table" "table" {
for_each = var.cosmosdb_table
name = each.value.name
resource_group_name = each.value.resource_group_name
account_name = each.value.account_name
}
resource "azurerm_cosmosdb_table" "tables" {
for_each = var.tables_to_create
name = each.value
resource_group_name = azurerm_cosmosdb_account.dbaccount.resource_group_name
account_name = azurerm_cosmosdb_account.dbaccount.name
resource "azurerm_cosmosdb_table" "table" {
name = var.settings.name
resource_group_name = var.resource_group_name
account_name = var.cosmosdb_account_name
throughput = try(var.settings.throughput, null)
resource "azurerm_cosmosdb_table" "table" {
name = var.settings.name
resource_group_name = var.resource_group_name
account_name = var.cosmosdb_account_name
throughput = try(var.settings.throughput, null)
resource "azurerm_cosmosdb_table" "table" {
name = var.settings.name
resource_group_name = var.resource_group_name
account_name = var.cosmosdb_account_name
throughput = try(var.settings.throughput, null)
resource "azurerm_cosmosdb_table" "table" {
name = var.settings.name
resource_group_name = var.resource_group_name
account_name = var.cosmosdb_account_name
throughput = try(var.settings.throughput, null)
resource "azurerm_cosmosdb_table" "this" {
account_name = var.account_name
name = var.name
resource_group_name = var.resource_group_name
throughput = var.throughput
resource "azurerm_cosmosdb_table" "example" {
name = var.table_name
resource_group_name = azurerm_cosmosdb_account.db.resource_group_name
account_name = azurerm_cosmosdb_account.db.name
throughput = var.throughput
}
Parameters
-
account_namerequired - string -
idoptional computed - string -
namerequired - string -
resource_group_namerequired - string -
throughputoptional computed - number -
autoscale_settingslist block-
max_throughputoptional computed - number
-
-
timeoutssingle block
Explanation in Terraform Registry
Manages a Table within a Cosmos DB Account.
Microsoft.DocumentDB/databaseAccounts/tables (Azure Resource Manager)
The databaseAccounts/tables in Microsoft.DocumentDB can be configured in Azure Resource Manager with the resource name Microsoft.DocumentDB/databaseAccounts/tables. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
apiVersionrequired - stringlocationoptional - stringThe location of the resource group to which the resource belongs.
namerequired - stringCosmos DB table name.
propertiesrequiredoptionsoptionalautoscaleSettingsoptionalmaxThroughputoptional - integerRepresents maximum throughput, the resource can scale up to.
throughputoptional - integerRequest Units per second. For example, "throughput": 10000.
resourcerequiredidrequired - stringName of the Cosmos DB table
tagsoptional - stringTags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".
typerequired - string
Frequently asked questions
What is Azure CosmosDB (DocumentDB) Table?
Azure CosmosDB (DocumentDB) Table is a resource for CosmosDB (DocumentDB) of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure CosmosDB (DocumentDB) Table?
For Terraform, the gilyas/infracost, infracost/infracost and learnwithmia/azure_modules source code examples are useful. See the Terraform Example section for further details.