From f8f940e8eaff44f2755741e8522fb0e1210b9c91 Mon Sep 17 00:00:00 2001 From: devops0706 Date: Mon, 22 Apr 2024 19:21:13 +0530 Subject: [PATCH 1/2] added cluster members list in the output of terraform --- examples/complete-cluster-mode/outputs.tf | 6 ++++++ examples/complete/main.tf | 8 ++++---- examples/complete/outputs.tf | 6 ++++++ outputs.tf | 5 +++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/examples/complete-cluster-mode/outputs.tf b/examples/complete-cluster-mode/outputs.tf index 5774b24..189dbde 100644 --- a/examples/complete-cluster-mode/outputs.tf +++ b/examples/complete-cluster-mode/outputs.tf @@ -14,6 +14,12 @@ output "id_of_redis_cluster" { value = module.redis.elastic_cache_redis_cluster_id } +output "redis_member_clusters" { + description = "Subnet group name of the elasticache-redis cluster" + value = module.redis.elastic_cache_redis_member_clusters + +} + output "port_no" { description = "Port number of Redis" value = module.redis.elastic_cache_redis_port diff --git a/examples/complete/main.tf b/examples/complete/main.tf index a8cdb50..13389bc 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -1,10 +1,10 @@ locals { name = "redis" - region = "us-east-2" + region = "us-west-2" family = "redis6.x" node_type = "cache.t3.small" vpc_cidr = "10.0.0.0/16" - allowed_security_groups = ["sg-09b5da32f11bc36f"] + allowed_security_groups = ["sg-0412fe49"] environment = "prod" redis_engine_version = "6.0" additional_tags = { @@ -96,7 +96,7 @@ module "vpc" { } module "redis" { - source = "squareops/elasticache-redis/aws" + source = "../.." name = local.name family = local.family node_type = local.node_type @@ -114,7 +114,7 @@ module "redis" { cloudwatch_metric_alarms_enabled = true alarm_cpu_threshold_percent = 70 alarm_memory_threshold_bytes = "10000000" # in bytes - slack_notification_enabled = true + slack_notification_enabled = false slack_username = "" slack_channel = "" slack_webhook_url = "" diff --git a/examples/complete/outputs.tf b/examples/complete/outputs.tf index 5774b24..2d0a92d 100644 --- a/examples/complete/outputs.tf +++ b/examples/complete/outputs.tf @@ -9,6 +9,12 @@ output "redis_subnet_group_name" { } +output "redis_member_clusters" { + description = "Subnet group name of the elasticache-redis cluster" + value = module.redis.elastic_cache_redis_member_clusters + +} + output "id_of_redis_cluster" { description = "ID of the elasticache-redis cluster" value = module.redis.elastic_cache_redis_cluster_id diff --git a/outputs.tf b/outputs.tf index 1de9fd5..ccee64d 100644 --- a/outputs.tf +++ b/outputs.tf @@ -32,3 +32,8 @@ output "auth_token_password" { description = "Elasticache-redis auth token password(this password may be old, because Terraform doesn't track it after initial creation)" value = var.transit_encryption_enabled ? nonsensitive(random_password.password[0].result) : null } + +output "elastic_cache_redis_member_clusters" { + description = "ID of the elasticache-redis cluster" + value = flatten(aws_elasticache_replication_group.redis.member_clusters) +} \ No newline at end of file From 1af9d835f850689480d17ace0f8e4310e9b544e8 Mon Sep 17 00:00:00 2001 From: devops0706 Date: Mon, 22 Apr 2024 19:24:08 +0530 Subject: [PATCH 2/2] updated source path in example main.tf --- examples/complete/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 13389bc..87d66bb 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -96,7 +96,7 @@ module "vpc" { } module "redis" { - source = "../.." + source = "squareops/elasticache-redis/aws" name = local.name family = local.family node_type = local.node_type