Module Structure
There is no mandatory structure for modules. However, HashiCorp recommends following their standard module structure, since Terraform tools are designed to understand this structure in order to generate documentation and index modules when you upload modules to the Terraform Registry.
HashiCorp adds a root module as the mandatory component of the module structure. However, the focus here is mostly on the child module’s structure. Hence, you will not see the root module as one of the requirements in the structure given here.
These are the key files that make up a module:
main.tf
: This is the main configuration file that defines the resources that need to be launched.variables.tf
: Hardcoding the configuration value in the module’s code makes it difficult to reuse it. You parameterize (define the variable but pass the value of the variable during execution) the arguments of the resources as variables and pass the value of these variables...