Giter Site home page Giter Site logo

terraform-azurerm-cosmos-db's Introduction

Azure CosmosDB

Changelog Notice Apache V2 License TF Registry

This terraform module creates an Azure CosmosDB. Diagnostic settings are also deployed.

Version compatibility

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

Usage

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
  }
}

Providers

Name Version
azurerm >= 2.62

Inputs

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)
{
"interval_in_minutes": 180,
"retention_in_hours": 168,
"type": "Periodic"
}
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({
id = string,
ignore_missing_vnet_service_endpoint = bool
}))
null no

Outputs

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.

Related documentation

terraform-azurerm-cosmos-db's People

Contributors

shr3ps avatar viacheslavsavinkov avatar jmapro avatar rossifumax avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.