Skip to content

lmgsaenz/aws-vpc-terraform

Repository files navigation

aws-vpc-terraform

Usage

module "vpc" {
  source          = "../.."
  name            = "vpc"
  azs             = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
  cidr_block      = "10.0.0.0/16"
  public_subnets  = ["10.0.10.0/24", "10.0.20.0/24", "10.0.30.0/24"]
  private_subnets = ["10.0.40.0/24", "10.0.50.0/24", "10.0.60.0/24"]
  tags            = {
    Terraform = "true"
    Environment = "dev"
  }
}

Requirements

Name Version
terraform >= 1.8
aws >= 5.48

Providers

Name Version
aws >= 5.48

Modules

No modules.

Resources

Name Type
aws_eip.nat resource
aws_internet_gateway.this resource
aws_nat_gateway.this resource
aws_network_acl.private resource
aws_network_acl.public resource
aws_network_acl_rule.private_inbound resource
aws_network_acl_rule.private_outbound resource
aws_network_acl_rule.public_inbound resource
aws_network_acl_rule.public_outbound 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_subnet.private resource
aws_subnet.public resource
aws_vpc.this resource

Inputs

Name Description Type Default Required
azs A list of availabily zones or ids in the region list(string) [] no
cidr_block The IPv4 CIDR block for the VPC string "10.0.0.0/16" no
create_igw Control if you want to create an Internet Gateway for public subnets and the configuration of the routes to connect bool true no
enable_dns_hostnames A boolean flag to enable/disable DNS hostnames in the VPC bool false no
enable_dns_support A boolean flag to enable/disable DNS support in the VPC. bool true no
enable_nat_gateway Control if you want to create an NAT Gateway for private subnets and the configuration of the routes to connect bool false no
igw_tags Additional tags for the Internet Gateway map(string) {} no
instance_tenancy tenancy option for instances launched into the VPC string "default" no
name Name to be used on all resources as identifier string "" no
nat_eip_tags Additional tags for the NAT Elastic IP map(string) {} no
nat_gateway_destinatino_cidr_block Used to define a destination CIDR block for the NAT Gateway. If not specified, the default value is 0.0.0.0/0 string "0.0.0.0/0" no
nat_gateway_per_az Should be true if you want to create a nat gateway per AZs. Requires var.azsvariable and the number of public subnet need to be greater than or equal to the number of AZs bool false no
nat_gateway_tags Additional tags for the NAT Gateways map(string) {} no
private_inbound_network_acl_rule value map(string)
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": "100",
"to_port": 0
}
no
private_network_acl_tags Additional tags for the Private Network ACL map(string) {} no
private_outbound_network_acl_rule value map(string)
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": "100",
"to_port": 0
}
no
private_route_table_tags Additional tags for the Private Route Table map(string) {} no
private_subnet_names Explicit subnet names to use in the Name tag on private subnets. If empty, Name tags are generated automatically list(string) [] no
private_subnet_suffix Suffix to append to private subnets names string "private" no
private_subnet_tags Additional tags for the Private Subnets map(string) {} no
private_subnets A list of private subnets inside the vpc list(string) [] no
public_inbound_network_acl_rule value map(string)
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": "100",
"to_port": 0
}
no
public_network_acl_tags Additional tags for the Public Network ACL map(string) {} no
public_outbound_network_acl_rule value map(string)
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": "100",
"to_port": 0
}
no
public_route_table_per_az Should be true if you want to create a public route table per AZs. Requires var.azsvariable and the number of public subnet need to be greater than or equal to the number of AZs bool false no
public_route_table_tags Additional tags for the Public Route Table map(string) {} no
public_subnet_names Explicit subnet names to use in the Name tag on public subnets. If empty, Name tags are generated automatically list(string) [] no
public_subnet_suffix Suffix to append to public subnets names string "public" no
public_subnet_tags Additional tags for the Public Subnets map(string) {} no
public_subnets A list of public subnets inside the vpc list(string) [] no
single_nat_gateway Should be true if you want create a single shared NAT Gateway across all of your private subnets bool false no
tags A map of tags to add to all resources map(string) {} no
vpc_tags Additional tags for the VPC map(string) {} no

Outputs

Name Description
igw_arn The arn of the Internet Gateway
igw_id The id of the Internet Gateway
nat_ids List of allocation ID of Elastic IPs created for AWS NAT Gateway
nat_public_ips List of public Elastic IPs created for AWS NAT Gateway
natgw_ids List of NAT Gateway IPs
natgw_interface_ids List of Network Interface IDs assigned to NAT Gateways
private_inbound_network_acl_rule_id The ID of the Private Inbound Network ACL Rule
private_nat_gateway_route_ids List of IDs of the Private NAT Gateway route
private_network_acl_arn The ARN of the Private Network ACL
private_network_acl_id The ID of the Private Network ACL
private_outbound_network_acl_rule_id The ID of the Private Outbound Network ACL Rule
private_route_table_arn List of ARN of the Private Route Table
private_route_table_association_id List of ID of the Private Route Table Association
private_route_table_id List of ID of the Private Route Table
private_subnet_arns A list of ARNs of private subnets
private_subnet_ids A list of IDs of private subnets
public_inbound_network_acl_rule_id The ID of the Public Inbound Network ACL Rule
public_internet_gateway_route_ids A list of ID of the Public Internet Gateway Rout
public_network_acl_arn The ARN of the Public Network ACL
public_network_acl_id The ID of the Public Network ACL
public_outbound_network_acl_rule_id The ID of the Public Outbound Network ACL Rule
public_route_table_arns A list of ARN of the Public Route Table
public_route_table_association_ids List of IDs of the Public Route Table Association
public_route_table_ids A list of ID of the Public Route Table
public_subnet_arns A list of ARNs of public subnets
public_subnet_ids A list of IDs of public subnets
vpc_arn The ARN of the VPC
vpc_cidr_block The CIDR Block of the VPC
vpc_id The ID of the VPC

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages