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

Hardcoded newbits value in cidrsubnet Function Causing Scalability Issues #1156

Open
Vinoth-S15 opened this issue Jan 7, 2025 · 1 comment
Labels

Comments

@Vinoth-S15
Copy link

Is your request related to a problem? Please describe.

The current code uses a hardcoded value for the newbits argument in the cidrsubnet function, which is not scalable and is causing issues when creating a VPC with non-/56 ranges.

For example, if the VPC IPv6 CIDR block is /60, the code attempts to create a subnet with /68, which is an unacceptable value.

Describe the solution you'd like.

To improve scalability, I propose introducing a new variable that provides the flexibility to select subnet sizes based on the VPC's IPv6 CIDR block size.

Resource: aws_subnet

Current argument:

ipv6_cidr_block = var.enable_ipv6 && length(var.private_subnet_ipv6_prefixes) > 0

Proposed solution:

ipv6_cidr_block = var.enable_ipv6 && length(var.public_subnet_ipv6_prefixes) > 0 ? cidrsubnet(aws_vpc.this[0].ipv6_cidr_block, var.cidr_subnet_newbits, var.public_subnet_ipv6_prefixes[count.index]) : null

This change allows for more flexibility in subnet size selection by using a variable for newbits, making the code adaptable to different VPC IPv6 CIDR sizes.

Copy link

github-actions bot commented Feb 7, 2025

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant