-
Notifications
You must be signed in to change notification settings - Fork 40
/
subnet.tf
83 lines (70 loc) · 2.04 KB
/
subnet.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
##____ _ _ ____ _ _ _____ _____
#/ ___|| | | | __ )| \ | | ____|_ _|
#\___ \| | | | _ \| \| | _| | |
##___) | |_| | |_) | |\ | |___ | |
#|____/ \___/|____/|_| \_|_____| |_|
# Subnets with AZ-A
resource "aws_subnet" "subnet-1a-prv" {
vpc_id = "${aws_vpc.vpc.id}"
cidr_block = "${var.vpc["subnet-1a-prv"]}"
availability_zone = "${var.region}a"
tags = "${
map(
"Name", "${var.env}-rt-1a-prv",
"Environment", "${var.env}",
"kubernetes.io/cluster/${var.cluster_defaults["name"]}", "shared"
)
}"
}
## route table association
resource "aws_route_table" "rt-1a-prv" {
vpc_id = "${aws_vpc.vpc.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.igw.id}"
}
tags {
Name = "${var.env}-rt-1a-prv"
Environment = "${var.env}"
}
}
# route table association Zone-A
resource "aws_route_table_association" "rt-1a-prv" {
subnet_id = "${aws_subnet.subnet-1a-prv.id}"
route_table_id = "${aws_route_table.rt-1a-prv.id}"
}
##____ _ _ ____ _ _ _____ _____
#/ ___|| | | | __ )| \ | | ____|_ _|
#\___ \| | | | _ \| \| | _| | |
##___) | |_| | |_) | |\ | |___ | |
#|____/ \___/|____/|_| \_|_____| |_|
# Subnets with AZ-C
resource "aws_subnet" "subnet-1c-prv" {
vpc_id = "${aws_vpc.vpc.id}"
cidr_block = "${var.vpc["subnet-1c-prv"]}"
availability_zone = "${var.region}c"
tags = "${
map(
"Name", "${var.env}-rt-1c-prv",
"Environment", "${var.env}",
"kubernetes.io/cluster/${var.cluster_defaults["name"]}", "shared"
)
}"
}
## route table association
resource "aws_route_table" "subnet-1c-prv" {
vpc_id = "${aws_vpc.vpc.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.igw.id}"
}
tags {
Name = "${var.env}-rt-1c-prv"
Environment = "${var.env}"
}
}
# route table association Zone-C
resource "aws_route_table_association" "subnet-1c-prv" {
subnet_id = "${aws_subnet.subnet-1c-prv.id}"
route_table_id = "${aws_route_table.subnet-1c-prv.id}"
}