############################################### # DO NOT EDIT THIS FILE # # This file is generated through 'make all'. # If you need to make changes, make your changes # to the corresponding .j file and then rerun # make all ############################################### ########### # Create a VPC with an Internet gateway for everybody to play in resource "aws_vpc" "vpc_primary" { cidr_block = "${var.VPC-Subnet}" enable_dns_support = true enable_dns_hostnames = true tags { Name = "Primary VPC" } } resource "aws_internet_gateway" "gw_primary" { vpc_id = "${aws_vpc.vpc_primary.id}" tags { Name = "Primary Gateway" } } ########### # Create public and private subnets in two different az's data "aws_availability_zones" "available" {} resource "aws_subnet" "subnet_public_a" { vpc_id = "${aws_vpc.vpc_primary.id}" cidr_block = "${var.Public-Subnet-A}" availability_zone = "${data.aws_availability_zones.available.names[0]}" map_public_ip_on_launch = true tags { Name = "Public Subnet A" } } #resource "aws_subnet" "subnet_public_b" { # vpc_id = "${aws_vpc.vpc_primary.id}" # cidr_block = "${var.Public-Subnet-B}" # availability_zone = "${data.aws_availability_zones.available.names[1]}" # map_public_ip_on_launch = true # tags { # Name = "Public Subnet B" # } #} #resource "aws_subnet" "subnet_private_a" { # vpc_id = "${aws_vpc.vpc_primary.id}" # cidr_block = "${var.Private-Subnet-A}" # availability_zone = "${data.aws_availability_zones.available.names[0]}" # map_public_ip_on_launch = true # tags { # Name = "Private Subnet A" # } #} #resource "aws_subnet" "subnet_private_b" { # vpc_id = "${aws_vpc.vpc_primary.id}" # cidr_block = "${var.Private-Subnet-B}" # availability_zone = "${data.aws_availability_zones.available.names[1]}" # map_public_ip_on_launch = true # tags { # Name = "Private Subnet B" # } #} ########## # Routing resource "aws_route_table" "r" { vpc_id = "${aws_vpc.vpc_primary.id}" route { cidr_block = "0.0.0.0/0" gateway_id = "${aws_internet_gateway.gw_primary.id}" } tags { Name = "Primary Route Table" } } resource "aws_route_table_association" "rt_public_a" { subnet_id = "${aws_subnet.subnet_public_a.id}" route_table_id = "${aws_route_table.r.id}" } #resource "aws_route_table_association" "rt_public_b" { # subnet_id = "${aws_subnet.subnet_public_b.id}" # route_table_id = "${aws_route_table.r.id}" #} #resource "aws_route_table_association" "rt_private_a" { # subnet_id = "${aws_subnet.subnet_private_a.id}" # route_table_id = "${aws_route_table.r.id}" #} #resource "aws_route_table_association" "rt_private_b" { # subnet_id = "${aws_subnet.subnet_private_b.id}" # route_table_id = "${aws_route_table.r.id}" #}