Skip to content

Commit

Permalink
Support multiple users with the same name for different host for 1st …
Browse files Browse the repository at this point in the history
…gen. (hashicorp#1066)

* Support multiple users with the same name for different host for 1st gen.

* Fix typo and rename user
  • Loading branch information
rosbo authored Feb 9, 2018
1 parent 98eab00 commit 47528f1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
24 changes: 22 additions & 2 deletions docs/r/sql_database_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,39 @@ a restricted host and strong password.

## Example Usage

Example creating a SQL Database.
### SQL First Generation

```hcl
resource "google_sql_database_instance" "master" {
name = "master-instance"
database_version = "POSTGRES_9_6"
database_version = "MYSQL_5_6"
# First-generation instance regions are not the conventional
# Google Compute Engine regions. See argument reference below.
region = "us-central"
settings {
tier = "D0"
}
}
```


### SQL Second generation

```hcl
resource "google_sql_database_instance" "master" {
name = "master-instance"
database_version = "POSTGRES_9_6"
region = "us-central1"
settings {
# Second-generation instance tiers are based on the machine
# type. See argument reference below.
tier = "db-f1-micro"
}
}
```

## Argument Reference

The following arguments are supported:
Expand Down
15 changes: 11 additions & 4 deletions docs/r/sql_user.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ resource "google_sql_user" "users" {

The following arguments are supported:

* `host` - (Required) The host the user can connect from. Can be an IP address.
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.

Expand All @@ -52,6 +49,10 @@ The following arguments are supported:

- - -

* `host` - (Optional) The host the user can connect from. This is only supported
for first generation SQL instances. Don't set this field for second generation
SQL instances. Can be an IP address. Changing this forces a new resource to be created.

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

Expand All @@ -61,7 +62,13 @@ Only the arguments listed above are exposed as attributes.

## Import

SQL users can be imported using the `instance` and `name`, e.g.
SQL users for 1st generation databases can be imported using the `instance`, `host` and `name`, e.g.

```
$ terraform import google_sql_user.users master-instance/my-domain.com/me
```

SQL users for 2nd generation databases can be imported using the `instance` and `name`, e.g.

```
$ terraform import google_sql_user.users master-instance/me
Expand Down

0 comments on commit 47528f1

Please sign in to comment.