Terraform & OpenTofu Basics
InfraDots runs your infrastructure using Terraform or OpenTofu. This page gives you the concepts you need whether you're new to infrastructure as code or already use these tools.
What is Infrastructure as Code (IaC)?
Instead of clicking in a cloud console to create servers and databases, you define everything in code (configuration files). Benefits:
- Version control — Changes are in Git; you get history, reviews, and rollbacks
- Reproducibility — Same code produces the same infrastructure every time
- Automation — Plan and apply from InfraDots on every push or on a schedule
What are Terraform and OpenTofu?
- Terraform — HashiCorp's open-source tool for defining and managing infrastructure with a declarative language (HCL).
- OpenTofu — A community fork of Terraform that is fully open source. It uses the same language (HCL), same providers, and the same workflow. Many teams use OpenTofu as a drop-in replacement.
InfraDots supports both Terraform and OpenTofu. You choose the engine and version per workspace.
Core concepts
| Concept | What it means |
|---|---|
| Provider | Plugin that talks to a cloud or service (e.g. AWS, GCP, Azure, Kubernetes) |
| Resource | A single piece of infrastructure (e.g. an S3 bucket, a VM) |
| State | A file or remote store that records what resources exist so Terraform/OpenTofu can update or destroy them |
| Plan | A dry run showing what would change (add, change, destroy) |
| Apply | Execute the plan and update real infrastructure |
| Variable | Input to your configuration (e.g. region, environment name) |
| Output | Value exported after apply (e.g. bucket name, URL) |
Minimal example
A single file can define a resource and output:
terraform {
required_version = ">= 1.5.0"
}
resource "aws_s3_bucket" "example" {
bucket = "my-unique-bucket-name-12345"
}
output "bucket_name" {
value = aws_s3_bucket.example.id
}
When you run plan, Terraform/OpenTofu shows it will create the bucket. When you apply, it creates it and stores the result in state.
Terraform vs OpenTofu: which should I use?
- Same language and workflow — HCL, providers, plan/apply all work the same.
- OpenTofu — Fully open source; no proprietary licensing; recommended for new projects and teams that want to avoid vendor lock-in.
- Terraform — Original project; same ecosystem; some organizations standardize on it for policy or compliance reasons.
You can switch the engine in your InfraDots workspace settings at any time. Your .tf files do not need to change.
Choosing a Terraform or OpenTofu version
InfraDots lets you select the engine (Terraform or OpenTofu) and version per workspace.
Recommended versions
- OpenTofu 1.6+ or Terraform 1.5+ — Modern features (e.g.
movedblocks, improved lifecycle) and broad provider support. - Set
required_versionin your code so everyone (and InfraDots) uses the same version:
terraform {
required_version = ">= 1.6.0" # OpenTofu, or ">= 1.5.0" for Terraform
}
Where to set the version
- In your InfraDots workspace, go to Settings → General
- Choose Terraform or OpenTofu and pick the version (e.g. 1.6.3, 1.5.7)
- The version you select should satisfy the
required_versionin your code
State format is compatible; you're not locked into a single vendor by using InfraDots.
Next steps
- Your first run — Run plan and apply in InfraDots step by step
- How InfraDots runs Terraform/OpenTofu — Execution, state, and security
- Structuring your code — Organize
.tffiles and workspaces
