Skip to content

Commit 55ab043

Browse files
committed
website: update docs for count.index
1 parent 88ac1b0 commit 55ab043

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

website/source/docs/configuration/interpolation.html.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,38 @@ into strings. These interpolations are wrapped in `${}`, such as
1414
The interpolation syntax is powerful and allows you to reference
1515
variables, attributes of resources, call functions, etc.
1616

17-
To reference variables, use the `var.` prefix followed by the
17+
## Available Variables
18+
19+
**To reference user variables**, use the `var.` prefix followed by the
1820
variable name. For example, `${var.foo}` will interpolate the
1921
`foo` variable value. If the variable is a mapping, then you
2022
can reference static keys in the map with the syntax
2123
`var.MAP.KEY`. For example, `${var.amis.us-east-1}` would
2224
get the value of the `us-east-1` key within the `amis` variable
2325
that is a mapping.
2426

25-
To reference attributes of other resources, the syntax is
27+
**To reference attributes of other resources**, the syntax is
2628
`TYPE.NAME.ATTRIBUTE`. For example, `${aws_instance.web.id}`
2729
will interpolate the ID attribute from the "aws\_instance"
2830
resource named "web".
2931

30-
Finally, Terraform ships with built-in functions. Functions
31-
are called with the syntax `name(arg, arg2, ...)`. For example,
32-
to read a file: `${file("path.txt")}`. The built-in functions
33-
are documented below.
32+
**To reference outputs from a module**, the syntax is
33+
`MODULE.NAME.OUTPUT`. For example `${module.foo.bar}` will
34+
interpolate the "bar" output from the "foo"
35+
[module](/docs/modules/index.html).
36+
37+
**To reference count information**, the syntax is `count.FIELD`.
38+
For example, `${count.index}` will interpolate the current index
39+
in a multi-count resource. For more information on count, see the
40+
resource configuration page.
3441

3542
## Built-in Functions
3643

44+
Terraform ships with built-in functions. Functions are called with
45+
the syntax `name(arg, arg2, ...)`. For example,
46+
to read a file: `${file("path.txt")}`. The built-in functions
47+
are documented below.
48+
3749
The supported built-in functions are:
3850

3951
* `concat(args...)` - Concatenates the values of multiple arguments into

website/source/docs/configuration/resources.html.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ resource type in the
4242
There are **meta-parameters** available to all resources:
4343

4444
* `count` (int) - The number of identical resources to create.
45-
This doesn't apply to all resources.
45+
This doesn't apply to all resources. You can use the `${count.index}`
46+
[interpolation](/docs/configuration/interpolation.html) to reference
47+
the current count index in your resource.
4648

4749
* `depends_on` (list of strings) - Explicit dependencies that this
4850
resource has. These dependencies will be created before this

0 commit comments

Comments
 (0)