aws-ia / terraform-aws-vpc

AWS VPC Module
https://registry.terraform.io/modules/aws-ia/vpc/aws/latest
Apache License 2.0
92 stars 98 forks source link

Create subnets dynamically while using IPAM to create the VPC #117

Closed DeOriginal closed 1 year ago

DeOriginal commented 1 year ago

1) I am creating VPCs using IPAM which means that the cidr ranges of the VPC are unknown at runtime. 2) I am creating multiple private subnets with the option to add or remove more in the future and as stated in "Updating a VPC with new or removed subnets", I should set the subnets explicitly.

The question is: How would I go about setting the subnets explicitly if the cidr of the subnet is unknown? If it was known I could have used cidrhost, but the ip address is created in the same module.

Thanks in advance

drewmullen commented 1 year ago

Hello! Thanks for opening this issue.

If I understand your scenario correctly you are trying to figure out "once a vpc and subnets have been created using a cidr from IPAM, how can I add or remove more subnets?"

Is this accurate?

How would I go about setting the subnets explicitly if the cidr of the subnet is unknown?

You will have to explicitly set them yourself. Whatever you put in the list the module will attempt to use. The netmask is helpful for the initial creation but is limited in what it can do once the network has been created

I hope this helps

DeOriginal commented 1 year ago

I see,

Thank you for the response!