File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -293,4 +293,9 @@ variable "fargate_only" {
293
293
variable "ec2_key_enabled" {
294
294
default = false
295
295
description = " Generate a SSH private key and include in launch template of ECS nodes"
296
+ }
297
+
298
+ variable "vpn_cidr" {
299
+ default = [" 10.37.0.0/16" ]
300
+ description = " Cidr of VPN to grant ssh access to ECS nodes"
296
301
}
Original file line number Diff line number Diff line change @@ -32,6 +32,18 @@ resource "aws_security_group_rule" "all_from_alb_internal_to_ecs_nodes" {
32
32
source_security_group_id = aws_security_group. alb_internal [0 ]. id
33
33
}
34
34
35
+ resource "aws_security_group_rule" "ssh_from_vpn_to_ecs_nodes" {
36
+ count = var. ec2_key_enabled ? 1 : 0
37
+
38
+ description = " ssh from VPN"
39
+ type = " ingress"
40
+ from_port = 22
41
+ to_port = 22
42
+ protocol = " tcp"
43
+ cidr_blocks = var. vpn_cidr
44
+ security_group_id = aws_security_group. ecs_nodes . id
45
+ }
46
+
35
47
resource "aws_security_group_rule" "all_from_ecs_nodes_to_ecs_nodes" {
36
48
description = " Traffic between ECS nodes"
37
49
type = " ingress"
You can’t perform that action at this time.
0 commit comments