Sha256: 3bdfbcb23d734a256edb60e1a3b7f88e4e63fea63f04d4535e42756fd99774db
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
# Create a VPC resource "aws_vpc" "vpc" { cidr_block = local.cidr_block tags = { Name = "${var.aws_recon_base_name}-${random_id.vpc.hex}" } } # Create subnet resource "aws_subnet" "subnet" { vpc_id = aws_vpc.vpc.id cidr_block = local.subnet_cidr_block availability_zone = data.aws_availability_zones.available.names[0] map_public_ip_on_launch = true tags = { Name = "${var.aws_recon_base_name}-${random_id.vpc.hex}-public" } } resource "aws_security_group" "sg" { name = "${var.aws_recon_base_name}-${random_id.vpc.hex}" description = "Allow AWS Recon collection egress" vpc_id = aws_vpc.vpc.id egress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } tags = { Name = "${var.aws_recon_base_name}-${random_id.vpc.hex}" } } resource "aws_internet_gateway" "igw" { vpc_id = aws_vpc.vpc.id tags = { Name = "${var.aws_recon_base_name}-${random_id.vpc.hex}" } } resource "aws_route_table" "rt" { vpc_id = aws_vpc.vpc.id route { cidr_block = "0.0.0.0/0" gateway_id = aws_internet_gateway.igw.id } tags = { Name = "${var.aws_recon_base_name}-${random_id.vpc.hex}" } } resource "aws_route_table_association" "rt_association" { subnet_id = aws_subnet.subnet.id route_table_id = aws_route_table.rt.id } locals { cidr_block = var.base_subnet_cidr subnet_cidr_block = cidrsubnet(local.cidr_block, 8, 0) } resource "random_id" "vpc" { byte_length = 4 } data "aws_region" "current" {} data "aws_availability_zones" "available" { state = "available" }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aws_recon-0.4.1 | terraform/vpc.tf |