Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added page documenting useful Environment Variables #2601

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions website/source/docs/configuration/environment-variables.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
layout: "docs"
page_title: "Environment Variables"
sidebar_current: "docs-config-environment-variables"
description: |-
Something on Environment Variables!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just say something like "Details on the environment variables that can be used to configure various aspects of Terraform"

---

# Environment Variables

## TF_LOG

If set to any value, enables detailed logs to appear on stderr which is useful for debugging. For example:

```
export TF_LOG=1
```

To disable, either unset it or set it to empty. For example:

```
export TF_LOG=
```

For more on debugging Terraform, check out the section on [Debugging](/docs/internals/debugging.html).

## TF_LOG_PATH

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should highlight that when this is unset, terraform logs to stderr.


```
export TF_LOG_PATH=./terraform.log
```

For more on debugging Terraform, check out the section on [Debugging](/docs/internals/debugging.html).

## TF_INPUT

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:

```
export TF_INPUT=0
```

## TF_MODULE_DEPTH

When given a value, causes terraform commands to behave as if the `-module=depth=VALUE` flag was specified. Modules are treated like a black box and terraform commands do not show what resources within the module will be created. By setting this to -1, for example, you enable commands such as [plan](/docs/commands/plan.html) and [graph](/docs/commands/graph.html) to display more detailed information.

```
export TF_MODULE_DEPTH=-1
```

For more information regarding modules, check out the section on [Using Modules](/docs/modules/usage.html).

## TF_VAR_name

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:

```
export TF_VAR_region=us-west-1
export TF_VAR_ami=ami-049d8641
```

For more on how to use `TF_VAR_name` in context, check out the section on [Variable Configuration](/docs/configuration/variables.html).
20 changes: 12 additions & 8 deletions website/source/layouts/docs.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ul class="nav docs-sidenav">
<li<%= sidebar_current("docs-home") %>>
<a href="/docs/index.html">Documentation Home</a>
</li>
</li>

<li<%= sidebar_current(/^docs-config/) %>>
<a href="/docs/configuration/index.html">Configuration</a>
Expand Down Expand Up @@ -49,6 +49,10 @@
<a href="/docs/configuration/atlas.html">Atlas</a>
</li>

<li<%= sidebar_current("docs-config-environment-variables") %>>
<a href="/docs/configuration/environment-variables.html">Environment Variables</a>
</li>

</ul>
</li>

Expand Down Expand Up @@ -81,15 +85,15 @@

<li<%= sidebar_current("docs-commands-plan") %>>
<a href="/docs/commands/plan.html">plan</a>
</li>
</li>

<li<%= sidebar_current("docs-commands-push") %>>
<a href="/docs/commands/push.html">push</a>
</li>

<li<%= sidebar_current("docs-commands-refresh") %>>
<a href="/docs/commands/refresh.html">refresh</a>
</li>
</li>

<li<%= sidebar_current("docs-commands-remote") %>>
<a href="/docs/commands/remote.html">remote</a>
Expand All @@ -116,10 +120,10 @@

<li<%= sidebar_current(/^docs-providers/) %>>
<a href="/docs/providers/index.html">Providers</a>
<ul class="nav">
<ul class="nav">
<li<%= sidebar_current("docs-providers-atlas") %>>
<a href="/docs/providers/atlas/index.html">Atlas</a>
</li>
</li>

<li<%= sidebar_current("docs-providers-aws") %>>
<a href="/docs/providers/aws/index.html">AWS</a>
Expand All @@ -131,11 +135,11 @@

<li<%= sidebar_current("docs-providers-cloudflare") %>>
<a href="/docs/providers/cloudflare/index.html">CloudFlare</a>
</li>
</li>

<li<%= sidebar_current("docs-providers-cloudstack") %>>
<li<%= sidebar_current("docs-providers-cloudstack") %>>
<a href="/docs/providers/cloudstack/index.html">CloudStack</a>
</li>
</li>

<li<%= sidebar_current("docs-providers-consul") %>>
<a href="/docs/providers/consul/index.html">Consul</a>
Expand Down