Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reader endpoint in aws_elasticache_replication_group #10519

Closed
MateuszStefek opened this issue Oct 16, 2019 · 5 comments · Fixed by #9979
Closed

Reader endpoint in aws_elasticache_replication_group #10519

MateuszStefek opened this issue Oct 16, 2019 · 5 comments · Fixed by #9979
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/elasticache Issues and PRs that pertain to the elasticache service.
Milestone

Comments

@MateuszStefek
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

AWS ElastiCache replication group for Redis has attribute called ReaderEndpoint. It has the same structure as PrimaryEndpoint.

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
@MateuszStefek MateuszStefek added the enhancement Requests to existing resources that expand the functionality or scope. label Oct 16, 2019
@ghost ghost added the service/elasticache Issues and PRs that pertain to the elasticache service. label Oct 16, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 16, 2019
@jamesmcminn96
Copy link

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))
      )
    )
  }"
}

@nikskiz
Copy link

nikskiz commented May 6, 2020

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.

@tormodmacleod
Copy link

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 :¬)

@ghost
Copy link

ghost commented Jan 8, 2021

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!

@ghost
Copy link

ghost commented Feb 5, 2021

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!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.