terraform-aws-dynamic-subnets icon indicating copy to clipboard operation
terraform-aws-dynamic-subnets copied to clipboard

Cannot create different number of public and private subnets.

Open piyushjajoo1991 opened this issue 2 years ago • 1 comments

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

Using version 2.0.2

I want to be able to create 6 private subnets and 3 public subnets. But there is no way I can create it correctly.

I have tried to specify the cidrs in the ipv4_cidrs var as below -

ipv4_cidrs = [ { private = ["10.0.0.0/20", "10.0.16.0/20", "10.0.32.0/20", "10.0.96.0/19", "10.0.128.0/19", "10.0.160.0/19"], public = ["10.0.48.0/20", "10.0.64.0/20", "10.0.80.0/20"] } ]

and tried to play with availability_zones (specified 3 azs twice i.e. 6 azs) and max_subnet_count (set it to 6); it fails as it tries to create the public azs again.

Expected Behavior

I should be able to create the uneven numbers of public and private subnets and NAT and route table configuration should be created accordingly.

Steps to Reproduce

Specified in description

Screenshots

n/a

Environment (please complete the following information): n/a

Additional Context

n/a

piyushjajoo1991 avatar Jul 06 '22 14:07 piyushjajoo1991

As stated in the README, the number of different possibilities for creating subnets is overwhelming, and we do not want to complicate this module even further by supporting rare use cases. You can see in https://github.com/cloudposse/terraform-aws-dynamic-subnets/issues/165#issuecomment-1265987787 how you can create a second set of private subnets cut off from the internet. Would that work for you, @piyushjajoo1991 ?

If not, please further explain your use case, including how you would configure the route tables for the private subnets and how you would handle the case of having more public subnets than private subnets.

Nuru avatar Oct 03 '22 20:10 Nuru