|
1 | 1 | ---
|
| 2 | +# ---------------------------------------------------------------------------- |
| 3 | +# |
| 4 | +# *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** |
| 5 | +# |
| 6 | +# ---------------------------------------------------------------------------- |
| 7 | +# |
| 8 | +# This file is automatically generated by Magic Modules and manual |
| 9 | +# changes will be clobbered when the file is regenerated. |
| 10 | +# |
| 11 | +# Please read more about how to change this file in |
| 12 | +# .github/CONTRIBUTING.md. |
| 13 | +# |
| 14 | +# ---------------------------------------------------------------------------- |
2 | 15 | layout: "google"
|
3 | 16 | page_title: "Google: google_sql_database"
|
4 |
| -sidebar_current: "docs-google-sql-database-x" |
| 17 | +sidebar_current: "docs-google-sql-database" |
5 | 18 | description: |-
|
6 |
| - Creates a new SQL database in Google Cloud SQL. |
| 19 | + Represents a SQL database inside the Cloud SQL instance, hosted in |
| 20 | + Google's cloud. |
7 | 21 | ---
|
8 | 22 |
|
9 | 23 | # google\_sql\_database
|
10 | 24 |
|
11 |
| -Creates a new Google SQL Database on a Google SQL Database Instance. For more information, see |
12 |
| -the [official documentation](https://cloud.google.com/sql/), |
13 |
| -or the [JSON API](https://cloud.google.com/sql/docs/admin-api/v1beta4/databases). |
| 25 | +Represents a SQL database inside the Cloud SQL instance, hosted in |
| 26 | +Google's cloud. |
14 | 27 |
|
15 |
| -## Example Usage |
16 | 28 |
|
17 |
| -Example creating a SQL Database. |
18 | 29 |
|
19 |
| -```hcl |
20 |
| -resource "random_id" "db_name_suffix" { |
21 |
| - byte_length = 4 |
22 |
| -} |
| 30 | +## Argument Reference |
23 | 31 |
|
24 |
| -resource "google_sql_database_instance" "master" { |
25 |
| - name = "master-instance-${random_id.db_name_suffix.hex}" |
| 32 | +The following arguments are supported: |
26 | 33 |
|
27 |
| - settings { |
28 |
| - tier = "D0" |
29 |
| - } |
30 |
| -} |
31 | 34 |
|
32 |
| -resource "google_sql_database" "users" { |
33 |
| - name = "users-db" |
34 |
| - instance = "${google_sql_database_instance.master.name}" |
35 |
| - charset = "latin1" |
36 |
| - collation = "latin1_swedish_ci" |
37 |
| -} |
38 |
| -``` |
| 35 | +* `name` - |
| 36 | + (Required) |
| 37 | + The name of the database in the Cloud SQL instance. |
| 38 | + This does not include the project ID or instance name. |
39 | 39 |
|
40 |
| -## Argument Reference |
| 40 | +* `instance` - |
| 41 | + (Required) |
| 42 | + The name of the Cloud SQL instance. This does not include the project |
| 43 | + ID. |
41 | 44 |
|
42 |
| -The following arguments are supported: |
43 | 45 |
|
44 |
| -* `name` - (Required) The name of the database. |
| 46 | +- - - |
| 47 | + |
45 | 48 |
|
46 |
| -* `instance` - (Required) The name of containing instance. |
| 49 | +* `charset` - |
| 50 | + (Optional) |
| 51 | + The MySQL charset value. |
47 | 52 |
|
48 |
| -- - - |
| 53 | +* `collation` - |
| 54 | + (Optional) |
| 55 | + The MySQL collation value. |
49 | 56 |
|
50 |
| -* `project` - (Optional) The ID of the project in which the resource belongs. If it |
51 |
| - is not provided, the provider project is used. |
| 57 | +* `project` - (Optional) The ID of the project in which the resource belongs. |
| 58 | + If it is not provided, the provider project is used. |
52 | 59 |
|
53 |
| -* `charset` - (Optional) The charset value. See MySQL's |
54 |
| - [Supported Character Sets and Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html) |
55 |
| - and Postgres' [Character Set Support](https://www.postgresql.org/docs/9.6/static/multibyte.html) |
56 |
| - for more details and supported values. Postgres databases are in beta |
57 |
| - and have limited `charset` support; they only support a value of `UTF8` at creation time. |
58 | 60 |
|
59 |
| -* `collation` - (Optional) The collation value. See MySQL's |
60 |
| - [Supported Character Sets and Collations](https://dev.mysql.com/doc/refman/5.7/en/charset-charsets.html) |
61 |
| - and Postgres' [Collation Support](https://www.postgresql.org/docs/9.6/static/collation.html) |
62 |
| - for more details and supported values. Postgres databases are in beta |
63 |
| - and have limited `collation` support; they only support a value of `en_US.UTF8` at creation time. |
64 | 61 |
|
65 |
| -## Attributes Reference |
| 62 | +## Timeouts |
66 | 63 |
|
67 |
| -In addition to the arguments listed above, the following computed attributes are |
68 |
| -exported: |
| 64 | +This resource provides the following |
| 65 | +[Timeouts](/docs/configuration/resources.html#timeouts) configuration options: |
69 | 66 |
|
70 |
| -* `self_link` - The URI of the created resource. |
| 67 | +- `create` - Default is 15 minutes. |
| 68 | +- `update` - Default is 10 minutes. |
| 69 | +- `delete` - Default is 10 minutes. |
71 | 70 |
|
72 | 71 | ## Import
|
73 | 72 |
|
74 |
| -SQL databases can be imported using one of any of these accepted formats: |
| 73 | +Database can be imported using any of these accepted formats: |
75 | 74 |
|
76 | 75 | ```
|
77 |
| -$ terraform import google_sql_database.database projects/{{project}}/instances/{{instance}}/databases/{{name}} |
78 |
| -$ terraform import google_sql_database.database {{project}}/{{instance}}/{{name}} |
79 |
| -$ terraform import google_sql_database.database instances/{{name}}/databases/{{name}} |
80 |
| -$ terraform import google_sql_database.database {{instance}}/{{name}} |
81 |
| -$ terraform import google_sql_database.database {{name}} |
82 |
| -
|
| 76 | +$ terraform import google_sql_database.default projects/{{project}}/instances/{{instance}}/databases/{{name}} |
| 77 | +$ terraform import google_sql_database.default instances/{{instance}}/databases/{{name}} |
| 78 | +$ terraform import google_sql_database.default {{project}}/{{instance}}/{{name}} |
| 79 | +$ terraform import google_sql_database.default {{instance}}/{{name}} |
| 80 | +$ terraform import google_sql_database.default {{instance}}:{{name}} |
| 81 | +$ terraform import google_sql_database.default {{name}} |
83 | 82 | ```
|
| 83 | + |
| 84 | +-> If you're importing a resource with beta features, make sure to include `-provider=google-beta` |
| 85 | +as an argument so that Terraform uses the correct provider to import your resource. |
| 86 | + |
| 87 | +## User Project Overrides |
| 88 | + |
| 89 | +This resource supports [User Project Overrides](https://www.terraform.io/docs/providers/google/provider_reference.html#user_project_override). |
0 commit comments