Interview Prep/Terraform/Pipelines Terraform Cloud and OpenTofu

Explain HCP Terraform workflows: VCS-driven, CLI-driven and API-driven.

BeginnerScenarioPipelines Terraform Cloud and OpenTofu
Answer

Situation read → A teammate is new to HCP Terraform workspaces.

What I'd do →

  1. VCS-driven: connect a repo; pushes trigger plans, merges trigger applies, PRs get speculative plans.
  2. CLI-driven: terraform plan runs remotely via the cloud block, with state and runs in HCP.
  3. API-driven: pipelines upload configuration versions and create runs via API for custom flows.
terraform {
  cloud {
    organization = "acme"
    workspaces { name = "network-prod" }
  }
}

Why → Pick by where you want the trigger: Git events, developers, or your own automation.

Interview tip → A workspace is state plus variables plus runs plus permissions.

All Terraform questions Roadmap: Terraform in production

More on Pipelines Terraform Cloud and OpenTofu