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 aftergoogle_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. WhennullTerraform 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< ? replicaNames, TfArg<String> >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_versionsattribute.no setter -
connectionName
→ TfRef<
String> -
Reference to
connection_nameattribute.no setter -
dependsOn
→ List<
DependencyTarget> ? -
Optional
depends_on = [...]. Each entry is aDependencyTarget— either a wholesale resource (rendered as bare address) or an explicitTfRef(rendered viabareAddress).finalinherited -
dnsName
→ TfRef<
String> -
Reference to
dns_nameattribute.no setter -
dnsNames
→ TfRef<
List< Map< >String, Object?> > -
Reference to
dns_namesattribute.no setter -
firstIpAddress
→ TfRef<
String> -
Reference to
first_ip_addressattribute.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
→ TfRef<
String> -
Reference to
idattribute.no setter -
ipAddress
→ TfRef<
List< Map< >String, Object?> > -
Reference to
ip_addressattribute.no setter - kind → ResourceKind
-
Always
ResourceKind.resource. Overridden byData.no setterinherited - lifecycle → LifecycleOptions?
-
Optional
lifecycle { ... }block.finalinherited - localName → String
-
User-supplied local name within a Stack.
finalinherited
-
nameRef
→ TfRef<
String> -
Reference to
nameattribute.no setter -
privateIpAddress
→ TfRef<
String> -
Reference to
private_ip_addressattribute.no setter - provider → String?
-
Optional Terraform
providermeta-argument: a provider name ('google-beta'on a GA type) or aname.aliaspair ('google.eu').finalinherited -
pscServiceAttachmentLink
→ TfRef<
String> -
Reference to
psc_service_attachment_linkattribute.no setter -
publicIpAddress
→ TfRef<
String> -
Reference to
public_ip_addressattribute.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selfLink
→ TfRef<
String> -
Reference to
self_linkattribute.no setter -
sensitiveFields
→ Set<
String> -
Field names that are
@Sensitiveper the IR-derived per-resource constant. Curated factories override with a baked-instatic const Set<String>(file-private in v0.5+).no setter -
serverCaCert
→ TfRef<
List< Map< >String, Object?> > -
Reference to
server_ca_certattribute.no setter -
serviceAccountEmailAddress
→ TfRef<
String> -
Reference to
service_account_email_addressattribute.no setter - supportsDeletionProtection → bool
-
Capability flag: true when this resource's underlying Terraform
schema has a
deletion_protectionboolean attribute that the synth-time devMode flow can flip tofalse. Defaults to false; the codegen emitter overrides this totruefor 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 likelifecycle— synth copies the duration strings verbatim, andterraform validatedecides 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