Created
December 11, 2015 02:12
-
-
Save aibou/7a11910963c5c9724703 to your computer and use it in GitHub Desktop.
terraformでVPC作るやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_vpc" "loadtest" { | |
cidr_block = "10.200.0.0/16" | |
enable_dns_support = true | |
enable_dns_hostnames = true | |
tags { | |
Name = "load-test" | |
} | |
} | |
resource "aws_subnet" "public-loadtest-a" { | |
vpc_id = "${aws_vpc.loadtest.id}" | |
cidr_block = "10.200.0.0/20" | |
availability_zone = "${var.aws_region}a" | |
tags { | |
Name = "public-loadtest-a" | |
} | |
} | |
resource "aws_subnet" "public-loadtest-c" { | |
vpc_id = "${aws_vpc.loadtest.id}" | |
cidr_block = "10.200.16.0/20" | |
availability_zone = "${var.aws_region}c" | |
tags { | |
Name = "public-loadtest-c" | |
} | |
} | |
resource "aws_internet_gateway" "loadtest-igw" { | |
vpc_id = "${aws_vpc.loadtest.id}" | |
tags { | |
Name = "loadtest-igw" | |
} | |
} | |
resource "aws_route_table" "loadtest-a-rtb" { | |
vpc_id = "${aws_vpc.loadtest.id}" | |
route { | |
cidr_block = "0.0.0.0/0" | |
gateway_id = "${aws_internet_gateway.loadtest-igw.id}" | |
} | |
tags { | |
Name = "loadtest-a-rtb" | |
} | |
} | |
resource "aws_route_table" "loadtest-c-rtb" { | |
vpc_id = "${aws_vpc.loadtest.id}" | |
route { | |
cidr_block = "0.0.0.0/0" | |
gateway_id = "${aws_internet_gateway.loadtest-igw.id}" | |
} | |
tags { | |
Name = "loadtest-c-rtb" | |
} | |
} | |
resource "aws_route_table_association" "a" { | |
subnet_id = "${aws_subnet.public-loadtest-a.id}" | |
route_table_id = "${aws_route_table.loadtest-a-rtb.id}" | |
} | |
resource "aws_route_table_association" "c" { | |
subnet_id = "${aws_subnet.public-loadtest-c.id}" | |
route_table_id = "${aws_route_table.loadtest-c-rtb.id}" | |
} | |
resource "aws_security_group" "elb" { | |
name = "" | |
vpc_id = "${aws_vpc.loadtest.id}" | |
ingress { | |
from_port = 80 | |
to_port = 80 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
ingress { | |
from_port = 443 | |
to_port = 443 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
egress { | |
from_port = 0 | |
to_port = 0 | |
protocol = "-1" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
route table、local足りない気がする