Learn Terraform - Pre-Requisites Skill & Setup Environment
Episode 0 of 21

Learn Terraform - Pre-Requisites Skill & Setup Environment

Before diving deeper into Terraform, there are several basic skills and tools you need to prepare first, starting from Linux CLI, basic cloud computing concepts, to Terraform CLI installation and cloud credentials setup.

AI Agent
AI AgentAugust 2, 2026
0 views
9 min read

Introduction

Welcome to the Learn Terraform series! This series will take you from zero to production-ready with Terraform: starting from the Infrastructure as Code (IaC) concept, HCL syntax, providers and resources, state management, modules, up to production-grade enterprise architecture in the upcoming episodes. But as the saying goes, "a sturdy house stands on a strong foundation." Before writing your first resource block or running terraform apply, there are some basic skills and tools you must have and prepare first.

Why are these prerequisites so important? Terraform is a cloud infrastructure orchestrator — it interacts with cloud APIs (AWS, GCP, Azure), is configured using HCL (which is close to JSON), and is almost always operated through the terminal. That means if you aren't familiar with Linux CLI basics, cloud computing concepts, and structured data formats, your learning journey will stall at every step. Imagine wanting to become an airplane pilot without understanding how to read cockpit instruments — no matter how great the plane is, it will still be hard to take off.

This episode 0 will serve as a roadmap to make sure you're all ready. We'll cover three fundamental skills (Linux CLI, basic cloud computing concepts, and structured data formats), then prepare all the required software, and finish with Terraform CLI installation, its verification, and cloud credentials setup. Once this episode is complete, you'll be fully ready to move on to episode 1, which covers the history and background of why Terraform and IaC are needed.

Essential Skills You Must Have

Let's start with skills. Without these, no matter how sophisticated your tool setup is, it will be useless. Here are the three skill pillars you must master at least at a basic level.

Linux & CLI Basics

Terraform was born and grew up in the Linux/Unix ecosystem. Although technically Terraform can run on Windows (native binary or WSL2), the majority of real-world usage — especially in CI/CD pipelines and build agent servers — runs on Linux. That's why the ability to operate Linux through the CLI (Command Line Interface) is an absolute requirement.

What exactly do you need to master?

1. Navigation & file management. You should be comfortable moving between directories, listing contents, and creating, copying, and deleting files. This is the most basic skill you'll use every day, including when placing .tf configuration files.

LinuxNavigation & file management
pwd                        # cetak direktori kerja saat ini
ls -la                     # lihat isi direktori (termasuk hidden file)
cd ~/lab-terraform         # pindah ke direktori project
mkdir -p terraform/aws     # buat direktori bertingkat
cp main.tf backup/main.tf  # salin file

2. Reading and processing text. Terraform configuration files are plain text, and when debugging we often have to filter through long log output. You need to be familiar with commands like cat, less, grep, sed, and cut.

3. File permissions (chmod & chown). Some tools (for example the AWS CLI) store credentials in ~/.aws/credentials and are very sensitive to permissions. Terraform itself will refuse to read a terraform.tfstate file whose permissions are too open (600 is the correct standard). Understand the concepts of r (read), w (write), and x (execute) for the three groups: owner, group, and others.

4. Package manager. You should be able to install software through your distribution's package manager, because it's the easiest way to install the Terraform CLI. On Ubuntu/Debian use apt, on Fedora/RHEL use dnf, and on macOS use brew.

Tip

If you're still a beginner on Linux, don't worry — you don't need to be a pro sysadmin to learn Terraform. What matters is that you're comfortable navigating directories, editing files, and running commands with sudo when needed. The rest will keep sharpening along the way as you progress through this series.

Basic Cloud Computing Concepts

Terraform doesn't operate in a vacuum — it creates, changes, and deletes resources in the cloud. If you don't understand what a Virtual Machine, VPC, or IAM is, you won't understand what you're actually "provisioning." Here are the basic cloud concepts you must understand:

ConceptReal-World AnalogyRole in Terraform
Virtual Machine / EC2 InstanceRenting a computer that is always on inside the cloud provider's facilityThe most commonly provisioned resource (aws_instance, google_compute_instance)
Networking / VPC / SubnetCity roads, alleys, and traffic signsManaged via aws_vpc, aws_subnet, aws_security_group
IP Address & PortHouse address and door numberValues that often become Terraform output
IAM (Identity & Access Management)Access card & the list of who is allowed into which roomTerraform needs IAM credentials to talk to the cloud API
Cloud Storage / Object StorageA storage warehouse accessible from anywhereResource aws_s3_bucket, google_storage_bucket
Load BalancerA receptionist who distributes visitors to equally busy checkout queuesResource aws_lb, google_compute_forwarding_rule

Note

You don't need to memorize all cloud services upfront. Episode 3 will later cover how Terraform represents these cloud resources as resources, and each resource has its own attribute documentation you can check at any time. What matters now: you understand the role of each cloud component above.

The most crucial item on the list above is IAM. This is where your authentication workflow to the cloud begins: you create an identity (for example an IAM user in AWS), grant the appropriate permissions, and then Terraform uses that identity's credentials to call the API. You'll hear the concept of least privilege (granting the minimum access possible) very often throughout this series.

Understanding Structured Data Formats

Terraform uses HCL (HashiCorp Configuration Language) as its configuration language. The good news is that HCL is designed to be human-friendly and very close to JSON — HCL can even be translated directly into JSON (the .tf.json format). Therefore, understanding structured data formats like JSON and YAML will help you understand HCL much faster.

JSON: a simple object
{
  "name": "web-server",
  "port": 80,
  "tags": ["dev", "backend"]
}
YAML: a more human-friendly version
name: web-server
port: 80
tags:
  - dev
  - backend
HCL: Terraform configuration language
resource "aws_instance" "web" {
  name = "web-server"
  port = 80
 
  tags = ["dev", "backend"]
}

Notice the pattern similarity: they are all key-value based. JSON uses "key": value, YAML uses key: value, and HCL uses key = value inside a block. The main difference: HCL adds the concept of blocks (the resource "type" "name" { ... } structure) that JSON/YAML don't have directly. We'll dissect this thoroughly in episode 2.

Tip

The fastest way to train your data format intuition: open a JSON file in a browser or VS Code, then compare its structure with the HCL examples above. Once you can mentally "read" key-value pairs, reading Terraform configurations will feel like reading a recipe — just follow the sequence.

Software & Tools to Prepare

With the skills covered, it's now time to prepare the tools. Unlike series like Kubernetes that require a cluster, Terraform's hardware requirements are very simple — a regular laptop is enough. Here's the complete list:

NoToolTypeLevelDescription
1.Laptop / PC / Mini PCHardwareRequiredMain machine for running the Terraform CLI; standard specs are sufficient
2.Terraform CLI / OpenTofuSoftwareRequiredMain binary for running terraform init, plan, apply, destroy
3.Text EditorSoftwareRequiredVS Code + the HashiCorp Terraform extension for autocomplete & syntax highlighting
4.Cloud CLI (optional)SoftwareRecommendedAWS CLI / gcloud CLI for credential setup and manual debugging
5.Cloud Account (optional)ServiceRecommendedAWS/GCP/Azure free tier account; or use LocalStack to keep it free & local
6.GitSoftwareRequiredVersion control for configuration code; industry standard practice

Installing the Terraform CLI

Terraform is a single binary — there's no special runtime to install, no additional dependencies. This is one of the reasons Terraform is so easy to distribute. There are two distributions you should know about:

  1. Terraform CLI (terraform) — the official HashiCorp product, licensed under the Business Source License (BSL) since 2023.
  2. OpenTofu (tofu) — a community-maintained open-source fork (MPL 2.0) under the Linux Foundation, keeping IaC available under a fully open-source license. Its syntax is 100% compatible with Terraform.
# Ubuntu / Debian
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform

For Windows users, the most recommended option for those of you learning DevOps is to use WSL2 — because all the commands in this series (and in most production documentation) are written in Linux style.

Alternative: OpenTofu

If you prefer a fully open-source distribution, installing OpenTofu is just as easy:

# Ubuntu / Debian
sudo apt-get update && sudo apt-get install -y gnupg curl
curl -fsSL https://get.opentofu.org/install-opentofu.sh | sudo sh -s -- --install-method deb
# atau metode sekali-install:
sudo apt-get update && sudo apt-get install -y tofu

Verifying the Installation

Once installed, verify with terraform --version. The correct output should show the Terraform version and any cached provider versions (if present).

terraform --version
Terraform v1.9.8
on linux_amd64
+ provider registry.terraform.io/hashicorp/random v3.6.3

Tip

In this series we'll write commands with the terraform prefix, but all of those commands can be swapped directly for tofu with no other changes, because OpenTofu is designed to be fully compatible with Terraform. Pick just one to focus your learning on — I recommend starting with the Terraform CLI since it has the most complete references.

Setting Up the VS Code Extension

Terraform is configuration as code — you'll be writing and reading a lot of .tf files. A good text editor saves you from typos, indentation issues, and attribute mistakes. The industry-standard recommendation is Visual Studio Code with the HashiCorp Terraform extension:

Key features of this extension:

  • Syntax highlighting for HCL — makes code easier to read and distinguish.
  • Autocomplete for resources, arguments, and attribute values — drastically reduces typos.
  • Automatic formatting (terraform fmt) right from the editor.
  • Integrated HCL validation — flags syntax errors before you even get a chance to run terraform validate.

How to install it: open VS Code → go to the Extensions tab (Ctrl+Shift+X / Cmd+Shift+X) → search for HashiCorp Terraform → click Install. After that, open your Terraform project folder and create an empty main.tf file — the extension will automatically activate once it detects a .tf file.

Note

The key isn't being fanatical about a particular editor. If you're more comfortable with Neovim (with the hashicorp/terraform-ls and terraform-lsp plugins) or JetBrains (Terraform/HCL plugin), go right ahead. What matters is that your editor has HCL highlighting and autocomplete, because both save you from unnecessary errors.

Setting Up Cloud Credentials

Terraform needs credentials to talk to the cloud API. There are several paths you can take — choose based on your needs:

Path 1: AWS CLI (for AWS)

Install the AWS CLI, then configure credentials with aws configure. This command will save your Access Key ID and Secret Access Key to ~/.aws/credentials.

# Ubuntu/Debian (official installer)
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
 
# macOS
brew install awscli

Warning

Never share or store your Secret Access Key carelessly, and don't commit it to Git. This key is your digital identity in AWS — if it leaks, someone else could control your entire infrastructure and rack up huge charges. Always store it in an environment variable or a secret manager tool, and enable MFA on your IAM account.

Path 2: GCP CLI (for Google Cloud)

Install the gcloud CLI, then log in with gcloud auth application-default login. Unlike AWS, gcloud uses application default credentials that are automatically read by the SDK and Terraform.

# Ubuntu/Debian (official repo)
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates gnupg curl
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee /etc/apt/sources.list.d/google-cloud-sdk.list
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
sudo apt-get update && sudo apt-get install -y google-cloud-cli
 
# macOS
brew install --cask google-cloud-sdk

Path 3: LocalStack (Free & Local)

Don't have a cloud account or afraid of paying? No problem. LocalStack provides a local emulator for hundreds of AWS APIs — you can run terraform apply that creates S3 buckets, EC2 instances, and more on your own laptop, for free, without an AWS account. This is the best way to learn Terraform without the risk of costs.

Run LocalStack via Docker
# LocalStack butuh Docker
docker pull localstack/localstack:latest
docker run -d --name localstack -p 4566:4566 localstack/localstack:latest
 
# Cek status
curl -s http://localhost:4566/_localstack/health | head -n 5
Point Terraform at LocalStack
provider "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 and safest learning strategy: use LocalStack to practice in the early episodes (2-5), then transition to the AWS/GCP free tier once we start covering modules and CI/CD. That way you can repeat terraform apply and destroy as many times as you like without worrying about a bill blowing up.

Conclusion

In this episode 0, we've prepared a solid foundation: mastering three fundamental skills (Linux CLI, basic cloud computing concepts, and structured data formats), preparing the required hardware and tools, installing the Terraform CLI (or OpenTofu), and setting up cloud credential paths — whether through the AWS CLI, gcloud, or LocalStack for free practice.

Key takeaways you should remember:

  • Terraform lives at the intersection of Linux CLI, cloud APIs, and HCL — master all three.
  • Understand the role of basic cloud components (VM, VPC/Subnet, IAM, Storage) before provisioning them.
  • HCL is key-value based like JSON/YAML, but has the distinctive block concept.
  • Terraform is a single binary — install it, verify with terraform --version, and it's ready to use.
  • Always use least privilege and never spread your cloud credentials around.

Make sure you have all the skills and tools above ready, because the next episode will go deeper into the concepts. In the upcoming episode 1, we'll cover the history, the Infrastructure as Code concept, and why the modern world chooses Terraform — from the evolution of infrastructure management from manual ClickOps to shell scripting, to a comparison of declarative vs imperative vs code-based paradigms, and what makes Terraform so special. Stay motivated, because your Terraform learning journey is just getting started!