diff --git a/website/source/docs/configuration/variables.html.md b/website/source/docs/configuration/variables.html.md index 1062b32bb38b..ea454c1dcbc9 100644 --- a/website/source/docs/configuration/variables.html.md +++ b/website/source/docs/configuration/variables.html.md @@ -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: @@ -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: