Terraform init fetches module sources for referenced modules.

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

Terraform init fetches module sources for referenced modules.

Explanation:
During initialization, Terraform prepares the working directory by pulling in everything it needs to run. When your configuration references modules, Terraform must obtain the actual code for those modules so they can be used in the plan and apply phases. Terraform init resolves each module’s source—whether from the Terraform Registry, a Git repository, a local path, or another source—and downloads the module contents into the hidden .terraform/modules directory. This makes all referenced modules available for composition in the configuration. Provider plugins are also installed during init, but that is a separate aspect from fetching module sources. Syntax validation is not the primary task of init; that happens with validate or during plan. So the reason this choice is best is that init’s role here is to fetch the source code for all referenced modules, enabling the full module graph to be evaluated.

During initialization, Terraform prepares the working directory by pulling in everything it needs to run. When your configuration references modules, Terraform must obtain the actual code for those modules so they can be used in the plan and apply phases. Terraform init resolves each module’s source—whether from the Terraform Registry, a Git repository, a local path, or another source—and downloads the module contents into the hidden .terraform/modules directory. This makes all referenced modules available for composition in the configuration.

Provider plugins are also installed during init, but that is a separate aspect from fetching module sources. Syntax validation is not the primary task of init; that happens with validate or during plan. So the reason this choice is best is that init’s role here is to fetch the source code for all referenced modules, enabling the full module graph to be evaluated.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy