Search

VPC

resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" enable_dns_hostnames = true enable_dns_support = true tags = { Name = "gm-vpc" } } resource"aws_internet_gateway" "main" { vpc_id = aws_vpc.main.id tags = { Name = "gm-igw" } } resource "aws_route_table" "public" { vpc_id = aws_vpc.main.id tags = { Name = "gm-public-rtb" } } resource "aws_route" "public" { route_table_id = aws_route_table.public.id destination_cidr_block = "0.0.0.0/0" gateway_id = aws_internet_gateway.main.id } resource "aws_subnet" "public_a" { vpc_id = aws_vpc.main.id cidr_block = "10.0.3.0/24" availability_zone = "ap-northeast-2a" map_public_ip_on_launch = true tags = { Name = "gm-pub-sn-a" } } resource "aws_route_table_association" "public_a" { subnet_id = aws_subnet.public_a.id route_table_id = aws_route_table.public.id } resource "aws_route_table" "private_a" { vpc_id = aws_vpc.main.id tags = { Name = "gm-private-rtb-a" } } resource "aws_route_table" "private_b" { vpc_id = aws_vpc.main.id tags = { Name = "gm-private-rtb-b" } } resource "aws_subnet" "private_a" { vpc_id = aws_vpc.main.id cidr_block = "10.0.1.0/24" availability_zone = "ap-northeast-2a" tags = { Name = "gm-pri-sn-a" } } resource "aws_subnet" "private_b" { vpc_id = aws_vpc.main.id cidr_block = "10.0.2.0/24" availability_zone = "ap-northeast-2b" tags = { Name = "gm-pri-sn-b" } } resource "aws_route_table_association" "private_a" { subnet_id = aws_subnet.private_a.id route_table_id = aws_route_table.private_a.id } resource "aws_route_table_association" "private_b" { subnet_id = aws_subnet.private_b.id route_table_id = aws_route_table.private_b.id }
JSON
복사