HyOps Cloud SQL External Replica Lifecycle¶
Purpose¶
org/gcp/cloudsql-external-replica is the live managed PostgreSQL DR module for the GCP lane.
It currently supports two operator phases:
assessestablish
assess validates upstream source posture and an existing Cloud SQL target.
establish creates Database Migration Service objects:
- source PostgreSQL connection profile
- destination Cloud SQL connection profile
- migration job
Important:
- the DMS
establishpath creates its own Cloud SQL replica through the destination connection profile - it does not reuse a standalone
org/gcp/cloudsql-postgresqlinstance - it is the engine behind
dr/postgresql-cloudsql-standby-gcp@v1
Prerequisites¶
hyops init gcpcompleted for the selected environmentplatform/onprem/postgresql-dr-sourcestate isok- for
assess,org/gcp/cloudsql-postgresqlstate isok - the operator has working
gcloudauthentication on the control host
Validate¶
cd "$HOME/hybridops-core"
./.venv/bin/hyops validate --env dev --skip-preflight \
--module org/gcp/cloudsql-external-replica \
--inputs modules/org/gcp/cloudsql-external-replica/examples/inputs.min.yml
Apply¶
cd "$HOME/hybridops-core"
./.venv/bin/hyops apply --env dev \
--module org/gcp/cloudsql-external-replica \
--inputs modules/org/gcp/cloudsql-external-replica/examples/inputs.min.yml
Establish¶
Prepare an operator input file with at least:
apply_mode: establishproject_state_reforproject_idnetwork_state_reforprivate_networksource_connection_profile_namedestination_connection_profile_namemigration_job_namesource_replication_usersource_replication_password_envconnectivity_mode
Then run:
cd "$HOME/hybridops-core"
./.venv/bin/hyops apply --env dev \
--module org/gcp/cloudsql-external-replica \
--inputs <operator-establish-inputs.yml>
Expected outputs¶
cap.db.managed_external_replica = assessed|establishedmanaged_replication_mode = logicalmanaged_replication_prereqs_ready = true|falsemanaged_replication_established = true|false- target instance metadata and target private IP
target_db_host,target_db_portendpoint_dns_name,endpoint_target,endpoint_target_type,endpoint_host,endpoint_portendpoint_cutover_required- source leader and source replication candidate signal
Contract rule:
- if
endpoint_dns_nameis set, clients should consumeendpoint_target=<dns name> - if
endpoint_dns_nameis blank,endpoint_targetfalls back to the Cloud SQL private host andendpoint_cutover_required=true
This keeps the managed GCP standby lane aligned with the same endpoint contract used by platform/postgresql-ha and platform/network/dns-routing.
Notes¶
- The module copies the operator's existing
~/.config/gcloudinto the HyOps runtime cache on first use so packaged runs do not rely on write access to the default gcloud config directory. - The module keeps replication secrets out of Terraform state by using
gcloudon the controller side. static-ipconnectivity requires the source database to accept DMS traffic from an allowlisted public IP.reverse-sshconnectivity requires an explicit bastion VM and VPC input.- promotion and failback are intentionally handled by separate blueprints with explicit manual gates and DNS cutover, not by this module directly.