Skip to content

Latest commit

 

History

History
162 lines (131 loc) · 3.03 KB

File metadata and controls

162 lines (131 loc) · 3.03 KB

azurerm_cosmosdb_sql_database

back

Index

Terraform

terraform {
  required_providers {
    azurerm = ">= 2.54.0"
  }
}

top

Example Usage

module "azurerm_cosmosdb_sql_database" {
  source = "./modules/azurerm/r/azurerm_cosmosdb_sql_database"

  # account_name - (required) is a type of string
  account_name = null
  # name - (required) is a type of string
  name = null
  # resource_group_name - (required) is a type of string
  resource_group_name = null
  # throughput - (optional) is a type of number
  throughput = null

  autoscale_settings = [{
    max_throughput = null
  }]

  timeouts = [{
    create = null
    delete = null
    read   = null
    update = null
  }]
}

top

Variables

variable "account_name" {
  description = "(required)"
  type        = string
}

variable "name" {
  description = "(required)"
  type        = string
}

variable "resource_group_name" {
  description = "(required)"
  type        = string
}

variable "throughput" {
  description = "(optional)"
  type        = number
  default     = null
}

variable "autoscale_settings" {
  description = "nested block: NestingList, min items: 0, max items: 1"
  type = set(object(
    {
      max_throughput = number
    }
  ))
  default = []
}

variable "timeouts" {
  description = "nested block: NestingSingle, min items: 0, max items: 0"
  type = set(object(
    {
      create = string
      delete = string
      read   = string
      update = string
    }
  ))
  default = []
}

top

Resource

resource "azurerm_cosmosdb_sql_database" "this" {
  # account_name - (required) is a type of string
  account_name = var.account_name
  # name - (required) is a type of string
  name = var.name
  # resource_group_name - (required) is a type of string
  resource_group_name = var.resource_group_name
  # throughput - (optional) is a type of number
  throughput = var.throughput

  dynamic "autoscale_settings" {
    for_each = var.autoscale_settings
    content {
      # max_throughput - (optional) is a type of number
      max_throughput = autoscale_settings.value["max_throughput"]
    }
  }

  dynamic "timeouts" {
    for_each = var.timeouts
    content {
      # create - (optional) is a type of string
      create = timeouts.value["create"]
      # delete - (optional) is a type of string
      delete = timeouts.value["delete"]
      # read - (optional) is a type of string
      read = timeouts.value["read"]
      # update - (optional) is a type of string
      update = timeouts.value["update"]
    }
  }

}

top

Outputs

output "id" {
  description = "returns a string"
  value       = azurerm_cosmosdb_sql_database.this.id
}

output "throughput" {
  description = "returns a number"
  value       = azurerm_cosmosdb_sql_database.this.throughput
}

output "this" {
  value = azurerm_cosmosdb_sql_database.this
}

top