google_redis_cluster

A Google Cloud Redis Cluster instance.

To get more information about Cluster, see:

Open in Cloud Shell

Example Usage - Redis Cluster Ha

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
  node_type = "REDIS_SHARED_CORE_NANO"
  transit_encryption_mode = "TRANSIT_ENCRYPTION_MODE_DISABLED"
  authorization_mode = "AUTH_MODE_DISABLED"
  redis_configs = {
    maxmemory-policy    = "volatile-ttl"
  }
  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:

The psc_configs block supports:


Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

The discovery_endpoints block contains:

The psc_config block supports:

The psc_connections block contains:

The state_info block contains:

The update_info block supports:

Timeouts

This resource provides the following Timeouts configuration options:

Import

Cluster can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import Cluster using one of the formats above. For example:

import {
  id = "projects/{{project}}/locations/{{region}}/clusters/{{name}}"
  to = google_redis_cluster.default
}

When using the terraform import command, 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.