# 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. ```hcl 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](variables.tf#L35) | The ID of the alloydb cluster. | string | ✓ | | | [network_self_link](variables.tf#L83) | Network ID where the AlloyDb cluster will be deployed. | string | ✓ | | | [primary_instance_config](variables.tf#L88) | Primary cluster configuration that supports read and write operations. | object({…}) | ✓ | | | [project_id](variables.tf#L110) | The ID of the project in which to provision resources. | string | ✓ | | | [automated_backup_policy](variables.tf#L17) | The automated backup policy for this cluster. | object({…}) | | null | | [display_name](variables.tf#L44) | Human readable display name for the Alloy DB Cluster. | string | | null | | [encryption_key_name](variables.tf#L50) | The fully-qualified resource name of the KMS key for cluster encryption. | string | | null | | [initial_user](variables.tf#L56) | Alloy DB Cluster Initial User Credentials. | object({…}) | | null | | [labels](variables.tf#L65) | User-defined labels for the alloydb cluster. | map(string) | | {} | | [location](variables.tf#L71) | Location where AlloyDb cluster will be deployed. | string | | "europe-west2" | | [network_name](variables.tf#L77) | The network name of the project in which to provision resources. | string | | "multiple-readpool" | | [read_pool_instance](variables.tf#L115) | List of Read Pool Instances to be created. | list(object({…})) | | [] | ## Outputs | name | description | sensitive | |---|---|:---:| | [cluster](outputs.tf#L17) | Cluster created. | ✓ | | [cluster_id](outputs.tf#L23) | ID of the Alloy DB Cluster created. | | | [primary_instance](outputs.tf#L28) | Primary instance created. | | | [primary_instance_id](outputs.tf#L33) | ID of the primary instance created. | | | [read_pool_instance_ids](outputs.tf#L38) | IDs of the read instances created. | |