-
Notifications
You must be signed in to change notification settings - Fork 0
/
vpc.tf
53 lines (42 loc) · 1.16 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
# This data source is included for ease of sample architecture deployment
# and can be swapped out as necessary.
data "aws_availability_zones" "available" {}
resource "aws_vpc" "rakam" {
cidr_block = "10.0.0.0/16"
tags = "${
map(
"Name", "terraform-eks-rakam-node",
"kubernetes.io/cluster/${var.cluster-name}", "shared",
)
}"
}
resource "aws_subnet" "rakam" {
count = 2
availability_zone = "${data.aws_availability_zones.available.names[count.index]}"
cidr_block = "10.0.${count.index}.0/24"
vpc_id = "${aws_vpc.rakam.id}"
tags = "${
map(
"Name", "terraform-eks-rakam-node",
"kubernetes.io/cluster/${var.cluster-name}", "shared",
)
}"
}
resource "aws_internet_gateway" "rakam" {
vpc_id = "${aws_vpc.rakam.id}"
tags = {
Name = "terraform-eks-rakam"
}
}
resource "aws_route_table" "rakam" {
vpc_id = "${aws_vpc.rakam.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.rakam.id}"
}
}
resource "aws_route_table_association" "rakam" {
count = 2
subnet_id = "${aws_subnet.rakam.*.id[count.index]}"
route_table_id = "${aws_route_table.rakam.id}"
}