-
Notifications
You must be signed in to change notification settings - Fork 3
/
vpce.tf
114 lines (89 loc) · 3.93 KB
/
vpce.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
resource "aws_vpc_endpoint" "ec2" {
vpc_id = data.aws_vpc.vpc.id
service_name = "com.amazonaws.${data.aws_region.current.name}.ec2"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private_subnet.*.id
private_dns_enabled = true
security_group_ids = [aws_security_group.infrastructure_security_group.id]
}
resource "aws_vpc_endpoint" "elasticloadbalancing" {
vpc_id = data.aws_vpc.vpc.id
service_name = "com.amazonaws.${data.aws_region.current.name}.elasticloadbalancing"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private_subnet.*.id
private_dns_enabled = true
security_group_ids = [aws_security_group.infrastructure_security_group.id]
}
resource "aws_vpc_endpoint" "secretsmanager" {
vpc_id = data.aws_vpc.vpc.id
service_name = "com.amazonaws.${data.aws_region.current.name}.secretsmanager"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private_subnet.*.id
private_dns_enabled = true
security_group_ids = [aws_security_group.infrastructure_security_group.id]
}
resource "aws_vpc_endpoint" "ec2messages" {
vpc_id = data.aws_vpc.vpc.id
service_name = "com.amazonaws.${data.aws_region.current.name}.ec2messages"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private_subnet.*.id
private_dns_enabled = true
security_group_ids = [aws_security_group.infrastructure_security_group.id]
}
resource "aws_vpc_endpoint" "ssm" {
vpc_id = data.aws_vpc.vpc.id
service_name = "com.amazonaws.${data.aws_region.current.name}.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private_subnet.*.id
private_dns_enabled = true
security_group_ids = [aws_security_group.infrastructure_security_group.id]
}
resource "aws_vpc_endpoint" "ssmmessages" {
vpc_id = data.aws_vpc.vpc.id
service_name = "com.amazonaws.${data.aws_region.current.name}.ssmmessages"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private_subnet.*.id
private_dns_enabled = true
security_group_ids = [aws_security_group.infrastructure_security_group.id]
}
resource "aws_vpc_endpoint" "sts" {
vpc_id = data.aws_vpc.vpc.id
service_name = "com.amazonaws.${data.aws_region.current.name}.sts"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private_subnet.*.id
private_dns_enabled = true
security_group_ids = [aws_security_group.infrastructure_security_group.id]
}
resource "aws_vpc_endpoint" "ecr_dkr" {
vpc_id = data.aws_vpc.vpc.id
service_name = "com.amazonaws.${data.aws_region.current.name}.ecr.dkr"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private_subnet.*.id
private_dns_enabled = true
security_group_ids = [aws_security_group.infrastructure_security_group.id]
}
resource "aws_vpc_endpoint" "ecr_api" {
vpc_id = data.aws_vpc.vpc.id
service_name = "com.amazonaws.${data.aws_region.current.name}.ecr.api"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private_subnet.*.id
private_dns_enabled = true
security_group_ids = [aws_security_group.infrastructure_security_group.id]
}
resource "aws_vpc_endpoint" "s3" {
vpc_id = data.aws_vpc.vpc.id
service_name = "com.amazonaws.${data.aws_region.current.name}.s3"
vpc_endpoint_type = "Gateway"
# policy = data.aws_iam_policy_document.cds-endpoint-policy.json
}
resource "aws_main_route_table_association" "main_route_table_association" {
vpc_id = data.aws_vpc.vpc.id
route_table_id = aws_route_table.main_route_table.id
}
resource "aws_vpc_endpoint_route_table_association" "s3_main_route_table_association" {
route_table_id = aws_route_table.main_route_table.id
vpc_endpoint_id = aws_vpc_endpoint.s3.id
}
resource "aws_route_table" "main_route_table" {
vpc_id = data.aws_vpc.vpc.id
}