-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvpc.tf
63 lines (53 loc) · 1.44 KB
/
vpc.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
# Internet VPC
resource "aws_vpc" "kubernetes" {
cidr_block = "10.240.0.0/16"
instance_tenancy = "default"
enable_dns_support = "true"
enable_dns_hostnames = "true"
enable_classiclink = "false"
tags {
Name = "kubernetes"
}
}
resource "aws_vpc_dhcp_options" "kubernetes" {
domain_name = "eu-west-1.compute.internal"
domain_name_servers = ["AmazonProvidedDNS"]
tags {
Name = "kubernetes"
}
}
resource "aws_vpc_dhcp_options_association" "dns_resolver" {
vpc_id = "${aws_vpc.kubernetes.id}"
dhcp_options_id = "${aws_vpc_dhcp_options.kubernetes.id}"
}
# Subnets
resource "aws_subnet" "kubernetes-public-1" {
vpc_id = "${aws_vpc.kubernetes.id}"
cidr_block = "10.240.0.0/16"
map_public_ip_on_launch = "true"
availability_zone = "eu-west-1a"
tags {
Name = "kubernetes-public-1"
}
}
# Internet GW
resource "aws_internet_gateway" "kubernetes-gw" {
vpc_id = "${aws_vpc.kubernetes.id}"
tags {
Name = "kubernetes"
}
}
resource "aws_route_table" "kubernetes-public" {
vpc_id = "${aws_vpc.kubernetes.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.kubernetes-gw.id}"
}
tags {
Name = "kubernetes-public-1"
}
}
resource "aws_route_table_association" "kubernetes-public-1" {
subnet_id = "${aws_subnet.kubernetes-public-1.id}"
route_table_id = "${aws_route_table.kubernetes-public.id}"
}