How to enable trace log and debug in Terraform CLI

terraformTo 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:

  1. Navigate to Settings > General > User Interface, and select “Console UI”console.jpg
  2. Navigate to Variables Workspace Variables, and add a new variable with “Environment” as category, TF_LOG as key, and TRACE as valueenv.jpg
  3. Start a new run
  4. Click on “View raw log”download.jpg

 

Terraform CLI in Unix/Linux & macOS

In your Linux/macOS terminal type this, run the following commands:

  1. export TF_LOG="TRACE"
  2. terraform apply -no-color 2>&1 | tee apply.txt

 

Terraform CLI in Windows

In your PowerShell terminal, run the following commands:

  1. $Env:TF_LOG = "TRACE"
  2. terraform apply -no-color 2>&1 | Tee-Object -FilePath apply.txt

Want me to do this for you? Drop me a line: itgalaxyzzz {at} gmail [point] com