Terraform count vs. for_each
Don't count on it
Terraform has two mechanisms for provisioning multiple resources (and modules since version 0.13): count and for_each. The count feature predates for_each. Now that for_each is available, there is no reason to use count.
The Terraform documentation says “If your instances are almost identical, count is appropriate. If some of their arguments need distinct values that can’t be directly derived from an integer, it’s safer to use for_each.”
This is bad advice.
[Read More]