Adding documentation for TF_CLI_CONFIG_FILE environment variable (#20834)

Fixes #15849
This commit is contained in:
Matthew Sanabria 2019-04-05 14:21:40 -04:00 committed by GitHub
parent 26c1e40ad7
commit be04e70a0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View File

@ -231,7 +231,12 @@ func wrappedMain() int {
func cliConfigFile() (string, error) { func cliConfigFile() (string, error) {
mustExist := true mustExist := true
configFilePath := os.Getenv("TERRAFORM_CONFIG")
configFilePath := os.Getenv("TF_CLI_CONFIG_FILE")
if configFilePath == "" {
configFilePath = os.Getenv("TERRAFORM_CONFIG")
}
if configFilePath == "" { if configFilePath == "" {
var err error var err error
configFilePath, err = ConfigFile() configFilePath, err = ConfigFile()

View File

@ -32,6 +32,9 @@ CLI configuration file, even though Windows Explorer may _display_ its name
as just `terraform.rc`. Use `dir` from PowerShell or Command Prompt to as just `terraform.rc`. Use `dir` from PowerShell or Command Prompt to
confirm the filename. confirm the filename.
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).
## Configuration File Syntax ## Configuration File Syntax
The configuration file uses the same _HCL_ syntax as `.tf` files, but with The configuration file uses the same _HCL_ syntax as `.tf` files, but with

View File

@ -113,3 +113,11 @@ This is a purely cosmetic change to Terraform's human-readable output, and the
exact output differences can change between minor Terraform versions. exact output differences can change between minor Terraform versions.
For more details see [Running Terraform in Automation](https://learn.hashicorp.com/terraform/development/running-terraform-in-automation). For more details see [Running Terraform in Automation](https://learn.hashicorp.com/terraform/development/running-terraform-in-automation).
## TF_CLI_CONFIG_FILE
The location of the [Terraform CLI configuration file](/docs/commands/cli-config.html).
```shell
export TF_CLI_CONFIG_FILE="$HOME/.terraformrc-custom"
```