Skip to content

Commit

Permalink
CDPAUTO-102 Improve subnet CIDR calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsgaspar committed Aug 5, 2023
1 parent 6198d7b commit beda186
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/terraform-cdp-aws-pre-reqs/modules/vpc/defaults.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ locals {
# Extract the VPC CIDR range from the user-provided CIDR
vpc_cidr_range = split("/",var.vpc_cidr)[1]

# Calculate the first suitable CIDR range for public subnets after private subnets have been allocated.
# Calculate the first suitable CIDR range for public subnets after private subnets have been allocated (normalize the offset, expressed as a multiplier of public subnet ranges)
public_subnet_offset = ceil(local.subnets_required.private * pow(2, 32-var.private_cidr_range)/pow(2, 32-var.public_cidr_range))
}

0 comments on commit beda186

Please sign in to comment.