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

AppConstant<T>
A value the Stack hands to application code as a static const in the generated AppExports file — known when synth runs, so the app compiles against it.
AppExports
Where synth writes the Dart file application code imports: the Stack's constants, as the static const members of <name>Constants, and a typed reader of its Terraform outputs, <name>Outputs.
AttributeRef<T>
Public for sealed pattern matching, but constructor is private — only TfRef.attribute() may construct instances.
DartDefineOutput
An output whose value is the client build's --dart-define file, registered with Stack.addDartDefineOutput.
Data
Base of every user-instantiable Terraform data block.
DataGoogleSqlBackupRun
Factory wrapper for google_sql_backup_run.
DataGoogleSqlCaCerts
Factory wrapper for google_sql_ca_certs.
DataGoogleSqlDatabase
Factory wrapper for google_sql_database.
DataGoogleSqlDatabaseInstance
Factory wrapper for google_sql_database_instance.
DataGoogleSqlDatabaseInstanceLatestRecoveryTime
Factory wrapper for google_sql_database_instance_latest_recovery_time.
DataGoogleSqlDatabaseInstances
Factory wrapper for google_sql_database_instances.
DataGoogleSqlDatabases
Factory wrapper for google_sql_databases.
DataGoogleSqlTiers
Factory wrapper for google_sql_tiers.
DataRef<T>
Public for sealed pattern matching, but constructor is private — only TfRef.data() may construct instances.
EnvironmentConstant
The AppConstant.fromEnvironment choice.
GcsBackend
terraform { backend "gcs" { ... } } configuration.
GoogleSqlDatabase
Factory wrapper for google_sql_database.
GoogleSqlDatabaseInstance
Factory wrapper for google_sql_database_instance.
GoogleSqlProvisionScript
Factory wrapper for google_sql_provision_script.
GoogleSqlSourceRepresentationInstance
Factory wrapper for google_sql_source_representation_instance.
GoogleSqlSslCert
Factory wrapper for google_sql_ssl_cert.
GoogleSqlUser
Factory wrapper for google_sql_user.
IgnoreAllChanges
IgnoreChanges.all.
IgnoreAttributes
IgnoreChanges.of.
IgnoreChanges
What ignore_changes covers: every attribute, or the listed ones.
InvalidDartDefineOutput
An output of Stack.addDartDefineOutput that cannot carry what it names: an output that is not registered, is sensitive or has no environment value, two outputs read from one variable, or no output at all.
InvalidLifecycle
A lifecycle block Terraform rejects: a data source (or one of its attributes) in replaceTriggeredBy, all inside IgnoreChanges.of, or a condition with an empty error message.
InvalidMoveTarget
A moved block whose to names no resource of the Stack.
InvalidTimeout
A negative timeouts duration.
LifecycleCondition
A precondition or postcondition block: Terraform fails the plan (LifecycleCondition.pre) or the apply (LifecycleCondition.post) with errorMessage when condition is false.
LifecycleOptions
lifecycle { ... } block on a resource.
LocalBackend
terraform { backend "local" { ... } } configuration.
MissingProvider
A block needs a provider configuration the Stack does not register: the provider its type implies (google for google_pubsub_topic), the one its provider meta-argument names, or one a module call passes on.
ModuleCall
A module "<localName>" { ... } call as a Dart value.
NoProviders
The Stack registers no provider, but declares resources or data sources.
ProviderConflict
Two provider registrations Terraform rejects together: two defaults of one name, a repeated alias, an alias that is not an identifier, or configurations of one name with different source / version constraints.
RefConstant<T>
The AppConstant.ref choice.
ReplaceTrigger
What lifecycle.replaceTriggeredBy lists: a resource of the Stack or an attribute getter of one. Resource and TfRef implement it; synth reports a data source or a data-source attribute as an InvalidLifecycle.
Resource
Base of every user-instantiable Terraform resource.
ResourceRef
Public for sealed pattern matching, but constructor is private — only TfRef.resource() may construct instances.
S3Backend
terraform { backend "s3" { ... } } configuration.
Sensitive<T>
What an argument Terraform marks sensitive takes: a variable, an expression or an attribute getter — a value Terraform resolves, never a Dart literal that would be written into main.tf.json.
SensitiveLiteral
A sensitive field is set to a literal, which would write the secret in plain text into main.tf.json.
SqlDatabaseInstanceActiveDirectoryConfig
Typed helper for the settings.active_directory_config block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceAdvancedMachineFeatures
Typed helper for the settings.advanced_machine_features block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceAuthorizedNetworks
Typed helper for the settings.ip_configuration.authorized_networks block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceBackupConfiguration
Typed helper for the settings.backup_configuration block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceBackupRetentionSettings
Typed helper for the settings.backup_configuration.backup_retention_settings block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceClone
Typed helper for the clone block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceConnectionPoolConfig
Typed helper for the settings.connection_pool_config block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceDatabaseFlags
Typed helper for the settings.database_flags block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceDataCacheConfig
Typed helper for the settings.data_cache_config block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceDenyMaintenancePeriod
Typed helper for the settings.deny_maintenance_period block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceEntraidConfig
Typed helper for the settings.entraid_config block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceFinalBackupConfig
Typed helper for the settings.final_backup_config block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceFlags
Typed helper for the settings.connection_pool_config.flags block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceInsightsConfig
Typed helper for the settings.insights_config block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceIpConfiguration
Typed helper for the settings.ip_configuration block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceLocationPreference
Typed helper for the settings.location_preference block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceMaintenanceWindow
Typed helper for the settings.maintenance_window block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstancePasswordValidationPolicy
Typed helper for the settings.password_validation_policy block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstancePointInTimeRestoreContext
Typed helper for the point_in_time_restore_context block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstancePscAutoConnections
Typed helper for the settings.ip_configuration.psc_config.psc_auto_connections block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstancePscConfig
Typed helper for the settings.ip_configuration.psc_config block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceReadPoolAutoScaleConfig
Typed helper for the settings.read_pool_auto_scale_config block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceReplicaConfiguration
Typed helper for the replica_configuration block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceReplicationCluster
Typed helper for the replication_cluster block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceRestoreBackupContext
Typed helper for the restore_backup_context block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceSettings
Typed helper for the settings block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceSqlServerAuditConfig
Typed helper for the settings.sql_server_audit_config block of google_sql_database_instance (derived from provider schema).
SqlDatabaseInstanceTargetMetrics
Typed helper for the settings.read_pool_auto_scale_config.target_metrics block of google_sql_database_instance (derived from provider schema).
SqlUserPasswordPolicy
Typed helper for the password_policy block of google_sql_user (derived from provider schema).
Stack
User-extended IaC composition root.
StackBackend
Lightweight backend hook. Core ships GcsBackend, S3Backend, and LocalBackend; anything else implements this interface in the caller. The Stack only stores the value and exposes a discriminator for synth's terraform { backend ... } emitter.
StackProvider
Coordination interface between Stack (in this package) and concrete providers (e.g. GoogleProvider in terradart_google). Concrete providers implement every getter using their baked-in constants from Stage 2 codegen.
SynthIssue
One reason a Stack cannot be synthesized.
SynthResult
Bundle returned by StackSynth.synth.
TfAddressed
Anything that exposes a Terraform address, e.g. google_pubsub_topic.orders.
TfArg<T>
A Terraform argument: a Dart-side literal, a reference to another block's attribute (TfRef), a variable or a raw expression.
TfArgExpression<T>
A raw Terraform expression — the tf.json template string, verbatim.
TfArgLiteral<T>
TfArgVariable<T>
TfCollectionType
list(...), set(...) or map(...).
TfMoved
One moved { from = ... to = ... } block: the state object at from now belongs to the resource at to, so a rename does not become a destroy-and-create.
TfObjectType
object({ ... }).
TfOptionalType
optional(<type>[, <default>]).
TfOutput<T>
An output "<name>" { value = ... } block, registered with Stack.addOutput.
TfPrimitiveType
string, number, bool or any.
TfRef<T>
A Terraform-side reference: an attribute of a resource (AttributeRef) or a data source (DataRef), or a whole resource (ResourceRef).
TfTimeouts
timeouts { ... } on a resource or data source: how long Terraform waits for each operation before giving up.
TfTupleType
tuple([...]).
TfType
A Terraform type constraint: string, list(number), object({ name = string }).
TfVariable
One variable "<name>" { ... } declaration.
UndeclaredVariable
A TfArg.variable or var.<name> in an expression names a variable the Stack does not declare.
UnregisteredReference
A block references another block that was never registered on the Stack: built, but not passed to add(...) / addModule(...).
UnresolvableConstant
An AppConstant.ref whose value is not known at synth: the attribute is not set to a literal, is sensitive, does not match the constant's type, or belongs to a block that is not registered.
ValueConstant<T>
The AppConstant.value choice.

Enums

ResourceKind
Whether a Stack entry is a resource block or a data block in Terraform JSON.

Extension Types

DatabaseVersion
Engine + major version for a Cloud SQL instance. Mapped from the database_version schema string (see the schema attribute description for the canonical supported set). Picking a major family is forcing — Terraform recreates the instance on change.
OutputEnvironment
The environment Stack.outputEnvironment returns: each variable and its value, in registration order.
RefTo
A reference to a resource of type R, for an argument that names another resource (network, vpc_id, role_arn, ...).
SqlActivationPolicy
settings.activation_policy. always (default) keeps the instance running 24/7; never keeps it stopped (the underlying storage is preserved). onDemand is legacy — kept for backwards compatibility.
SqlAvailabilityType
settings.availability_type. regional is HA (across 2 zones in the region, automatic failover); zonal is 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 — hyperdiskBalanced is only available on Enterprise Plus.
SqlEdition
settings.edition. enterprisePlus unlocks data cache, advanced disaster recovery, and the read-pool instance type.
SqlUserDeletionPolicy
deletion_policy — Postgres users with granted SQL roles cannot be deleted via the API; ABANDON drops them from Terraform state only.
SqlUserType
Authentication mechanism for a google_sql_user.

Extensions

RefToList on TfArg<List<RefTo<R>>>
A list-valued reference argument (security_group_ids, subnet_ids): a literal list of RefTos, or one value that is the whole list (TfArg.variable('subnet_ids'), TfArg.expression(...)).
TerraformDurationExt on Duration
Converts a Dart Duration into a Terraform duration string ("604800s").

Constants

terradartManifestVariable → const String
The environment variable the terradart command sets to the file runStack and runEnvironments describe what they wrote in.

Functions

runEnvironments<E extends Enum>(List<String> args, List<E> environments, Stack build(E env), {String dir(E env)?, String? workspace(E env)?, List<String> backendConfig(E env)?, E? defaultEnv}) → Future<void>
The entry point of a project with one Stack per environment. The environments are the members of an enum of the project's own — any names, each carrying its values — so the Stack takes a typed env and derives everything per environment from it, its backend included:
runStack(List<String> args, Stack build(), {String out = 'tf-out'}) → Future<void>
The entry point of a project with one Stack: writes it to out.

Exceptions / Errors

DuplicateModuleError
A ModuleCall registered twice under one name.
DuplicateResourceError
Thrown by Stack.add when an entry with the same (kind, terraformType, localName) triple is registered twice.
SynthException
Thrown by Stack.synth() and Stack.writeTo() when the Stack has one or more SynthIssues. Nothing is written.