google_sql_database

Creates a new Google SQL Database on a Google SQL Database Instance. For more information, see the official documentation, or the JSON API.

Example Usage

Example creating a SQL Database.

resource "google_sql_database_instance" "master" {
  name = "master-instance"

  settings {
    tier = "D0"
  }
}

resource "google_sql_database" "users" {
  name      = "users-db"
  instance  = "${google_sql_database_instance.master.name}"
  charset   = "latin1"
  collation = "latin1_swedish_ci"
}

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the database.

  • instance - (Required) The name of containing instance.

Attributes Reference

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

  • self_link - The URI of the created resource.

Import

SQL databases can be imported using the instance and name, e.g.

$ terraform import google_sql_database.database master-instance:users-db

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/google/r/sql_database.html