Skip to content

Commit 0a08ea0

Browse files
authored
When disabled, skip coalese and just return null (#254)
1 parent d4a0a1a commit 0a08ea0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ locals {
115115
endpoint_cluster = try(aws_elasticache_replication_group.default[0].configuration_endpoint_address, null)
116116
endpoint_instance = try(aws_elasticache_replication_group.default[0].primary_endpoint_address, null)
117117
# Use the serverless endpoint if serverless mode is enabled, otherwise use the cluster endpoint, otherwise use the instance endpoint
118-
endpoint_address = coalesce(local.endpoint_serverless, local.endpoint_cluster, local.endpoint_instance)
118+
endpoint_address = local.enabled ? coalesce(local.endpoint_serverless, local.endpoint_cluster, local.endpoint_instance) : null
119119

120120
reader_endpoint_serverless = try(aws_elasticache_serverless_cache.default[0].reader_endpoint[0].address, null)
121121
reader_endpoint_cluster = try(aws_elasticache_replication_group.default[0].reader_endpoint_address, null)
122122
reader_endpoint_instance = try(aws_elasticache_replication_group.default[0].reader_endpoint_address, null)
123123
# Use the serverless reader endpoint if serverless mode is enabled, otherwise use the cluster reader endpoint, otherwise use the instance reader endpoint, otherwise use the endpoint address
124-
reader_endpoint_address = coalesce(local.reader_endpoint_serverless, local.reader_endpoint_cluster, local.reader_endpoint_instance, local.endpoint_address)
124+
reader_endpoint_address = local.enabled ? coalesce(local.reader_endpoint_serverless, local.reader_endpoint_cluster, local.reader_endpoint_instance, local.endpoint_address) : null
125125
}
126126

127127
resource "aws_elasticache_subnet_group" "default" {

0 commit comments

Comments
 (0)