» google_sql_database

Represents a SQL database inside the Cloud SQL instance, hosted in Google's cloud.

» Example Usage - Sql Database Basic

resource "google_sql_database" "database" {
    name = "my-database"
    instance = "${google_sql_database_instance.instance.name}"
}

resource "google_sql_database_instance" "instance" {
    name = "my-database-instance"
    region = "us-central"
    settings {
        tier = "D0"
    }
}

» Argument Reference

The following arguments are supported:

  • name - (Required) The name of the database in the Cloud SQL instance. This does not include the project ID or instance name.

  • instance - (Required) The name of the Cloud SQL instance. This does not include the project ID.


» Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 15 minutes.
  • update - Default is 10 minutes.
  • delete - Default is 10 minutes.

» Import

Database can be imported using any of these accepted formats:

$ terraform import google_sql_database.default projects/{{project}}/instances/{{instance}}/databases/{{name}}
$ terraform import google_sql_database.default instances/{{instance}}/databases/{{name}}
$ terraform import google_sql_database.default {{project}}/{{instance}}/{{name}}
$ terraform import google_sql_database.default {{instance}}/{{name}}
$ terraform import google_sql_database.default {{instance}}:{{name}}
$ terraform import google_sql_database.default {{name}}

» User Project Overrides

This resource supports User Project Overrides.