-
Notifications
You must be signed in to change notification settings - Fork 0
/
elasticache.tf
40 lines (34 loc) · 1.32 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
resource "aws_elasticache_subnet_group" "default" {
name = "${var.name}"
subnet_ids = ["${module.vpc.private_subnets}"]
}
resource "aws_security_group" "super_elasticache" {
name_prefix = "super-elasticache-"
vpc_id = "${module.vpc.vpc_id}"
}
resource "aws_security_group_rule" "super_elasticache_ingress" {
security_group_id = "${aws_security_group.super_elasticache.id}"
type = "ingress"
from_port = 6379
to_port = 6379
protocol = "tcp"
source_security_group_id = "${module.eks.worker_security_group_id}"
}
resource "aws_security_group_rule" "super_elasticache_egress" {
security_group_id = "${aws_security_group.super_elasticache.id}"
type = "ingress"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
resource "aws_elasticache_cluster" "super" {
cluster_id = "${var.name}"
engine = "redis"
node_type = "${var.elasticcache_instance_type}"
num_cache_nodes = 1
parameter_group_name = "default.redis5.0"
engine_version = "5.0.3"
subnet_group_name = "${aws_elasticache_subnet_group.default.name}"
security_group_ids = ["${aws_security_group.super_elasticache.id}"]
}