From 5313f427bf659849d7049880967aa9c8830b5ab3 Mon Sep 17 00:00:00 2001 From: David Moran <23364162+wavemoran@users.noreply.github.com> Date: Tue, 21 May 2024 15:07:08 -0700 Subject: [PATCH] chore: bump elasticache-redis module version (#1040) --- modules/elasticache-redis/main.tf | 17 ++++++++++------- .../modules/redis_cluster/main.tf | 5 ++++- .../modules/redis_cluster/variables.tf | 12 ++++++++++++ modules/elasticache-redis/variables.tf | 6 ++++++ 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/modules/elasticache-redis/main.tf b/modules/elasticache-redis/main.tf index 2f4003da5..2e5f8ead9 100644 --- a/modules/elasticache-redis/main.tf +++ b/modules/elasticache-redis/main.tf @@ -38,6 +38,7 @@ locals { vpc_id = module.vpc.outputs.vpc_id subnets = module.vpc.outputs.private_subnet_ids availability_zones = var.availability_zones + multi_az_enabled = var.multi_az_enabled allowed_security_groups = local.allowed_security_groups additional_security_group_rules = local.additional_security_group_rules @@ -65,13 +66,15 @@ module "redis_clusters" { cluster_name = lookup(each.value, "cluster_name", replace(each.key, "_", "-")) dns_subdomain = join(".", [lookup(each.value, "cluster_name", replace(each.key, "_", "-")), module.this.environment]) - instance_type = each.value.instance_type - num_replicas = lookup(each.value, "num_replicas", 1) - num_shards = lookup(each.value, "num_shards", 0) - replicas_per_shard = lookup(each.value, "replicas_per_shard", 0) - engine_version = each.value.engine_version - parameters = each.value.parameters - cluster_attributes = local.cluster_attributes + instance_type = each.value.instance_type + num_replicas = lookup(each.value, "num_replicas", 1) + num_shards = lookup(each.value, "num_shards", 0) + replicas_per_shard = lookup(each.value, "replicas_per_shard", 0) + engine_version = each.value.engine_version + create_parameter_group = lookup(each.value, "create_parameter_group", true) + parameters = lookup(each.value, "parameters", null) + parameter_group_name = lookup(each.value, "parameter_group_name", null) + cluster_attributes = local.cluster_attributes context = module.this.context } diff --git a/modules/elasticache-redis/modules/redis_cluster/main.tf b/modules/elasticache-redis/modules/redis_cluster/main.tf index ec7e8eb48..c7a9cf02d 100644 --- a/modules/elasticache-redis/modules/redis_cluster/main.tf +++ b/modules/elasticache-redis/modules/redis_cluster/main.tf @@ -10,7 +10,7 @@ locals { module "redis" { source = "cloudposse/elasticache-redis/aws" - version = "0.52.0" + version = "1.2.2" name = var.cluster_name @@ -22,6 +22,7 @@ module "redis" { auth_token = local.auth_token automatic_failover_enabled = var.cluster_attributes.automatic_failover_enabled availability_zones = var.cluster_attributes.availability_zones + multi_az_enabled = var.cluster_attributes.multi_az_enabled cluster_mode_enabled = var.num_shards > 0 cluster_mode_num_node_groups = var.num_shards cluster_mode_replicas_per_node_group = var.replicas_per_shard @@ -30,7 +31,9 @@ module "redis" { engine_version = var.engine_version family = var.cluster_attributes.family instance_type = var.instance_type + create_parameter_group = var.create_parameter_group parameter = var.parameters + parameter_group_name = var.parameter_group_name port = var.cluster_attributes.port subnets = var.cluster_attributes.subnets transit_encryption_enabled = var.cluster_attributes.transit_encryption_enabled diff --git a/modules/elasticache-redis/modules/redis_cluster/variables.tf b/modules/elasticache-redis/modules/redis_cluster/variables.tf index 3366c1b2b..9a16924a9 100644 --- a/modules/elasticache-redis/modules/redis_cluster/variables.tf +++ b/modules/elasticache-redis/modules/redis_cluster/variables.tf @@ -5,6 +5,12 @@ variable "cluster_name" { description = "Elasticache Cluster name" } +variable "create_parameter_group" { + type = bool + default = true + description = "Whether new parameter group should be created. Set to false if you want to use existing parameter group" +} + variable "engine_version" { type = string description = "Redis Version" @@ -66,6 +72,12 @@ variable "parameters" { description = "Parameters to configure cluster parameter group" } +variable "parameter_group_name" { + type = string + default = null + description = "Override the default parameter group name" +} + variable "kms_alias_name_ssm" { default = "alias/aws/ssm" description = "KMS alias name for SSM" diff --git a/modules/elasticache-redis/variables.tf b/modules/elasticache-redis/variables.tf index 3b25582c5..6f9739ff3 100644 --- a/modules/elasticache-redis/variables.tf +++ b/modules/elasticache-redis/variables.tf @@ -9,6 +9,12 @@ variable "availability_zones" { default = [] } +variable "multi_az_enabled" { + type = bool + default = false + description = "Multi AZ (Automatic Failover must also be enabled. If Cluster Mode is enabled, Multi AZ is on by default, and this setting is ignored)" +} + variable "family" { type = string description = "Redis family"