GithubHelp home page GithubHelp logo

isabella232 / terraform-aws-ha-vpc-module Goto Github PK

View Code? Open in Web Editor NEW

This project forked from binxio/terraform-aws-ha-vpc-module

0.0 0.0 0.0 52 KB

Terraform module containing a highly available AWS VPC

License: Apache License 2.0

HCL 100.00%

terraform-aws-ha-vpc-module's Introduction

Terraform AWS HA VPC Module

This Terraform module creates a full-fledged highly available AWS VPC. The intention of this module is to deploy a straight-forward highly available IPv4 VPC without too much hassle.

Features

  • Public subnets in every availability zone
  • Private subnets in every availability zone
  • NAT gateway in every availability zone
  • Internet gateway
  • Custom configured route table for public subnets
  • Custom configured route tables for every private subnet

Usage

module "aws_ha_vpc" {
  source = "github.com/binxio/terraform-aws-ha-vpc-module"

  cidr_block = "10.0.0.0/20"
  subnet_newbits = 4
  tags = {
    Key = "Value"
  }
}

How subnets are calculated

We create a public and private availability zone in every availability zone of a particular region (the private subnets are created on top of the already calculated public subnet cidr ranges). To calculate the cidr block of a subnet, we use the following formula:

cidrsubnet(var.cidr_block, var.subnet_newbits, availability_zone_count)

Consider a region with 3 availability zones and a VPC with the range 10.0.0.0/20.

The cidr block ranges of the public subnets are:

> cidrsubnet("10.0.0.0/20", 3, 0)
"10.0.0.0/23"
> cidrsubnet("10.0.0.0/20", 3, 1)
"10.0.2.0/23"
> cidrsubnet("10.0.0.0/20", 3, 2)
"10.0.4.0/23"

The cidr block ranges of the private subnets are:

> cidrsubnet("10.0.0.0/20", 3, 3)
"10.0.6.0/23"
> cidrsubnet("10.0.0.0/20", 3, 4)
"10.0.8.0/23"
> cidrsubnet("10.0.0.0/20", 3, 5)
"10.0.10.0/23"

Requirements

No requirements.

Providers

Name Version
aws 4.2.0

Modules

No modules.

Resources

Name Type
aws_eip.ngws resource
aws_internet_gateway.igw resource
aws_nat_gateway.ngw resource
aws_route.igw resource
aws_route.ngw resource
aws_route_table.private_crt resource
aws_route_table.public_crt resource
aws_route_table_association.private_subnets resource
aws_route_table_association.public_subnets resource
aws_subnet.private_subnet resource
aws_subnet.public_subnet resource
aws_vpc.main resource
aws_availability_zones.available data source
aws_region.current data source

Inputs

Name Description Type Default Required
cidr_block Classless Inter-Domain Routing (CIDR) block string n/a yes
enable_dns_support Enable DNS support bool true no
enable_dns_hostnames Enable DNS hostnames bool false no
subnet_newbits Subnet mask bits string n/a yes
tags Tags that will be applied to all resources map(any) {} no

Outputs

Name Description
vpc_id Outputs the unique VPC identifier
public_subnet_ids Outputs the public subnet identifiers
private_subnet_ids Outputs the private subnet identifiers

terraform-aws-ha-vpc-module's People

Contributors

bschaatsbergen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.