HashiCorp Certified: Terraform Associate — Question 312
Once a new Terraform backend is configured with a Terraform code block, which command(s) is (are) used to migrate the state file?
Answer options
- A. terraform apply
- B. terraform push
- C. terraform destroy, then terraform apply
- D. terraform init
Correct answer: D
Explanation
The correct command to migrate the state file after configuring a new Terraform backend is 'terraform init', as it initializes the backend and handles the state file migration. 'terraform apply' is used to apply changes, 'terraform push' is not a valid Terraform command, and 'terraform destroy, then terraform apply' is not necessary for state migration.