TA-002-P · Question #73
You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (*.tf files). You need to enable debug messages to find this out. Which of the following…
The correct answer is A. Set the environment variable TF_LOG=TRACE. To enable detailed debug messages, including provider loading paths, for Terraform, you need to set the TF_LOG environment variable to TRACE.
Question
You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (*.tf files). You need to enable debug messages to find this out. Which of the following would achieve this?
Options
- ASet the environment variable TF_LOG=TRACE
- BSet verbose logging for each provider in your Terraform configuration
- CSet the environment variable TF_VAR_log=TRACE
- DSet the environment variable TF_LOG_PATH
How the community answered
(42 responses)- A93% (39)
- B5% (2)
- D2% (1)
Why each option
To enable detailed debug messages, including provider loading paths, for Terraform, you need to set the `TF_LOG` environment variable to `TRACE`.
Setting the environment variable `TF_LOG` to `TRACE` enables the most verbose logging level in Terraform. This provides highly detailed output, including information about provider discovery, loading paths, and internal execution steps, which is necessary to understand from where providers are being loaded.
Terraform does not offer a direct configuration block within HCL to set verbose logging for individual providers; logging levels are primarily controlled via the `TF_LOG` environment variable.
`TF_VAR_log=TRACE` would attempt to set a Terraform input variable named `log` with the value `TRACE`, which is not related to controlling Terraform's internal logging level.
`TF_LOG_PATH` is used to specify a file path where Terraform should write its log output, but it does not enable or set the logging level; `TF_LOG` controls the level.
Concept tested: Terraform debugging and logging
Source: https://developer.hashicorp.com/terraform/cli/commands/environment-variables#tf_log
Topics
Community Discussion
No community discussion yet for this question.