» google_spanner_instance

An isolated set of Cloud Spanner resources on which databases can be hosted.

To get more information about Instance, see:

» Example Usage - Spanner Instance Basic

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.

  • 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 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}}