-
Notifications
You must be signed in to change notification settings - Fork 3
/
_vpc.tf
39 lines (32 loc) · 1.04 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
resource "aws_vpc" "k8s-production" {
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = false
tags {
Name = "k8s-production-vpc"
}
}
resource "aws_subnet" "k8s-public" {
availability_zone = "${var.region}b"
vpc_id = "${aws_vpc.k8s-production.id}"
cidr_block = "${var.subnet_cidr}"
map_public_ip_on_launch = true
}
resource "aws_internet_gateway" "k8s-production" {
vpc_id = "${aws_vpc.k8s-production.id}"
}
resource "aws_route" "k8s-internet_access" {
route_table_id = "${aws_vpc.k8s-production.main_route_table_id}"
destination_cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.k8s-production.id}"
}
resource "aws_route_table" "k8s-public" {
vpc_id = "${aws_vpc.k8s-production.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.k8s-production.id}"
}
}
resource "aws_route_table_association" "k8s-public" {
subnet_id = "${aws_subnet.k8s-public.id}"
route_table_id = "${aws_route_table.k8s-public.id}"
}