From 21b1d981659eec84d45546d7c0b1425efac2c94e Mon Sep 17 00:00:00 2001 From: Allan Denot Date: Wed, 11 Dec 2024 09:28:42 +1000 Subject: [PATCH 1/2] Fix configuration name num_cache_clusters --- _variables.tf | 4 ++-- redis.tf | 44 ++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/_variables.tf b/_variables.tf index bfedd02..387c94e 100644 --- a/_variables.tf +++ b/_variables.tf @@ -58,7 +58,7 @@ variable "notification_topic_arn" { default = "" } -variable "number_cache_clusters" { +variable "num_cache_clusters" { description = "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" default = 1 } @@ -120,4 +120,4 @@ variable "user_group_ids" { description = "(Optional) User Group ID to associate with the replication group. Only a maximum of one (1) user group ID is valid. NOTE: This argument is a set because the AWS specification allows for multiple IDs. However, in practice, AWS only allows a maximum size of one." type = set(string) default = null -} \ No newline at end of file +} diff --git a/redis.tf b/redis.tf index 2b6793d..35daf9b 100644 --- a/redis.tf +++ b/redis.tf @@ -5,30 +5,30 @@ resource "random_string" "redis_password" { } resource "aws_elasticache_replication_group" "redis" { - replication_group_id = var.name - replication_group_description = var.name - automatic_failover_enabled = var.automatic_failover_enabled - at_rest_encryption_enabled = var.at_rest_encryption_enabled - transit_encryption_enabled = var.transit_encryption_enabled - multi_az_enabled = var.multi_az_enabled - auth_token = var.transit_encryption_enabled ? random_string.redis_password[0].result : null - engine = var.engine - engine_version = var.engine_version - kms_key_id = var.kms_key_id - maintenance_window = var.maintenance_window - node_type = var.node_type - notification_topic_arn = var.notification_topic_arn - number_cache_clusters = var.number_cache_clusters - port = var.port - security_group_ids = [aws_security_group.redis.id] - snapshot_retention_limit = var.snapshot_retention_limit - snapshot_window = var.snapshot_window - subnet_group_name = try(aws_elasticache_subnet_group.redis[0].name, var.subnet_group_name) - parameter_group_name = var.parameter_group_name - user_group_ids = var.user_group_ids + replication_group_id = var.name + description = var.name + automatic_failover_enabled = var.automatic_failover_enabled + at_rest_encryption_enabled = var.at_rest_encryption_enabled + transit_encryption_enabled = var.transit_encryption_enabled + multi_az_enabled = var.multi_az_enabled + auth_token = var.transit_encryption_enabled ? random_string.redis_password[0].result : null + engine = var.engine + engine_version = var.engine_version + kms_key_id = var.kms_key_id + maintenance_window = var.maintenance_window + node_type = var.node_type + notification_topic_arn = var.notification_topic_arn + num_cache_clusters = var.num_cache_clusters + port = var.port + security_group_ids = [aws_security_group.redis.id] + snapshot_retention_limit = var.snapshot_retention_limit + snapshot_window = var.snapshot_window + subnet_group_name = try(aws_elasticache_subnet_group.redis[0].name, var.subnet_group_name) + parameter_group_name = var.parameter_group_name + user_group_ids = var.user_group_ids tags = { "Name" = var.name "EnvName" = var.environment_name } -} \ No newline at end of file +} From 26f40d5b95e32ed42440ba84b94e65b39ade4d44 Mon Sep 17 00:00:00 2001 From: adenot Date: Tue, 10 Dec 2024 23:29:29 +0000 Subject: [PATCH 2/2] terraform-docs: automated update action --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d6cb66..842dd6b 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ module "cache_redis" { | name | Name of this Redis | `string` | n/a | yes | | node\_type | The instance class to be used | `string` | n/a | yes | | notification\_topic\_arn | n/a | `string` | `""` | no | -| number\_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 | `number` | `1` | 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 | `number` | `1` | no | | parameter\_group\_name | The name of the parameter group to associate with this replication group | `string` | `null` | no | | port | Port number for this Redis | `number` | `6379` | no | | snapshot\_retention\_limit | The number of days for which ElastiCache will retain automatic cache cluster snapshots before deleting them | `number` | `0` | no |