File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,17 @@ locals {
4
4
}
5
5
6
6
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
+
8
9
count = " ${ var . module_enabled ? 1 : 0 } "
9
10
name = " ${ local . cluster_name } "
10
11
description = " Subnet Group for ${ local . cluster_name } "
11
12
subnet_ids = [" ${ var . subnet_ids } " ]
12
13
}
13
14
14
15
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
+
16
18
count = " ${ var . module_enabled ? 1 : 0 } "
17
19
cluster_id = " ${ local . cluster_name } "
18
20
engine = " redis"
@@ -22,8 +24,7 @@ resource "aws_elasticache_cluster" "redis-with-subnet-group-and-security-group"
22
24
engine_version = " ${ var . engine_version } "
23
25
port = " ${ var . cluster_port } "
24
26
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 } "
27
28
28
29
security_group_ids = [" ${ var . security_group_ids } " ]
29
30
Original file line number Diff line number Diff line change 1
1
output "cache_nodes" {
2
2
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 ) } "
4
4
}
You can’t perform that action at this time.
0 commit comments