-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkubernetes.tf
66 lines (55 loc) · 1.42 KB
/
kubernetes.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
resource "aws_subnet" "kubernetes" {
vpc_id = aws_vpc.team_vpc.id
availability_zone = "us-east-2a"
map_public_ip_on_launch = false
cidr_block = "10.${var.team_number}.192.192/26"
tags = merge(var.default_tags, {
Name = "kubernetes"
network = "public"
})
}
resource "aws_network_acl" "kubernetes" {
vpc_id = aws_vpc.team_vpc.id
ingress {
protocol = "-1"
rule_no = 1000
action = "allow"
cidr_block = "0.0.0.0/0"
from_port = 0
to_port = 0
}
egress {
protocol = "-1"
rule_no = 1000
action = "allow"
cidr_block = "0.0.0.0/0"
from_port = 0
to_port = 0
}
tags = merge(var.default_tags, {
Name = "kubernetes"
})
}
resource "aws_network_acl_association" "kubernetes" {
subnet_id = aws_subnet.kubernetes.id
network_acl_id = aws_network_acl.kubernetes.id
}
resource "aws_route_table" "kubernetes" {
vpc_id = aws_vpc.team_vpc.id
route {
cidr_block = "0.0.0.0/0"
nat_gateway_id = aws_nat_gateway.team.id
}
route {
cidr_block = "172.16.0.0/12"
vpc_peering_connection_id = aws_vpc_peering_connection_accepter.accepter_connection.id
}
tags = {
Name = "kubernetes-corp"
network = "private"
}
}
resource "aws_route_table_association" "kubernetes" {
subnet_id = aws_subnet.kubernetes.id
route_table_id = aws_route_table.kubernetes.id
}