New Terraform Tutorial: Terraform Data Sources

Learn how to query remote data sources with Terraform in this new tutorial added to HashiCorp Learn.

HashiCorp Terraform uses providers to manage cloud infrastructure, which you define in Terraform configuration files. When learning to use Terraform, practitioners focus on resource blocks, which map to infrastructure that Terraform will manage.

Resource definition in Terraform configuration file.

In addition to resources, Terraform providers can also define data sources. Terraform uses data sources to fetch information from cloud provider APIs, such as disk image IDs, or information about the rest of your infrastructure through the outputs of other Terraform configurations. Data sources represent data that Terraform queries from the same cloud provider APIs that it uses to provision resources.

You can make your Terraform projects more flexible by using data sources to query your cloud provider for information.

Data source defined in Terraform configuration file.

»Get Hands-on with Data Sources

In this tutorial, you will provision a web application with Terraform, and use data sources to configure it to support multiple AWS regions and availability zones: Query Data Sources

For even more news about our latest tutorials being added to HashiCorp Learn, follow @HashiCorp on Twitter.

»Learn More

Terraform configurations allow you to manage multiple pieces of infrastructure and iterate over structured data. Get more hands-on experience with Terraform configurations with these additional tutorials on HashiCorp Learn:

Customize Terraform Configuration with Variables

Learn how to make your Terraform configuration more flexible with input variables. In this tutorial, you will use input variables to customize infrastructure for a web application with Terraform.

Manage Similar Resources with Count

Learn how to manage similar Terraform resources using the count argument. In this tutorial, you will use Terraform to provision a VPC, load balancer, and EC2 instances on AWS. Then you will use the count argument to provision multiple EC2 instances per private subnet with a single resource block.

Perform Dynamic Operations with Functions

The Terraform configuration language allows you to write declarative expressions to create infrastructure. In this tutorial, you will use several built-in functions to perform operations dynamically and effectively to create an EC2 instance running a pre-built web app.

Sign up for the latest HashiCorp news