Terraform: Support for Replication Groups for Elasticache

Created on 17 Dec 2015  ยท  47Comments  ยท  Source: hashicorp/terraform

Amazon have support for Mutli-AZ deployments for Elasticache nodes, including Redis v2.8.6+.

Meaning you get automatic failover, via the master/slave replication via slave promotion.

http://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_CreateReplicationGroup.html

Currently according to the docs it isn't possible to create one of these via terraform, would be great if this was available for the next release.

enhancement new-resource provideaws

Most helpful comment

Just saw 0.7 rc2 go out without this feature yesterday. Redundancy is quite important for a production-level architecture using Redis. I'm use non-redundancy at the moment via terraform to begin engineering on top of ElastiCache, but I hope to get this added soon. Any way we can bump the priority of this?

All 47 comments

@zoltrain just a FYI, I have started this and will finish it in a day or 2 - #4363

Amazing! HA Redis FTW

Need this, any updates on it?

+1 for this!

Need this also, any updates/ETA?

Any news on this?

+1!

+1

+1

+1 - any updates on this?

+1

+1

+1

+1

+1

+1

:+1:

+1

+1

Wow, I can't tell if these +1s are trolling or not. Do the terraform developers actually use this information to prioritize work or are we all just spamming each other uselessly?

@catsby Any chance this is somewhere on Hashicorp's radar for implementation? Not being able to set a replication group is preventing us from being able to use Terraform to deploy our redis clusters in AWS.

sorry to ping you directly, I just know you've worked on some of the AWS providers :)

+1

Also very much hoping to see this. We need multi-AZ Redis capabilities and it looks like we'll have to roll our own machines rather than using ElastiCache. :(

+1

Maybe this can help someone?

resource "aws_cloudformation_stack" "default_elasticache" {
name = "${var.product}-${var.redis_dns}-${var.environment}-${var.region}-replgrp"
on_failure = "DELETE"
template_body = < {
"Resources" : {
"${var.product}${var.redis_dns}replgrp": {
"Type" : "AWS::ElastiCache::ReplicationGroup",
"Properties" : {
"AutomaticFailoverEnabled" : "true",
"AutoMinorVersionUpgrade" : "true",
"CacheNodeType" : "${var.reddis_instance_size}",
"CacheSubnetGroupName" : "${aws_elasticache_subnet_group.default_reddis_sg.name}",
"Engine" : "redis",
"NumCacheClusters" : "2",
"Port" : "6379",
"PreferredCacheClusterAZs" : ["eu-west-1a", "eu-west-1b"],
"ReplicationGroupDescription" : "${aws_elasticache_subnet_group.default_reddis_sg.name}",
"SecurityGroupIds" : ["${aws_security_group.default.id}"],
"PreferredMaintenanceWindow" : "wed:09:25-wed:22:30",
"SnapshotRetentionLimit" : "5",
"SnapshotWindow" : "03:30-05:30"
}
}
},
"Outputs" : {
"endpoint" : {
"Description": "Redis Cluster Endpoint",
"Value" : { "Fn::GetAtt" : [ "${var.product}${var.redis_dns}replgrp", "PrimaryEndPoint.Address"]}
}
}
}
STACK
}

Then I get the cache primary cluster endpoint using IAM roles on the specific box and this command. Basically I pull in the redis_cache cluster description and get the replication group and use that to find the endpoint and finally override my config.

redis_description=$(/usr/bin/curl -fs http://169.254.169.254/latest/user-data | jq -r '.host_variables.redis_description')
redis_endpoint=$(/usr/local/bin/aws --region eu-west-1 elasticache describe-replication-groups | jq -r ".ReplicationGroups[] | select(.Description == \"${redis_description}\") | .NodeGroups[].PrimaryEndpoint.Address")

this is very much needed :)

+1

+1

It's been 8 month and nothing...? Please add support!

+1

+1

+2

+1

+1

Just saw 0.7 rc2 go out without this feature yesterday. Redundancy is quite important for a production-level architecture using Redis. I'm use non-redundancy at the moment via terraform to begin engineering on top of ElastiCache, but I hope to get this added soon. Any way we can bump the priority of this?

Any news on this? @mitchellh - we have a production roll out in the pipeline that I would love to use Terraform for, and Replication Groups for Elasticache would be a piece that we need.

I'm shocked this isn't in here. +1 on getting this feature out. Currently working on a production rollout of some new systems and this is a huge blocker.

Just a tip - We have been using the Terraform CloudFormation provider to build our Elasticache clusters in production and it works fine for the time being

@MrPink Yea I figured that is possible but didn't spend the time to do that. Mind gist-ing some example code to save some of us some time until this is implemented in Terraform?

+1

+1

Here's the Gist for creating a Replication group with Cloudformation and controlling it with Terraform https://gist.github.com/MrPink/393840d460c0cb1caa5074d3fafd5657 - Unfortunately I have to modify it after with aws-cli to enable snapshots as its currently not possible with CF.

+1

This is a blocker. It should be moved higher in the priority list.

Finally got back to doing the work here - #8275 should fix it up!

Closed via #8275

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings