Merge pull request #9281 from nwalke/issue_9037

DOCS: Update interpolation page to show list usage
This commit is contained in:
Paul Stack 2016-10-07 16:48:04 +01:00 committed by GitHub
commit 42c2fe5c85
2 changed files with 12 additions and 7 deletions

View File

@ -23,12 +23,17 @@ will be rendered as a literal `${foo}`.
## Available Variables
**To reference user variables**, use the `var.` prefix followed by the
**To reference user string variables**, use the `var.` prefix followed by the
variable name. For example, `${var.foo}` will interpolate the
`foo` variable value. If the variable is a map, then you
can reference static keys in the map with the syntax
`var.MAP["KEY"]`. For example, `${var.amis["us-east-1"]` would
get the value of the `us-east-1` key within the `amis` map variable.
`foo` variable value.
**To reference user map variables**, the syntax is `var.MAP["KEY"]`. For
example, `${var.amis["us-east-1"]}` would get the value of the `us-east-1`
key within the `amis` map variable.
**To reference user list variables**, the syntax is `["${var.LIST}"]`. For
example, `["${var.subnets}"]` would get the value of the `subnets` list, as a
list.
**To reference attributes of your own resource**, the syntax is
`self.ATTRIBUTE`. For example `${self.private_ip_address}` will

View File

@ -109,7 +109,7 @@ variable "users" {
}
```
The usage of maps, list, strings, etc. is documented fully in the
The usage of maps, lists, strings, etc. is documented fully in the
[interpolation syntax](/docs/configuration/interpolation.html)
page.
@ -194,7 +194,7 @@ $ TF_VAR_somemap='{foo = "bar", baz = "qux"}' terraform plan
<a id="variable-files"></a>
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.tfvars` flag. The format for variables in `.tfvars`
files is [HCL](/docs/configuration/syntax.html#HCL), with top level key/value
pairs: