Skip to content

EnergiMidt/terraform-azurerm-cosmosdbaccount

Repository files navigation

Manages a CosmosDB (formally DocumentDB) Account.

Getting Started

  • Format and validate Terraform code before commit.
terraform init -upgrade \
    && terraform init -reconfigure -upgrade \
    && terraform fmt -recursive . \
    && terraform fmt -check \
    && terraform validate .
  • Always fetch latest changes from upstream and rebase from it. Terraform documentation will always be updated with GitHub Actions. See also .github/workflows/terraform.yml GitHub Actions workflow.
git fetch --all --tags --prune --prune-tags \
  && git pull --rebase --all --prune --tags

Requirements

Name Version
terraform >= 1.3.1
azurerm >= 3.33.0, < 4.0.0

Providers

Name Version
azurerm 3.52.0

Modules

No modules.

Resources

Name Type
azurerm_cosmosdb_account.cosmosdb_account resource

Inputs

Name Description Type Default Required
access_key_metadata_writes_enabled (Optional) Is write operations on metadata resources (databases, containers, throughput) via account keys enabled? Defaults to true. bool true no
analytical_storage_schema_type (Optional) The schema type of the Analytical Storage for this Cosmos DB account. Possible values are FullFidelity and WellDefined. string null no
capabilities_disable_rate_limiting_responses (Optional) Configures the DisableRateLimitingResponses capability for this Cosmos DB account. bool false no
capabilities_enable_mongo (Optional) Configures the EnableMongo capability for this Cosmos DB account. bool false no
capabilities_enable_mongo_16mb_document_support (Optional) Configures the EnableMongo16MBDocumentSupport capability for this Cosmos DB account. bool false no
capabilities_enable_mongo_retryable_writes (Optional) Configures the EnableMongoRetryableWrites capability for this Cosmos DB account. bool false no
capabilities_enable_serverless (Optional) Configures the EnableServerless capability for this Cosmos DB account. bool false no
capabilities_enable_table (Optional) Configures the EnableTable capability for this Cosmos DB account. bool false no
consistency_policy_consistency_level (Required) The Consistency Level to use for this CosmosDB Account. It can be either BoundedStaleness, Eventual, Session, Strong or ConsistentPrefix. string n/a yes
consistency_policy_max_interval_in_seconds (Optional) When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400 (1 day). Defaults to 5. Required when consistency_level is set to BoundedStaleness. number 5 no
consistency_policy_max_staleness_prefix (Optional) When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 102147483647. Defaults to 100. Required when consistency_level is set to BoundedStaleness. number 100 no
enable_automatic_failover (Optional) Enable automatic fail over for this Cosmos DB account. bool false no
enabled (Optional) Enable the creation of this Cosmos DB account. bool true no
environment (Required) The name of the environment. string n/a yes
geo_location_failover_priority (Optional) The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. Changing this causes the location to be re-provisioned and cannot be changed for the location with failover priority 0. number 0 no
geo_location_location (Optional) The name of the Azure region to host replicated data. string "" no
geo_location_zone_redundant (Optional) Should zone redundancy be enabled for this region? Defaults to false. bool false no
key_vault_key_id (Optional) A versionless Key Vault Key ID for CMK encryption. Changing this forces a new resource to be created. string null no
kind (Optional) Specifies the Kind of CosmosDB to create. Possible values are GlobalDocumentDB and MongoDB. Defaults to GlobalDocumentDB. Changing this forces a new resource to be created. string "GlobalDocumentDB" no
local_authentication_disabled (Optional) Disable local authentication and ensure only MSI and AAD can be used exclusively for authentication. Defaults to false. Can be set only when using the SQL API. bool false no
mongo_server_version (Optional) The Server Version of a MongoDB account. Possible values are 4.2, 4.0, 3.6, and 3.2. string null no
offer_type (Optional) Specifies the Offer Type to use for this CosmosDB Account. Currently, this option can only be set to Standard. string "Standard" no
override_location (Optional) Override the location of the resource. Under normal circumstances, it should not be used. string null no
override_name (Optional) Override the name of the resource. Under normal circumstances, it should not be used. string null no
public_network_access_enabled (Optional) Whether or not public network access is allowed for this CosmosDB account. bool true no
resource_group (Required) The resource group in which to create the resource. any n/a yes
system_name (Required) The systen name which should be used for this resource. Changing this forces a new resource to be created. string n/a yes
tags (Optional) A mapping of tags to assign to the resource. map(string) null no

Outputs

Name Description
azurerm_cosmosdb_account The Azure CosmosDB Account resource.