Closed MateuszStefek closed 3 years ago
If anyone is looking for a work around in the meantime, inferring the reader endpoint from the primary endpoint has worked well for us.
output "cache_reader_endpoint" {
value = "${aws_elasticache_replication_group.cache.id}-ro.${
join(
".",
slice(
split(".", aws_elasticache_replication_group.cache.primary_endpoint_address),
1,
length(split(".", aws_elasticache_replication_group.cache.primary_endpoint_address))
)
)
}"
}
If anyone is looking for a work around in the meantime, inferring the reader endpoint from the primary endpoint has worked well for us.
output "cache_reader_endpoint" { value = "${aws_elasticache_replication_group.cache.id}-ro.${ join( ".", slice( split(".", aws_elasticache_replication_group.cache.primary_endpoint_address), 1, length(split(".", aws_elasticache_replication_group.cache.primary_endpoint_address)) ) ) }" }
It seems if you enable encryption in transit the endpoint is different. They are:
Replica:
replica.xxx.xxx.xxx.cache.amazonaws.com
Master:
master.xxx.xxx.xxx..cache.amazonaws.com
I managed to get the reader endpoint with the following if encryption in transit is enabled:
locals {
# The AWS provider does not have a attribute reference for the reader_endpoint. Below is a way to get the reader_endpoint
replace(aws_elasticache_replication_group.default.primary_endpoint_address, "/^master/", "replica")
}
Keep in mind this is only for a non-clustered redis.
If anyone is looking for a work around in the meantime, inferring the reader endpoint from the primary endpoint has worked well for us.
output "cache_reader_endpoint" { value = "${aws_elasticache_replication_group.cache.id}-ro.${ join( ".", slice( split(".", aws_elasticache_replication_group.cache.primary_endpoint_address), 1, length(split(".", aws_elasticache_replication_group.cache.primary_endpoint_address)) ) ) }" }
we CNAME the address of the master to cache.FULL_DOMAIN
and were hoping to CNAME the address of the reader to cache-ro.FULL_DOMAIN
in order to have a consistent endpoint for our services.
just wanted to highlight that while this workaround is good for many use cases, it doesn't negate the need for this feature :¬)
This has been released in version 3.23.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Community Note
Description
AWS ElastiCache replication group for Redis has attribute called
ReaderEndpoint
. It has the same structure asPrimaryEndpoint
.Terraform aws provider already gives us
primary_endpoint_address
attribute. Implement a new, similar attribute (reader_endpoint_address
?) for the reader endpoint.https://docs.aws.amazon.com/cli/latest/reference/elasticache/describe-replication-groups.html
New or Affected Resource(s)
aws_elasticache_replication_group
resource and datasource