-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubnet.tf
More file actions
57 lines (47 loc) · 1.34 KB
/
subnet.tf
File metadata and controls
57 lines (47 loc) · 1.34 KB
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
# Create subnets in the VPCs
resource "aws_subnet" "subnet_us_east" {
vpc_id = aws_vpc.vpc_us_east.id
cidr_block = "10.0.1.0/24"
availability_zone = "us-east-1a"
map_public_ip_on_launch = true
provider = aws.us-east
}
resource "aws_subnet" "subnet_us_west" {
vpc_id = aws_vpc.vpc_us_west.id
cidr_block = "10.1.1.0/24"
availability_zone = "us-west-1a"
map_public_ip_on_launch = true
provider = aws.us-west
}
# East components
resource "aws_route_table" "east-pub-RT" {
vpc_id = aws_vpc.vpc_us_east.id
route {
cidr_block = var.WEST
gateway_id = aws_vpc_peering_connection.vpc_peering.id
}
tags = {
Name = "east-pub-RT"
}
}
resource "aws_route_table_association" "east-pub-1-a" {
subnet_id = aws_subnet.subnet_us_east.id
route_table_id = aws_route_table.east-pub-RT.id
}
# West components
resource "aws_route_table" "west-pub-RT" {
vpc_id = aws_vpc.vpc_us_west.id
provider = aws.us-west
route {
cidr_block = var.EAST
gateway_id = aws_vpc_peering_connection.vpc_peering.id
}
tags = {
Name = "west-pub-RT"
}
}
resource "aws_route_table_association" "west-pub-1-a" {
subnet_id = aws_subnet.subnet_us_west.id
route_table_id = aws_route_table.west-pub-RT.id
provider = aws.us-west
}