TF-004 Understand Terraform basics Practice Question
A developer wants to use the output of one Terraform configuration as input to another. Which Terraform feature should they use?
⚠ Common exam trap
Candidates often mistakenly choose 'data sources' as a catch-all answer, but the terraform_remote_state data source specifically reads outputs from another Terraform state, not provider resources.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
remote state data source
The remote state data source (terraform_remote_state) is the correct feature because it allows one Terraform configuration to read the output values from another configuration's state file, enabling cross-configuration data sharing without manual intervention. This is the idiomatic way to consume outputs from a separate Terraform root module, such as retrieving a VPC ID from a networking configuration to use in an application configuration.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
local values
Why it's wrong here
Local values (`locals`) are named expressions defined within a module or configuration to avoid repeating complex values. They are strictly scoped to the module where they are declared, meaning their values are not exposed externally and cannot be referenced by other separate Terraform configurations or modules. Therefore, they cannot be used to pass outputs between distinct configurations.
- ✓
remote state data source
Why this is correct
The `terraform_remote_state` data source is specifically designed to read outputs from a Terraform state file stored in a remote backend. By configuring this data source with the appropriate backend type and configuration, a separate Terraform configuration can securely access and utilize the output values defined in another, previously applied, Terraform configuration. This enables modularity and dependency management across distinct infrastructure deployments.
- ✗
data sources
Why it's wrong here
While `data sources` generally allow Terraform to fetch information from external systems, such as cloud provider APIs (e.g., AWS EC2 instances, Azure resource groups) or external services, the generic term 'data sources' alone is too broad. Without specifying `terraform_remote_state`, a standard data source primarily queries existing infrastructure or external APIs, rather than directly reading the outputs from another Terraform state file.
- ✗
variables
Why it's wrong here
Input variables (`variable` blocks) are used to parameterize a Terraform configuration or module, allowing values to be passed *into* it from the command line, environment variables, or `.tfvars` files. They serve to customize the behavior of a single configuration or module during its application, but they do not provide a mechanism for one *separate* Terraform configuration to directly consume outputs from another *separate* configuration's state.
Go deeper
Related to this question
About these practice questions
One of 428 original TF-004 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This TF-004 practice question is part of Courseiva's free HashiCorp certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the TF-004 exam.