Module Source Options

Learn about the Terraform module and its source options.

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 ...