Search⌘ K
AI Features

Module Source Options

Explore how Terraform modules work and understand the various source options available for storing module files. Learn to use local paths, the Terraform Registry, GitHub, and other remote repositories to organize reusable configurations for Infrastructure as Code.

What is a Terraform module?

A Terraform module is simply a configuration that defines inputs, resources, and outputs. All are optional! When we create a set of tf or tf.json files in a directory, that’s a module. The main configuration we’re working with is the root module, and it can invoke other modules to create resources.

Modules have a hierarchical structure, where the root module invokes a child module, which in turn can invoke another child module. Consider a root module that invokes a child module (lb-vms) to create a load-balanced cluster of Azure virtual machines. The lb-vms module may invoke a vnet module to create the necessary VNet and subnets for the load-balanced cluster. If ...