Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create public and private networks #14

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

Stretch96
Copy link
Member

@Stretch96 Stretch96 commented Nov 21, 2023

  • This calculates the IP range for the 'private' and 'public' networks within the VPC. It does this by initially splitting the given vpc CIDR block into 2, and then calcalting the 'nebits' so that individual '/24' ranges can be calulated for subnets.
  • A subnet for each given availability zone will be created, in both the 'private' and 'public' ranges.
  • A public route table will be created, along with an Internet Gateway, and a 0/0 route created for the gateway. The subnets within the 'public' range will then be associated with this route table, allowing any resource launched within them to access the internet.
  • A private route table will also be created. If 'public' networking is enabled, a NAT gateway will be created in one of the public subnets, and a route created to allow resources within the 'private' subnets access to the internet.
  • Example subnets that will be created:
infrastructure_vpc_cidr_block                 = "10.0.0.0/16"
infrastructure_vpc_network_enable_public      = true
infrastructure_vpc_network_enable_private     = true
infrastructure_vpc_network_availability_zones = ["a", "b", "c"]

public subnets (Allocated "10.0.0.0/17"):
[
  "10.0.0.0/24",
  "10.0.1.0/24",
  "10.0.2.0/24"
]

private subnets (Allocated "10.0.128.0/17"):
[
  "10.0.128.0/24",
  "10.0.129.0/24",
  "10.0.130.0/24"
]

@rjw1
Copy link
Member

rjw1 commented Nov 21, 2023

Could you provide a sample of what the new variables end up outputting. (The plan would be fine possibly)

@Stretch96 Stretch96 force-pushed the create-public-and-private-networks branch 2 times, most recently from fcfde22 to 932ada4 Compare November 21, 2023 16:17
@Stretch96
Copy link
Member Author

I've added an example to the git comment and PR description 👍

@Stretch96 Stretch96 force-pushed the create-public-and-private-networks branch from 932ada4 to 1816a25 Compare November 21, 2023 16:20
@Stretch96 Stretch96 force-pushed the create-public-and-private-networks branch 7 times, most recently from 861c07d to cb34185 Compare November 22, 2023 12:06
* This calculates the IP range for the 'private' and 'public' networks
  within the VPC. It does this by initially splitting the given vpc CIDR
  block into 2, and then calcalting the 'nebits' so that individual '/24'
  ranges can be calulated for subnets.
* A subnet for each given availability zone will be created, in both the
  'private' and 'public' ranges.
* A public route table will be created, along with an Internet Gateway,
  and a 0/0 route created for the gateway. The subnets within the
  'public' range will then be associated with this route table, allowing
  any resource launched within them to access the internet.
* A private route table will also be created. If 'public' networking is
  enabled, a NAT gateway will be created in one of the public subnets,
  and a route created to allow resources within the 'private' subnets
  access to the internet.
* Example subnets that will be created:
```
infrastructure_vpc_cidr_block                 = "10.0.0.0/16"
infrastructure_vpc_network_enable_public      = true
infrastructure_vpc_network_enable_private     = true
infrastructure_vpc_network_availability_zones = ["a", "b", "c"]

public subnets (Allocated "10.0.0.0/17"):
[
  "10.0.0.0/24",
  "10.0.1.0/24",
  "10.0.2.0/24"
]

private subnets (Allocated "10.0.128.0/17"):
[
  "10.0.128.0/24",
  "10.0.129.0/24",
  "10.0.130.0/24"
]
```
@Stretch96 Stretch96 force-pushed the create-public-and-private-networks branch from cb34185 to 2eb260e Compare November 22, 2023 12:09
@Stretch96 Stretch96 merged commit 453808d into main Nov 22, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants