This module creates Memorystore for Redis cluster in GCP with flexible configuration.

Key features:

NOTE: This module is meant to be used with an already created VPC.

NOTE: Google Cloud Memorystore for Redis API must be enabled in GCP to successfully deploy Redis cluster

Redis Cluster in GCP Memorystore

Creates a managed Redis Cluster in GCP Memorystore
$600
BUY
Log in to Corewide IaC registry

Once you have a Corewide Solutions Portal account, this one-time action will use your browser session to retrieve credentials:

 shellterraform login solutions.corewide.com
Provision instructions

Initialize mandatory providers:

Copy and paste into your Terraform configuration and insert the variables:

 hclmodule "tf_gcp_memorystore_redis" {
  source  = "solutions.corewide.com/google-cloud/tf-gcp-memorystore-redis/google"
  version = "~> 1.0.0"

  # specify module inputs here or try one of the examples below
  ...
}

Initialize the setup:

 shellterraform init
Define update strategy

Corewide DevOps team strictly follows Semantic Versioning Specification to provide our clients with products that have predictable upgrades between versions. We recommend pinning patch versions of our modules using pessimistic constraint operator (~>) to prevent breaking changes during upgrades.

To get new features during the upgrades (without breaking compatibility), use ~> 1.0 and run terraform init -upgrade

For the safest setup, use strict pinning with version = "1.0.0"

v1.0.0 released 1 month, 2 weeks ago

Setup with cross-regional read replica cluster configured, node_size with maximum write keyspace capacity, disabled encryption, custom backup and maintenance windows, and VPC resources created using tf-gcp-vpc module:

 hclmodule "vpc" {
  source  = "solutions.corewide.com/google-cloud/tf-gcp-vpc/google"
  version = "~> 1.0"

  name_prefix = "foo"

  subnets = {
    bar = {
      cidr_block = "10.0.0.0/8"
      region     = "us-west1"
    }

    biz = {
      cidr_block = "11.0.0.0/8"
      region     = "us-east1"
    }
  }
}

module "redis" {
  source  = "solutions.corewide.com/google-cloud/tf-gcp-memorystore-redis/google"
  version = "~> 1.0"

  name_prefix                = "foo"
  vpc                        = module.vpc.vpc.id
  region                     = module.vpc.subnets["bar"].region
  subnet_id                  = module.vpc.subnets["bar"].id
  traffic_encryption_enabled = false
  node_size                  = "REDIS_HIGHMEM_XLARGE"

  maintenance_window = {
    day        = "Fri"
    hour_start = 4
  }

  backups = {
    mode = "aof"
  }

  secondary_cluster = {
    enabled   = true
    region    = module.vpc.subnets["biz"].region
    subnet_id = module.vpc.subnets["biz"].id
  }
}

Setup with mandatory parameters, data import from GCS bucket and VPC resources created using tf-gcp-vpc module:

 hclmodule "vpc" {
  source  = "solutions.corewide.com/google-cloud/tf-gcp-vpc/google"
  version = "~> 1.0"

  name_prefix = "foo"

  subnets = {
    bar = {
      cidr_block = "10.0.0.0/8"
      region     = "us-west1"
    }
  }
}

module "redis" {
  source  = "solutions.corewide.com/google-cloud/tf-gcp-memorystore-redis/google"
  version = "~> 1.0"

  name_prefix    = "foo"
  gcs_source_uri = "gs://bucket/biz/123.rdb"
  vpc            = module.vpc.vpc.id
  region         = module.vpc.subnets["bar"].region
  subnet_id      = module.vpc.subnets["bar"].id
}

Minimal setup with mandatory parameters and VPC resources created using tf-gcp-vpc module:

 hclmodule "vpc" {
  source  = "solutions.corewide.com/google-cloud/tf-gcp-vpc/google"
  version = "~> 1.0"

  name_prefix = "foo"

  subnets = {
    bar = {
      cidr_block = "10.0.0.0/8"
      region     = "us-west1"
    }
  }
}

module "redis" {
  source  = "solutions.corewide.com/google-cloud/tf-gcp-memorystore-redis/google"
  version = "~> 1.0"

  name_prefix = "foo"
  vpc         = module.vpc.vpc.id
  region      = module.vpc.subnets["bar"].region
  subnet_id   = module.vpc.subnets["bar"].id
}
Variable Description Type Default Required Sensitive
gcs_source_uri GCS object URI to import into Redis cluster string yes no
name_prefix Name prefix for created resources string yes no
region GCP region to create main Redis cluster resources in string yes no
subnet_id Google Compute Engine subnet ID to create the main cluster endpoint in string yes no
vpc Google Compute Engine network ID to create the cluster endpoints in string yes no
zone Zone name for the main single zone Redis cluster. Applicable only if var.multi_az_enabled is false. Zone is automatically chosen if not set string yes no
aof_backups_fsync AOF backup fsync() call mode. Possible values are: APPEND_FSYNC_UNSPECIFIED, NO, EVERYSEC, ALWAYS. Applicable only if var.backups.enabled is true and var.backups.mode is AOF string EVERYSEC no no
backups Redis cluster backup parameters object {} no no
backups.enabled Whether to enable backups configuration bool true no no
backups.mode Backup (persistence) mode name. Possible values are: RDB, AOF string RDB no no
configs Map of supported Redis engine configuration parameters map(any) {} no no
deletion_protection_enabled Indicates whether the main cluster is deletion protected bool true no no
maintenance_window Cluster maintenance window parameters object {} no no
maintenance_window.day Day of the week in 3 letters format, on which maintenance window will be applied string Wed no no
maintenance_window.start_hour Start hour for maintenance window in 24-hour format number 2 no no
multi_az_enabled Indicates whether High Availability is enabled for the main cluster bool true no no
node_replica_count Count of node replicas per shard. Value must be in 0-2 range number 0 no no
node_size Redis node size. Possible values are: REDIS_SHARED_CORE_NANO, REDIS_HIGHMEM_MEDIUM, REDIS_HIGHMEM_XLARGE, REDIS_STANDARD_SMALL string REDIS_HIGHMEM_MEDIUM no no
rdb_backups RDB backups parameters object {} no no
rdb_backups.period RDB backups schedule. Possible values are: ONE_HOUR, SIX_HOURS, TWELVE_HOURS, TWENTY_FOUR_HOURS string TWENTY_FOUR_HOURS no no
rdb_backups.start_time Time that the first snapshot was/will be attempted, and to which future backups will be aligned. If not provided, the current time will be used. string no no
secondary_cluster Secondary (read) cluster parameters object {} no no
secondary_cluster.deletion_protection_enabled Indicates whether the cluster is deletion protected bool false no no
secondary_cluster.enabled Whether to enable secondary cluster creation bool false no no
secondary_cluster.maintenance_window Secondary cluster maintenance window parameters object no no
secondary_cluster.maintenance_window.day Day of the week in 3 letters format, on which maintenance window will be applied string Wed no no
secondary_cluster.maintenance_window.start_hour Start hour for maintenance window in 24-hour format number 2 no no
secondary_cluster.multi_az_enabled Indicates whether High Availability is enabled for the cluster bool true no no
secondary_cluster.node_replica_count Count of node replicas per shard in secondary cluster. Value must be in 0-2 range number 0 no no
secondary_cluster.region GCP region to create secondary cluster in string no no
secondary_cluster.subnet_id Google Compute Engine subnet ID to create secondary cluster endpoint in string no no
secondary_cluster.zone Zone name for the single zone secondary cluster string no no
shard_count Number of Redis cluster shards. Must be greater than 0 number 1 no no
traffic_encryption_enabled Indicates whether in-transit encryption for the Redis cluster is enabled bool true no no
Output Description Type Sensitive
cluster Attributes of main Redis cluster in Memorystore resource yes
connection_parameters Main Redis cluster connection parameters host - cluster endpoint, port - cluster port) map no
read_connection_parameters Secondary (read only) Redis cluster connection parameters host - cluster endpoint, port - cluster port) computed no
secondary_cluster Attributes of secondary Redis cluster in Memorystore computed yes
Dependency Version Kind
terraform >= 1.3 CLI
hashicorp/google ~> 6.30 provider

Not sure where to start?
Let's find your perfect match.