subcategory | layout | page_title | sidebar_current | description |
---|---|---|---|---|
Cloud Spanner |
google |
Google: google_spanner_instance |
docs-google-spanner-instance |
An isolated set of Cloud Spanner resources on which databases can be
hosted. |
An isolated set of Cloud Spanner resources on which databases can be hosted.
To get more information about Instance, see:
- API documentation
- How-to Guides
resource "google_spanner_instance" "example" {
config = "regional-us-central1"
display_name = "Test Spanner Instance"
num_nodes = 2
labels = {
"foo" = "bar"
}
}
resource "google_spanner_instance" "example" {
config = "regional-us-central1"
display_name = "Test Spanner Instance"
processing_units = 200
labels = {
"foo" = "bar"
}
}
resource "google_spanner_instance" "example" {
config = "nam-eur-asia1"
display_name = "Multi Regional Instance"
num_nodes = 2
labels = {
"foo" = "bar"
}
}
The following arguments are supported:
-
name
- (Required) A unique identifier for the instance, which cannot be changed after the instance is created. The name must be between 6 and 30 characters in length.If not provided, a random string starting with
tf-
will be selected. -
config
- (Required) The name of the instance's configuration (similar but not quite the same as a region) which defines the geographic placement and replication of your databases in this instance. It determines where your data is stored. Values are typically of the formregional-europe-west1
,us-central
etc. In order to obtain a valid list please consult the Configuration section of the docs. -
display_name
- (Required) The descriptive name for this instance as it appears in UIs. Must be unique per project and between 4 and 30 characters in length.
-
num_nodes
- (Optional) The number of nodes allocated to this instance. At most one of either node_count or processing_units can be present in terraform. -
processing_units
- (Optional) The number of processing units allocated to this instance. At most one of processing_units or node_count can be present in terraform. -
labels
- (Optional) An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. -
project
- (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used. -
force_destroy
- (Optional) When deleting a spanner instance, this boolean option will delete all backups of this instance. This must be set to true if you created a backup manually in the console.
In addition to the arguments listed above, the following computed attributes are exported:
-
id
- an identifier for the resource with format{{project}}/{{name}}
-
state
- Instance status:CREATING
orREADY
.
This resource provides the following Timeouts configuration options:
create
- Default is 4 minutes.update
- Default is 4 minutes.delete
- Default is 4 minutes.
Instance can be imported using any of these accepted formats:
$ terraform import google_spanner_instance.default projects/{{project}}/instances/{{name}}
$ terraform import google_spanner_instance.default {{project}}/{{name}}
$ terraform import google_spanner_instance.default {{name}}
This resource supports User Project Overrides.