arminc / terraform-ecs

AWS ECS terraform module
MIT License
803 stars 374 forks source link

Derive availability_zones from aws datasource and remove from configs. #42

Closed JustinTRoss closed 3 years ago

JustinTRoss commented 3 years ago

This reduces required configuration, but also reduces configurability from root vars without modifying the network module itself. It's a win in my book. It may or may not be one in yours ;).

arminc commented 3 years ago

It is oke to use the info from a data resource but the problem is you need to determine how many AZ's you should use. Now it is fixed to two but in dev you probably want one and in production 3, etc....

JustinTRoss commented 3 years ago

That makes sense. I can add a configuration to specify number of required zones and pass this through to network. Hopefully terraform plan will error if a count is specified higher than available. E.g. 8 zones in us-east-1, where there are only 6 available.

Would this be a productive solution?

arminc commented 3 years ago

On second thought I don't think we should change this or make an automated selection as it removes the flexibility of the following two things: 1) How many AZ's you actually want to use. This can be fixed using your suggestion. 2) Specify which AZ's you actually want to use. This can be pretty important when you have other things running outside of the cluster and you might not want to let the traffic cross AZ's if not really necessary. For example if your DB is in eu-west-1a and b it makes sense to have the cluster in the same and not in b and c.