-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelasticache.tf
38 lines (33 loc) · 1000 Bytes
/
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
resource "aws_security_group" "default_elasticache" {
name_prefix = "test-elasticache"
vpc_id = module.secondary_vpc.vpc_id
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_elasticache_subnet_group" "default" {
name = "test-cache-subnet"
subnet_ids = module.secondary_vpc.private_subnets
}
resource "aws_elasticache_cluster" "test" {
availability_zone = "us-east-1a"
az_mode = "single-az"
cluster_id = "test"
engine = "redis"
engine_version = "6.0"
node_type = "cache.m5.large"
num_cache_nodes = 1
parameter_group_name = "default.redis6.x"
port = 6379
security_group_ids = [aws_security_group.default_elasticache.id]
subnet_group_name = aws_elasticache_subnet_group.default.name
}