What is a Terraform module?

  1. A Terraform command-line tool
  2. A reusable collection of Terraform files organized in a directory structure ✓
  3. A provider plugin for Terraform
  4. A single Terraform configuration file

Correct answer: A reusable collection of Terraform files organized in a directory structure

Option B is correct because a Terraform module is a container for multiple related resources defined across one or more .tf files in a directory, designed to be reused and shared as a logical unit of infrastructure. Modules allow teams to encapsulate and standardize infrastructure patterns so they can be invoked repeatedly with different input variables. Option A is wrong because Terraform CLI is a command-line tool, not a module; it is the binary used to plan, apply, and manage infrastructure. Option C is wrong because provider plugins are separate binaries that enable Terraform to interact with specific APIs such as AWS or Azure, and they are not modules. Option D is wrong because a module is not limited to a single file; it encompasses an entire directory structure of configuration files.

Topic: · terraform, modules, infrastructure-as-code, reusability

Practice HashiCorp Terraform Associate (003) Questions Free