Skip to content

moarpheus/terraform-aws-vpc-basic

Repository files navigation

AWS VPC Terraform module

Terraform module which creates basic VPC on AWS with optional public and private subnets.

Usage

module "vpc" {
  source  = "moarpheus/vpc-basic/aws"
  vpc_cidr = "10.0.0.0/16"

  enable_dns_hostnames  = true
  enable_dns_support    = true

  availability_zones    = ["eu-west-2a", "eu-west-2b", "eu-west-2c"]
  private_subnets_cidr  = ["10.0.0.0/24", "10.0.1.0/24", "10.0.2.0/24"]
  public_subnets_cidr   = ["10.0.3.0/24", "10.0.4.0/24", "10.0.5.0/24"]

  environment = "dev"
}

Internet and NAT gateways

This module will create Internet Gateway and routing for public subnet. It will create NAT gateway in public subnet and create routing for private subnets to have access outside the VPC.

Requirements

Name Version
terraform >= 1.6.4
aws >= 5

Providers

Name Version
aws 5.27.0

Modules

No modules.

Resources

Name Type
aws_eip.nat_eip resource
aws_internet_gateway.ig resource
aws_nat_gateway.nat resource
aws_route.private_nat_gateway resource
aws_route.public_internet_gateway resource
aws_route_table.private resource
aws_route_table.public resource
aws_route_table_association.private resource
aws_route_table_association.public resource
aws_security_group.default resource
aws_subnet.private_subnet resource
aws_subnet.public_subnet resource
aws_vpc.this resource
aws_availability_zones.available data source

Inputs

Name Description Type Default Required
availability_zones Availability zones list(any)
[
"eu-west-2a",
"us-west-2b"
]
no
enable_dns_hostnames Enables DNS hosntnames for the VPC bool true no
enable_dns_support Enables DNS support for the VPC bool true no
environment Environment name string "dev" no
private_subnets_cidr Private subnets CIDR list(any)
[
"10.0.1.0/24",
"10.0.2.0/24"
]
no
public_subnets_cidr Public Subnets CIDR list(any)
[
"10.0.0.0/24"
]
no
vpc_cidr The IPv4 CIDR block for the VPC string "10.0.0.0/16" no

Outputs

Name Description
vpc_id VPC id

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages