saif-resources / cosmosdb
Provisions a Cosmos DB NoSQL account with serverless billing, private endpoint, and RBAC for the service principal.
Usage
module "cosmosdb" {
source = "app.terraform.io/SAIFCorp/resources/saif//modules/cosmosdb"
version = "~> 1.0.0"
context = module.environment.context
identity = module.identity.identity
resource_group_name = module.resource_group.resource_group_name
resource_group_location = module.resource_group.location
containers = {
conversations = {
partition_key_path = "/id"
default_ttl = 2592000 # 30 days
}
}
}
Outputs
Name
Description
account_endpoint
Cosmos DB account endpoint
account_id
Cosmos DB account resource ID
database_name
Cosmos DB database name
app_settings
Map of app settings for web app configuration
Providers
No providers.
Name
Description
Type
Default
Required
containers
Map of container definitions
map(object({ partition_key_path = string unique_keys = optional(list(list(string)), []) default_ttl = optional(number) }))
n/a
yes
context
Platform context from the environment module
any
n/a
yes
data_reader_identities
Map of identities granted Cosmos DB Built-in Data Reader role. Each entry specifies either object_id (direct) or group_name (resolved by inner module). Ignored when context.is_production is true; reader access is suppressed in production.
map(object({ object_id = optional(string) group_name = optional(string) }))
{}
no
database_name
The Cosmos DB database name (defaults to project_id)
string
""
no
identity
Identity bundle from the identity module
any
n/a
yes
is_serverless
Whether to use serverless billing mode
bool
true
no
resource_group_location
The Azure region for the Cosmos DB account
string
n/a
yes
resource_group_name
The resource group for the Cosmos DB account
string
n/a
yes
Outputs
Resources
View source on GitHub