From 660572afdc1b3dd3d9e08b98ea4affa6bb802dbc Mon Sep 17 00:00:00 2001 From: xpk Date: Thu, 28 Jan 2021 16:52:18 +0800 Subject: [PATCH] UPD: updated readme --- modules/networking/vpc_subnets/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/networking/vpc_subnets/README.md b/modules/networking/vpc_subnets/README.md index 59b2073..516548c 100644 --- a/modules/networking/vpc_subnets/README.md +++ b/modules/networking/vpc_subnets/README.md @@ -5,6 +5,21 @@ This module performs the following tasks: - Create subnets in every AZ - Create IGW, NGW +## Subnet addressing +This module takes in the VPC cidr. Then add 4 bits to the netmask and divide the cidr into 2 ranges. +First range will be used for private subnet and second for public subnets. +Another 4 bits are added to these ranges for each subnet. + +For example, if the VPC cidr is 10.2.0.0/16, the following subnets will be created: + +| Subnet Type | Subnet AZ1 | Subnet AZ2 | Subnet AZ3 | +|-------------|------------|------------|------------| +| Private | 10.2.0.0/24 | 10.2.1.0/24 | 10.2.2.0/24 | +| Public | 10.2.16.0/24 | 10.2.17.0/24 | 10.2.18.0/24 | + +The VPC cidr netmask should be /20 or above, to produce subnets with /28 netmasks or above. +Subnet smaller than /28 is unlikely useful. + ## Inputs: | Name | Description | Type | Default | Required | |------|-------------|------|---------|:-----:|