Where are modules cached in the first initialization of Terraform?

Prepare for the HashiCorp Terraform Associate Exam. Utilize flashcards and multiple-choice questions with detailed hints and explanations. Boost your confidence and be ready for success!

Multiple Choice

Where are modules cached in the first initialization of Terraform?

Explanation:
When Terraform initializes a project, it caches modules on disk inside a hidden .terraform directory at the root of your configuration. The first init downloads each module source and stores it under .terraform/modules, so later runs can reuse them without re-downloading. This cache is tied to the project and persists across commands, unlike memory-only storage or a system temp folder like /tmp. If you delete the .terraform folder or run init -upgrade, Terraform will fetch the modules again. (Provider plugins have their own separate cache, but that’s a different location from the module cache.)

When Terraform initializes a project, it caches modules on disk inside a hidden .terraform directory at the root of your configuration. The first init downloads each module source and stores it under .terraform/modules, so later runs can reuse them without re-downloading. This cache is tied to the project and persists across commands, unlike memory-only storage or a system temp folder like /tmp. If you delete the .terraform folder or run init -upgrade, Terraform will fetch the modules again. (Provider plugins have their own separate cache, but that’s a different location from the module cache.)

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy