← Back to Pull requests

Add optional secondary read pool support to the alloydb module #3529

Closed
unknown closed this pull request without merging on Nov 18, 2025 23:15 UTC
View on GitHub
unknown unknown commented on Nov 14, 2025 20:45 UTC
Author

Add optional secondary read pool support to the alloydb module.

It is now possible to configure and create secondary read pools replicating from the secondary instance using the alloydb module. The configuration is same as existing primary read pool configuration but available under the cross_region_replication, e.g:

 module "my_alloydb" {
  # source         = "github.com/terraform-google-modules/cloud-foundation-fabric//modules/alloydb?ref=v48.0.0"
  source            = "../../modules/alloydb"
  project_id     = var.project_id
  location       = var.location_primary
  cluster_name   = "${var.name}-primary"
  instance_name  = "${var.name}-primary"
  machine_config = {
    cpu_count    = 2
    machine_type = var.machine_type
  }
  initial_user = {
    password = var.initial_password
  }
  network_config = {
    psc_config = { allowed_consumer_projects = [ data.google_project.client_project.number ] }
  }
  database_version = var.database_version
  read_pool = {
    "${var.name}-read-pool" = {
      node_count = var.read_pool_count
    }
  }
  cross_region_replication = {
    enabled = true
    region  = var.location_secondary
    secondary_cluster_name = "${var.name}-secondary"
    secondary_instance_name = "${var.name}-secondary"
    read_pool = {
      "${var.name}-secondary-read-pool" = {
        node_count = var.read_pool_count
      }
    }
  }

  # Set to true in the real production environment
  deletion_protection = false
}

---
Checklist

I applicable, I acknowledge that I have:

  • [X] Read the contributing guide

  • [X] Ran terraform fmt on all modified files

  • [X] Regenerated the relevant README.md files using tools/tfdoc.py

  • [X] Made sure all relevant tests pass
  • Diff: 247 lines (+185 / -62) across 3 files Reviewer: sshcherbakov Review duration: 5910m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 247 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.330
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3529"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 38.9% (MEDIUM) · Higher = larger blast radius
    38.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.4% · Safe to merge
    15.4%