Closed JustinTRoss closed 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....
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?
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.
availability_zones
root var.availability_zones
fromaws_availability_zones
datasource in network module.availability_zones
variable to network module.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 ;).