| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** 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: "Memorystore (Redis)" |
| description: |- |
| A Google Cloud Redis Cluster instance. |
| --- |
| |
| # google\_redis\_cluster |
| |
| A Google Cloud Redis Cluster instance. |
| |
| |
| To get more information about Cluster, see: |
| |
| * [API documentation](https://cloud.google.com/memorystore/docs/cluster/reference/rest/v1/projects.locations.clusters) |
| * How-to Guides |
| * [Official Documentation](https://cloud.google.com/memorystore/docs/cluster/) |
| |
| <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_working_dir=redis_cluster_ha&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" 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 - Redis Cluster Ha |
| |
| |
| ```hcl |
| resource "google_redis_cluster" "cluster-ha" { |
| name = "ha-cluster" |
| shard_count = 3 |
| psc_configs { |
| network = google_compute_network.producer_net.id |
| } |
| region = "us-central1" |
| replica_count = 1 |
| transit_encryption_mode = "TRANSIT_ENCRYPTION_MODE_DISABLED" |
| authorization_mode = "AUTH_MODE_DISABLED" |
| depends_on = [ |
| google_network_connectivity_service_connection_policy.default |
| ] |
| |
| lifecycle { |
| prevent_destroy = true |
| } |
| } |
| |
| resource "google_network_connectivity_service_connection_policy" "default" { |
| name = "mypolicy" |
| location = "us-central1" |
| service_class = "gcp-memorystore-redis" |
| description = "my basic service connection policy" |
| network = google_compute_network.producer_net.id |
| psc_config { |
| subnetworks = [google_compute_subnetwork.producer_subnet.id] |
| } |
| } |
| |
| resource "google_compute_subnetwork" "producer_subnet" { |
| name = "mysubnet" |
| ip_cidr_range = "10.0.0.248/29" |
| region = "us-central1" |
| network = google_compute_network.producer_net.id |
| } |
| |
| resource "google_compute_network" "producer_net" { |
| name = "mynetwork" |
| auto_create_subnetworks = false |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `psc_configs` - |
| (Required) |
| Required. Each PscConfig configures the consumer network where two |
| network addresses will be designated to the cluster for client access. |
| Currently, only one PscConfig is supported. |
| Structure is [documented below](#nested_psc_configs). |
| |
| * `shard_count` - |
| (Required) |
| Required. Number of shards for the Redis cluster. |
| |
| * `name` - |
| (Required) |
| Unique name of the resource in this scope including project and location using the form: |
| projects/{projectId}/locations/{locationId}/clusters/{clusterId} |
| |
| |
| <a name="nested_psc_configs"></a>The `psc_configs` block supports: |
| |
| * `network` - |
| (Required) |
| Required. The consumer network where the network address of |
| the discovery endpoint will be reserved, in the form of |
| projects/{network_project_id_or_number}/global/networks/{network_id}. |
| |
| - - - |
| |
| |
| * `authorization_mode` - |
| (Optional) |
| Optional. The authorization mode of the Redis cluster. If not provided, auth feature is disabled for the cluster. |
| Default value is `AUTH_MODE_DISABLED`. |
| Possible values are: `AUTH_MODE_UNSPECIFIED`, `AUTH_MODE_IAM_AUTH`, `AUTH_MODE_DISABLED`. |
| |
| * `transit_encryption_mode` - |
| (Optional) |
| Optional. The in-transit encryption for the Redis cluster. |
| If not provided, encryption is disabled for the cluster. |
| Default value is `TRANSIT_ENCRYPTION_MODE_DISABLED`. |
| Possible values are: `TRANSIT_ENCRYPTION_MODE_UNSPECIFIED`, `TRANSIT_ENCRYPTION_MODE_DISABLED`, `TRANSIT_ENCRYPTION_MODE_SERVER_AUTHENTICATION`. |
| |
| * `replica_count` - |
| (Optional) |
| Optional. The number of replica nodes per shard. |
| |
| * `region` - |
| (Optional) |
| The name of the region of the Redis cluster. |
| |
| * `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 `projects/{{project}}/locations/{{region}}/clusters/{{name}}` |
| |
| * `create_time` - |
| The timestamp associated with the cluster creation request. A timestamp in |
| RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional |
| digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". |
| |
| * `state` - |
| The current state of this cluster. Can be CREATING, READY, UPDATING, DELETING and SUSPENDED |
| |
| * `uid` - |
| System assigned, unique identifier for the cluster. |
| |
| * `discovery_endpoints` - |
| Output only. Endpoints created on each given network, |
| for Redis clients to connect to the cluster. |
| Currently only one endpoint is supported. |
| Structure is [documented below](#nested_discovery_endpoints). |
| |
| * `psc_connections` - |
| Output only. PSC connections for discovery of the cluster topology and accessing the cluster. |
| Structure is [documented below](#nested_psc_connections). |
| |
| * `state_info` - |
| Output only. Additional information about the current state of the cluster. |
| Structure is [documented below](#nested_state_info). |
| |
| * `size_gb` - |
| Output only. Redis memory size in GB for the entire cluster. |
| |
| |
| <a name="nested_discovery_endpoints"></a>The `discovery_endpoints` block contains: |
| |
| * `address` - |
| (Optional) |
| Output only. Network address of the exposed Redis endpoint used by clients to connect to the service. |
| |
| * `port` - |
| (Optional) |
| Output only. The port number of the exposed Redis endpoint. |
| |
| * `psc_config` - |
| (Optional) |
| Output only. Customer configuration for where the endpoint |
| is created and accessed from. |
| Structure is [documented below](#nested_psc_config). |
| |
| |
| <a name="nested_psc_config"></a>The `psc_config` block supports: |
| |
| * `network` - |
| (Optional) |
| The consumer network where the network address of the discovery |
| endpoint will be reserved, in the form of |
| projects/{network_project_id}/global/networks/{network_id}. |
| |
| <a name="nested_psc_connections"></a>The `psc_connections` block contains: |
| |
| * `psc_connection_id` - |
| (Optional) |
| Output only. The PSC connection id of the forwarding rule connected to the service attachment. |
| |
| * `address` - |
| (Optional) |
| Output only. The IP allocated on the consumer network for the PSC forwarding rule. |
| |
| * `forwarding_rule` - |
| (Optional) |
| Output only. The URI of the consumer side forwarding rule. Example: projects/{projectNumOrId}/regions/us-east1/forwardingRules/{resourceId}. |
| |
| * `project_id` - |
| (Optional) |
| Output only. The consumer projectId where the forwarding rule is created from. |
| |
| * `network` - |
| (Optional) |
| The consumer network where the IP address resides, in the form of projects/{projectId}/global/networks/{network_id}. |
| |
| <a name="nested_state_info"></a>The `state_info` block contains: |
| |
| * `update_info` - |
| (Optional) |
| A nested object resource |
| Structure is [documented below](#nested_update_info). |
| |
| |
| <a name="nested_update_info"></a>The `update_info` block supports: |
| |
| * `target_shard_count` - |
| (Optional) |
| Target number of shards for redis cluster. |
| |
| * `target_replica_count` - |
| (Optional) |
| Target number of replica nodes per shard. |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| |
| - `create` - Default is 60 minutes. |
| - `update` - Default is 120 minutes. |
| - `delete` - Default is 30 minutes. |
| |
| ## Import |
| |
| |
| Cluster can be imported using any of these accepted formats: |
| |
| * `projects/{{project}}/locations/{{region}}/clusters/{{name}}` |
| * `{{project}}/{{region}}/{{name}}` |
| * `{{region}}/{{name}}` |
| * `{{name}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Cluster using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/locations/{{region}}/clusters/{{name}}" |
| to = google_redis_cluster.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Cluster can be imported using one of the formats above. For example: |
| |
| ``` |
| $ terraform import google_redis_cluster.default projects/{{project}}/locations/{{region}}/clusters/{{name}} |
| $ terraform import google_redis_cluster.default {{project}}/{{region}}/{{name}} |
| $ terraform import google_redis_cluster.default {{region}}/{{name}} |
| $ terraform import google_redis_cluster.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). |