From d026b46eba2e5ac39d5197cb92270147ead64d26 Mon Sep 17 00:00:00 2001 From: ghosalkarpratikdeliveryhero Date: Mon, 31 Mar 2025 14:38:20 +0200 Subject: [PATCH 1/3] NoRef-add-support-for-valkey --- main.tf | 5 +++++ variables.tf | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/main.tf b/main.tf index acefe51..2db6896 100644 --- a/main.tf +++ b/main.tf @@ -4,6 +4,7 @@ locals { resource "aws_elasticache_replication_group" "redis" { count = var.create_resources ? 1 : 0 + engine = var.engine replication_group_id = var.name description = var.name automatic_failover_enabled = local.automatic_failover_enabled @@ -19,6 +20,10 @@ resource "aws_elasticache_replication_group" "redis" { apply_immediately = var.apply_immediately tags = var.tags multi_az_enabled = local.automatic_failover_enabled ? var.multi_az_enabled : false + at_rest_encryption_enabled = var.at_rest_encryption_enabled + transit_encryption_enabled = var.transit_encryption_enabled + transit_encryption_mode = var.transit_encryption_enabled ? var.transit_encryption_mode : null + auto_minor_version_upgrade = var.auto_minor_version_upgrade } resource "aws_elasticache_subnet_group" "redis" { diff --git a/variables.tf b/variables.tf index 64f0134..66a3b76 100644 --- a/variables.tf +++ b/variables.tf @@ -1,3 +1,33 @@ +variable "engine" { + description = "Cache engine; redis or valkey" + type = string + default = "redis" +} + +variable "at_rest_encryption_enabled" { + description = "To encrypt data on disk. For redis, default:false; for valkey, default:true. Its default:false here to maintain backward compatibility" + type = bool + default = false +} + +variable "transit_encryption_enabled" { + description = "To encrypt data between client-server communications." + type = bool + default = false +} + +variable "transit_encryption_mode" { + description = "Is transit encryption preferred or required" + type = string + default = "preferred" +} + +variable "auto_minor_version_upgrade" { + description = "Allow automatic minor version upgrade; default:true for engine version 6+ for both redis and valkey" + type = bool + default = true +} + variable "name" { description = "Name given resources" type = string From 569dc4eb2f29060c97b01eefcb188c65ead81a36 Mon Sep 17 00:00:00 2001 From: ghosalkarpratikdeliveryhero Date: Mon, 31 Mar 2025 14:47:36 +0200 Subject: [PATCH 2/3] Update-readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index bb3f049..a54085f 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,11 @@ terraform-docs md ./ | cat -s | tail -r | tail -n +2 | tail -r > README.md | cloudwatch_alarm_default_thresholds | Override default thresholds for CloudWatch alarms. See cloudwatch_alarm_thresholds in cloudwatch.tf for valid keys | map | `` | no | | cloudwatch_create_alarms | Whether to enable CloudWatch alarms | string | `false` | no | | create_resources | Whether to create the Aurora cluster and related resources | string | `true` | no | +| engine | Engine type, either `redis` or `valkey` | string | `redis` | no | +| at_rest_encryption_enabled | To encrypt data on disk. For `redis`, default:false; for `valkey`, default:true. Its default:false here to maintain backward compatibility | bool | `false` | no | +| transit_encryption_enabled | To encrypt data between client-server communications | bool | `false` | no | +| transit_encryption_mode | Is transit encryption preferred or required | string | `preferred` | no | +| auto_minor_version_upgrade | Allow automatic minor version upgrade; default:true for engine version 6+ for both `redis` and `valkey` | bool | `true` | no | | engine_version | Redis engine verions | string | `4.0.10` | no | | maintenance_window | When to perform maintenance | string | `sun:02:30-sun:03:30` | no | | multi_az_enabled | Specifies whether to enable Multi-AZ Support for the replication group. Applied only when `number_cache_clusters` is greater than 1. | bool | `true` | no | From f55d99dce7dc60a2adea7792e0e9fe2ef3bbb1be Mon Sep 17 00:00:00 2001 From: ghosalkarpratikdeliveryhero Date: Tue, 1 Apr 2025 14:55:25 +0200 Subject: [PATCH 3/3] linitng --- variables.tf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/variables.tf b/variables.tf index 66a3b76..3a70d49 100644 --- a/variables.tf +++ b/variables.tf @@ -6,26 +6,26 @@ variable "engine" { variable "at_rest_encryption_enabled" { description = "To encrypt data on disk. For redis, default:false; for valkey, default:true. Its default:false here to maintain backward compatibility" - type = bool - default = false + type = bool + default = false } variable "transit_encryption_enabled" { description = "To encrypt data between client-server communications." - type = bool - default = false + type = bool + default = false } variable "transit_encryption_mode" { description = "Is transit encryption preferred or required" - type = string - default = "preferred" + type = string + default = "preferred" } variable "auto_minor_version_upgrade" { description = "Allow automatic minor version upgrade; default:true for engine version 6+ for both redis and valkey" - type = bool - default = true + type = bool + default = true } variable "name" {