website: update docs for count.index
This commit is contained in:
parent
88ac1b030a
commit
55ab043036
|
@ -14,7 +14,9 @@ into strings. These interpolations are wrapped in `${}`, such as
|
||||||
The interpolation syntax is powerful and allows you to reference
|
The interpolation syntax is powerful and allows you to reference
|
||||||
variables, attributes of resources, call functions, etc.
|
variables, attributes of resources, call functions, etc.
|
||||||
|
|
||||||
To reference variables, use the `var.` prefix followed by the
|
## Available Variables
|
||||||
|
|
||||||
|
**To reference user variables**, use the `var.` prefix followed by the
|
||||||
variable name. For example, `${var.foo}` will interpolate the
|
variable name. For example, `${var.foo}` will interpolate the
|
||||||
`foo` variable value. If the variable is a mapping, then you
|
`foo` variable value. If the variable is a mapping, then you
|
||||||
can reference static keys in the map with the syntax
|
can reference static keys in the map with the syntax
|
||||||
|
@ -22,18 +24,28 @@ can reference static keys in the map with the syntax
|
||||||
get the value of the `us-east-1` key within the `amis` variable
|
get the value of the `us-east-1` key within the `amis` variable
|
||||||
that is a mapping.
|
that is a mapping.
|
||||||
|
|
||||||
To reference attributes of other resources, the syntax is
|
**To reference attributes of other resources**, the syntax is
|
||||||
`TYPE.NAME.ATTRIBUTE`. For example, `${aws_instance.web.id}`
|
`TYPE.NAME.ATTRIBUTE`. For example, `${aws_instance.web.id}`
|
||||||
will interpolate the ID attribute from the "aws\_instance"
|
will interpolate the ID attribute from the "aws\_instance"
|
||||||
resource named "web".
|
resource named "web".
|
||||||
|
|
||||||
Finally, Terraform ships with built-in functions. Functions
|
**To reference outputs from a module**, the syntax is
|
||||||
are called with the syntax `name(arg, arg2, ...)`. For example,
|
`MODULE.NAME.OUTPUT`. For example `${module.foo.bar}` will
|
||||||
to read a file: `${file("path.txt")}`. The built-in functions
|
interpolate the "bar" output from the "foo"
|
||||||
are documented below.
|
[module](/docs/modules/index.html).
|
||||||
|
|
||||||
|
**To reference count information**, the syntax is `count.FIELD`.
|
||||||
|
For example, `${count.index}` will interpolate the current index
|
||||||
|
in a multi-count resource. For more information on count, see the
|
||||||
|
resource configuration page.
|
||||||
|
|
||||||
## Built-in Functions
|
## Built-in Functions
|
||||||
|
|
||||||
|
Terraform ships with built-in functions. Functions are called with
|
||||||
|
the syntax `name(arg, arg2, ...)`. For example,
|
||||||
|
to read a file: `${file("path.txt")}`. The built-in functions
|
||||||
|
are documented below.
|
||||||
|
|
||||||
The supported built-in functions are:
|
The supported built-in functions are:
|
||||||
|
|
||||||
* `concat(args...)` - Concatenates the values of multiple arguments into
|
* `concat(args...)` - Concatenates the values of multiple arguments into
|
||||||
|
|
|
@ -42,7 +42,9 @@ resource type in the
|
||||||
There are **meta-parameters** available to all resources:
|
There are **meta-parameters** available to all resources:
|
||||||
|
|
||||||
* `count` (int) - The number of identical resources to create.
|
* `count` (int) - The number of identical resources to create.
|
||||||
This doesn't apply to all resources.
|
This doesn't apply to all resources. You can use the `${count.index}`
|
||||||
|
[interpolation](/docs/configuration/interpolation.html) to reference
|
||||||
|
the current count index in your resource.
|
||||||
|
|
||||||
* `depends_on` (list of strings) - Explicit dependencies that this
|
* `depends_on` (list of strings) - Explicit dependencies that this
|
||||||
resource has. These dependencies will be created before this
|
resource has. These dependencies will be created before this
|
||||||
|
|
Loading…
Reference in New Issue