A Terraform module to create an AWS Redis ElastiCache cluster.
terraform-aws-elasticache-redis
A Terraform module to create an AWS Redis ElastiCache cluster
Terraform versions
- For AWS Provider >= 4.0.0, pin module version to
~> v3.0. - For Terraform 0.14.5 and higher and AWS Provider < 4.0.0, pin module version to
~> v2.0. - For Terraform 0.12 to 0.14.4, pin module version to
~> v1.0. - Submit pull-requests to
mainbranch.
Usage
module "redis" {
source = "umotif-public/elasticache-redis/aws"
version = "~> 3.0.0"
name_prefix = "core-example" numcacheclusters = 2 node_type = "cache.t4g.small"
engine_version = "7.0" port = 6379 maintenance_window = "mon:03:00-mon:04:00" snapshot_window = "04:00-06:00" snapshotretentionlimit = 7
automaticfailoverenabled = true
atrestencryption_enabled = true transitencryptionenabled = true auth_token = "1234567890asdfghjkl"
apply_immediately = true family = "redis7" description = "Test elasticache redis."
subnetids = module.vpc.privatesubnets vpcid = module.vpc.vpcid
ingresscidrblocks = ["0.0.0.0/0"]
parameter = [ { name = "repl-backlog-size" value = "16384" } ]
logdeliveryconfiguration = [ { destination_type = "cloudwatch-logs" destination = "awscloudwatchlog_group.example.name" log_format = "json" log_type = "engine-log" } ]
tags = { Project = "Test" } }
Examples
Authors
Module managed by uMotif
Requirements
| Name | Version | |------|---------| | terraform | >= 1.0.11 | | aws | >= 4.12.0 | | random | >= 3.3.2 |
Providers
| Name | Version | |------|---------| | aws | >= 4.12.0 | | random | >= 3.3.2 |
Modules
No modules.
Resources
| Name | Type | |------|------| | awselasticacheparametergroup.redis | resource | | awselasticachereplicationgroup.redis | resource | | awselasticachesubnetgroup.redis | resource | | awssecuritygroup.redis | resource | | awssecuritygrouprule.othersgingress | resource | | awssecuritygrouprule.redis_egress | resource | | awssecuritygrouprule.redisingresscidr_blocks | resource | | awssecuritygrouprule.redisingressself | resource | | randomid.redis_pg | resource |
Inputs
| Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | allowed\security\groups | List of existing security groups that will be allowed ingress via the elaticache security group rules | list(string) | [] | no | | apply\_immediately | Specifies whether any modifications are applied immediately, or during the next maintenance window. | bool | false | no | | at\rest\encryption\_enabled | Whether to enable encryption at rest. | bool | true | no | | auth\token | The password used to access a password protected server. Can be specified only if transitencryption_enabled = true. | string | "" | no | | auto\minor\version\_upgrade | n/a | string | true | no | | automatic\failover\enabled | Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. If enabled, number\cache\clusters must be greater than 1. Must be enabled for Redis (cluster mode enabled) replication groups. | bool | true | no | | cluster\mode\enabled | Enable creation of a native redis cluster. | bool | false | no | | data\tiering\enabled | Enables data tiering. Data tiering is only supported for replication groups using the r6gd node type. This parameter must be set to true when using r6gd nodes. | bool | false | no | | description | The description of the all resources. | string | "Managed by Terraform" | no | | egress\cidr\blocks | List of Egress CIDR blocks. | list(string) |
[| no | | engine\_version | The version number of the cache engine to be used for the cache clusters in this replication group. |
"0.0.0.0/0"
]
string | "6.x" | no | | family | The family of the ElastiCache parameter group. | string | "redis6.x" | no | | final\snapshot\identifier | The name of your final node group (shard) snapshot. ElastiCache creates the snapshot from the primary node in the cluster. If omitted, no final snapshot will be made. | string | null | no | | global\replication\group\_id | The ID of the global replication group to which this replication group should belong. | string | null | no | | ingress\cidr\blocks | List of Ingress CIDR blocks. | list(string) | [] | no | | ingress\_self | Specify whether the security group itself will be added as a source to the ingress rule. | bool | false | no | | kms\key\id | The ARN of the key that you wish to use if encrypting at rest. If not supplied, uses service managed encryption. Can be specified only if atrestencryption_enabled = true | string | "" | no | | log\delivery\configuration | Log Delivery configuration for the cluster. | list(object({
destinationtype = string
destination = string
logformat = string
log_type = string
})) | [] | no | | maintenance\_window | Specifies the weekly time range for when maintenance on the cache cluster is performed. | string | "" | no | | multi\az\enabled | Specifies whether to enable Multi-AZ Support for the replication group. If true, automaticfailoverenabled must also be enabled. Defaults to false. | bool | false | no | | name\_prefix | The replication group identifier. This parameter is stored as a lowercase string. | string | n/a | yes | | node\_type | The compute and memory capacity of the nodes in the node group. | string | n/a | yes | | notification\topic\arn | An Amazon Resource Name (ARN) of an SNS topic to send ElastiCache notifications to. Example: arn:aws:sns:us-east-1:012345678999:mysnstopic | string | "" | no | | num\cache\clusters | The 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. Updates will occur before other modifications. Conflicts with num\node\groups. | number | 1 | no | | num\node\groups | Specify the 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 | | parameter | A list of Redis parameters to apply. Note that parameters may differ from one Redis family to another | list(object({
name = string
value = string
})) | [] | no | | parameter\group\description | The description of the ElastiCache parameter group | string | null | no | | port | The port number on which each of the cache nodes will accept connections. | number | 6379 | no | | preferred\cache\cluster\_azs | 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(string) | null | no | | replicas\per\node\_group | Specify the number of replica nodes in each node group. Valid values are 0 to 5. Changing this number will trigger an online resizing operation before other settings modifications. | number | 0 | no | | security\group\ids | List of Security Groups. | 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 | null | no | | snapshot\retention\limit | The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them. | number | 30 | no | | snapshot\_window | The daily time range (in UTC) during which ElastiCache will begin taking a daily snapshot of your cache cluster. | string | "" | no | | subnet\group\name | The name of the subnet group. If it is not specified, the module will create one for you | string | null | no | | subnet\_ids | List of VPC Subnet IDs for the cache subnet group. | list(string) | [] | 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 | | user\group\ids | User Group ID to associate with the replication group | list(string) | null | no | | vpc\_id | VPC Id to associate with Redis ElastiCache. | string | n/a | yes |
Outputs
| Name | Description | |------|-------------| | elasticache\auth\token | The Redis Auth Token. | | elasticache\parameter\group\_id | The ElastiCache parameter group name. | | elasticache\_port | The Redis port. | | elasticache\replication\group\_arn | The Amazon Resource Name (ARN) of the created ElastiCache Replication Group. | | elasticache\replication\group\_id | The ID of the ElastiCache Replication Group. | | elasticache\replication\group\member\clusters | The identifiers of all the nodes that are part of this replication group. | | elasticache\replication\group\primary\endpoint\_address | The address of the endpoint for the primary node in the replication group. | | elasticache\replication\group\reader\endpoint\_address | The address of the endpoint for the reader node in the replication group. | | security\group\arn | The ARN of the Redis ElastiCache security group. | | security\group\description | The description of the Redis ElastiCache security group. | | security\group\egress | The egress rules of the Redis ElastiCache security group. | | security\group\id | The ID of the Redis ElastiCache security group. | | security\group\ingress | The ingress rules of the Redis ElastiCache security group. | | security\group\name | The name of the Redis ElastiCache security group. | | security\group\owner\_id | The owner ID of the Redis ElastiCache security group. | | security\group\vpc\_id | The VPC ID of the Redis ElastiCache security group. |
License
See LICENSE for full details.
Pre-commit hooks
Install dependencies
pre-committerraform-docsrequired forterraformdocshooks.TFLintrequired forterraformtflinthook.
MacOS
brew install pre-commit terraform-docs tflint
brew tap git-chglog/git-chglog brew install git-chglog