GoogleSqlDatabaseInstance class final

Factory wrapper for google_sql_database_instance.

Manages a Cloud SQL instance — a managed MySQL, PostgreSQL, or SQL Server engine. The schema is large; this wrapper exposes the commonly-used fields as typed helpers (SqlDatabaseInstanceSettings, SqlDatabaseInstanceIpConfiguration, SqlDatabaseInstanceBackupConfiguration, SqlDatabaseInstanceDatabaseFlag, SqlDatabaseInstanceLocationPreference, SqlDatabaseInstanceMaintenanceWindow, SqlDatabaseInstanceReplicaConfiguration) and leaves the rarely-set knobs (e.g. active_directory_config, sql_server_audit_config, password_validation_policy) on the SqlDatabaseInstanceSettings.extra / SqlDatabaseInstanceSettings.advancedExtra escape hatches so the curation surface stays manageable.

Required identity:

  • localName: Terraform local name (the address segment after google_sql_database_instance.).
  • databaseVersion: engine + major version (e.g. DatabaseVersion.postgres15, DatabaseVersion.mysql80). Forces replacement when the major family changes (Postgres → MySQL etc.); minor in-family upgrades are in-place.

Strongly recommended:

  • name: instance name. When null Terraform picks a random one — surprising in CI, set explicitly in production.
  • region: GCP region (e.g. 'asia-northeast1'). Falls back to the provider's region.
  • settings.tier: machine type (e.g. 'db-perf-optimized-N-2', 'db-custom-2-7680', or the lower-cost 'db-f1-micro' legacy shared-core tier for dev).

Private-IP wiring (the canonical Wave 5 chain):

google_compute_network              ┐
google_compute_global_address       ├─ build the peering bridge first
google_service_networking_connection┘
                 ↓
google_sql_database_instance        ── private_network points at
                                       the network above; ipv4Enabled
                                       is false → private-only.

Example (private-IP PostgreSQL primary — see the cloud_sql_quickstart example for the full chain):

final primary = GoogleSqlDatabaseInstance(
  localName: 'primary',
  name: TfArg.literal('orders-primary'),
  databaseVersion: TfArg.literal(DatabaseVersion.postgres15),
  region: TfArg.literal('asia-northeast1'),
  deletionProtection: TfArg.literal(false), // dev / quickstart
  settings: SqlDatabaseInstanceSettings(
    tier: TfArg.literal('db-custom-2-7680'),
    availabilityType: TfArg.literal(SqlAvailabilityType.regional),
    edition: TfArg.literal(SqlEdition.enterprise),
    diskSize: TfArg.literal(20),
    diskType: TfArg.literal(SqlDiskType.pdSsd),
    ipConfiguration: SqlDatabaseInstanceIpConfiguration(
      ipv4Enabled: TfArg.literal(false),
      privateNetwork: TfArg.ref(vpc.selfLink),
    ),
    backupConfiguration: const SqlDatabaseInstanceBackupConfiguration(
      enabled: true,
      pointInTimeRecoveryEnabled: true,
      startTime: '03:00',
    ),
  ),
);

root_password is sensitive in the schema and round-trips through the generated sensitiveFields set — synth masks it. Prefer root_password_wo (write-only, never stored in state, requires Terraform >= 1.11) for new deployments.

Constructors

GoogleSqlDatabaseInstance({required String localName, required TfArg<DatabaseVersion> databaseVersion, TfArg<String>? name, TfArg<String>? region, SqlDatabaseInstanceSettings? settings, TfArg<String>? rootPassword, TfArg<String>? rootPasswordWo, TfArg<String>? rootPasswordWoVersion, TfArg<bool>? deletionProtection, TfArg<String>? masterInstanceName, SqlDatabaseInstanceReplicaConfiguration? replicaConfiguration, TfArg<String>? instanceType, TfArg<num>? nodeCount, TfArg<String>? maintenanceVersion, TfArg<String>? encryptionKeyName, TfArg<List<String>>? replicaNames, TfArg<String>? finalBackupDescription, TfArg<String>? backupdrBackup, TfArg<String>? project, LifecycleOptions? lifecycle, List<DependencyTarget>? dependsOn, String? provider, TfTimeouts? timeouts})

Properties

argMap Map<String, TfArg?>
Argument-name → TfArg map. Keys are snake_case (Terraform JSON name). Synth emits these keys directly; the factory is responsible for the camelCase → snake_case translation at construction time.
finalinherited
availableMaintenanceVersions → TfRef<List<String>>
Reference to available_maintenance_versions attribute.
no setter
connectionName → TfRef<String>
Reference to connection_name attribute.
no setter
dependsOn List<DependencyTarget>?
Optional depends_on = [...]. Each entry is a DependencyTarget — either a wholesale resource (rendered as bare address) or an explicit TfRef (rendered via bareAddress).
finalinherited
dnsName → TfRef<String>
Reference to dns_name attribute.
no setter
dnsNames → TfRef<List<Map<String, Object?>>>
Reference to dns_names attribute.
no setter
firstIpAddress → TfRef<String>
Reference to first_ip_address attribute.
no setter
hashCode int
The hash code for this object.
no setterinherited
id → TfRef<String>
Reference to id attribute.
no setter
ipAddress → TfRef<List<Map<String, Object?>>>
Reference to ip_address attribute.
no setter
kind → ResourceKind
Always ResourceKind.resource. Overridden by Data.
no setterinherited
lifecycle → LifecycleOptions?
Optional lifecycle { ... } block.
finalinherited
localName String
User-supplied local name within a Stack.
finalinherited
nameRef → TfRef<String>
Reference to name attribute.
no setter
privateIpAddress → TfRef<String>
Reference to private_ip_address attribute.
no setter
provider String?
Optional Terraform provider meta-argument: a provider name ('google-beta' on a GA type) or a name.alias pair ('google.eu').
finalinherited
Reference to psc_service_attachment_link attribute.
no setter
publicIpAddress → TfRef<String>
Reference to public_ip_address attribute.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
Reference to self_link attribute.
no setter
sensitiveFields Set<String>
Field names that are @Sensitive per the IR-derived per-resource constant. Curated factories override with a baked-in static const Set<String> (file-private in v0.5+).
no setter
serverCaCert → TfRef<List<Map<String, Object?>>>
Reference to server_ca_cert attribute.
no setter
serviceAccountEmailAddress → TfRef<String>
Reference to service_account_email_address attribute.
no setter
supportsDeletionProtection bool
Capability flag: true when this resource's underlying Terraform schema has a deletion_protection boolean attribute that the synth-time devMode flow can flip to false. Defaults to false; the codegen emitter overrides this to true for wrappers whose schema includes the attribute.
no setter
terraformType String
Terraform resource type, e.g. google_pubsub_topic.
finalinherited
tfAddress String
no setterinherited
timeouts → TfTimeouts?
Optional timeouts { ... } block: how long Terraform waits for each operation. Provider-neutral like lifecycle — synth copies the duration strings verbatim, and terraform validate decides whether this resource's schema declares the operations set here.
finalinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

tfType → const String