Provision and manage Cloud SQL database instances with databases and users on Google Cloud Platform.Cloud SQL resources form a hierarchy: Instance → Database → User.
- Instance
- Database
- User
gcp/cloudsql/database_instance
Creates a managed Cloud SQL instance (PostgreSQL, MySQL, or SQL Server).Config
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
project_id | string | Yes | — | GCP project ID (immutable) |
credentials | dict or string | Yes | — | GCP service account credentials JSON |
region | string | Yes | — | GCP region, e.g., europe-west4 (immutable) |
instance_name | string | Yes | — | Instance name, 1–98 chars, starts with letter (immutable) |
database_version | string | No | "POSTGRES_15" | Database version (immutable). Supported: POSTGRES_*, MYSQL_*, SQLSERVER_* |
tier | string | No | "db-f1-micro" | Machine tier (e.g., db-custom-1-3840) |
availability_type | "ZONAL" | "REGIONAL" | No | "ZONAL" | Single zone or high availability |
backup_enabled | boolean | No | true | Enable automatic backups |
deletion_protection | boolean | No | false | Prevent accidental deletion |
authorized_networks | list[string] | No | [] | CIDR ranges allowed to connect |
enable_public_ip | boolean | No | true | Assign a public IP address |
Outputs
| Field | Type | Description |
|---|---|---|
connection_name | string | Cloud SQL connection name (project:region:instance) |
public_ip | string or null | Public IP address |
private_ip | string or null | Private IP address |
ready | boolean | Whether the instance is running |
console_url | string | URL to GCP Console |
logs_url | string | URL to Cloud Logging |
Example
Dependencies
Notes
- Instance creation takes several minutes. The resource polls until the instance reaches
RUNNABLEstate. - Fields marked (immutable) cannot be changed after creation — you must delete and recreate the resource.
- Password changes on users are applied in place without recreation.
- All Cloud SQL resources are idempotent — creating an existing resource returns its current state.