-
Notifications
You must be signed in to change notification settings - Fork 0
/
endpoint.tf
54 lines (45 loc) · 1.22 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
// Endpoint
resource "aws_vpc_endpoint" "bridge_endpoint" {
provider = aws.internal_account
vpc_id = var.target_vpc_id
subnet_ids = var.target_subnet_ids
security_group_ids = [
aws_security_group.bridge_endpoint_security_group.id
]
service_name = aws_vpc_endpoint_service.bridge_service.service_name
auto_accept = true
vpc_endpoint_type = "Interface"
tags = {
Name = "${var.project_name}-bridge-endpoint"
}
depends_on = [
aws_vpc_endpoint_service.bridge_service
]
}
// Security Groups to only allow HTTP and SSH Traffic
resource "aws_security_group" "bridge_endpoint_security_group" {
provider = aws.internal_account
name = "${var.project_name}-bridge-endpoint-sg"
vpc_id = var.target_vpc_id
ingress {
description = "HTTP Connection"
protocol = "tcp"
from_port = 80
to_port = 80
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "${var.project_name}-bridge-endpoint-sg"
}
}
// Route 53 Record
resource "aws_route53_record" "application_record" {
provider = aws.internal_account
name = "*"
type = "CNAME"
zone_id = var.target_hosted_zone_id
records = [
aws_vpc_endpoint.bridge_endpoint.dns_entry[0].dns_name
]
ttl = 300
}