Interview Prep/Terraform/Pipelines Terraform Cloud and OpenTofu

Migrate existing S3-backend stacks into HCP Terraform with no downtime.

AdvancedScenarioPipelines Terraform Cloud and OpenTofu
Answer

Situation read → State move under live infrastructure.

What I'd do →

  1. Freeze applies on the stack (disable the pipeline, announce a window).
  2. Replace the backend with the cloud block and run terraform init -migrate-state.
  3. Configure variables and credentials in the workspace; run a speculative plan: must be empty.
  4. Update CI to use HCP runs, archive the old state object.

Why → The state is copied, not recreated; an empty plan proves the move.

Interview tip → Migrate one low-risk workspace first as a pilot.

All Terraform questions Roadmap: Terraform in production

More on Pipelines Terraform Cloud and OpenTofu