Terraform & IaC (50 Qs)•Part 1: Terraform Core Architecture, HCL & Providers (1 - 15)
What is `terraform init`, and what happens inside the `.terraform` directory and `.terraform.lock.hcl`?
senior LevelFormsCI/CD & DevOpsSystem Design
In Simple Words:
terraform init initializes a working directory containing Terraform configuration files:
- Downloads required provider plugins and child modules into the hidden
.terraform/directory. - Initializes the configured backend (local disk, AWS S3, Terraform Cloud).
- Generates or updates the
.terraform.lock.hcldependency lock file, recording the exact cryptographic checksums and pinned versions of installed providers. This file MUST be committed to Git to ensure deterministic builds across team members and CI/CD pipelines.