--- # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** # # ---------------------------------------------------------------------------- # # This file is automatically generated by Magic Modules and manual # changes will be clobbered when the file is regenerated. # # Please read more about how to change this file in # .github/CONTRIBUTING.md. # # ---------------------------------------------------------------------------- layout: "google" page_title: "Google: google_spanner_instance" sidebar_current: "docs-google-spanner-instance" description: |- An isolated set of Cloud Spanner resources on which databases can be hosted. --- # google\_spanner\_instance An isolated set of Cloud Spanner resources on which databases can be hosted. To get more information about Instance, see: * [API documentation](https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances) * How-to Guides * [Official Documentation](https://cloud.google.com/spanner/)
Open in Cloud Shell
## Example Usage - Spanner Instance Basic ```hcl resource "google_spanner_instance" "example" { config = "regional-us-central1" display_name = "Test Spanner Instance" num_nodes = 2 labels = { "foo" = "bar" } } ``` ## Argument Reference 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 defines the geographic placement and replication of your databases in this instance. It determines where your data is stored. Values are typically of the form `regional-europe-west1` , `us-central` etc. In order to obtain a valid list please consult the [Configuration section of the docs](https://cloud.google.com/spanner/docs/instances). * `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. * `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. ## Attributes Reference In addition to the arguments listed above, the following computed attributes are exported: * `state` - Instance status: `CREATING` or `READY`. ## Timeouts This resource provides the following [Timeouts](/docs/configuration/resources.html#timeouts) configuration options: - `create` - Default is 4 minutes. - `update` - Default is 4 minutes. - `delete` - Default is 4 minutes. ## Import 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}} ``` -> If you're importing a resource with beta features, make sure to include `-provider=google-beta` as an argument so that Terraform uses the correct provider to import your resource.