HashiCorp Certified: Terraform Associate — Question 126
When should you run terraform init?
Answer options
- A. After you run terraform apply for the first time in a new Terraform project and before you run terraform plan
- B. After you run terraform plan for the first time in a new Terraform project and before you run terraform apply
- C. After you start coding a new Terraform project and before you run terraform plan for the first time
- D. Before you start coding a new Terraform project
Correct answer: C
Explanation
The correct answer is C because terraform init must be run to initialize the working directory and download necessary provider plugins before you can execute terraform plan. Options A and B are incorrect as they suggest running terraform init after commands that cannot be executed without prior initialization. Option D is incorrect because the initialization should happen after coding has started but before any plans are made.