Member-only story
Terraform Basics — Modules
Note, full mind map is available at: “DevOps in Terraform MindMap”
Terraform Modules
In Terraform, a module is a reusable, self-contained package of Terraform configurations that manages a set of related resources. Modules are used to create reusable infrastructure components, encapsulate best practices, and simplify complex configurations.
They promote code reusability and can be shared among different projects or within a team to standardize infrastructure management. A module can consist of a collection of .tf
files (or .tf.json
) files.
Modules serve as a container for multiple resources that are used together, and are the primary way to package and reuse resource configurations in Terraform. There are three types of modules: the root module, child modules, and published modules.
Root Module
In Terraform, the root module is the top-level module in your Terraform configuration. It is the starting point for Terraform when it processes your infrastructure code. The root module contains the Terraform code you write and execute directly, as opposed to code from other modules that you reference using the module
block.