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 →
- Freeze applies on the stack (disable the pipeline, announce a window).
- Replace the backend with the
cloudblock and runterraform init -migrate-state. - Configure variables and credentials in the workspace; run a speculative plan: must be empty.
- 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.
More on Pipelines Terraform Cloud and OpenTofu
Build a basic GitHub Actions pipeline: plan on pull request, apply on merge to main.BeginnerReviewers can't read raw plan logs. How do you present the plan in the PR?IntermediateTwo PRs merge close together and both apply to the same stack. What prevents trouble?IntermediateHow do you add a manual approval before prod applies?IntermediateCompare Atlantis, HCP Terraform and a hand-built GitHub Actions pipeline.IntermediateA saved plan was approved yesterday and apply fails because main changed. How do you avoid dead approvals?Intermediate