» google_sql_database_instance

Use this data source to get information about a Cloud SQL instance

» Example Usage

data "google_sql_database_instance" "qa" {
    name = google_sql_database_instance.master.name
}

» Argument Reference

The following arguments are supported:

  • name - (required) The name of the instance.

  • project - (optional) The ID of the project in which the resource belongs.

» Attributes Reference

In addition to the arguments listed above, the following attributes are exported:

  • settings - The settings to use for the database. The configuration is detailed below.

  • database_version - The MySQL, PostgreSQL or SQL Server (beta) version to use.

  • master_instance_name - The name of the instance that will act as the master in the replication setup.

  • replica_configuration - The configuration for replication. The configuration is detailed below.

  • root_password - Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

  • encryption_key_name - Beta) The full path to the encryption key used for the CMEK disk encryption.

The settings block contains:

  • tier - The machine type to use.

  • activation_policy - This specifies when the instance should be active. Can be either ALWAYS, NEVER or ON_DEMAND.

  • authorized_gae_applications - (Deprecated) This property is only applicable to First Generation instances. First Generation instances are now deprecated, see here for information on how to upgrade to Second Generation instances. A list of Google App Engine (GAE) project names that are allowed to access this instance.

  • availability_type - The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL).

  • crash_safe_replication - (Deprecated) This property is only applicable to First Generation instances. First Generation instances are now deprecated, see here

  • disk_autoresize - Configuration to increase storage size automatically.

  • disk_size - The size of data disk, in GB.

  • disk_type - The type of data disk.

  • pricing_plan - Pricing plan for this instance.

  • replication_type - This property is only applicable to First Generation instances. First Generation instances are now deprecated, see here

  • user_labels - A set of key/value user label pairs to assign to the instance.

The settings.database_flags sublist contains:

  • name - Name of the flag.

  • value - Value of the flag.

The settings.backup_configuration subblock contains:

  • binary_log_enabled - True if binary logging is enabled.

  • enabled - True if backup configuration is enabled.

  • start_time - HH:MM format time indicating when backup configuration starts.

The settings.ip_configuration subblock contains:

  • ipv4_enabled - Whether this Cloud SQL instance should be assigned a public IPV4 address.

  • private_network - The VPC network from which the Cloud SQL instance is accessible for private IP.

  • require_ssl - True if mysqld default to REQUIRE X509 for users connecting over IP.

The settings.ip_configuration.authorized_networks[] sublist contains:

  • expiration_time - The RFC 3339 formatted date time string indicating when this whitelist expires.

  • name - A name for this whitelist entry.

  • value - A CIDR notation IPv4 or IPv6 address that is allowed to access this instance.

The settings.location_preference subblock contains:

The settings.maintenance_window subblock for instances declares a one-hour maintenance window when an Instance can automatically restart to apply updates. The maintenance window is specified in UTC time. It contains:

  • day - Day of week (1-7), starting on Monday.

  • hour - Hour of day (0-23), ignored if day not set.

  • update_track - Receive updates earlier (canary) or later (stable).

The replica_configuration block contains: