File tree 1 file changed +23
-19
lines changed 1 file changed +23
-19
lines changed Original file line number Diff line number Diff line change 1
- resource "aws_default_security_group" "default" {
2
- vpc_id = aws_vpc. this . id
3
- }
1
+ # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group
4
2
resource "aws_security_group" "elasticache" {
5
- name = " app-4 -elasticache-sg"
3
+ name = " ${ var . name } -elasticache-sg"
6
4
description = " Allow inbound to and outbound access from the Amazon ElastiCache cluster."
7
- ingress {
8
- from_port = 6379
9
- to_port = 6379
10
- protocol = " tcp"
11
- cidr_blocks = [var . vpc_cidr ]
12
- description = " Enable communication to the Amazon ElastiCache for Redis cluster. "
13
- }
14
- egress {
15
- from_port = 0
16
- to_port = 0
17
- protocol = " -1"
18
- cidr_blocks = [" 0.0.0.0/0" ]
19
- description = " Enable access to the ElastiCache cluster."
20
- }
21
- vpc_id = aws_vpc. this . id
5
+ vpc_id = module. vpc . vpc . id
6
+ }
7
+ # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule
8
+ resource "aws_security_group_rule" "elasticache_ingress" {
9
+ type = " ingress"
10
+ security_group_id = aws_security_group. elasticache . id
11
+ from_port = 6379
12
+ to_port = 6379
13
+ protocol = " tcp"
14
+ cidr_blocks = [var . vpc_cidr ]
15
+ description = " Enable communication to the Amazon ElastiCache for Redis cluster."
16
+ }
17
+ # https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule
18
+ resource "aws_security_group_rule" "elasticache_egress" {
19
+ type = " egress"
20
+ security_group_id = aws_security_group. elasticache . id
21
+ from_port = 0
22
+ to_port = 0
23
+ protocol = " -1"
24
+ cidr_blocks = [" 0.0.0.0/0" ]
25
+ description = " Enable access to the ElastiCache cluster."
22
26
}
You can’t perform that action at this time.
0 commit comments