Skip to content

Commit 7ca03ac

Browse files
committed
fix output
1 parent 250b530 commit 7ca03ac

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ locals {
44
}
55

66
resource "aws_elasticache_subnet_group" "this" {
7-
# count = "${ length(var.subnet_ids) == 0 ? 0 : 1 }"
7+
# count = "${ var.module_enabled && "${length(var.subnet_ids)}" > 0 ? 1 : 0 }"
8+
89
count = "${ var.module_enabled ? 1 : 0 }"
910
name = "${local.cluster_name}"
1011
description = "Subnet Group for ${local.cluster_name}"
1112
subnet_ids = ["${var.subnet_ids}"]
1213
}
1314

1415
resource "aws_elasticache_cluster" "redis-with-subnet-group-and-security-group" {
15-
# count = "${ lower(var.cache_engine) == "redis" && length(var.subnet_ids) > 0 && length(var.security_group_ids) > 0 ? 1 : 0 }"
16+
# count = "${ var.module_enabled && "${lower(var.cache_engine)}" == "redis" && "${length(var.subnet_ids)}" > 0 && "${length(var.security_group_ids)}" > 0 ? 1 : 0 }"
17+
1618
count = "${ var.module_enabled ? 1 : 0 }"
1719
cluster_id = "${local.cluster_name}"
1820
engine = "redis"
@@ -22,8 +24,7 @@ resource "aws_elasticache_cluster" "redis-with-subnet-group-and-security-group"
2224
engine_version = "${var.engine_version}"
2325
port = "${var.cluster_port}"
2426

25-
# subnet_group_name = "${aws_elasticache_subnet_group.this.0.name}"
26-
subnet_group_name = "${aws_elasticache_subnet_group.this.name}"
27+
subnet_group_name = "${aws_elasticache_subnet_group.this.0.name}"
2728

2829
security_group_ids = ["${var.security_group_ids}"]
2930

output.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
output "cache_nodes" {
22
description = "List of node objects including id, address, port and availability_zone. "
3-
value = "${aws_elasticache_cluster.redis-with-subnet-group-and-security-group.cache_nodes}"
3+
value = "${element(concat(aws_elasticache_cluster.redis-with-subnet-group-and-security-group.*.cache_nodes, list("")), 0)}"
44
}

0 commit comments

Comments
 (0)