| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # 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. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Cloud Spanner" |
| description: |- |
| A possible configuration for a Cloud Spanner instance. |
| --- |
| |
| # google_spanner_instance_config |
| |
| A possible configuration for a Cloud Spanner instance. Configurations |
| define the geographic placement of nodes and their replication. |
| |
| |
| To get more information about InstanceConfig, see: |
| |
| * [API documentation](https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instanceConfigs) |
| * How-to Guides |
| * [Official Documentation](https://cloud.google.com/spanner/) |
| |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=spanner_instance_config_basic&open_in_editor=main.tf" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Spanner Instance Config Basic |
| |
| |
| ```hcl |
| resource "google_spanner_instance_config" "example" { |
| name = ""custom-nam11-config"" |
| display_name = "Test Spanner Instance Config" |
| base_config = "nam11" |
| replicas { |
| location = "us-west1" |
| type = "READ_ONLY" |
| default_leader_location = false |
| } |
| labels = { |
| "foo" = "bar" |
| } |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `name` - |
| (Required) |
| A unique identifier for the instance configuration. Values are of the |
| form projects/<project>/instanceConfigs/[a-z][-a-z0-9]* |
| |
| * `display_name` - |
| (Required) |
| The name of this instance configuration as it appears in UIs. |
| |
| * `replicas` - |
| (Required) |
| The geographic placement of nodes in this instance configuration and their replication properties. |
| Structure is [documented below](#nested_replicas). |
| |
| |
| <a name="nested_replicas"></a>The `replicas` block supports: |
| |
| * `location` - |
| (Optional) |
| The location of the serving resources, e.g. "us-central1". |
| |
| * `type` - |
| (Optional) |
| Indicates the type of replica. See the [replica types |
| documentation](https://cloud.google.com/spanner/docs/replication#replica_types) |
| for more details. |
| Possible values are: `READ_WRITE`, `READ_ONLY`, `WITNESS`. |
| |
| * `default_leader_location` - |
| (Optional) |
| If true, this location is designated as the default leader location where |
| leader replicas are placed. |
| |
| - - - |
| |
| |
| * `base_config` - |
| (Optional) |
| Base configuration name, e.g. nam3, based on which this configuration is created. |
| Only set for user managed configurations. |
| baseConfig must refer to a configuration of type GOOGLE_MANAGED in the same project as this configuration. |
| |
| * `labels` - |
| (Optional) |
| An object containing a list of "key": value pairs. |
| Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. |
| |
| **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. |
| Please refer to the field `effective_labels` for all of the labels present on the resource. |
| |
| * `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: |
| |
| * `id` - an identifier for the resource with format `{{project}}/{{name}}` |
| |
| * `config_type` - |
| Output only. Whether this instance config is a Google or User Managed Configuration. |
| |
| * `terraform_labels` - |
| The combination of labels configured directly on the resource |
| and default labels configured on the provider. |
| |
| * `effective_labels` - |
| All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. |
| |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| |
| - `create` - Default is 20 minutes. |
| - `update` - Default is 20 minutes. |
| - `delete` - Default is 20 minutes. |
| |
| ## Import |
| |
| |
| InstanceConfig can be imported using any of these accepted formats: |
| |
| * `projects/{{project}}/instanceConfigs/{{name}}` |
| * `{{project}}/{{name}}` |
| * `{{name}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import InstanceConfig using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/instanceConfigs/{{name}}" |
| to = google_spanner_instance_config.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), InstanceConfig can be imported using one of the formats above. For example: |
| |
| ``` |
| $ terraform import google_spanner_instance_config.default projects/{{project}}/instanceConfigs/{{name}} |
| $ terraform import google_spanner_instance_config.default {{project}}/{{name}} |
| $ terraform import google_spanner_instance_config.default {{name}} |
| ``` |
| |
| ## User Project Overrides |
| |
| This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |