A pipeline runs terraform test for a shared module, and the CI dashboard displays test results only from JUnit XML report files. The team still wants the normal human-readable test output in the job log. Which command meets both needs?
Select an answer to reveal the explanation.
Short Explanation
Your dashboard only speaks JUnit, so you need Terraform to write a translation. -junit-xml saves that translation to a file while the normal output keeps scrolling in the log. -json is a different language entirely, and -verbose just makes the regular output chattier.
Full Explanation
terraform test accepts -junit-xml=PATH, which saves a test report in JUnit XML format to the specified file. The documentation shows the command still printing results to the terminal in the default human-readable form while also writing the XML report, so the job log stays readable and the dashboard ingests the file. The -json option changes the terminal output to machine-readable JSON messages; JSON is not JUnit XML, so a dashboard that requires JUnit cannot use it. terraform validate checks configuration validity and does not execute test files or run blocks at all. -verbose prints the plan or state for each run block, making the output longer, but it is still human-readable text; redirecting it to a file with an .xml extension does not make it XML. Exam caveat: the JUnit report is currently incompatible with remote test execution using the -cloud-run option, so it fits tests that the CI runner executes locally. Operational check: after the job, confirm the report file exists at the configured path, contains a test case for each run block, and that the dashboard shows failures when an assertion is deliberately broken.