Skip to content

Commit

Permalink
Tweak docs to properly document .tfvars format (hashicorp#6415)
Browse files Browse the repository at this point in the history
As reported and described in hashicorp#3292
  • Loading branch information
chids authored and Xavier Sellier committed May 17, 2016
1 parent 6d7256a commit 529342c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions website/source/docs/configuration/variables.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,13 @@ $ TF_VAR_image=foo terraform apply
## Variable Files

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:

Expand All @@ -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
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:

_foo.tfvars_
```
variable "baz" {
default = "foo"
}
baz = "foo"
```

_bar.tfvars_
```
variable "baz" {
default = "bar"
}
baz = "bar"
```

When they are passed in the following order:
Expand Down

0 comments on commit 529342c

Please sign in to comment.