Skip to content

Commit

Permalink
Merge pull request #16 from smerle33/vpc/v3
Browse files Browse the repository at this point in the history
feat(vpc): enhance network/subnet and ipv6
  • Loading branch information
smerle33 authored Oct 9, 2024
2 parents 4a51428 + 7b5b4ac commit e827b01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion providers.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
provider "aws" {
region = "us-east-1"
region = "us-east-1"
# profile = var.aws_profile
assume_role {
role_arn = "arn:aws:iam::326712726440:role/infra-developer"
Expand Down
14 changes: 9 additions & 5 deletions vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module "vpc" {
version = "5.13.0"

name = "${local.cluster_name}-vpc"
cidr = "10.0.0.0/16"
cidr = "10.0.0.0/16" # cannot be less then /16 (more ips)


# dual stack https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/v5.13.0/examples/ipv6-dualstack/main.tf
Expand All @@ -29,17 +29,21 @@ module "vpc" {
# only private subnets for security (to control allowed outbound connections)
private_subnets = [ # only one zone
# first VM ci.jenkins.io
"10.0.0.0/24", # 10.0.0.1 -> 10.0.0.254 (254 ips)
# second for VM agent jenkins
"10.0.1.0/24", # 10.0.1.1 -> 10.0.1.254 (254 ips)
# second for VM agent jenkins
"10.0.2.0/23", # 10.0.2.1 -> 10.0.3.254 (510 ips)
# next for eks agents
"10.0.2.0/24", # 10.0.2.1 -> 10.0.2.254 (254 ips)
"10.0.4.0/23", # 10.0.4.1 -> 10.0.5.254 (510 ips)
]
public_subnets = [ # need at least one for the module (line 1085 : subnet_id = element(aws_subnet.public[*].id,var.single_nat_gateway ? 0 : count.index,))
#fake one
"10.0.254.0/24", # 100.0.254.1 -> 10.0.254.254 (254 ips)
"10.0.255.0/24", # 10.0.255.1 -> 10.0.255.254 (254 ips)
]

## TODO analyse result
public_subnet_ipv6_prefixes = [0]
private_subnet_ipv6_prefixes = [3, 4, 5]

# One NAT gateway per subnet (default)
# ref. https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest#one-nat-gateway-per-subnet-default
enable_nat_gateway = true
Expand Down

0 comments on commit e827b01

Please sign in to comment.