-
Notifications
You must be signed in to change notification settings - Fork 0
/
security.tf
42 lines (38 loc) · 1.17 KB
/
security.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
# =============================================================================
# Terraform
# =============================================================================
#
# ECS
# -----------------------------------------------------------------------------
resource "aws_security_group" "alb_sg" {
name = format("%s-cluster-alb-sg", var.cluster_name)
description = format("%s-cluster-alb-sg", var.cluster_name)
vpc_id = var.vpc_id
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = format("%s-cluster-alb-sg", var.cluster_name)
}
}
# Should be restricted, VPC cird
resource "aws_security_group_rule" "vpc" {
type = "ingress"
from_port = 0
to_port = 65535
protocol = "tcp"
cidr_blocks = [var.vpc_ipv4_cird]
security_group_id = aws_security_group.alb_sg.id
}
## Use only for maintenance purposes
resource "aws_security_group_rule" "ssh" {
cidr_blocks = ["0.0.0.0/0"]
from_port = 22
to_port = 22
protocol = "tcp"
security_group_id = aws_security_group.alb_sg.id
type = "ingress"
}