nerdexam
HashiCorp

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.

Use the Terraform CLI (terraform plan, apply, destroy, fmt, init, validate, workspace, import, taint, providers, output)

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)
  • A
    93% (39)
  • B
    5% (2)
  • D
    2% (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`.

ASet the environment variable TF_LOG=TRACECorrect

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.

BSet verbose logging for each provider in your Terraform configuration

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.

CSet the environment variable TF_VAR_log=TRACE

`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.

DSet the environment variable TF_LOG_PATH

`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

#Terraform logging#Debugging#Environment variables#Provider loading

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice