forked from chelto/ApiGateway-Fargate-Terraform-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendpoints.tf
82 lines (78 loc) · 2.18 KB
/
endpoints.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# s3
resource "aws_vpc_endpoint" "s3" {
vpc_id = var.vpc_id
service_name = "com.amazonaws.${var.region}.s3"
route_table_ids = [for s in data.aws_route_table.selected : s.id]
auto_accept = true
vpc_endpoint_type = "Gateway"
tags = merge(
var.default_tags,
{
Name = "s3-vpc-endpoint"
}
)
}
# API Gateway
resource "aws_vpc_endpoint" "apigateway-endpoint" {
vpc_id = var.vpc_id
service_name = "com.amazonaws.${var.region}.execute-api"
security_group_ids = [aws_security_group.VPC_endpoint_sg.id]
subnet_ids = tolist(data.aws_subnet_ids.private.ids)
private_dns_enabled = true
auto_accept = true
vpc_endpoint_type = "Interface"
tags = merge(
var.default_tags,
{
Name = "apigateway-vpc-endpoint"
}
)
}
# ECR
resource "aws_vpc_endpoint" "ecr-endpoint" {
vpc_id = var.vpc_id
service_name = "com.amazonaws.${var.region}.ecr.api"
security_group_ids = [aws_security_group.VPC_endpoint_sg.id]
subnet_ids = tolist(data.aws_subnet_ids.private.ids)
private_dns_enabled = true
auto_accept = true
vpc_endpoint_type = "Interface"
tags = merge(
var.default_tags,
{
Name = "ecr-vpc-endpoint"
}
)
}
# cloudwatch
resource "aws_vpc_endpoint" "logs-endpoint" {
vpc_id = var.vpc_id
service_name = "com.amazonaws.${var.region}.logs"
security_group_ids = [aws_security_group.VPC_endpoint_sg.id]
subnet_ids = tolist(data.aws_subnet_ids.private.ids)
private_dns_enabled = true
auto_accept = true
vpc_endpoint_type = "Interface"
tags = merge(
var.default_tags,
{
Name = "cloudwatch-vpc-endpoint"
}
)
}
# docker
resource "aws_vpc_endpoint" "docker-endpoint" {
vpc_id = var.vpc_id
service_name = "com.amazonaws.${var.region}.ecr.dkr"
security_group_ids = [aws_security_group.VPC_endpoint_sg.id]
subnet_ids = tolist(data.aws_subnet_ids.private.ids)
private_dns_enabled = true
auto_accept = true
vpc_endpoint_type = "Interface"
tags = merge(
var.default_tags,
{
Name = "docker-ECR-vpc-endpoint"
}
)
}