From the course: Advanced Terraform

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Introduction to modules

Introduction to modules - Terraform Tutorial

From the course: Advanced Terraform

Introduction to modules

- [Instructor] A Terraform module is a self-contained, encapsulated set of resources. It's useful to think of a module as a sub configuration. It has input and output variables and modules are written in HCL. HashiCorp and open source contributors maintain a large library of modules for Terraform users. Modules can vastly simplify a configuration by reducing the number of lines needed to execute complex configurations. GCP modules are available for service accounts, compute engine VMs, GKE, and many more. Terraform modules cannot be deployed by themselves. They have to be declared in a root module. All configurations have a root module. The root module contains the resources declared in the .tf files of a configuration. External modules that are declared in the root module are called child modules. Child modules are imported into the root module using the module HCL declaration. A module declaration in the root module…

Contents