@@ -34,6 +34,8 @@ module "aws_security_group" {
34
34
source = " cloudposse/security-group/aws"
35
35
version = " 0.4.2"
36
36
37
+ enabled = local. create_security_group
38
+
37
39
allow_all_egress = local. allow_all_egress
38
40
security_group_name = var. security_group_name
39
41
rules_map = local. sg_rules
@@ -61,7 +63,6 @@ module "aws_security_group" {
61
63
security_group_delete_timeout = var. security_group_delete_timeout
62
64
63
65
64
- enabled = local. enabled && local. create_security_group
65
66
context = module. this . context
66
67
}
67
68
@@ -114,10 +115,10 @@ resource "aws_elasticache_replication_group" "default" {
114
115
automatic_failover_enabled = var. automatic_failover_enabled
115
116
multi_az_enabled = var. multi_az_enabled
116
117
subnet_group_name = local. elasticache_subnet_group_name
117
- # It would be nice to remove duplicate security group IDs, if there are any, using `compact`,
118
+ # It would be nice to remove null or duplicate security group IDs, if there are any, using `compact`,
118
119
# but that causes problems, and having duplicates does not seem to cause problems.
119
120
# See https://github.com/hashicorp/terraform/issues/29799
120
- security_group_ids = concat (local. associated_security_group_ids , [module . aws_security_group . id ])
121
+ security_group_ids = local . create_security_group ? concat (local. associated_security_group_ids , [module . aws_security_group . id ]) : local . associated_security_group_ids
121
122
maintenance_window = var. maintenance_window
122
123
notification_topic_arn = var. notification_topic_arn
123
124
engine_version = var. engine_version
@@ -196,7 +197,7 @@ module "dns" {
196
197
enabled = module. this . enabled && length (var. zone_id ) > 0 ? true : false
197
198
dns_name = var. dns_subdomain != " " ? var. dns_subdomain : module. this . id
198
199
ttl = 60
199
- zone_id = try (var. zone_id [0 ], var. zone_id )
200
+ zone_id = try (var. zone_id [0 ], tostring ( var. zone_id ), " " )
200
201
records = var. cluster_mode_enabled ? [join (" " , aws_elasticache_replication_group. default . * . configuration_endpoint_address )] : [join (" " , aws_elasticache_replication_group. default . * . primary_endpoint_address )]
201
202
202
203
context = module. this . context
0 commit comments