Courseiva
Question 510 of 428
Use Terraform outside the core workfloweasyMultiple ChoiceObjective-mapped

TF-004 Use Terraform outside the core workflow Practice Question

A DevOps team is using Terraform Cloud to manage infrastructure. They want to integrate Terraform into their CI/CD pipeline by triggering runs programmatically. Which approach should they use to invoke a Terraform run from an external system?

⚠ Common exam trap

HashiCorp often tests the distinction between event-driven triggers (VCS webhooks) and programmatic API calls, where candidates mistakenly choose webhooks because they seem 'automated,' but the question explicitly requires programmatic invocation from an external system, not a VCS event.

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

Use the Terraform Cloud API to trigger a run.

The Terraform Cloud API provides a programmatic endpoint to trigger runs, allowing external CI/CD systems to initiate Terraform operations without manual intervention. This is the correct approach because it directly invokes a run with full control over variables, configuration versions, and apply strategies, aligning with the requirement to integrate Terraform into a CI/CD pipeline programmatically.

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 the Terraform Cloud API to trigger a run.

    Why this is correct

    This is the correct method for programmatic interaction with Terraform Cloud. The Terraform Cloud API provides specific endpoints to create, manage, and trigger runs for designated workspaces, enabling seamless integration with external systems like CI/CD pipelines, custom scripts, or other automation tools. This approach allows for precise control over the run lifecycle, including dynamic variable overrides and explicit plan/apply actions, without requiring direct VCS commits.

  • Set up a webhook from the VCS provider to trigger runs.

    Why it's wrong here

    While Terraform Cloud supports webhooks from VCS providers (e.g., GitHub, GitLab) to automatically trigger runs upon code commits or pull requests, this mechanism is specifically designed for VCS-driven workflows. It does not facilitate programmatic triggering of runs from an arbitrary CI pipeline or an external system that isn't directly pushing code to the configured VCS repository. The question implies a need for programmatic control *from* a CI pipeline, not *by* a VCS commit.

  • Configure a remote backend to automatically run apply.

    Why it's wrong here

    A remote backend, such as the `remote` backend for Terraform Cloud, is primarily responsible for securely storing Terraform state files and facilitating state locking to prevent concurrent modifications. While it enables collaboration and remote operations by centralizing state, configuring a remote backend itself does not automatically trigger Terraform runs or apply operations within Terraform Cloud. It merely defines where the state is managed, requiring explicit `terraform plan` or `terraform apply` commands (or API calls in TFC) to initiate actions.

  • Execute 'terraform apply -auto-approve' in the CI pipeline.

    Why it's wrong here

    Executing `terraform apply -auto-approve` directly within a CI pipeline would perform the Terraform operations on the CI runner itself, using its local environment and credentials. This approach completely bypasses Terraform Cloud's managed run environment, its centralized state management, policy enforcement (Sentinel), and detailed run history. It does not integrate with Terraform Cloud's workflow for executing runs, making it unsuitable for leveraging Terraform Cloud's features for governed infrastructure management.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.