terraform apply usually points out error sources during provisioning, there are instances when you need more detailed internal logs. Terraform’s TF_LOG environment variable allows you to access these detailed logs.
Terraform supports various log levels: info, warning, error, debug, and trace—with trace providing the most verbose output. By setting TF_LOG to one of these levels, Terraform outputs additional details during command execution. For example, running a Terraform plan with TF_LOG set to trace may produce hundreds or even thousands of log entries, including low-level details from Terraform plugins. Such detailed logs are particularly useful for diagnosing issues within Terraform or when submitting a bug report.
Below is an example output from running terraform plan with detailed logging enabled:
To disable logging, simply unset the TF_LOG and TF_LOG_PATH environment variables. This stops Terraform from generating extensive log output.