Is it possible to create a ElastiCache Clustered Redis cluster from a snapshot using Terraform?
I don't see a Terraform option similar to the create-replication-group --node-group-configuration
cli option.
Error:
Error creating Elasticache Replication Group: InvalidParameterCombination: Slots must be provided when restoring from snapshot ARNs with cluster mode enabled
Terraform:
resource "aws_elasticache_replication_group" "test-cluster" {
replication_group_id = "test-cluster"
replication_group_description = "test cluster"
node_type = "cache.r3.xlarge"
parameter_group_name = "default.redis3.2.cluster.on"
port = 6379
automatic_failover_enabled = true
subnet_group_name = "${var.subnet_group_name}"
security_group_ids = ["${var.security_group_id}"]
cluster_mode {
replicas_per_node_group = 3
num_node_groups = 3
}
snapshot_arns = ["${var.snapshot_arns}"]
}
Best Answer
Just got an answer from AWS , its not yet possible with terraform , you need to use sdk or cli or console to do that as this feature was added in last2016. https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Replication.CreatingReplGroup.NoExistingCluster.Cluster.html#Replication.CreatingReplGroup.NoExistingCluster.Cluster.API