To capture a trace log in Terraform, set the environment variable TF_LOG
to TRACE
. Refer to the steps below for details in your Terraform product:
Terraform Cloud or Enterprise
In Terraform Cloud or Terraform Enterprise, perform these steps in your Workspace:
- Navigate to Settings > General > User Interface, and select “Console UI”
- Navigate to Variables > Workspace Variables, and add a new variable with “Environment” as category,
TF_LOG
as key, andTRACE
as value - Start a new run
- Click on “View raw log”
Terraform CLI in Unix/Linux & macOS
In your Linux/macOS terminal type this, run the following commands:
export TF_LOG="TRACE"
terraform apply -no-color 2>&1 | tee apply.txt
Terraform CLI in Windows
In your PowerShell terminal, run the following commands:
$Env:TF_LOG = "TRACE"
terraform apply -no-color 2>&1 | Tee-Object -FilePath apply.txt