Skip to Content

HashiCorp Certified Terraform Associate: Terraform Debug Enable Verbose Logging with Environment Variables

Learn how to troubleshoot slow responses and odd behavior in Terraform by enabling verbose logging using the correct environment variable configuration.

Table of Contents

Question

While attempting to deploy resources into your cloud provider using Terraform, you begin to see some odd behavior and experience slow responses. In order to troubleshoot you decide to turn on Terraform debugging. Which environment variables must be configured to make Terraform’s logging more verbose?

A. TF_LOG_PATH
B. TF_VAR_log_level
C. TF_LOG
D. TF_VAR_log_path

Answer

C. TF_LOG

Explanation

To enable verbose logging for debugging purposes in Terraform, you must set the TF_LOG environment variable. This variable controls the verbosity of Terraform’s output and can be set to one of the following values: TRACE, DEBUG, INFO, WARN, or ERROR. Setting TF_LOG to TRACE or DEBUG will provide the most detailed output, including information about API requests, response bodies, and other internal operations. The TF_LOG_PATH variable can be used to specify a location for the log file, but it is not required for enabling verbose logging itself.

HashiCorp Certified: Terraform Associate certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the HashiCorp Certified: Terraform Associate exam and earn HashiCorp Certified: Terraform Associate certification.