HashiCorp Certified: Terraform Associate Practice Questions

HashiCorp Certified: Terraform Associate (004) exam preparationAligned with the official Terraform Associate (004) exam content list (Terraform 1.12; retrieved 2026-11-03)

HashiCorp Certified: Terraform Associate practice questions in English: 180 questions with explanations. The mock exam has 60 questions and 60 minutes.

HashiCorp Certified: Terraform Associate free question 7 / 10 · Domain 5: Terraform modules

An engineer writes source = "/home/alice/modules/vpc" in a module block, so the configuration works on her laptop. What does the module block reference say about this source?

  1. Terraform clones it with git, using the Git settings of the local system it runs on.
  2. Terraform stops with an error, because a local path has to start with ./ or ../.
  3. Terraform copies it to the module cache, and the page advises against such paths.
  4. Terraform reads it as a registry address, because it has no ./ prefix before it.
Show the answer and explanation

Answer: C

Why this is correct
The module block reference lists local paths among the types of sources from which Terraform can install modules. You use the ./ or ../ prefix followed by the path to local module source code to install a module from files already on disk, as in source = "./consul". The same section says Terraform recognizes paths that begin with a / or drive letter as absolute paths, and that Terraform copies modules specified with an absolute path to the local module cache as a package. It then gives its advice: we don't recommend using absolute filesystem paths to refer to Terraform modules, because doing so can couple your configuration to the filesystem layout of a particular computer. The path in the question exists on the engineer's laptop, so the configuration would depend on that layout, and another engineer or a CI system would need the same folder at the same place. A relative path that starts with ./ or ../, kept in the repository with the configuration, does not tie the configuration to one computer.

Why the other options are wrong
"Terraform reads it as a registry address, because it has no ./ prefix before it." … The page says Terraform recognizes paths that begin with a / or drive letter as absolute paths. A path starting with / is treated as an absolute filesystem path, not as a <NAMESPACE>/<NAME>/<PROVIDER> registry address.
"Terraform clones it with git, using the Git settings of the local system it runs on." … Running git clone with the local Git configuration is how Terraform installs GitHub, Git and Bitbucket sources. A path that begins with / is recognized as an absolute path, and Terraform copies the module to the local module cache as a package.
"Terraform stops with an error, because a local path has to start with ./ or ../." … The ./ or ../ prefix is how you install a module from files already on disk, but the page also says Terraform recognizes paths that begin with a / or drive letter as absolute paths. Such a path is accepted; the page recommends against it.

Prefer relative local paths
Local modules use ./ or ../. Absolute paths are accepted and copied to the module cache, but they tie the configuration to one machine.

Go to the HashiCorp Certified: Terraform Associate practice app (10 free questions; purchase unlocks all questions)

See the full practice set