github.com/loicalbertin/terraform@v0.6.15-0.20170626182346-8e2583055467/website/docs/configuration/environment-variables.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Environment Variables"
     4  sidebar_current: "docs-config-environment-variables"
     5  description: |-
     6    Terraform uses different environment variables that can be used to configure various aspects of how Terraform behaves. this section documents those variables, their potential values, and how to use them.
     7  ---
     8  
     9  # Environment Variables
    10  
    11  ## TF_LOG
    12  
    13  If set to any value, enables detailed logs to appear on stderr which is useful for debugging. For example:
    14  
    15  ```shell
    16  export TF_LOG=TRACE
    17  ```
    18  
    19  To disable, either unset it or set it to empty. When unset, logging will default to stderr. For example:
    20  
    21  ```shell
    22  export TF_LOG=
    23  ```
    24  
    25  For more on debugging Terraform, check out the section on [Debugging](/docs/internals/debugging.html).
    26  
    27  ## TF_LOG_PATH
    28  
    29  This specifies where the log should persist its output to. Note that even when `TF_LOG_PATH` is set, `TF_LOG` must be set in order for any logging to be enabled. For example, to always write the log to the directory you're currently running terraform from:
    30  
    31  ```shell
    32  export TF_LOG_PATH=./terraform.log
    33  ```
    34  
    35  For more on debugging Terraform, check out the section on [Debugging](/docs/internals/debugging.html).
    36  
    37  ## TF_INPUT
    38  
    39  If set to "false" or "0", causes terraform commands to behave as if the `-input=false` flag was specified. This is used when you want to disable prompts for variables that haven't had their values specified. For example:
    40  
    41  ```shell
    42  export TF_INPUT=0
    43  ```
    44  
    45  ## TF_MODULE_DEPTH
    46  
    47  When given a value, causes terraform commands to behave as if the `-module-depth=VALUE` flag was specified. By setting this to 0, for example, you enable commands such as [plan](/docs/commands/plan.html) and [graph](/docs/commands/graph.html) to display more compressed information.
    48  
    49  ```shell
    50  export TF_MODULE_DEPTH=0
    51  ```
    52  
    53  For more information regarding modules, check out the section on [Using Modules](/docs/modules/usage.html).
    54  
    55  ## TF_VAR_name
    56  
    57  Environment variables can be used to set variables. The environment variables must be in the format `TF_VAR_name` and this will be checked last for a value. For example:
    58  
    59  ```shell
    60  export TF_VAR_region=us-west-1
    61  export TF_VAR_ami=ami-049d8641
    62  export TF_VAR_alist='[1,2,3]'
    63  export TF_VAR_amap='{ foo = "bar", baz = "qux" }'
    64  ```
    65  
    66  For more on how to use `TF_VAR_name` in context, check out the section on [Variable Configuration](/docs/configuration/variables.html).
    67  
    68  ## TF_CLI_ARGS and TF_CLI_ARGS_name
    69  
    70  The value of `TF_CLI_ARGS` will specify additional arguments to the
    71  command-line. This allows easier automation in CI environments as well as
    72  modifying default behavior of Terraform on your own system.
    73  
    74  These arguments are inserted directly _after_ the subcommand
    75  (such as `plan`) and _before_ any flags specified directly on the command-line.
    76  This behavior ensures that flags on the command-line take precedence over
    77  environment variables.
    78  
    79  For example, the following command: `TF_CLI_ARGS="-input=false" terraform apply -force`
    80  is the equivalent to manually typing: `terraform apply -input=false -force`.
    81  
    82  The flag `TF_CLI_ARGS` affects all Terraform commands. If you specify a
    83  named command in the form of `TF_CLI_ARGS_name` then it will only affect
    84  that command. As an example, to specify that only plans never refresh,
    85  you can set `TF_CLI_ARGS_plan="-refresh=false"`.
    86  
    87  The value of the flag is parsed as if you typed it directly to the shell.
    88  Double and single quotes are allowed to capture strings and arguments will
    89  be separated by spaces otherwise.
    90  
    91  ## TF_SKIP_REMOTE_TESTS
    92  
    93  This can be set prior to running the unit tests to opt-out of any tests
    94  requiring remote network connectivity. The unit tests make an attempt to
    95  automatically detect when connectivity is unavailable and skip the relevant
    96  tests, but by setting this variable you can force these tests to be skipped.
    97  
    98  ```shell
    99  export TF_SKIP_REMOTE_TESTS=1
   100  make test
   101  ```