Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 325


You can configure Terraform to log to a file using the TF_LOG environment variable.

Show Answer
Correct Answer: B

The statement that you can configure Terraform to log to a file using the TF_LOG environment variable is false. The TF_LOG environment variable controls the verbosity of log output but does not specify a file destination. To log to a specific file, you need to use the TF_LOG_PATH environment variable in addition to setting TF_LOG.

Discussion

3 comments
Sign in to comment
J_boyOption: B
Feb 23, 2024

TF_LOG_PATH is used instead https://developer.hashicorp.com/terraform/internals/debugging

6957dbdOption: A
Mar 10, 2024

This is a badly worded question... Terraform has detailed logs that you can enable by setting the TF_LOG environment variable to any value. Enabling this setting causes detailed logs to appear on stderr. To persist logged output you can set TF_LOG_PATH in order to force the log to always be appended to a specific file when logging is enabled. Note that even when TF_LOG_PATH is set, TF_LOG must be set in order for any logging to be enabled. So, TF_LOG_PATH sets the directory itself, but it will not output anything unless TF_LOG is set.

kyochanOption: B
Apr 20, 2024

You can configure Terraform to log to a file by setting the TF_LOG_PATH environment variable. When this variable is set, Terraform will write its log output to the specified file.