World map

 

BM: Baca dalam Bahasa Melayu

World T3: State & Teams

Remote state backends

You will learn: where a team keeps one shared register, and how to move it there.

Checked with OpenTofu 1.13 on 1 Nov 2026

The problem

Aina built Kedai Kancil from her laptop. Today Ben runs tofu apply with the same blueprint, on his laptop. His folder has no state file. What does his plan want?

Pick one answer.

Try it

Where is the register now? Type ls. Then read it: cat terraform.tfstate.

Blueprint (your .tf files)init done

  • local_file.menu
  • random_pet.stall

Built (the state file)state #1

  • local_file.menu
  • random_pet.stall
stall
lucky-civet
Blueprint: 2 resources. Built: 2.

Change a file, then run tofu plan to see what it means.

Watch

Tap the two lines that say where the register goes.

0 of 2 found

A backend: Where the register (the state) lives. A shared one online lets a whole team read the same register. is where the register lives. A shared one sits online, so the whole team reads the same register.

Try it

Sort each fact: a file on one laptop, or a shared backend?

Drag a card into a box. Or tap the card, then tap the box.

      Watch

      bash
      tofu init
      Initializing the backend...
      Do you want to copy existing state to the new backend?
      Pre-existing state was found while migrating the previous "local" backend to the
      newly configured "local" backend. No existing state was found in the newly
      configured "local" backend. Do you want to copy this state to the new "local"
      backend? Enter "yes" to copy and "no" to start with an empty state.
      Enter a value: yes
      Successfully configured the backend "local"! OpenTofu will automatically
      use this backend unless the backend configuration changes.
      tofu state list
      terraform_data.bell
      A real tofu init after adding a backend block. OpenTofu asks to copy the existing state, the answer is yes, and the backend is configured. tofu state list then shows terraform_data.bell.

      Moving day. Add the backend block, then run tofu init. It asks before it copies the register. This real run moved it to a new folder.

      Predict

      Put the moving steps in order.

      First step at the top. Put these in order. Use the arrows, or drag.

      • Make the shared place first (a bucket)
      • Run tofu init and answer yes
      • Add the backend block to the blueprint
      • Run tofu plan: "No changes" means it worked
      • Commit the backend block, never the state file

      Check

      Could you share terraform.tfstate through Git instead?

      Pick one answer.

      You did it!

      You can now explain where a team keeps its register, and how to move it.

      Go deeper (optional)

      Other backends: gcs, azurerm, pg, kubernetes, http and more. Terraform also offers HCP Terraform (the cloud block). OpenTofu can also encrypt the state itself. After a move, OpenTofu empties the old local file and keeps a .backup copy.

      Real rep (optional): move a register on your own machine. No cloud, no cost.

      Real mission

      1. tofu init && tofu apply
      2. tofu init
      3. tofu state list && ls register

      0 of 5 steps done ยท Your ticks are saved.