Skip to content

geekcell/terraform-aws-elasticache-redis-cluster

Repository files navigation

Geek Cell GmbH

Code Quality

License GitHub release (latest tag) Release Validate Lint Test

Security

Infrastructure Tests

Cloud

Infrastructure Tests Infrastructure Tests Infrastructure Tests Infrastructure Tests Infrastructure Tests

Container

Infrastructure Tests Infrastructure Tests Infrastructure Tests Infrastructure Tests

Data protection

Infrastructure Tests Infrastructure Tests Infrastructure Tests Infrastructure Tests Infrastructure Tests Infrastructure Tests Infrastructure Tests

Terraform AWS Elasticache Redis

Introducing the AWS ElastiCache Redis Cluster Terraform Module, a highly efficient solution for creating and managing your Redis clusters within Amazon Web Services (AWS). This module has been expertly crafted to provide you with a simple and streamlined way to create and manage your Redis clusters within AWS ElastiCache.

Our team of experts has years of experience working with AWS ElastiCache and has a deep understanding of the best practices and configurations. By using this Terraform module, you can be sure that your Redis clusters are created and managed in a secure, efficient, and scalable manner.

This module offers a preconfigured solution for creating Redis clusters, saving you time and effort in the process. Whether you're looking to improve the performance of your applications or to implement a highly available and scalable cache, this module has you covered.

So, if you're looking for a convenient and reliable solution for creating and managing your Redis clusters within AWS ElastiCache, look no further than the AWS ElastiCache Redis Cluster Terraform Module. Give it a try and see the difference it can make in your AWS setup!

Inputs

Name Description Type Default Required
apply_immediately Specifies whether any modifications are applied immediately, or during the next maintenance window. bool true no
at_rest_encryption_enabled Whether to enable encryption at rest. bool true no
auth_token_length The length of the generated auth token. number 24 no
auth_token_special_characters Whether to include special characters in the generated auth token. bool false no
auto_minor_version_upgrade Specifies whether minor version engine upgrades will be applied automatically to the underlying Cache Cluster instances during the maintenance window. string false no
data_tearing_enabled Enables data tiering. Data tiering is only supported for replication groups using the r6gd node type. bool false no
description The description of the all resources. string "Managed by Terraform" no
enable_customer_managed_kms If enabled, will create a customer managed KMS key for at-rest encryption. bool false no
enable_sns_sse_encryption Enable SSE Encryption for SNS Topic. bool true no
engine Name of the cache engine to be used for the clusters in this replication group. string "redis" no
engine_version The version number of the cache engine to be used for the cache clusters in this replication group. string "7.0" no
kms_key_id The ARN of the AWS KMS to encrypt data at rest. Uses the AWS service managed encryption if not specified. string null no
log_destination_type For CloudWatch Logs use cloudwatch-logs or for Kinesis Data Firehose use kinesis-firehose. Only 'cloudwatch-logs' supported at the moment. string "cloudwatch-logs" no
log_enable_customer_managed_kms Whether to enable customer managed KMS key for CloudWatch Logs encryption. bool false no
log_format Valid values are json or text. string "text" no
log_retention_in_days The number of days log events are kept in CloudWatch Logs. number 30 no
log_skip_destroy Whether to skip the deletion of the log groups when deleting the log group resources. bool false no
log_type Type of logs, slow-log and engine-log list(string)
[
"slow-log",
"engine-log"
]
no
maintenance_window Specifies the weekly time range for when maintenance on the cache cluster is performed. string "Mon:00:00-Mon:03:00" no
node_type The cluster identifier. If omitted, Terraform will assign a random, unique identifier. string n/a yes
num_cache_clusters Number of cache clusters (primary and replicas) this replication group will have. If Multi-AZ is enabled, the value of this parameter must be at least 2 number n/a yes
parameter_group_family The family of the ElastiCache parameter group. Defaults to engine and engine_version. string null no
parameter_group_name The name of the ElastiCache parameter group. Defaults to the cluster name. string null no
parameters Set custom parameters via a parameter group.
list(object({
name = string
value = string
}))
[] no
port Port number on which each of the cache nodes will accept connections. number 6379 no
replication_group_id ID of the replication group to which this cluster should belong. string n/a yes
security_group_ids A list of security group IDs to associate with this replication group. list(string) n/a yes
snapshot_retention_limit Number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. number 7 no
snapshot_window Daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. string "03:30-05:30" no
sns_event_recipients Recipients of the ElastiCache SNS event topic. Should be a list of E-Mails. list(string) [] no
sns_kms_master_key_id The ID of an AWS KMS key for the SNS topic. string "alias/aws/sns" no
tags A mapping of tags to assign to all resources. map(string) {} no
transit_encryption_enabled Whether to enable encryption in transit. bool true no
vpc_subnet_group_name Subnet group name for the Elasticache cluster. string n/a yes

Outputs

Name Description
auth_token The generate auth token used to access the Redis cluster.
primary_endpoint_address Address of the endpoint for the primary node in the replication group, if the cluster mode is disabled.
reader_endpoint_address Address of the endpoint for the reader node in the replication group, if the cluster mode is disabled.

Providers

Name Version
aws >= 4.4
random >= 3.0

Resources

  • resource.aws_elasticache_replication_group.redis (main.tf#20)
  • resource.random_password.main_password (main.tf#85)

Examples

Basic Example

module "vpc" {
  source  = "registry.terraform.io/terraform-aws-modules/vpc/aws"
  version = "~> 5.0.0"

  name                = "${var.name}-main"
  cidr                = "10.100.0.0/16"
  azs                 = ["eu-central-1a", "eu-central-1b"]
  private_subnets     = ["10.100.1.0/24", "10.100.2.0/24"]
  elasticache_subnets = ["10.100.10.0/24", "10.100.11.0/24"]
}

module "redis_security_group" {
  source  = "geekcell/security-group/aws"
  version = ">= 1.0.0, < 2.0.0"

  name   = "${var.name}-redis"
  vpc_id = module.vpc.vpc_id
}

module "basic-example" {
  source = "../../"

  replication_group_id  = var.name
  node_type             = "cache.t4g.micro"
  num_cache_clusters    = 2
  security_group_ids    = [module.redis_security_group.security_group_id]
  vpc_subnet_group_name = module.vpc.elasticache_subnet_group_name
}