Courseiva
Understand Terraform basicsmediumDrag & DropObjective-mapped

TF-004 Understand Terraform basics Practice Question

Drag and drop the steps to set up remote state with Terraform Cloud in the correct order.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5

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

Create a workspace in Terraform Cloud, then add the cloud block to your configuration, then run terraform init.

The correct order is to first create the workspace in Terraform Cloud, then add the cloud block to your Terraform configuration referencing that workspace, and finally run terraform init which detects the cloud block and migrates the state from local to the remote workspace. Other orders fail because the workspace must exist before the cloud block is configured or init is run without proper backend 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.

  • Create a workspace in Terraform Cloud, then add the cloud block to your configuration, then run terraform init.

    Why this is correct

    This sequence is correct because the Terraform Cloud workspace must exist first to provide a valid target for the remote state. The `cloud` block in the configuration then explicitly defines the connection to this pre-existing workspace. Finally, `terraform init` detects the configured remote backend and performs the necessary state migration from local to the specified Terraform Cloud workspace, establishing the remote state management.

  • Add the cloud block to your configuration, then create a workspace in Terraform Cloud, then run terraform init.

    Why it's wrong here

    This order is incorrect because `terraform init` will attempt to configure the backend immediately after the `cloud` block is added. If the referenced Terraform Cloud workspace does not yet exist when `init` runs, the backend configuration will fail, preventing the successful establishment of remote state. The workspace must be provisioned before being referenced in the configuration.

  • Run terraform init, then add the cloud block to your configuration, then create a workspace in Terraform Cloud.

    Why it's wrong here

    This sequence is incorrect because running `terraform init` without the `cloud` block present will initialize the backend to use local state by default. Even if the `cloud` block is added and a workspace is created afterward, the initial `init` has already established a local state. A subsequent `init` would be required to detect the remote backend and migrate state, making the initial `init` premature and ineffective for remote state setup.

  • Create a workspace in Terraform Cloud, then run terraform init, then add the cloud block to your configuration.

    Why it's wrong here

    This order is incorrect because `terraform init` requires the `cloud` block to be present in the configuration *before* it runs to detect and configure the remote backend. Running `init` after workspace creation but *before* adding the `cloud` block means it will initialize a local state. This completely bypasses the intended remote state configuration, as the `cloud` block is essential for defining the connection to Terraform Cloud.

About these practice questions

Courseiva writes every TF-004 question from scratch — 428 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.