Terraform fundamentals · 10 min read
What is Terraform?
Terraform is an infrastructure-as-code tool. You describe the cloud resources you want in files, review the proposed change, and apply only what you understand. The configuration becomes a shareable blueprint instead of a collection of undocumented console clicks.
The core Terraform workflow
These are the commands you use to prepare, check, preview, and apply a configuration. They belong together as one safe workflow.
terraform init
terraform fmt
terraform validate
terraform plan
terraform applyInfrastructure as code in plain language
Infrastructure as code means a network, server, database, or storage service is described in versionable configuration. That lets people review a proposed cloud change before it happens and rebuild a known pattern consistently.
Terraform makes decisions repeatable; it does not make them correct by itself. Security, networking, cost, backups, and access are still design decisions that belong in the configuration and review process.
The workflow is intentionally cautious
init prepares the directory and downloads provider plugins. fmt improves readability. validate checks the configuration structure without changing cloud resources.
plan compares your desired configuration with Terraform state and the provider. It is the critical safety checkpoint. apply performs the reviewed work, so a surprising plan is a reason to stop and investigate—not something to rush past.
Terraform state is operational data
State maps resource addresses in your files to real resources. It may contain identifiers and sensitive values, so teams normally use secured remote storage, access control, locking, and backups.
Configuration is the desired blueprint; state is Terraform’s memory. Do not delete or edit state merely to remove an error. First understand whether the cloud, configuration, or state is out of sync.
Put it into practice
Create a training folder and run the workflow on a small example. Before every apply, write down what each create, update, replacement, or delete action means.
- Create a dedicated folder with .tf files.
- Run init to install providers for that folder.
- Format and validate before reviewing a plan.
- Apply only after you can explain the proposed actions.