Tweak docs to properly document .tfvars format (#6415)

As reported and described in hashicorp/terraform#3292
This commit is contained in:
Mårten Gustafson 2016-04-29 15:06:36 +02:00 committed by Paul Stack
parent c61c0216e1
commit 5b7f12ecd7
1 changed files with 10 additions and 8 deletions

View File

@ -153,7 +153,13 @@ $ TF_VAR_image=foo terraform apply
## Variable Files ## Variable Files
Variables can be collected in files and passed all at once using the Variables can be collected in files and passed all at once using the
`-var-file=foo` flag. `-var-file=foo.tfvars` flag. The format for variables in `.tfvars`
files is:
```
foo = "bar"
xyz = "abc"
```
The flag can be used multiple times per command invocation: The flag can be used multiple times per command invocation:
@ -165,22 +171,18 @@ terraform apply -var-file=foo.tfvars -var-file=bar.tfvars
variable file (reading left to right) will be the definition used. Put more variable file (reading left to right) will be the definition used. Put more
simply, the last time a variable is defined is the one which will be used. simply, the last time a variable is defined is the one which will be used.
##Example: ### Precedence example:
Both these files have the variable `baz` defined: Both these files have the variable `baz` defined:
_foo.tfvars_ _foo.tfvars_
``` ```
variable "baz" { baz = "foo"
default = "foo"
}
``` ```
_bar.tfvars_ _bar.tfvars_
``` ```
variable "baz" { baz = "bar"
default = "bar"
}
``` ```
When they are passed in the following order: When they are passed in the following order: