antonbabenko / terraform-best-practices

Terraform Best Practices free ebook translated into 🇬🇧🇦🇪🇧🇦🇧🇷🇫🇷🇬🇪🇩🇪🇬🇷🇮🇱🇮🇳🇮🇩🇮🇹🇰🇷🇵🇱🇷🇴🇨🇳🇪🇸🇹🇷🇺🇦🇵🇰
https://www.terraform-best-practices.com/
Other
2.06k stars 431 forks source link

Not a good place for providers #34

Closed ccsalway closed 2 years ago

ccsalway commented 2 years ago

https://github.com/antonbabenko/terraform-best-practices/blob/fdc28948f2b7ab1074ffd60aaab12cd7defd8072/examples/large-terraform/stage/main.tf#L1

If you have to specify many aws regions as aliases, you will get lost with where the actual work is (the modules down below).

Reconsider where to put the provider blocks; eg, new file called providers.tf

antonbabenko commented 2 years ago

There is usually one but sometimes a couple of providers in large-terraform infrastructure. It does not make a lot of sense to move them outside unless there is a large amount of code. I don't think it has to be described in the book.