Skip to content

Think-Cube/terraform-azure-cosmosdb-database-container

Repository files navigation

Requirements

Name Version
terraform >= 1.6.3
azurerm 4.27.0

Providers

Name Version
azurerm 4.27.0

Modules

No modules.

Resources

Name Type
azurerm_cosmosdb_sql_container.main resource
azurerm_client_config.current data source
azurerm_cosmosdb_account.main data source
azurerm_resource_group.rg data source

Inputs

Name Description Type Default Required
conflict_resolution_policy The conflict resolution policy for the Cosmos DB SQL container, which determines how conflicting changes are resolved.
object({
mode = string # E.g., 'LastWriterWins' or 'Custom'.
conflict_resolution_path = string # Path used for resolving conflicts, applicable for 'LastWriterWins' mode.
})
null no
cosmosdb_account_name The name of the Cosmos DB account. Changing this value forces the creation of a new resource. string n/a yes
cosmosdb_sql_database_container_name The name of the Cosmos DB SQL container to be created. string n/a yes
cosmosdb_sql_database_container_partition_key_paths A list of partition key paths for the Cosmos DB SQL container. Partition keys are essential for scalable performance in Cosmos DB. list(string)
[
"/myPartitionKey"
]
no
cosmosdb_sql_database_container_partition_key_version The version of the partition key for the Cosmos DB SQL container. Defaults to 1. number 1 no
cosmosdb_sql_database_name The name of the Cosmos DB SQL database. Changing this value forces the creation of a new resource. string n/a yes
default_ttl Default time-to-live (TTL) for the Cosmos DB SQL container, specified in seconds. If null, TTL is not configured. number null no
environment The environment name used for backend container naming (e.g., dev, staging, prod). string "dev" no
indexing_policy The indexing policy for the Cosmos DB SQL container, which specifies how items are indexed for queries.
object({
indexing_mode = string # Either 'consistent' or 'none'.
included_paths = list(object({
path = string # Paths explicitly included in the index.
}))
excluded_paths = list(object({
path = string # Paths explicitly excluded from the index.
}))
})
null no
resource_group_location The Azure location where the resource group is created. Changing this value forces the creation of a new resource. string "West Europe" no
resource_group_name The name of the resource group in which to create the Cosmos DB SQL container. Changing this value forces the creation of a new resource. string n/a yes
sql_database_container_paths List of Cosmos DB SQL containers to create. Some parameters are inherited from the Cosmos DB account. string n/a yes
unique_keys A list of unique keys for the Cosmos DB SQL container to ensure uniqueness of specified paths.
list(object({
paths = list(string) # Paths defining the unique key constraints.
}))
null no

Outputs

Name Description
id The CosmosDB Database container ID.