The module creates a set of resources and configures VPC following a canonical scheme for secure multi-AZ AWS VPC.
The setup includes public and private subnets with NAT gateways and Internet Gateway in specified Avalability Zone(s).

Log in to Corewide IaC registry

Once you have a Corewide Solutions Portal account, this one-time action will use your browser session to retrieve credentials:

 shellterraform login solutions.corewide.com
Provision instructions

Initialize mandatory providers:

Copy and paste into your Terraform configuration and insert the variables:

 hclmodule "tf_aws_vpc" {
  source  = "solutions.corewide.com/aws/tf-aws-vpc/aws"
  version = "~> 2.0.0"

  # specify module inputs here or try one of the examples below
  ...
}

Initialize the setup:

 shellterraform init
Define update strategy

Corewide DevOps team strictly follows Semantic Versioning Specification to provide our clients with products that have predictable upgrades between versions. We recommend pinning patch versions of our modules using pessimistic constraint operator (~>) to prevent breaking changes during upgrades.

To get new features during the upgrades (without breaking compatibility), use ~> 2.0 and run terraform init -upgrade

For the safest setup, use strict pinning with version = "2.0.0"

AWS VPC Setup

Flexible VPC setup in AWS
€460
BUY
291
v2.0.0 released 2 years, 8 months ago
New version approx. every 12 weeks

The module creates a set of resources and configures VPC following a canonical scheme for secure multi-AZ AWS VPC.
The setup includes public and private subnets with NAT gateways and Internet Gateway in specified Avalability Zone(s).

Canonical VPC setup with public and private segments of the network:

 hclmodule "vpc" {
  source  = "solutions.corewide.com/aws/tf-aws-vpc/aws"
  version = "~> 2.0"

  name_prefix = "foo"
  cidr_block  = "20.20.0.0/16"

  subnets = [
    {
      public_subnet_cidr_block  = "20.20.1.0/24"
      availability_zone         = "us-east-1a"
      private_subnet_cidr_block = "20.20.2.0/24"
    },
    # This one is public only
    {
      public_subnet_cidr_block  = "20.20.3.0/24"
      availability_zone         = "us-east-1b"
      private_subnet_cidr_block = null
    },
    {
      public_subnet_cidr_block  = "20.20.4.0/24"
      availability_zone         = "us-east-1c"
      private_subnet_cidr_block = "20.20.5.0/24"
    },
  ]

  tags = {
    Project = "bar"
  }
}

Non-canonical VPC setup with public only segment of the network:

 hclmodule "vpc" {
  source  = "solutions.corewide.com/aws/tf-aws-vpc/aws"
  version = "~> 2.0"

  name_prefix = "foo"
  cidr_block  = "20.20.0.0/16"

  subnets = [
    {
      public_subnet_cidr_block  = "20.20.1.0/24"
      availability_zone         = "us-east-1a"
      private_subnet_cidr_block = null
    },
    {
      public_subnet_cidr_block  = "20.20.3.0/24"
      availability_zone         = "us-east-1b"
      private_subnet_cidr_block = null
    },
  ]

  tags = {
    Project = "bar"
  }
}
Variable Description Type Default Required Sensitive
cidr_block The CIDR block for the VPC string yes no
name_prefix Tag with resource name string yes no
subnets The list of specific definitions for the subnets creation list(object) yes no
tags Tag(s) that must be assigned to resources map(string) yes no
enable_dns_hostnames Defines if DNS hostnames should be enabled for VPC bool true no no
private_subnet_destination_cidr_block Allowed destination CIDR block for access from the public VPC segment string 0.0.0.0/0 no no
public_subnet_destination_cidr_block Allowed destination CIDR block for access from the public VPC segment string 0.0.0.0/0 no no
subnets[*].availability_zone Availability zone of the subnet string yes no
subnets[*].enable_auto_assigning_ips Defines that instances launched into the public subnet should be assigned a public IP address bool true no no
subnets[*].private_subnet_cidr_block The IPv4 CIDR block for the private subnet string yes no
subnets[*].public_subnet_cidr_block The IPv4 CIDR block for the public subnet string yes no
Output Description Type Sensitive
private_subnet Contains attributes of private VPC segment computed no
public_subnet Contains attributes of public VPC segment computed no
vpc Contains attributes of aws_vpc resource resource no
Dependency Version Kind
terraform >= 1.3 CLI
hashicorp/aws ~> 4.0 provider

Not sure where to start?
Let's find your perfect match.