-
Notifications
You must be signed in to change notification settings - Fork 51
/
security_groups.tf
38 lines (27 loc) · 1016 Bytes
/
security_groups.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" "cluster" {
name = "${var.component}-${var.deployment_identifier}-${var.cluster_name}"
description = "Container access for component: ${var.component}, deployment: ${var.deployment_identifier}, cluster: ${var.cluster_name}"
vpc_id = var.vpc_id
tags = merge(local.tags, {
Name = "${var.component}-${var.deployment_identifier}-${var.cluster_name}"
ClusterName = var.cluster_name
})
}
resource "aws_security_group_rule" "cluster_default_ingress" {
count = var.include_default_ingress_rule ? 1 : 0
type = "ingress"
security_group_id = aws_security_group.cluster.id
protocol = "-1"
from_port = 0
to_port = 0
cidr_blocks = var.default_ingress_cidrs
}
resource "aws_security_group_rule" "cluster_default_egress" {
count = var.include_default_egress_rule ? 1 : 0
type = "egress"
security_group_id = aws_security_group.cluster.id
protocol = "-1"
from_port = 0
to_port = 0
cidr_blocks = var.default_egress_cidrs
}