Skip to main content
Type: rvn-aws-network · Latest version: 0.2.2

Dependencies and consumers

Every dependency input can be specified manually to reference existing external infrastructure rather than a Ravion module.

Readme

Production-ready AWS VPC with public and private subnets, NAT gateways, and compliance-ready flow logs.

Overview

A VPC (Virtual Private Cloud) is the foundational networking layer for your AWS infrastructure. This module creates an isolated virtual network with public and private subnets spanning multiple availability zones, giving you complete control over your networking environment. The VPC module provides:
  • Public and private subnets across multiple availability zones for high availability
  • NAT Gateway options for outbound internet access from private subnets
  • VPC Flow Logs for network traffic monitoring and SOC 2 compliance
  • VPC Peering to connect with existing VPCs across accounts or regions
Terraform source: flightcontrolhq/modules/networking/vpc

Use cases

Subnet types

Public subnets

Public subnets have direct internet access via a free Internet Gateway. Resources in public subnets do not receive public IP addresses automatically; attach public IPs explicitly when needed. Use these for:
  • Load balancers (ALB, NLB)
  • Bastion hosts
  • NAT Gateways

Private subnets

Private subnets have no direct internet access. Outbound traffic routes through NAT Gateway(s) when enabled. Use these for:
  • Application servers (ECS tasks, EKS pods)
  • RDS databases
  • ElastiCache clusters
  • Lambda functions with VPC access

NAT Gateway

NAT Gateway gives your private subnets two things:
  1. Internet access — Resources can reach the internet for updates, API calls, and external services
  2. Static public IP — All outbound traffic exits through the same IP, so partners can allowlist your IP address

Keeping your IP stable

By default, the module creates a new Elastic IP for each NAT Gateway. If you ever reprovision the VPC, that IP changes. To keep the same IP permanently, create your Elastic IPs separately and pass in the allocation IDs. This way, even if you destroy and recreate the entire VPC, your NAT Gateway will use the same public IP — no need to update partner allowlists or firewall rules.

Configuration

VPC Peering

Connect this VPC to existing VPCs for private communication without traversing the internet. Peering supports:
  • Same-account, same-region: Auto-accepts and configures routes in both directions
  • Cross-account or cross-region: Creates the peering request; peer must accept and configure return routes

SOC 2 compliance

Enable Flow Logs to capture network traffic metadata for security auditing. Flow logs record:
  • Source and destination IP addresses
  • Ports and protocols
  • Packet and byte counts
  • Accept/reject actions
Logs are stored in CloudWatch Logs with configurable retention. This satisfies SOC 2 requirements for network traffic monitoring and audit trails.

Design decisions

This VPC follows AWS VPC best practices:
  • Availability zone spread: Subnets are provisioned across up to 3 AZs by default, capped by the AZs available in the selected region and AWS account
  • Automatic CIDR allocation: Subnets are /24 blocks carved from your VPC CIDR. With the default 10.0.0.0/16, the first three public subnets get 10.0.1.0/24, 10.0.2.0/24, 10.0.3.0/24 and private subnets get 10.0.11.0/24, 10.0.12.0/24, 10.0.13.0/24.
  • DNS enabled: DNS support and hostnames are enabled for service discovery
  • Single route table for public: All public subnets share one route table with an Internet Gateway route
  • Per-AZ route tables when HA NAT: Each private subnet gets its own route table pointing to the NAT in its AZ

Learn more

AWS VPC Network Architecture

Inputs reference

All inputs for rvn-aws-network version 0.2.2. Use the name shown for each field as the input key in module config.

AWS account & region

aws_account_id
string
required
AWS account.
  • Immutable after creation
aws_region
string
required
Region. Recommend anything but us-east-1 as it has the most outages.
  • Immutable after creation

VPC config

name
string
required
Name slug. Name prefix for all resources created by this module.
  • Default: <<project.given_id>>-<<environment.given_id>>
  • Immutable after creation
  • Pattern: ^[a-z0-9]([a-z0-9-]{0,34}[a-z0-9])?$ — The name must be 1-36 characters, contain only lowercase letters, numbers, and hyphens, and start and end with a letter or number.
vpc_cidr
string
VPC CIDR. The IPv4 CIDR block for the VPC.
  • Default: 10.0.0.0/16
  • Immutable after creation
subnet_count
number
Subnet pairs. Leave empty to create up to 3 public/private subnet pairs, capped by the availability zones available in the selected region and AWS account.
  • Min: 1
  • Max: 6

NAT gateway

nat_gateway_enabled
boolean
NAT gateway. Needed if you want to access the internet from within private subnets
  • Default: true
nat_gateway_high_availability_enabled
boolean
NAT gateway high availability. High availability adds NAT Gateway to every AZ. Otherwise single NAT gateway serves all AZs.
  • Default: false
nat_gateway_eip_allocation_ids
string_array
NAT gateway Elastic IP allocation IDs. A list of pre-allocated Elastic IP allocation IDs (for example from the networking/eips module) to associate with the NAT Gateway(s). When null or empty (default), the module allocates new EIPs internally.The list length must match the number of NAT Gateways the module will create:
  • 1 when nat_gateway_high_availability_enabled = false
  • the resolved subnet pair count when nat_gateway_high_availability_enabled = true
Supplied EIPs must already exist with domain = “vpc”. This is useful for keeping NAT public IPs stable across VPC replacements (e.g. for partner allowlists or firewall rules).

SOC 2

flow_logs_enabled
boolean
Flow logs. Enable VPC Flow Logs for network traffic monitoring. Required for SOC 2.
  • Default: false

Misc

tags
keyvalue
Tags. A map of tags to assign to all resources. Default tags are Owner, ProjectGivenId, EnvironmentGivenId, ModuleGivenId, ModuleId

VPC peering

vpc_peering_connections
object_map
Peering connections. Connect this VPC to other VPCsNOTE: For cross-account or cross-region peerings, this module cannot manage the peer VPC’s route tables. The owner of the peer VPC is responsible for adding return routes pointing at the peering connection.

Terraform settings

opentofu_version
string
OpenTofu version override. Override the environment’s default version for this module
ravion_state_backend_workspace
string
Ravion Terraform workspace name. Override Terraform state backend workspace name. Defaults to project + environment + module given ids.
  • Immutable after creation
advanced_terraform_variables
object
Advanced Terraform variables. Optional raw Terraform variable overrides for advanced module inputs or one-off overrides. Values here override the generated variables above.
  • Default: {}
execution_environment_id
string
Terraform execution environment. Override the VPC, subnet, and security group for Terraform runners. Must use the same AWS account as selected above.