2015-10-23 16:10:41 +02:00
---
layout: "google"
page_title: "Google: google_sql_database"
sidebar_current: "docs-google-sql-database"
description: |-
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 ](https://cloud.google.com/sql/ ), or the [JSON API ](https://cloud.google.com/sql/docs/admin-api/v1beta4/databases ).
## Example Usage
Example creating a SQL Database.
2017-04-17 12:17:54 +02:00
```hcl
2015-10-23 16:10:41 +02:00
resource "google_sql_database_instance" "master" {
2016-04-10 23:34:15 +02:00
name = "master-instance"
2016-03-31 12:37:17 +02:00
2016-04-10 23:34:15 +02:00
settings {
tier = "D0"
}
2015-10-23 16:10:41 +02:00
}
resource "google_sql_database" "users" {
2016-04-10 23:34:15 +02:00
name = "image-store-bucket"
instance = "${google_sql_database_instance.master.name}"
2015-10-23 16:10:41 +02:00
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The name of the database.
* `instance` - (Required) The name of containing instance.
2016-04-10 23:34:15 +02:00
- - -
* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.
2015-10-23 16:10:41 +02:00
## Attributes Reference
2016-04-10 23:34:15 +02:00
In addition to the arguments listed above, the following computed attributes are
exported:
2015-10-23 16:10:41 +02:00
* `self_link` - The URI of the created resource.