gcp.sql.instance.ensure ​
Create or return a Cloud SQL PostgreSQL instance.
Overview ​
| Property | Value |
|---|---|
| Workflow type | Linear |
| Library | Base-gcp |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | Yes | — | GCP CloudConnection UUID. |
project_id | string | No | — | GCP project override. |
instance_id | string | Yes | — | Cloud SQL instance id. |
region | string | Yes | — | Cloud SQL region. |
database_version | string | No | — | Defaults to POSTGRES_16. |
tier | string | Yes | — | Machine tier, e.g. db-f1-micro. |
storage_gb | integer | No | — | Allocated storage size. |
availability_type | string | No | — | ZONAL or REGIONAL. |
private_network | string | No | — | VPC selfLink for private IP. |
authorized_networks | json | No | — | Public authorized networks. |
backup_config | json | No | — | Backup and PITR settings. |
labels | json | No | — | Instance labels. |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | No | — | Echoed connection UUID. |
project_id | string | No | — | Effective project. |
instance_id | string | No | — | Cloud SQL instance id. |
region | string | No | — | Cloud SQL region (carried through). |
database_version | string | No | — | Postgres version (carried through). |
tier | string | No | — | Instance tier (carried through). |
storage_gb | integer | No | — | Storage GB (carried through). |
availability_type | string | No | — | Availability type (carried through). |
private_network | string | No | — | Private network (carried through). |
authorized_networks | json | No | — | Authorized networks (carried through). |
backup_config | json | No | — | Backup config (carried through). |
labels | json | No | — | Labels (carried through). |
instance_connection_name | string | No | — | project:region:instance connection name. |
self_link | string | No | — | Provider selfLink. |
operation_name | string | No | — | Cloud SQL operation name when creation/update started. |
created | boolean | No | — | True when created during this run. |
instance | json | No | — | Sanitized instance response. |
failure_reason | string | No | — | Human-readable failure reason. |
failed_step | string | No | — | Failed logical step. |
failed_layer | json | No | — | Engine failed layer. |
failed_at_state | string | No | — | State where failure occurred. |
error | string | No | — | Error message. |
error_type | string | No | — | Error class. |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | preflight | — |
ensuring | No | No | — | complete | — |
preflighting | No | No | — | execute | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | preflight | preflighting | — |
preflighting | execute | ensuring | — |
ensuring | complete | completed | — |
* (any state) | fail | failed | — |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "gcp.sql.instance.ensure",
"initial_data": {
"connection_uuid": "value",
"instance_id": "value",
"region": "value",
"tier": "value"
}
}