-
Notifications
You must be signed in to change notification settings - Fork 0
/
sg.tf
37 lines (32 loc) · 833 Bytes
/
sg.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
data "aws_subnet" "selected" {
count = length(var.subnet_ids) > 0 ? 1 : 0
id = var.subnet_ids[0]
}
resource "aws_security_group" "lambda" {
count = length(var.subnet_ids) > 0 ? 1 : 0
name = "${var.prefix}lambda_alb_logs_to_elasticsearch"
description = "${var.prefix}lambda_alb_logs_to_elasticsearch"
vpc_id = data.aws_subnet.selected[0].vpc_id
egress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 53
to_port = 53
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 53
to_port = 53
protocol = "udp"
cidr_blocks = ["0.0.0.0/0"]
}
tags = merge(
var.tags,
tomap({ "Scope" = "${var.prefix}lambda_function_to_elasticsearch" }),
)
}