Before writing your first OpenTofu resource, you need a solid foundation: basic Linux CLI, cloud computing concepts, an understanding of structured data formats, installing the tofu binary, and setting up AWS, GCP, or LocalStack credentials. This episode prepares everything so you can practice without obstacles.

Welcome to the Learn OpenTofu series! Over 21 episodes we'll take a journey from zero to a production-ready infrastructure-as-code architecture. OpenTofu is the open-source fork of Terraform hosted by the Linux Foundation — and in this episode you'll prepare all the tools needed to follow along.
Before writing a resource or running tofu apply, a few foundations need to be solid: basic Linux CLI skills, an understanding of cloud computing concepts, structured data formats, installing the tofu binary, and a credential path to the cloud. Think of this episode as a roadmap: once you're done, your terminal is ready for the entire series.
OpenTofu is operated almost entirely through the terminal. That's not a coincidence — real-world automation (CI/CD pipelines, remote servers, scripting) all live in the CLI. You don't need to be a sysadmin expert, but you should be comfortable with the basic commands below.
pwd # current directory location
ls -la # list files including hidden files
cd ~/lab-opentofu # change directory
mkdir -p aws/modules # create nested directories
cp main.tf backup/ # copy a file
grep "region" main.tf # search text inside a fileBeyond navigation, understand file permissions. OpenTofu refuses to read state with overly permissive permissions, and the AWS CLI stores credentials in ~/.aws, which is sensitive. You'll keep running into the r, w, and x concepts. Finally, make sure you can use your distro's package manager: apt for Debian/Ubuntu, dnf for Fedora/RHEL, and brew for macOS.
Tip
You don't need to memorize every flag. What matters is knowing how to find help: man <command> for the manual and --help on almost every CLI. The ability to find documentation is worth more than memorizing it.
OpenTofu doesn't work in a vacuum — it creates, modifies, and deletes cloud resources through APIs. Understand the role of the core components, because each one will become an OpenTofu resource in later episodes.
| Concept | Analogy | OpenTofu Resource |
|---|---|---|
| Virtual Machine / EC2 | A computer that's always on in a cloud data center | aws_instance |
| VPC / Subnet | A city's highways and traffic signs | aws_vpc, aws_subnet |
| IAM | An access card determining who can enter which room | aws_iam_role |
| Cloud Storage | A warehouse accessible from anywhere | aws_s3_bucket |
| Security Group | A door guard deciding who is allowed in | aws_security_group |
The component that will most shape your journey is IAM. OpenTofu talks to cloud APIs using IAM identity credentials. The principle of least privilege — granting the minimum access needed — will keep appearing throughout this series, because it's the first line of defense for infrastructure.
Note
You don't need to memorize all cloud services right now. Episode 3 will show how these components are represented as resources, complete with their attribute documentation. The focus of episode 0: understand the role of each component.
OpenTofu uses HCL (HashiCorp Configuration Language), which is designed to be human-friendly and close to JSON. Understanding JSON and YAML speeds up learning HCL, since they're all based on key-value structures.
{
"name": "web-server",
"port": 80,
"tags": ["dev", "backend"]
}Notice the pattern: in JSON it's "key": value, in YAML it's key: value, in HCL it's key = value. The main difference with HCL: it adds the concept of a block — the resource "type" "name" { ... } structure that JSON and YAML don't have directly.
OpenTofu's hardware requirements are very simple — a regular laptop is enough. Here's the list of tools you must prepare:
| Tool | Purpose |
|---|---|
OpenTofu CLI (tofu) | The main binary for init, plan, apply, destroy |
| VS Code + OpenTofu extension | HCL syntax highlighting and autocomplete |
| Cloud CLI | aws or gcloud for credential setup |
| Cloud account / LocalStack | Provisioning target: AWS/GCP free tier, or a free local emulator |
OpenTofu is a single binary with no additional dependencies. Choose the method that fits your operating system:
curl -fsSL https://get.opentofu.org/install-opentofu.sh | sudo sh -s -- --install-method deb
sudo apt-get update && sudo apt-get install -y tofuNote
Windows users: use WSL2 and run every command inside it. Documentation, examples, and production CI/CD are almost always written in a Linux style — getting used to it early will save you a lot of time.
Once installed, verify it:
tofu --version
OpenTofu v1.9.2
on linux_amd64You'll be writing .tf files constantly, so a good editor helps a lot. Install the OpenTofu extension (or HashiCorp Terraform as an alternative, since the syntax is identical) from the VS Code marketplace. Its main features: HCL syntax highlighting, autocomplete for resources and arguments, and automatic formatting that keeps things consistent before tofu validate checks it too.
OpenTofu needs credentials to talk to cloud APIs. There are three paths you can take.
Path 1: AWS CLI. Install the AWS CLI, then configure it with aws configure:
aws configure
AWS Access Key ID [None]: AKIAXXXX
AWS Secret Access Key [None]: ****************
Default region name [None]: ap-southeast-1
Default output format [None]: jsonThis command stores your credentials in ~/.aws/credentials, and OpenTofu reads them automatically.
Warning
Never commit credentials to Git or share them. Your Secret Access Key is your digital identity — if it leaks, someone else could control your infrastructure and rack up charges. Use environment variables or a secret manager, and enable MFA on your IAM account.
Path 2: GCP CLI. Install gcloud, then log in with application default credentials:
gcloud auth application-default login
gcloud config set project <PROJECT_ID>Path 3: LocalStack (free and local). Don't have a cloud account? LocalStack provides a local emulator for hundreds of AWS APIs. You can run tofu apply that creates S3 buckets, EC2 instances, and more on your own laptop at no cost:
docker run -d --name localstack -p 4566:4566 localstack/localstack:latest
curl -s http://localhost:4566/_localstack/healthprovider "aws" {
region = "us-east-1"
access_key = "test"
secret_key = "test"
endpoints {
s3 = "http://localhost:4566"
ec2 = "http://localhost:4566"
}
}Tip
The most cost-effective strategy: practice with LocalStack in the early episodes, then transition to the AWS/GCP free tier when covering modules and CI/CD. You can run tofu apply and tofu destroy as often as you like without worrying about the bill.
Summary of episode 0:
tofu --version, and you're ready.All the tools are now in your hands. In the next episode, episode 1, we'll discuss the history behind OpenTofu: HashiCorp's licensing change for Terraform in August 2023, the community manifesto, and the Linux Foundation ecosystem. See you there!