DEVOPS-2289: ElasticCache: Add single reader_endpoint_address to aws_elasticache_replication_group #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why do we need these changes
We had two incidents caused by ElastiCache writer instance for high network and CPU usage. By redirecting all read requests to the read-only Redis replicas, is a quick way to ease the CPU and bandwidth usage of the writer/primary node.
Fix
AWS recently added a single reader endpoint for AWS ElastiCache Redis so that we can only use a single reader endpoint to connect to your Redis read replicas:
https://aws.amazon.com/about-aws/whats-new/2019/06/amazon-elasticache-launches-reader-endpoint-for-redis/
Although, as the official Terraform Provider (for v0.11) is not supporting the single reader endpoint at the moment, we have to modify our fork of the Terraform AWS Provider to return this single reader endpoint.
Changelog
resource/aws_elasticache_replication_group
: Add reader_endpoint_address attributedata-source/aws_elasticache_replication_group
: Add reader_endpoint_address attributeReference
On the official repo of the Terraform AWS Provider, there is an open issue regarding the above use-case.
Regarding this PR, I cherry-picked the changes from this PR (and more specifically this commit):
hashicorp#9979
The changes in this PR will let our (forked) Terraform AWS Provider to return this single endpoint (both with Terraform's
resource
anddata
definitions).In Action
With the newly built binary of the Terraform AWS Provider, and by changing the custom JSON file with the new attribute:
a
terraform plan
will produce the following changelog (in this example we use theArgentina
stack):Output
So, based on the above output, it will replace the endpoints of all the reader hostnames and replace it with the single reader endpoint that AWS will take care of adding/removing endpoints in real-time.