Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How are custom terraform modules used in terraform?


Asked by Mira Moyer on Dec 13, 2021 FAQ



Custom Terraform modules are created to encapsulate connected components that are used and deployed together frequently in bigger projects. They are self contained, bundling only the resources, variables, and providers they need.
Indeed,
Even when you don't create a module intentionally, if you use Terraform, you are already writing a module – a so-called " root " module. Any Terraform configuration file ( .tf) in a directory, even just one, forms a module. What does a module do? A Terraform module allows you to create logical abstraction on the top of some resource set.
Similarly, *.tfvars: Since module input variables are set via arguments to the module block in your configuration, you don't need to distribute any *.tfvars files with your module, unless you are also using it as a standalone Terraform configuration.
Subsequently,
The source argument in a module block tells Terraform where to find the source code for the desired child module. Terraform uses this during the module installation step of terraform init to download the source code to a directory on local disk so that it can be used by other Terraform commands.
In addition,
Terraform is an open-source IaC software tool that allows cloud architects to define components and their dependencies using relatively simple declarative configuration files. Terraform allows for provisioning, modification, and decommission of all cloud resources using a simple CLI workflow (write, plan, apply).