Skip to content

Latest commit

 

History

History
238 lines (195 loc) · 4.76 KB

digitalocean_database_cluster.md

File metadata and controls

238 lines (195 loc) · 4.76 KB

digitalocean_database_cluster

back

Index

Terraform

terraform {
  required_providers {
    digitalocean = ">= 2.7.0"
  }
}

top

Example Usage

module "digitalocean_database_cluster" {
  source = "./modules/digitalocean/r/digitalocean_database_cluster"

  # engine - (required) is a type of string
  engine = null
  # eviction_policy - (optional) is a type of string
  eviction_policy = null
  # name - (required) is a type of string
  name = null
  # node_count - (required) is a type of number
  node_count = null
  # private_network_uuid - (optional) is a type of string
  private_network_uuid = null
  # region - (required) is a type of string
  region = null
  # size - (required) is a type of string
  size = null
  # sql_mode - (optional) is a type of string
  sql_mode = null
  # tags - (optional) is a type of set of string
  tags = []
  # version - (optional) is a type of string
  version = null

  maintenance_window = [{
    day  = null
    hour = null
  }]
}

top

Variables

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

variable "eviction_policy" {
  description = "(optional)"
  type        = string
  default     = null
}

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

variable "node_count" {
  description = "(required)"
  type        = number
}

variable "private_network_uuid" {
  description = "(optional)"
  type        = string
  default     = null
}

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

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

variable "sql_mode" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "tags" {
  description = "(optional)"
  type        = set(string)
  default     = null
}

variable "version" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "maintenance_window" {
  description = "nested block: NestingList, min items: 0, max items: 0"
  type = set(object(
    {
      day  = string
      hour = string
    }
  ))
  default = []
}

top

Resource

resource "digitalocean_database_cluster" "this" {
  # engine - (required) is a type of string
  engine = var.engine
  # eviction_policy - (optional) is a type of string
  eviction_policy = var.eviction_policy
  # name - (required) is a type of string
  name = var.name
  # node_count - (required) is a type of number
  node_count = var.node_count
  # private_network_uuid - (optional) is a type of string
  private_network_uuid = var.private_network_uuid
  # region - (required) is a type of string
  region = var.region
  # size - (required) is a type of string
  size = var.size
  # sql_mode - (optional) is a type of string
  sql_mode = var.sql_mode
  # tags - (optional) is a type of set of string
  tags = var.tags
  # version - (optional) is a type of string
  version = var.version

  dynamic "maintenance_window" {
    for_each = var.maintenance_window
    content {
      # day - (required) is a type of string
      day = maintenance_window.value["day"]
      # hour - (required) is a type of string
      hour = maintenance_window.value["hour"]
    }
  }

}

top

Outputs

output "database" {
  description = "returns a string"
  value       = digitalocean_database_cluster.this.database
}

output "host" {
  description = "returns a string"
  value       = digitalocean_database_cluster.this.host
}

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

output "password" {
  description = "returns a string"
  value       = digitalocean_database_cluster.this.password
  sensitive   = true
}

output "port" {
  description = "returns a number"
  value       = digitalocean_database_cluster.this.port
}

output "private_host" {
  description = "returns a string"
  value       = digitalocean_database_cluster.this.private_host
}

output "private_network_uuid" {
  description = "returns a string"
  value       = digitalocean_database_cluster.this.private_network_uuid
}

output "private_uri" {
  description = "returns a string"
  value       = digitalocean_database_cluster.this.private_uri
  sensitive   = true
}

output "uri" {
  description = "returns a string"
  value       = digitalocean_database_cluster.this.uri
  sensitive   = true
}

output "urn" {
  description = "returns a string"
  value       = digitalocean_database_cluster.this.urn
}

output "user" {
  description = "returns a string"
  value       = digitalocean_database_cluster.this.user
}

output "this" {
  value = digitalocean_database_cluster.this
}

top