Implementing DevOps Solutions and Practices Using Cisco Platforms (DEVOPS) — Question 6
A CI/CD pipeline that builds infrastructure components using Terraform must be designed. A step in the pipeline is needed that checks for errors in any of the .tf files in the working directory. It also checks the existing state of the defined infrastructure.
Which command does the pipeline run to accomplish this goal?
Answer options
- A. terraform plan
- B. terraform check
- C. terraform fmt
- D. terraform validate
Correct answer: D
Explanation
The correct answer is D, as 'terraform validate' is specifically designed to check .tf files for syntax errors and validate the configuration. Option A, 'terraform plan', prepares an execution plan but does not validate the files. Option B, 'terraform check', is not a valid Terraform command. Option C, 'terraform fmt', formats the code but does not check for errors.