This terraform module is to create an AWS ElastiCache Replica Set/Cluster. The purpose of this module is not to limit the IAC to a specific team/project but rather be used across different Business Units/Organizations.
- This is terraform module to create an AWS Redis ElastiCache Replica Set
- The following components are also created as part of this module to support the Elasticache Redis Cluster Infrastructure
- Redis Parameter Group with custom parameters which can be controlled in the vars
- Redis Subnet Group to support the Cluster
- Custom Security Group which is dedicated to the Redis Cluster
- Post Creation the Authentication Details are put into a custom AWS Secret Manager for Security Purposes
module "aws-elasticache" {
source = "git@github.com:Kartheeko07/terraform-aws-elasticache-module.git?ref=LATEST_VERSION"
...
tags = var.tags
}
Name | Version |
---|---|
terraform | >= 0.13.0, < 0.15.0 |
Name | Version |
---|---|
aws | n/a |
random | n/a |
Name | Description | Type | Default | Required |
---|---|---|---|---|
apply_immediately | Specifies whether any cluster modifications are applied immediately, or during the next maintenance window | string |
"false" |
no |
at_rest_encryption_enabled | Enable encryption at rest | bool |
true |
no |
auto_minor_version_upgrade | Specifies whether a minor engine upgrades will be applied automatically to the underlying Cache Cluster instances during the maintenance window | string |
"true" |
no |
automatic_failover_enabled | Automatic failover (Not available for T1/T2 instances) | bool |
true |
no |
availability_zones | A list of EC2 availability zones in which the replication group's cache clusters will be created. The order of the availability zones in the list is not important | list(any) |
[ |
no |
cluster_mode_enabled | Flag to enable/disable creation of a native redis cluster. automatic_failover_enabled must be set to true . Only 1 cluster_mode block is allowed |
bool |
true |
no |
cluster_mode_num_node_groups | Number of node groups (shards) for this Redis replication group. Changing this number will trigger an online resizing operation before other settings modifications | number |
0 |
no |
cluster_mode_replicas_per_node_group | Number of replica nodes in each node group. Valid values are 0 to 5. Changing this number will force a new resource | number |
0 |
no |
cluster_size | Number of nodes in the redis cluster. *Ignored when cluster_mode_enabled == true * |
number |
2 |
no |
family | Redis family | string |
"redis6.x" |
no |
mandatory_elasticache_tags | The Default tags that should be present while creating the application | map(any) |
{ |
no |
multi_az_enabled | Multi AZ (Automatic Failover must also be enabled. If Cluster Mode is enabled, Multi AZ is on by default, and this setting is ignored) | bool |
true |
no |
name | Name for the Redis replication group i.e. UserObject | string |
"redis-devops" |
no |
parameter | A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another | list(object({ |
[ |
no |
redis_auth_token | The password used to access a password protected server. Can be specified only if transit_encryption_enabled = true. If specified must contain from 16 to 128 alphanumeric characters or symbols | string |
"" |
no |
redis_ingress_rules | n/a | list(object({ |
[] |
no |
redis_maintenance_window | Specifies the weekly time range for when maintenance on the cache cluster is performed. The format is ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period | string |
"fri:08:00-fri:09:00" |
no |
redis_node_type | Instance type to use for creating the Redis cache clusters | string |
"cache.m5.large" |
no |
redis_parameter_group_name | Name of the custom aws_elasticache_parameter_group | string |
n/a | yes |
redis_port | n/a | number |
6379 |
no |
redis_secret_name | n/a | string |
"redis-devops" |
no |
redis_snapshot_retention_limit | The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, then a snapshot that was taken today will be retained for 5 days before being deleted. If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off. Please note that setting a snapshot_retention_limit is not supported on cache.t1.micro or cache.t2.* cache nodes | number |
0 |
no |
redis_snapshot_window | The daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. The minimum snapshot window is a 60 minute period | string |
"06:30-07:30" |
no |
redis_version | Redis version to use, defaults to 6.x | string |
"6.x" |
no |
snapshot_arns | A single-element string list containing an Amazon Resource Name (ARN) of a Redis RDB snapshot file stored in Amazon S3. Example: arn:aws:s3:::my_bucket/snapshot1.rdb | list(string) |
[] |
no |
snapshot_name | The name of a snapshot from which to restore data into the new node group. Changing the snapshot_name forces a new resource | string |
"" |
no |
subnet_group_name | name of the subnet group | string |
"redis-devops" |
no |
subnet_ids | ID | list(string) |
[] |
no |
tags | Additional tags (e.g. map(BusinessUnit ,XYZ ) |
map(any) |
{} |
no |
transit_encryption_enabled | Whether to enable encryption in transit. If this is enabled, use the following guide to access redis | bool |
true |
no |
vpc_id | VPC ID to create the cluster in (e.g. vpc-a22222ee ) |
string |
"" |
no |
Name | Description |
---|---|
endpoint | Redis primary endpoint |
id | n/a |
parameter_group | n/a |
port | n/a |