HashiCorp Certified: Terraform Associate — Question 271
You have just developed a new Terraform configuration for two virtual machines with a cloud provider. You would like to create the infrastructure for the first time.
Which Terraform command should you run first?
Answer options
- A. terraform apply
- B. terraform plan
- C. terraform show
- D. terraform init
Correct answer: D
Explanation
The correct command to run first is 'terraform init', as it initializes the working directory containing the Terraform configuration files, downloading necessary provider plugins. The other commands like 'terraform apply' and 'terraform plan' require the initialization step to be completed first, while 'terraform show' is used to display the current state but does not set up the infrastructure.