Ad space (banner)
AD

Got the fundamentals? A structured Terraform course is a fast way to level up.

Find Terraform courses on Udemy

Affiliate link. Costs you nothing extra.

Lesson 20 / 37

What Is a Module?

A module is a reusable package of Terraform configuration — a set of resources that belong together, parameterised by variables.

Once a network layout is a module, you call it from several places with different variables instead of copying the same blocks around.

Modules are called with a module block, and terraform init fetches any that live in a registry or a Git repository.

A common stumble is modularising too early. Write the resources plainly first; extract a module once you actually need it twice.

In real work, teams keep a library of internal modules so that a standard-shaped environment can be assembled from known-good pieces.

Terraform
Try it (type this into the pseudo terminal)
terraform init

🧑‍💻 You can type this command into the Terraform pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)