- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Core Tech
Connect Terraform Configurations with Data Sources and Remote State
Learn how to connect separate Terraform configurations using data sources, outputs, and remote state. In this hands-on lab, you will retrieve information about existing AWS resources, publish infrastructure values as Terraform outputs, and configure a dependent Terraform configuration to consume those outputs from an Amazon S3 remote state backend. You will also validate that changes to upstream outputs are reflected in the dependent configuration.
Lab Info
Table of Contents
-
Challenge
Look up existing resources using Terraform data sources
In this objective, you will use Terraform data sources to retrieve information about existing AWS networking resources. You will identify a preconfigured VPC and subnet, configure data sources to look up these resources using their tags, and validate that Terraform successfully retrieves their identifiers without creating duplicate infrastructure.
-
Challenge
Publish values from a Terraform configuration as outputs
In this objective, you will configure Terraform outputs to expose information from an existing networking configuration. You will publish the VPC ID, subnet ID, and a shared configuration value, apply the changes, and verify that the outputs are recorded in the upstream Terraform state stored in Amazon S3.
-
Challenge
Read another configuration's outputs using Terraform remote state
In this objective, you will connect a dependent Terraform configuration to the upstream networking configuration using
terraform_remote_state. You will configure access to the state stored in Amazon S3, retrieve the published networking outputs, and validate that the dependent configuration can consume those values without managing or recreating the original resources. -
Challenge
Verify upstream changes are reflected in the dependent configuration
In this objective, you will modify a shared output value in the upstream networking configuration and apply the change to update its remote state. You will then refresh the dependent configuration and verify that it retrieves the updated value while the existing AWS networking resources remain unchanged.
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.