Drawbacks of Modules
Though modules help in solving several problems, they also come with a few cons that you should be careful about. When you compare the pros and cons, the pros outweigh the cons by a huge margin, but still, you need to know about them. Even HashiCorp recommends using modules in moderation.
- When you start using module blocks, your configuration becomes hierarchical, where each module contains its own set of resources and could have its own child modules. This creates a deep, complex tree of resource configurations that make troubleshooting difficult.
- By default, Terraform downloads the latest version of the module from Terraform Registry. Over a period of time, you may end up having incompatibilities due to the untested version upgrade. You can avoid this issue by pinning the module to a certain version in the module block.
- Public modules are created to cover most generic use cases. If you have a use case that is very specific, you will either have...