forked from giuliocalzolari/terraform-aws-es-cleanup
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sg.tf
40 lines (34 loc) · 874 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
38
39
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_cleanup_to_elasticsearch${var.suffix}"
description = "${var.prefix}lambda_cleanup_to_elasticsearch${var.suffix}"
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,
{
"Scope" = "${var.prefix}lambda_function_to_elasticsearch${var.suffix}"
},
)
}