▰▰IaC Bazaar

AWS · AWS · AWS VPC

Production VPC (Multi-AZ)

Terraform / OpenTofuLive-tested

Battle-tested multi-AZ VPC with public/private/database subnets, NAT, endpoints, and flow logs.

Compare Virtual Private Cloud (VPC) across clouds →

Verification

Live-tested

Really deployed, verified, idempotent and destroyed in a cloud sandbox.

Conformance

  • Static validation (fmt · validate · tflint)
  • Security scan: findings disclosed (Checkov)
  • Plan tests (mocked: validation rules · outputs)

Provenance

  • SHA-256 checksum
  • Signature (pending)

Functional

  • Live-tested — applied, verified, destroyed

Last verified 2026-06-11 · how we verify

Details

Type
tf_module
Provider / collection
hashicorp/aws
Target clouds
aws
Target OS
Version
v1.0.0
License
LicenseRef-IaCBazaar-Commercial

$129.00

one-time · perpetual license + 12 months of updates

Included in the builder+ subscription.

Documentation

aws-vpc — Production VPC (Multi-AZ)

Battle-tested multi-AZ VPC with public/private/database subnets, NAT, endpoints, and flow logs. Three subnet tiers (public, private-with-egress, fully isolated database), a NAT strategy dial (none / single / per_az), free S3/DynamoDB gateway endpoints attached to every route table, CloudWatch flow logs behind a least-privilege IAM role, and a stripped default security group — secure defaults you would otherwise assemble from a dozen resources by hand.

Works with Terraform and OpenTofu (>= 1.6), AWS provider >= 6.0, < 7.0.

Usage

module "vpc" {
  source = "./aws-vpc"

  name       = "prod"
  cidr_block = "10.0.0.0/16"
  azs        = ["eu-central-1a", "eu-central-1b", "eu-central-1c"]

  public_subnet_cidrs   = ["10.0.0.0/24", "10.0.1.0/24", "10.0.2.0/24"]
  private_subnet_cidrs  = ["10.0.16.0/20", "10.0.32.0/20", "10.0.48.0/20"]
  database_subnet_cidrs = ["10.0.64.0/24", "10.0.65.0/24", "10.0.66.0/24"]

  nat_gateway_mode = "per_az" # "single" to save money, "none" for air-gapped

  tags = { Environment = "prod" }
}

All subnet CIDR lists are index-aligned to azs (entry i lands in AZ i). Any tier can be omitted by leaving its list empty. Database subnets get a route table with no routes at all — reachable only from inside the VPC.

Inputs

NameTypeDefaultDescription
namestringName prefix for the VPC and all child resources (required)
cidr_blockstringIPv4 CIDR of the VPC (required)
azslist(string)≥ 2 availability zone names (required)
public_subnet_cidrslist(string)[]Public subnet CIDRs, one per AZ
private_subnet_cidrslist(string)[]Private subnet CIDRs, one per AZ
database_subnet_cidrslist(string)[]Isolated database subnet CIDRs, one per AZ
nat_gateway_modestring"single"none, single, or per_az
map_public_ip_on_launchboolfalseAuto-assign public IPs in public subnets
enable_dns_supportbooltrueVPC DNS resolution
enable_dns_hostnamesbooltrueVPC DNS hostnames (needed for interface endpoints/EKS)
instance_tenancystring"default"default or dedicated
gateway_vpc_endpointsset(string)["s3"]Free gateway endpoints: s3 and/or dynamodb
enable_flow_logbooltrueVPC flow log to a module-managed CloudWatch log group
flow_log_traffic_typestring"ALL"ACCEPT, REJECT, or ALL
flow_log_retention_daysnumber90Log group retention (CloudWatch-supported values)
flow_log_max_aggregation_intervalnumber6060 or 600 seconds
flow_log_kms_key_arnstringnullCMK for the flow-log log group
manage_default_security_groupbooltrueStrip all rules from the VPC default SG
public_subnet_tagsmap(string){}Extra tags for public subnets (e.g. kubernetes.io/role/elb)
private_subnet_tagsmap(string){}Extra tags for private subnets
database_subnet_tagsmap(string){}Extra tags for database subnets
tagsmap(string){}Tags applied to all resources

Outputs

NameDescription
vpc_id, vpc_arn, vpc_cidr_blockVPC identifiers
public_subnet_ids, private_subnet_ids, database_subnet_idsSubnet ID lists, AZ-ordered
public_subnets_by_az, private_subnets_by_az, database_subnets_by_azAZ => subnet ID maps
internet_gateway_idIGW ID (null without a public tier)
nat_gateway_ids, nat_public_ipsAZ-keyed NAT gateway IDs / public IPs
public_route_table_id, private_route_table_ids, database_route_table_idRoute table IDs
gateway_vpc_endpoint_idsService => endpoint ID map
flow_log_id, flow_log_group_name, flow_log_role_arnFlow-log resources

Cost notes

  • NAT gateways bill hourly + per-GB. single is the budget option; per_az removes the cross-AZ single point of failure.
  • Gateway endpoints (S3/DynamoDB) are free and on by default for S3 — they keep bulk traffic off the NAT data-processing meter.

Requirements

  • Terraform or OpenTofu >= 1.6
  • hashicorp/aws >= 6.0, < 7.0

Verification

Static-validated (fmt, validate, tflint). Live apply/destroy testing pending cloud sandbox availability — see catalog status.

License

Commercial — IaC Bazaar EULA. © IaC Bazaar. Original work (not derived from a third-party module).