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

Tweak docs to properly document .tfvars format #6415

Merged
merged 1 commit into from
Apr 29, 2016
Merged
Changes from all 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
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