xuwang / aws-terraform

Code examples to create CoreOS cluster on AWS with Terraform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating subnets in regions with only 2 availability zones fails

wombat opened this issue · comments

I wanted to create a vpc with subnets and an etcd cluster in the Frankfurt region but it fails because only 2 availability zones exist and terraform always tries to create 3 subnets.
I manually solved this by deleting all references to subnet_2 in my local copy but I think it would be cool to have a general switch as there are regions with 2, 3 and 4 availability zones.

See: https://github.com/jsonmaur/aws-regions

@w0mbat This is a little tricky I think. Terraform resource names are static. It means subnets resource tf files and other terraform files that reference the subnet variables have to be generated with scripts, making it complicated and hard to understand. I try to cut-down script glues and use Terraform whenever possible. I know it is painful now have to manually customize vpc/zones/subnets resource definitions... let me know if you have any thoughts better ideas to implement this. Thanks!

@w0mbat Thanks for your feedback and we've Implemented dynamic subnet creation in https://github.com/xuwang/kube-aws-terraform repo. If you are still still interested in porting that code back to this repo, let me know.