World map

 

BM: Baca dalam Bahasa Melayu

World T1: Blueprints

Providers and init

You will learn: what providers are, what tofu init does, and how to build your first stall.

Checked with OpenTofu 1.13 on 1 Nov 2026

The problem

A new folder, straight from Git. Type tofu plan. What does OpenTofu say?

Blueprint (your .tf files)needs tofu init

  • local_file.signnot built yet
  • random_pet.stallnot built yet

Built (the state file)

Nothing built yet.

Blueprint: 2 resources. Built: 0.

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

Error: Inconsistent dependency lock file. Plain words: the tools are not here yet.

Watch

OpenTofu can’t make files or names by itself. provider: A plugin that knows how to build one family of things, like a supplier. random makes names; local makes files. do the work, like suppliers. Who supplies what?

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

      Check

      providers.tf lists the suppliers. ~> 3.7 means β€œ3.7 or newer, but not 4”. Which version may init pick?

      random = {
        source  = "hashicorp/random"
        version = "~> 3.7"
      }

      Pick one answer.

      Try it

      Now get the suppliers. Type tofu init.

      Blueprint (your .tf files)needs tofu init

      • local_file.signnot built yet
      • random_pet.stallnot built yet

      Built (the state file)

      Nothing built yet.

      Blueprint: 2 resources. Built: 0.

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

      Check

      This is what init printed. Tap the two lines where a download starts.

      Tap the lines that match.

      0 of 2 found

      .terraform.lock.hcl is the lock file: .terraform.lock.hcl: the receipt tofu init writes. It records which provider versions it picked. Commit it to Git.: a receipt of the versions. Commit it to Git.

      Try it

      Your first real build. Type tofu plan and read it. Then tofu apply, and yes.

      Blueprint (your .tf files)init done

      • local_file.signnot built yet
      • random_pet.stallnot built yet

      Built (the state file)

      Nothing built yet.

      Blueprint: 2 resources. Built: 0.

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

      Predict

      You run tofu init again in the same folder. What happens?

      Pick one answer.

      You did it!

      You can now explain providers and run your first init, plan and apply.

      Go deeper (optional)

      init also makes a hidden .terraform/ folder with the provider programs. Keep it out of Git; commit .terraform.lock.hcl. OpenTofu downloads providers from its own registry, registry.opentofu.org. terraform init does the same job in Terraform, from HashiCorp’s registry.