2017-09-08 01:38:34 +02:00
|
|
|
|
---
|
|
|
|
|
layout: "docs"
|
|
|
|
|
page_title: "CLI Configuration"
|
|
|
|
|
sidebar_current: "docs-commands-cli-config"
|
|
|
|
|
description: |-
|
|
|
|
|
The general behavior of the Terraform CLI can be customized using the CLI
|
|
|
|
|
configuration file.
|
|
|
|
|
---
|
|
|
|
|
|
2018-11-03 01:26:52 +01:00
|
|
|
|
# CLI Configuration File (`.terraformrc` or `terraform.rc`)
|
2017-09-08 01:38:34 +02:00
|
|
|
|
|
2018-02-07 18:15:55 +01:00
|
|
|
|
The CLI configuration file configures per-user settings for CLI behaviors,
|
|
|
|
|
which apply across all Terraform working directories. This is separate from
|
|
|
|
|
[your infrastructure configuration](/docs/configuration/index.html).
|
2017-09-08 01:38:34 +02:00
|
|
|
|
|
2018-02-07 18:15:55 +01:00
|
|
|
|
## Location
|
2017-09-08 01:38:34 +02:00
|
|
|
|
|
|
|
|
|
The configuration is placed in a single file whose location depends on the
|
|
|
|
|
host operating system:
|
|
|
|
|
|
|
|
|
|
* On Windows, the file must be named named `terraform.rc` and placed
|
2018-11-21 01:54:18 +01:00
|
|
|
|
in the relevant user's `%APPDATA%` directory. The physical location
|
2017-09-08 01:38:34 +02:00
|
|
|
|
of this directory depends on your Windows version and system configuration;
|
|
|
|
|
use `$env:APPDATA` in PowerShell to find its location on your system.
|
|
|
|
|
* On all other systems, the file must be named `.terraformrc` (note
|
|
|
|
|
the leading period) and placed directly in the home directory
|
|
|
|
|
of the relevant user.
|
|
|
|
|
|
|
|
|
|
On Windows, beware of Windows Explorer's default behavior of hiding filename
|
|
|
|
|
extensions. Terraform will not recognize a file named `terraform.rc.txt` as a
|
|
|
|
|
CLI configuration file, even though Windows Explorer may _display_ its name
|
|
|
|
|
as just `terraform.rc`. Use `dir` from PowerShell or Command Prompt to
|
|
|
|
|
confirm the filename.
|
|
|
|
|
|
2019-04-05 20:21:40 +02:00
|
|
|
|
The location of the Terraform CLI configuration file can also be specified
|
|
|
|
|
using the `TF_CLI_CONFIG_FILE` [environment variable](/docs/commands/environment-variables.html).
|
|
|
|
|
|
2017-09-08 01:38:34 +02:00
|
|
|
|
## Configuration File Syntax
|
|
|
|
|
|
|
|
|
|
The configuration file uses the same _HCL_ syntax as `.tf` files, but with
|
|
|
|
|
different attributes and blocks. The following example illustrates the
|
|
|
|
|
general syntax; see the following section for information on the meaning
|
|
|
|
|
of each of these settings:
|
|
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
|
plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"
|
|
|
|
|
disable_checkpoint = true
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Available Settings
|
|
|
|
|
|
|
|
|
|
The following settings can be set in the CLI configuration file:
|
|
|
|
|
|
2018-02-07 18:15:55 +01:00
|
|
|
|
- `disable_checkpoint` — when set to `true`, disables
|
2017-09-08 01:38:34 +02:00
|
|
|
|
[upgrade and security bulletin checks](/docs/commands/index.html#upgrade-and-security-bulletin-checks)
|
|
|
|
|
that require reaching out to HashiCorp-provided network services.
|
|
|
|
|
|
2018-02-07 18:15:55 +01:00
|
|
|
|
- `disable_checkpoint_signature` — when set to `true`, allows the upgrade and
|
2017-09-08 01:38:34 +02:00
|
|
|
|
security bulletin checks described above but disables the use of an anonymous
|
|
|
|
|
id used to de-duplicate warning messages.
|
|
|
|
|
|
2018-02-07 18:15:55 +01:00
|
|
|
|
- `plugin_cache_dir` — enables
|
2017-09-08 01:38:34 +02:00
|
|
|
|
[plugin caching](/docs/configuration/providers.html#provider-plugin-cache)
|
|
|
|
|
and specifies, as a string, the location of the plugin cache directory.
|
|
|
|
|
|
2019-08-07 00:28:03 +02:00
|
|
|
|
- `credentials` — provides credentials for use with Terraform Cloud.
|
2018-08-17 07:40:51 +02:00
|
|
|
|
Terraform uses this when performing remote operations or state access with
|
|
|
|
|
the [remote backend](../backends/types/remote.html) and when accessing
|
2019-08-07 00:28:03 +02:00
|
|
|
|
Terraform Cloud's [private module registry.](/docs/cloud/registry/index.html)
|
2018-02-07 18:15:55 +01:00
|
|
|
|
|
|
|
|
|
This setting is a repeatable block, where the block label is a hostname
|
2019-08-07 00:28:03 +02:00
|
|
|
|
(either `app.terraform.io` or the hostname of a Terraform Enterprise instance) and
|
2018-08-17 07:40:51 +02:00
|
|
|
|
the block body contains a `token` attribute. Whenever Terraform accesses
|
|
|
|
|
state, modules, or remote operations from that hostname, it will
|
|
|
|
|
authenticate with that API token.
|
2018-02-07 18:15:55 +01:00
|
|
|
|
|
|
|
|
|
``` hcl
|
|
|
|
|
credentials "app.terraform.io" {
|
|
|
|
|
token = "xxxxxx.atlasv1.zzzzzzzzzzzzz"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2018-08-17 07:40:51 +02:00
|
|
|
|
~> **Important:** The token provided here must be a
|
2019-08-07 00:28:03 +02:00
|
|
|
|
[user token](/docs/cloud/users-teams-organizations/users.html#api-tokens)
|
2019-06-26 19:56:30 +02:00
|
|
|
|
or a
|
2019-08-07 00:28:03 +02:00
|
|
|
|
[team token](/docs/cloud/users-teams-organizations/service-accounts.html#team-service-accounts);
|
2019-06-26 19:56:30 +02:00
|
|
|
|
organization tokens cannot be used for command-line Terraform actions.
|
2018-08-17 07:40:51 +02:00
|
|
|
|
|
|
|
|
|
-> **Note:** The credentials hostname must match the hostname in your module
|
|
|
|
|
sources and/or backend configuration. If your Terraform Enterprise instance
|
|
|
|
|
is available at multiple hostnames, use one of them consistently. (The SaaS
|
2019-08-07 00:28:03 +02:00
|
|
|
|
version of Terraform Cloud responds to API calls at both its current
|
2018-08-17 07:40:51 +02:00
|
|
|
|
hostname, app.terraform.io, and its historical hostname,
|
|
|
|
|
atlas.hashicorp.com.)
|
2018-02-07 18:15:55 +01:00
|
|
|
|
|
2017-09-08 01:38:34 +02:00
|
|
|
|
## Deprecated Settings
|
|
|
|
|
|
|
|
|
|
The following settings are supported for backward compatibility but are no
|
|
|
|
|
longer recommended for use:
|
|
|
|
|
|
|
|
|
|
* `providers` - a configuration block that allows specifying the locations of
|
|
|
|
|
specific plugins for each named provider. This mechanism is deprecated
|
|
|
|
|
because it is unable to specify a version number for each plugin, and thus
|
2019-03-21 20:20:29 +01:00
|
|
|
|
it does not co-operate with the plugin versioning mechanism. Instead,
|
2017-09-08 01:38:34 +02:00
|
|
|
|
place the plugin executable files in
|
|
|
|
|
[the third-party plugins directory](/docs/configuration/providers.html#third-party-plugins).
|