cloud_sql library
Cloud SQL — managed relational databases (MySQL / PostgreSQL / SQL Server).
For private-IP deployments, see also service_networking.dart
(GoogleServiceNetworkingConnection) and compute.dart
(GoogleComputeGlobalAddress).
Classes
- AuthorizedNetwork
-
One entry in
ip_configuration.authorized_networks. Thevaluefield is a CIDR ('203.0.113.0/24'or'203.0.113.42/32'). - BackupConfiguration
-
settings.backup_configuration. Enabling backups is a prerequisite for HA (availability_type: REGIONAL) and point-in-time recovery on Postgres. - BackupRetentionSettings
-
backup_configuration.backup_retention_settings. - DatabaseFlag
-
One
settings.database_flagsentry — engine-level flag. Both keys are simple strings on the wire (numeric flag values are stringified —'1000', not1000). - GoogleSqlDatabase
-
Factory wrapper for
google_sql_database(providerhashicorp/google ~> 7.0). - GoogleSqlDatabaseInstance
-
Factory wrapper for
google_sql_database_instance(providerhashicorp/google ~> 7.0). - GoogleSqlUser
-
Factory wrapper for
google_sql_user(providerhashicorp/google ~> 7.0). - IpConfiguration
-
settings.ip_configuration— controls how clients reach the instance. Two main shapes: - LocationPreference
-
settings.location_preference. Optional — the API picks a zone when omitted. followGaeApplication is rarely set; leavenullunless co-locating with an App Engine app. - MaintenanceWindow
-
settings.maintenance_window. Pin a weekly window when GCP can take the instance down for upgrades. - PscConfig
-
ip_configuration.psc_config— Private Service Connect. Mutually exclusive with VPC peering on the same instance. - ReplicaConfiguration
-
replica_configurationblock. Only set on read-replica instances (i.e. whenGoogleSqlDatabaseInstance.masterInstanceNameis also set). The replica'sGoogleSqlDatabaseInstance.databaseVersionmust match the primary. - Settings
-
settingsblock. Required in practice for any non-trivial instance — at minimum supply tier. The remaining knobs default to GCP's per-tier sensible values; override only the ones you need.
Enums
- DatabaseVersion
-
Engine + major version for a Cloud SQL instance. Mapped from the
database_versionschema string (see the schema attribute description for the canonical supported set). Picking a major family is forcing — Terraform recreates the instance on change. - SqlActivationPolicy
-
settings.activation_policy.always(default) keeps the instance running 24/7;neverkeeps it stopped (the underlying storage is preserved).onDemandis legacy — kept for backwards compatibility. - SqlAvailabilityType
-
settings.availability_type.regionalis HA (across 2 zones in the region, automatic failover);zonalis single-zone (cheaper). HA also requires backup_configuration to be enabled (and binary logs on MySQL / point-in-time recovery on Postgres). - SqlDiskType
-
settings.disk_type. Tier-dependent —hyperdiskBalancedis only available on Enterprise Plus. - SqlEdition
-
settings.edition.enterprisePlusunlocks data cache, advanced disaster recovery, and the read-pool instance type. - SqlUserType
-
Authentication mechanism for a
google_sql_user.