From 551eedcf2616376b00d7da170b09f682bbfa3445 Mon Sep 17 00:00:00 2001 From: Tom Elliff Date: Tue, 2 May 2017 15:17:24 +0100 Subject: [PATCH] Document the data source interpolation usage (#14144) * Document the data source interpolation usage Also briefly mentions how to use counts and splat syntax as with resources to further document the usage of counts for data sources (see https://github.com/hashicorp/terraform/pull/14143). * Output -> Attribute As per feedback. --- website/source/docs/configuration/interpolation.html.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/website/source/docs/configuration/interpolation.html.md b/website/source/docs/configuration/interpolation.html.md index aef902d6e9..0a1814665c 100644 --- a/website/source/docs/configuration/interpolation.html.md +++ b/website/source/docs/configuration/interpolation.html.md @@ -61,6 +61,13 @@ attribute set, you can access individual attributes with a zero-based index, such as `${aws_instance.web.0.id}`. You can also use the splat syntax to get a list of all the attributes: `${aws_instance.web.*.id}`. +#### Attributes of a data source + +The syntax is `data.TYPE.NAME.ATTRIBUTE`. For example. `${data.aws_ami.ubuntu.id}` will interpolate the `id` attribute from the `aws_ami` [data source](/docs/configuration/data-sources.html) named `ubuntu`. If the data source has a `count` +attribute set, you can access individual attributes with a zero-based +index, such as `${data.aws_subnet.example.0.cidr_block}`. You can also use the splat +syntax to get a list of all the attributes: `${data.aws_subnet.example.*.cidr_block}`. + #### Outputs from a module The syntax is `MODULE.NAME.OUTPUT`. For example `${module.foo.bar}` will