Terraform module which creates db related resources on AWS.
Terraform Modules from this package were written to manage the following AWS Services with Terraform.
- AWS RDS (Relational Database Service)
- (comming sooon!)
- AWS ElastiCache
- Redis Cluster
- Redis User RBAC
module "cluster" {
source = "tedilabs/db/aws//modules/elasticache-redis-cluster"
version = "~> 0.2.0"
name = "example-redis-full"
description = "Managed by Terraform."
engine = {
type = "redis"
version = "7.1"
}
node_instance_type = "cache.t4g.micro"
# node_size = 1
cluster_mode = {
state = "ENABLED"
shard_size = 3
replicas = 2
}
## Network
ip_address_type = "IPv4"
discovery_ip_address_type = "IPv4"
port = 6379
vpc_id = "vpc-0123456789abcdef0"
subnet_group = "example-redis-subnet-group"
preferred_availability_zones = []
default_security_group = {
enabled = true
name = "example-redis-full-default-sg"
description = "Managed by Terraform."
ingress_rules = [
{
id = "all"
ipv4_cidrs = ["0.0.0.0/0"]
}
]
}
security_groups = []
## Parameters
default_parameter_group = {
enabled = true
name = "example-redis-full-parameter-group"
description = "Managed by Terraform."
parameters = {
"lazyfree-lazy-eviction" = "yes"
"lazyfree-lazy-expire" = "yes"
"lazyfree-lazy-server-del" = "yes"
"rename-commands" = "KEYS BLOCKED"
}
}
parameter_group = null
## Auth
password = sensitive("helloworld!#!!1234")
password_update_strategy = "ROTATE"
user_groups = []
## Encryption
encryption_at_rest = {
enabled = true
kms_key = null
}
encryption_in_transit = {
enabled = true
mode = "required"
}
## Backup
backup = {
enabled = true
window = "16:00-17:00"
retention = 1
final_snapshot_name = "example-redis-full-final"
}
## Restore
restore = {
backup_name = null
rdb_s3_arns = null
}
## Maintenance
maintenance = {
window = "fri:18:00-fri:20:00"
auto_upgrade_minor_version_enabled = true
notification_sns_topic = null
}
## Logging
logging_slow_log = {
enabled = false
format = "JSON"
destination = {
type = "CLOUDWATCH_LOGS"
name = null
}
}
logging_engine_log = {
enabled = false
format = "JSON"
destination = {
type = "CLOUDWATCH_LOGS"
name = null
}
}
## Attributes
multi_az_enabled = true
auto_failover_enabled = true
apply_immediately = true
timeouts = {
create = "60m"
update = "40m"
delete = "40m"
}
tags = {
"project" = "terraform-aws-db-examples"
}
}- Singie Redis Instance
- Multi-AZs Redis Cluster (Sharding Disabled)
- Full Redis Cluster (Sharding Enabled)
- Redis Cluster with RBAC(Role Based Access Control)
Like this project? Follow the repository on GitHub. And if you're feeling especially charitable, follow posquit0 on GitHub.
Provided under the terms of the Apache License.
Copyright Β© 2022-2026, Byungjin Park.