
The module create Redis ElastiCache replication group with flexible configuration
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
Initialize mandatory providers:
Copy and paste into your Terraform configuration and insert the variables:
hclmodule "tf_aws_elasticache" {
source = "solutions.corewide.com/aws/tf-aws-elasticache/aws"
version = "~> 1.0.2"
# specify module inputs here or try one of the examples below
...
}
Initialize the setup:
shellterraform init
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.2"
All notable changes to this project are documented here.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
allowed_security_group_ids
variable) uses a ordering number instead of ID to make each rule uniqueallowed_security_group_ids
variable) due to data not known until applyparameter_group_parameters
having incorrect type definition (list(map)
, now map(any)
)First stable version
Create Redis ElastiCache replication group with single cache cluster with Redis v6.2, custom maintenance window, snapshot window, parameter group parameters, tags and node type:
hclmodule "redis" {
source = "solutions.corewide.com/aws/tf-aws-elasticache/aws"
version = "~> 1.0.1"
name_prefix = "my-project"
engine_version = "6.2"
node_type = "t4g.medium"
automatic_failover_enabled = false
parameter_group_parameters = {
"activerehashing" = "yes",
"min-slaves-to-write" = 2,
}
maintenance_window = {
day = "Sun"
hour_start = 1
hour_end = 3
}
snaphot_window = {
hour_start = 4
hour_end = 5
}
tags = {
project = "my_test_project"
}
allowed_security_group_ids = [
"sg-123xyz456qwerty",
]
subnet_ids = [
"id-123-di-321",
"321-di-123-id",
]
}
Create Redis ElastiCache replication group with default parameters (single-node with Redis v7.0 cluster with cache.t4g-micro
machine size):
hclmodule "redis" {
source = "solutions.corewide.com/aws/tf-aws-elasticache/aws"
version = "~> 1.0.1"
name_prefix = "my-project"
subnet_ids = [
"id-123-di-321",
"321-di-123-id",
]
}
Variable | Description | Type | Default | Required | Sensitive |
---|---|---|---|---|---|
name_prefix |
Name prefix for the created resources | string |
yes | no | |
subnet_ids |
List of subnet IDs in which Redis instance can be provisioned in | list(string) |
yes | no | |
allowed_security_group_ids |
List of security group IDs to allow connections from (re-ordering IDs in the list can cause re-creation of corresponding Security Group Rule) | list(string) |
[] |
no | no |
apply_during_maintenance_window |
Apply changes to ElastiCache instance during maintenance window | bool |
true |
no | no |
automatic_failover_enabled |
Whether a read-only replica will be automatically promoted to primary on existing primary fail | bool |
false |
no | no |
engine_version |
Redis engine version | string |
7.0 |
no | no |
machine_size |
ElastiCache instance class | string |
t4g.micro |
no | no |
maintenance_window |
ElastiCache 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.hour_end |
End hour for maintenance window in 24-hour format | number |
3 |
no | no |
maintenance_window.hour_start |
Start hour for maintenance window in 24-hour format | number |
2 |
no | no |
multi_az_enabled |
Enables High Availability for the primary ElastiCache instance | bool |
false |
no | no |
node_count |
Number of nodes (primary and replicas) this replication group will have | number |
1 |
no | no |
parameter_group_parameters |
Map of ElastiCache parameter group parameters | map(any) |
{} |
no | no |
snapshot_retention_limit_days |
Number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them | number |
10 |
no | no |
snapshot_window |
ElastiCache snapshot window | object |
{} |
no | no |
snapshot_window.hour_end |
End hour for snapshot in 24-hour format | number |
5 |
no | no |
snapshot_window.hour_start |
Start hour for snapshot in 24-hour format | number |
4 |
no | no |
tags |
Map of tags to be assigned to the cluster resource | map(string) |
{} |
no | no |
Output | Description | Type | Sensitive |
---|---|---|---|
connection_parameters |
AWS ElastiCache connection parameters (host - instance endpoint, port - instance port) |
map |
no |
replication_group |
Attributes of ElastiCache replication group | resource |
yes |
security_group |
Security Group of the Redis instances | attribute |
no |
Dependency | Version | Kind |
---|---|---|
terraform |
>= 1.3 |
CLI |
hashicorp/aws |
~> 5.49 |
provider |
tf-aws-security-group |
~> 2.0 |
module |