---
name: secure-enterprise-schematics-env-vars
title: Enabling Terraform logs by using the CLI
description: Terraform uses environment variables to customize its behavior, which includes enabling Terraform logs. You can set an environment variable to take advantage of Terraform logs to debug unexpected issues with your code. Terraform reads environment variables and applies them at runtime.
last-updated: 2026-01-15
---

> ## Documentation Index
> The table of contents for this documentation set is at https://cloud.ibm.com/docs/secure-enterprise?format=markdown
> The index for all IBM Cloud docs is at: https://cloud.ibm.com/docs/llms.txt
> Use these files to discover more information as needed.

# Enabling Terraform logs by using the CLI
{: #da-env-vars}

Terraform uses environment variables to customize its behavior, which includes [enabling Terraform logs](https://developer.hashicorp.com/terraform/internals/debugging){: external}. You can set an environment variable to take advantage of Terraform logs to debug unexpected issues with your code. Terraform reads environment variables and applies them at runtime. 

Complete these steps if you use IBM Cloud projects to deploy architectures and want to enable Terraform logs. If you use an IBM Cloud Schematics workspace to execute Terraform without an IBM Cloud project, go to [Using environment variables with workspaces](https://cloud.ibm.com/docs/schematics?topic=schematics-set-parallelism&format=markdown) for more information. 
{: note}

## Before you begin
{: #prereqs}

- Install the [IBM Cloud CLI plug-in](https://cloud.ibm.com/docs/cli?topic=cli-getting-started&format=markdown).
- Install the [IBM Cloud Projects CLI plug-in](https://cloud.ibm.com/docs/cli?topic=cli-projects-cli&format=markdown).
- Make sure that you have the Editor role on the IBM Cloud Projects service. For more information, go to [Assigning access to projects](https://cloud.ibm.com/docs/secure-enterprise?topic=secure-enterprise-access-project&interface=ui&format=markdown). 

## Setting the environment variable
{: #set-variable}

1. Log in to the IBM Cloud CLI and select your account:

   ```bash
   ibmcloud login
   ```
   {: pre}

1. Set the environment variable by running the `ibmcloud project config-update` command, specifying the project ID, configuration ID, and a name and value for the environment variable:

   ```bash
   ibmcloud project config-update --project-id PROJECT_ID --id CONFIG_ID --definition-settings "{\"ENV_NAME\":\"ENV_VALUE\"}"
   ```
   {: pre}

   The following example adds the `TF_LOG` environment variable to enable Terraform logs: 

   ```bash
   ibmcloud project config-update --project-id PROJECT_ID --id CONFIG_ID --definition-settings "{\"TF_LOG\":\"debug\"}"
   ```
   {: pre}

   For a full list of command options, go to [`ibmcloud project config-update`](https://cloud.ibm.com/docs/cli?topic=cli-projects-cli&format=markdown#project-cli-config-update-command). 

Other environment variables are supported in addition to `TF_LOG`. For more information, see the [List of Terraform environment variables](https://cloud.ibm.com/docs/schematics?topic=schematics-set-parallelism&format=markdown#list-special-env-vars).
{: tip}