Terraform: start here
Terraform is HashiCorpβs infrastructure as code tool: you declare cloud and platform resources in configuration files, review a plan of the changes, and apply it. This section teaches it in two pages, in the order you need it on a real project. Samples use an invented OrdersPortal application and were run with Terraform 1.17.2.
Reading path
Section titled βReading pathβ| Step | Page | What you get from it |
|---|---|---|
| 1 | Terraform basics and the core workflow | What Terraform is, the configuration blocks (providers, resources, variables, outputs), init and the lock file, plan and apply, per-environment variables and CI checks. |
| 2 | Terraform state and modules | What state stores, remote state and locking, importing existing resources, refactoring with moved and removed blocks, workspaces, and reusable versioned modules. |
Find a topic
Section titled βFind a topicβ| If you need to | Go to |
|---|---|
| Understand what Terraform does and when to use it | What Terraform is |
| Review a change before applying it | Plan and apply |
| Run the same code for dev, staging and production | Variables and environments |
| Share state safely in a team | Remote state and locking |
| Rename resources without destroying them | Refactoring with moved and removed blocks |
| Stop copy-pasting the same infrastructure | Modules |
Where to go next
Section titled βWhere to go nextβ- GitLab CI/CD pipelines to run
planon merge requests andapplyafter approval. - Ansible automation to configure the servers Terraform creates.
- Kubernetes introduction for the platform many Terraform configurations provision.