cloud-foundation-fabric/modules/__experimental_deprecated/alloydb-instance/README.md

5.5 KiB

AlloyDB cluster and instance with read replicas

This module manages the creation of AlloyDB cluster and configuration with/without automated backup policy, Primary node instance and Read Node Pools.

Simple example

This example shows how to create Alloydb cluster and instance with multiple read pools in GCP project.

module "alloydb" {
  source       = "./fabric/modules/alloydb-instance"
  project_id   = "myproject"
  cluster_id   = "alloydb-cluster-all"
  location     = "europe-west2"
  labels       = {}
  display_name = ""
  initial_user = {
    user     = "alloydb-cluster-full",
    password = "alloydb-cluster-password"
  }
  network_self_link = "projects/myproject/global/networks/default"

  automated_backup_policy = null

  primary_instance_config = {
    instance_id       = "primary-instance-1",
    instance_type     = "PRIMARY",
    machine_cpu_count = 2,
    database_flags    = {},
    display_name      = "alloydb-primary-instance"
  }
  read_pool_instance = [
    {
      instance_id       = "read-instance-1",
      display_name      = "read-instance-1",
      instance_type     = "READ_POOL",
      node_count        = 1,
      database_flags    = {},
      machine_cpu_count = 1
    },
    {
      instance_id       = "read-instance-2",
      display_name      = "read-instance-2",
      instance_type     = "READ_POOL",
      node_count        = 1,
      database_flags    = {},
      machine_cpu_count = 1
    }
  ]

}

# tftest skip

TODO

  • Add IAM support
  • support password in output

Variables

name description type required default
cluster_id The ID of the alloydb cluster. string
network_self_link Network ID where the AlloyDb cluster will be deployed. string
primary_instance_config Primary cluster configuration that supports read and write operations. object({…})
project_id The ID of the project in which to provision resources. string
automated_backup_policy The automated backup policy for this cluster. object({…}) null
display_name Human readable display name for the Alloy DB Cluster. string null
encryption_key_name The fully-qualified resource name of the KMS key for cluster encryption. string null
initial_user Alloy DB Cluster Initial User Credentials. object({…}) null
labels User-defined labels for the alloydb cluster. map(string) {}
location Location where AlloyDb cluster will be deployed. string "europe-west2"
network_name The network name of the project in which to provision resources. string "multiple-readpool"
read_pool_instance List of Read Pool Instances to be created. list(object({…})) []

Outputs

name description sensitive
cluster Cluster created.
cluster_id ID of the Alloy DB Cluster created.
primary_instance Primary instance created.
primary_instance_id ID of the primary instance created.
read_pool_instance_ids IDs of the read instances created.