This terraform module creates an Azure CosmosDB. Diagnostic settings are also deployed.
Module version | Terraform version | AzureRM version |
---|---|---|
>= 4.x.x | 0.13.x | >= 2.0 |
>= 3.x.x | 0.12.x | >= 2.0 |
>= 2.x.x | 0.12.x | < 2.0 |
< 2.x.x | 0.11.x | < 2.0 |
This module is optimized to work with the Claranet terraform-wrapper tool
which set some terraform variables in the environment needed by this module.
More details about variables set by the terraform-wrapper
available in the documentation.
module "azure-region" {
source = "claranet/regions/azurerm"
version = "x.x.x"
azure_region = var.azure_region
}
module "rg" {
source = "claranet/rg/azurerm"
version = "x.x.x"
location = module.azure-region.location
client_name = var.client_name
environment = var.environment
stack = var.stack
}
module "cosmosdb" {
source = "claranet/cosmos-db/azurerm"
version = "x.x.x"
environment = var.environment
location = module.azure-region.location
location_short = module.azure-region.location_short
client_name = var.client_name
stack = var.stack
resource_group_name = module.rg.resource_group_name
logs_destinations_ids = [module.run-common.log_analytics_workspace_id]
backup = {
type = "Periodic"
interval_in_minutes = 60 * 3 # 3 hours
retention_in_hours = 24
}
extra_tags = {
managed_by = "Terraform"
foo = "bar"
monitor_autoscale_max = 2
}
}
Name | Version |
---|---|
azurerm | >= 2.62 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
allowed_cidrs | CosmosDB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IP's for a given database account. | list(string) |
[] |
no |
backup | Backup block with type (Continuous / Periodic), interval_in_minutes and retention_in_hours keys | map(string) |
{ |
no |
capabilities | Configures the capabilities to enable for this Cosmos DB account: Possible values are AllowSelfServeUpgradeToMongo36, DisableRateLimitingResponses, EnableAggregationPipeline, EnableCassandra, EnableGremlin,EnableMongo, EnableTable, EnableServerless, MongoDBv3.4 and mongoEnableDocLevelTTL. |
list(string) |
[] |
no |
client_name | Name of client | string |
n/a | yes |
consistency_policy_level | Consistency policy level. Allowed values are BoundedStaleness , Eventual , Session , Strong or ConsistentPrefix |
string |
"BoundedStaleness" |
no |
consistency_policy_max_interval_in_seconds | 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 |
10 |
no |
consistency_policy_max_staleness_prefix | When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 10 โ 2147483647. Defaults to 100. Required when consistency_level is set to BoundedStaleness. | number |
200 |
no |
custom_server_name | Custom Server Name identifier | string |
"" |
no |
environment | Name of application's environnement | string |
n/a | yes |
extra_tags | Map of custom tags | map(string) |
{} |
no |
failover_locations | The name of the Azure region to host replicated data and their priority. | map(map(string)) |
null |
no |
is_virtual_network_filter_enabled | Enables virtual network filtering for this Cosmos DB account | bool |
false |
no |
kind | Specifies the Kind of CosmosDB to create - possible values are GlobalDocumentDB and MongoDB . |
string |
"GlobalDocumentDB" |
no |
location | Azure location for Key Vault. | string |
n/a | yes |
location_short | Short string for Azure location. | string |
n/a | yes |
logs_destinations_ids | List of destination resources IDs for logs diagnostic destination. Can be Storage Account, Log Analytics Workspace and Event Hub. No more than one of each can be set. | list(string) |
n/a | yes |
name_prefix | Optional prefix for PostgreSQL server name | string |
"" |
no |
offer_type | Specifies the Offer Type to use for this CosmosDB Account - currently this can only be set to Standard. | string |
"Standard" |
no |
resource_group_name | Name of the application ressource group, herited from infra module | string |
n/a | yes |
stack | Name of application stack | string |
n/a | yes |
virtual_network_rule | Specifues a virtual_network_rules resource used to define which subnets are allowed to access this CosmosDB account | list(object({ |
null |
no |
Name | Description |
---|---|
cosmosdb_connection_strings | A list of connection strings available for this CosmosDB account. |
cosmosdb_endpoint | The endpoint used to connect to the CosmosDB account. |
cosmosdb_id | The CosmosDB Account ID. |
cosmosdb_name | The CosmosDB Account Name. |
cosmosdb_primary_master_key | The Primary master key for the CosmosDB Account. |
cosmosdb_primary_readonly_master_key | The Primary read-only master Key for the CosmosDB Account. |
cosmosdb_read_endpoints | A list of read endpoints available for this CosmosDB account. |
cosmosdb_secondary_master_key | The Secondary master key for the CosmosDB Account. |
cosmosdb_secondary_readonly_master_key | The Secondary read-only master key for the CosmosDB Account. |
cosmosdb_write_endpoints | A list of write endpoints available for this CosmosDB account. |