This repository contains a minimalist but working prototype for terraforming a VPC in AWS using dynamic private & public subnets with an extra feature to turnoff private subnet. The details are explained over this post. This project is just a DIY to give an example which can the be basis of for other related projects.
terraform init
terraform plan -out /tmp/vpc.plan -detailed-exitcode
terraform apply /tmp/vpc.plan
terraform show
terraform destroy -force