1.0.8 • Published 7 months ago

@scalereal/terraform-aws-vpc v1.0.8

Weekly downloads
-
License
BSD-3.0
Repository
-
Last release
7 months ago

AWS VPC Module for CDKTF (Typescript)

Overview

This CDKTF module creates a fully featured AWS VPC with customizable subnet configurations. It supports both IPv4 and IPv6 addressing and can create public, private, and database subnets across multiple availability zones.

Features

  • Creates VPC with IPv4 and IPv6 CIDR blocks
  • Automatically spans across all the availability zones
  • Supports multiple subnet types:
    • Public subnets (default)
    • Private subnets (optional)
    • Database subnets (optional)
  • Automatic CIDR block calculation and distribution
  • Internet Gateway for public subnets
  • Optional NAT Gateway for private subnets (IPv4)
  • Optional Egress-Only Internet Gateway for private subnets (IPv6)
  • Automatic route table creation and association
  • Resource tagging with customizable tags

Installation

npm install @scalereal/terraform-aws-vpc
# or
yarn add @scalereal/terraform-aws-vpc
# or
pnpm add @scalereal/terraform-aws-vpc

Usage

import { VpcModule } from '@scalereal/cdktf-aws-vpc';

// In your CDKTF stack
const vpc = new VpcModule(this, 'vpc', {
  cidr: '10.0.0.0/16',
  service_name: 'myapp',
  env: 'dev',
  enable_private_subnets: true, // optional
  enable_database_subnets: true, // optional
  enable_ip4_nat: true, // optional
  enable_ip6_egw: true, // optional
  tags: {
    Project: 'MyProject', // optional
    Owner: 'DevOps' // optional
  }
});

Configuration Options

ParameterTypeRequiredDefaultDescription
cidrstringYes-IPv4 CIDR block for the VPC
service_namestringYes-Name of the service/application
envstringYes-Environment name (e.g., dev, prod)
enable_private_subnetsbooleanNofalseEnable private subnet creation
enable_database_subnetsbooleanNofalseEnable database subnet creation
enable_ip4_natbooleanNofalseEnable NAT Gateway for private subnets
enable_ip6_egwbooleanNofalseEnable Egress-Only Gateway for IPv6
tagsobjectNo{}Additional tags to apply to resources

Outputs

NameTypeDescription
vpc_idstringID of the created VPC
vpc_cidrstringIPv4 CIDR block of the VPC
vpc_ipv6_cidrstringIPv6 CIDR block of the VPC
public_subnet_idsstring[]List of public subnet IDs
private_subnet_idsstring[]List of private subnet IDs (if enabled)
database_subnet_idsstring[]List of database subnet IDs (if enabled)

Architecture

The module creates the following architecture:

  1. VPC with IPv4 and IPv6 CIDR blocks
  2. Public subnets in all available AZs with:
    • Internet Gateway
    • Route table with routes to IGW
  3. Optional private subnets with:
    • NAT Gateway (if enabled)
    • Egress-Only Internet Gateway (if enabled)
    • Route table with appropriate routes
  4. Optional database subnets with:
    • Isolated route table

Requirements

  • CDKTF >= 0.20.0
  • Node.js >= 20.x
  • AWS Provider

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

BSD 3-Clause License - See LICENSE for details.

About Us

This module is maintained by the DevOps team at ScaleReal Technologies. We're a remote first company with a cohesive team, working asynchronously to help people across the globe to build and scale their dream projects.

For more information about ScaleReal and our work:

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1-d

12 months ago

1.0.1-c

12 months ago

1.0.1-b

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago