Skip to content

Instantly share code, notes, and snippets.

@jmhale
Created August 6, 2018 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmhale/79a7d1f0a535fc3add83b5a87f6c7d47 to your computer and use it in GitHub Desktop.
Save jmhale/79a7d1f0a535fc3add83b5a87f6c7d47 to your computer and use it in GitHub Desktop.
## Temporary VPC for DEF CON
variable "defcon_cidr_vpc" { default = "10.170.0.0/16" }
variable "defcon_cidr_private_east_1a" { default = "10.170.1.0/24"}
variable "defcon_cidr_private_east_1b" { default = "10.170.2.0/24"}
variable "defcon_cidr_private_east_1c" { default = "10.170.3.0/24"}
variable "defcon_cidr_public_east_1a" { default = "10.170.11.0/24"}
variable "defcon_cidr_public_east_1b" { default = "10.170.12.0/24"}
variable "defcon_cidr_public_east_1c" { default = "10.170.13.0/24"}
# VPC
resource "aws_vpc" "vpc_defcon" {
cidr_block = "${var.defcon_cidr_vpc}"
tags {
Name = "defcon-vpc"
}
}
resource "aws_internet_gateway" "defcon_igw" {
vpc_id = "${aws_vpc.vpc_defcon.id}"
tags {
Name = "defcon-igw",
Project = "common",
tf-managed = "True"
}
}
# Public subnets
resource "aws_subnet" "defcon_subnet_public_east_1a" {
vpc_id = "${aws_vpc.vpc_defcon.id}"
cidr_block = "${var.defcon_cidr_public_east_1a}"
availability_zone = "us-east-1a"
tags {
Name = "defcon-public-us-east-1a",
Project = "common",
tf-managed = "True"
}
}
# Route tables
resource "aws_route_table" "defcon-rtb-public" {
vpc_id = "${aws_vpc.vpc_defcon.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.defcon_igw.id}"
}
tags {
Name = "defcon-rtb-public",
Project = "common",
tf-managed = "True"
}
}
resource "aws_route_table_association" "defcon-rtb-public-1a" {
subnet_id = "${aws_subnet.defcon_subnet_public_east_1a.id}"
route_table_id = "${aws_route_table.defcon-rtb-public.id}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment