-
Notifications
You must be signed in to change notification settings - Fork 0
/
vpc_endpoint.tf
43 lines (43 loc) · 1.65 KB
/
vpc_endpoint.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
43
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group
resource "aws_security_group" "endpoint_sg" {
name = "endpoint_access"
description = "allow inbound traffic"
vpc_id = module.vpc.vpc.id
tags = {
"Name" = "${var.name}-endpoint-sg"
}
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule
resource "aws_security_group_rule" "ingress_vpc_endpoint" {
description = "Enable access for the endpoints."
type = "ingress"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = [module.vpc.vpc.cidr_block]
security_group_id = aws_security_group.endpoint_sg.id
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint
resource "aws_vpc_endpoint" "logs" {
vpc_id = module.vpc.vpc.id
service_name = "com.amazonaws.${var.region}.logs"
vpc_endpoint_type = "Interface"
subnet_ids = [for subnet in module.vpc.private_subnets : subnet.id]
security_group_ids = [aws_security_group.endpoint_sg.id]
private_dns_enabled = true
tags = {
"Name" = "${var.name}-logs"
}
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_endpoint
resource "aws_vpc_endpoint" "ssm" {
vpc_id = module.vpc.vpc.id
service_name = "com.amazonaws.${var.region}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = [for subnet in module.vpc.private_subnets : subnet.id]
security_group_ids = [aws_security_group.endpoint_sg.id]
private_dns_enabled = true
tags = {
"Name" = "${var.name}-ssm"
}
}