-
Notifications
You must be signed in to change notification settings - Fork 51
/
elasticache.tf
43 lines (35 loc) · 1.08 KB
/
elasticache.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
resource "aws_security_group" "default" {
name_prefix = "${var.namespace}"
vpc_id = "${aws_vpc.default.id}"
ingress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_elasticache_subnet_group" "default" {
name = "${var.namespace}-cache-subnet"
subnet_ids = ["${aws_subnet.default.*.id}"]
}
resource "aws_elasticache_replication_group" "default" {
replication_group_id = "${var.cluster_id}"
replication_group_description = "Redis cluster for Hashicorp ElastiCache example"
node_type = "cache.m4.large"
port = 6379
parameter_group_name = "default.redis3.2.cluster.on"
snapshot_retention_limit = 5
snapshot_window = "00:00-05:00"
subnet_group_name = "${aws_elasticache_subnet_group.default.name}"
automatic_failover_enabled = true
cluster_mode {
replicas_per_node_group = 1
num_node_groups = "${var.node_groups}"
}
}