-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76d7bb5
commit 91baff7
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
layout: "google" | ||
page_title: "Google: google_spanner_database" | ||
sidebar_current: "docs-google-spanner-database" | ||
description: |- | ||
Creates a Google Spanner Database within a Spanner Instance. | ||
--- | ||
|
||
# google\_spanner\_instance | ||
|
||
Creates a Google Spanner Database within a Spanner Instance. For more information, see the [official documentation](https://cloud.google.com/spanner/), or the [JSON API](https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances.databases). | ||
|
||
## Example Usage | ||
|
||
Example creating a Spanner database. | ||
|
||
```hcl | ||
resource "google_spanner_instance" "main" { | ||
config = "regional-europe-west1" | ||
display_name = "main-instance" | ||
} | ||
resource "google_spanner_database" "db" { | ||
instance = "${google_spanner_instance.main.name}" | ||
name = "main-instance" | ||
ddl = [ | ||
"CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)", | ||
"CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)" | ||
] | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `instance` - (Required) The name of the instance that will serve the new database. | ||
|
||
* `name` - (Required) The name of the database. | ||
|
||
- - - | ||
|
||
* `project` - (Optional) The project in which to look for the `instance` specified. If it | ||
is not provided, the provider project is used. | ||
|
||
* `ddl` - (Optional) An optional list of DDL statements to run inside the newly created | ||
database. Statements can create tables, indexes, etc. These statements execute atomically | ||
with the creation of the database: if there is an error in any statement, the database | ||
is not created. | ||
|
||
|
||
## Attributes Reference | ||
|
||
No additional attributes are computed other than those defined above. | ||
|
||
## Import | ||
|
||
Databases can be imported via their `instance` and `name` values, and optionally | ||
the `project` in which the instance is defined (Often used when the project is different | ||
to that defined in the provider). The format is thus either `{instanceName}/{dbName}` or | ||
`{projectId}/{instanceName}/{dbName}`. e.g. | ||
|
||
``` | ||
$ terraform import google_spanner_database.db1 instance456/db789 | ||
$ terraform import google_spanner_database.db1 project123/instance456/db789 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters