パブリックネットワークをマルチAZにする
code:subnet.tf
resource "aws_subnet" "public_0" {
vpc_id=aws_vpc.example.id
cidr_block="10.0.1.0/24"
availability_zone="ap-northeast-1a"
map_public_ip_on_launch=true
}
resource "aws_subnet" "public_1" {
vpc_id = aws_vpc.example.id
cidr_block = "10.0.2.0/24"
availability_zone = "ap-northeast-1c"
map_public_ip_on_launch = true
}
code:route_table.tf
resource "aws_route_table_association" "public_0"{
subnet_id = aws_subnet.public_0.id
route_table_id = aws_route_table.public.id
}
resource "aws_route_table_association" "public_1"{
subnet_id = aws_subnet.public_1.id
route_table_id=aws_route_table.public.id
}