"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "website/docs/language/data-sources/index.html.md" between
terraform-1.0.2.tar.gz and terraform-1.0.3.tar.gz

About: Terraform is a tool for building, changing, and versioning a datacenter infrastructure (written in Go).

index.html.md  (terraform-1.0.2):index.html.md  (terraform-1.0.3)
--- ---
layout: "language" layout: "language"
page_title: "Data Sources - Configuration Language" page_title: "Data Sources - Configuration Language"
sidebar_current: "docs-config-data-sources" sidebar_current: "docs-config-data-sources"
description: |- description: |-
Data sources allow data to be fetched or computed for use elsewhere in Terrafo rm configuration. Data sources allow data to be fetched or computed for use elsewhere in Terrafo rm configuration.
--- ---
# Data Sources # Data Sources
> **Hands-on:** Try the [Query data sources](https://learn.hashicorp.com/tutoria _Data sources_ allow Terraform use information defined outside of Terraform,
ls/terraform/data-sources?in=terraform/configuration-language&utm_source=WEBSITE defined by another separate Terraform configuration, or modified by functions.
&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCor
p Learn.
_Data sources_ allow data to be fetched or computed for use elsewhere > **Hands-on:** Try the [Query data sources](https://learn.hashicorp.com/tutoria
in Terraform configuration. Use of data sources allows a Terraform ls/terraform/data-sources?in=terraform/configuration-language&utm_source=WEBSITE
configuration to make use of information defined outside of Terraform, &utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCor
or defined by another separate Terraform configuration. p Learn.
Each [provider](/docs/language/providers/index.html) may offer data sources Each [provider](/docs/language/providers/index.html) may offer data sources
alongside its set of [resource](/docs/language/resources/index.html) alongside its set of [resource](/docs/language/resources/index.html)
types. types.
## Using Data Sources ## Using Data Sources
A data source is accessed via a special kind of resource known as a A data source is accessed via a special kind of resource known as a
_data resource_, declared using a `data` block: _data resource_, declared using a `data` block:
skipping to change at line 177 skipping to change at line 175
} }
``` ```
## Description ## Description
The `data` block creates a data instance of the given _type_ (first The `data` block creates a data instance of the given _type_ (first
block label) and _name_ (second block label). The combination of the type block label) and _name_ (second block label). The combination of the type
and name must be unique. and name must be unique.
Within the block (the `{ }`) is configuration for the data instance. The Within the block (the `{ }`) is configuration for the data instance. The
configuration is dependent on the type, and is documented for each configuration is dependent on the type; as with
data source in the [providers section](/docs/providers/index.html). [resources](/docs/language/resources/index.html), each provider on the
[Terraform Registry](https://registry.terraform.io/browse/providers) has its own
documentation for configuring and using the data types it provides.
Each data instance will export one or more attributes, which can be Each data instance will export one or more attributes, which can be
used in other resources as reference expressions of the form used in other resources as reference expressions of the form
`data.<TYPE>.<NAME>.<ATTRIBUTE>`. For example: `data.<TYPE>.<NAME>.<ATTRIBUTE>`. For example:
```hcl ```hcl
resource "aws_instance" "web" { resource "aws_instance" "web" {
ami = data.aws_ami.web.id ami = data.aws_ami.web.id
instance_type = "t1.micro" instance_type = "t1.micro"
} }
 End of changes. 3 change blocks. 
10 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)