TF-004 Use Terraform outside the core workflow Practice Question
A company wants to use Terraform to manage resources across AWS and Azure. They need a single workflow that can apply changes to both providers. What is the best practice?
⚠ Common exam trap
A common mix-up: candidates confuse workspaces (which isolate state for different environments) with provider separation, leading them to choose option C, when in fact workspaces do not change the provider definitions in a configuration.
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
✓
Define both providers in a single configuration
Terraform allows multiple providers to be defined in a single configuration, enabling a unified workflow to manage resources across AWS and Azure. By declaring both providers in the same root module, a single `terraform apply` can create, update, or destroy resources from both clouds in the correct order, leveraging Terraform's dependency graph to handle cross-provider dependencies. This is the recommended best practice for multi-cloud management with a single workflow.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use separate Terraform configurations for each provider
Why it's wrong here
While technically feasible, using separate Terraform configurations for each provider necessitates independent `terraform init`, `plan`, and `apply` workflows. This approach significantly complicates managing dependencies between resources hosted on different providers, as changes in one configuration would not automatically trigger updates or awareness in another, hindering a unified infrastructure management strategy and increasing operational overhead.
- ✗
Use Terraform Cloud workspaces with different providers
Why it's wrong here
Terraform Cloud workspaces are designed to manage distinct state files for different environments (e.g., dev, staging, prod) or logical separations *within a single Terraform configuration*. While you could assign a different configuration to each workspace, this still means you're maintaining separate, isolated configurations for each provider, failing to achieve a unified management approach for resources that might be interdependent across those providers.
- ✗
Use Terraform workspaces to separate providers
Why it's wrong here
Terraform workspaces, managed via the `terraform workspace` CLI command, are primarily used to isolate state files for different environments (e.g., development, production) *within a single Terraform configuration*. They do not inherently provide a mechanism to define or separate different providers themselves; rather, they manage distinct instances of the infrastructure defined by the *same* configuration, making them unsuitable for separating provider definitions.
- ✓
Define both providers in a single configuration
Why this is correct
Defining multiple providers within a single Terraform configuration allows for a truly unified infrastructure as code workflow. This approach enables the declaration and management of resources from different cloud providers (e.g., AWS and Azure) within the same set of `.tf` files, facilitating the creation of cross-provider dependencies and ensuring that `terraform plan` and `apply` operations consider the entire infrastructure holistically.
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.