2016-01-13 22:33:08 +01:00
---
layout: "google"
page_title: "Google: google_sql_user"
sidebar_current: "docs-google-sql-user"
description: |-
Creates a new SQL user in Google Cloud SQL.
---
# google\_sql\_user
Creates a new Google SQL User on a Google SQL User 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/users ).
2017-03-29 11:37:36 +02:00
~> **Note:** All arguments including the username and password will be stored in the raw state as plain-text.
[Read more about sensitive data in state ](/docs/state/sensitive-data.html ).
2016-01-13 22:33:08 +01:00
## Example Usage
Example creating a SQL User.
2017-04-17 12:17:54 +02:00
```hcl
2016-01-13 22:33:08 +01: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"
}
2016-01-13 22:33:08 +01:00
}
resource "google_sql_user" "users" {
2016-04-10 23:34:15 +02:00
name = "me"
instance = "${google_sql_database_instance.master.name}"
host = "me.com"
2017-02-18 15:16:14 +01:00
password = "changeme"
2016-01-13 22:33:08 +01:00
}
```
## Argument Reference
The following arguments are supported:
* `host` - (Required) The host the user can connect from. Can be an IP address.
2016-04-10 23:34:15 +02:00
Changing this forces a new resource to be created.
* `instance` - (Required) The name of the Cloud SQL instance. Changing this
forces a new resource to be created.
* `name` - (Required) The name of the user. Changing this forces a new resource
to be created.
2016-01-13 22:33:08 +01:00
* `password` - (Required) The users password. Can be updated.
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.
## Attributes Reference
Only the arguments listed above are exposed as attributes.