Terraform module which creates basic VPC on AWS with optional public and private subnets.
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"
}
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.
Name | Version |
---|---|
terraform | >= 1.6.4 |
aws | >= 5 |
Name | Version |
---|---|
aws | 5.27.0 |
No modules.
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 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
availability_zones | Availability zones | list(any) |
[ |
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) |
[ |
no |
public_subnets_cidr | Public Subnets CIDR | list(any) |
[ |
no |
vpc_cidr | The IPv4 CIDR block for the VPC | string |
"10.0.0.0/16" |
no |
Name | Description |
---|---|
vpc_id | VPC id |