terraform-provider-google/website/docs/r/sql_database.html.markdown
Riley Karson 7625ad3375 Document Beta Features in index.html (#280)
* First pass of Beta docs.

* Updated new docs to link as well.

* Updated new Beta resources with Beta link.
2017-08-10 13:28:52 -07:00

2.5 KiB

layout page_title sidebar_current description
google Google: google_sql_database docs-google-sql-database-x Creates a new SQL database in Google Cloud SQL.

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. Postgres support for google_sql_database is in Beta.

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.


  • project - (Optional) The project in which the resource belongs. If it is not provided, the provider project is used.

  • charset - (Optional) The charset value. See MySQL's Supported Character Sets and Collations and Postgres' Character Set Support for more details and supported values. Postgres databases are in Beta, and have limited charset support; they only support a value of UTF8 at creation time.

  • collation - (Optional) The collation value. See MySQL's Supported Character Sets and Collations and Postgres' Collation Support for more details and supported values. Postgres databases are in Beta, and have limited collation support; they only support a value of en_US.UTF8 at creation time.

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