Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Terraform / OpenTofu Fundamentals

Direct answer

Terraform/OpenTofu fundamentals center on HCL configuration, provider plugins, dependency graphs, state, planning and explicit reconciliation of managed resources.

When to use this

Use it when configuring, checking or troubleshooting Terraform / OpenTofu Fundamentals in Terraform / OpenTofu.

First 30 seconds

1. Fundamentals: write HCL, init, plan, apply.

2. Terraform (BSL since 1.6) vs OpenTofu (MPL fork).

3. Pin required_version.

4. State management.

5. Modules.

Operational verification

code → CLI → providers → infrastructure

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
OpenTofu/Terraform infrastructure automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformOpenTofu/Terraform infrastructure automation · Automation owns Terraform/OpenTofu HCL, initialization, dependency/provider/backend/state/workspace, plan/apply/import/lifecycle and troubleshooting semantics; target Domains own provider-side infrastructure behavior and workload acceptance.
Scope / prerequisiteUse it when configuring, checking or troubleshooting Terraform / OpenTofu Fundamentals in Terraform / OpenTofu.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

Healthy evidence: Tool version, working directory, initialized dependencies, backend and effective inputs are deterministic and reproducible.

Step 2 Verification path Verify boundary

To verify Terraform / OpenTofu Fundamentals, first record workspace/backend, state lineage/serial, resource address, provider instance and remote object ID. Then check the result reported by the tool, and finally read the remote infrastructure objects represented by the state and provider read-back directly and compare it with what you intended.

Also test the cases that usually go wrong: wrong workspace/backend, stale state, lock bypass, provider drift, destructive replacement surprise, import/address mismatch and treating apply completion as service health.

Step 3 Failure modes and next checks Narrow the fault

Suspicious evidence: Different machines or pipelines resolve different providers/modules, state locations or credentials from the same repository.

Step 4 Common mistakes Narrow the fault
  • Mixing Terraform and OpenTofu on the same state without care.
Step 5 Where it fails Narrow the fault

Typical problems with Terraform / OpenTofu Fundamentals: wrong workspace/backend, stale state, lock bypass, provider drift, destructive replacement surprise, import/address mismatch and treating apply completion as service health.

Before you retry a change, read the target's current state first, using workspace/backend, state lineage/serial, resource address, provider instance and remote object ID.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Configuration valid ≠ infrastructure safe to change; remote reads, credentials, state and lifecycle behavior still determine the plan.
  • Terraform/OpenTofu command success ≠ target workload health; provider operations and application acceptance are separate proof boundaries.
  • The same repository ≠ same run when binary, provider/module versions, backend/workspace, variables, credentials or lock selections differ.
  • Treat Terraform and OpenTofu as separate implementations: verify behavior against the pinned tool and dependency versions rather than assuming interchangeability.
Key checks
  • terraform -version — version
  • required_version constraint — pinning
  • Terraform vs OpenTofu choice — licensing/features
ReferenceWhy it matters1 section · depth on demand

In depth

Terraform/OpenTofu fundamentals: configuration is written in HCL using provider, resource, data, variable, output and module blocks. The workflow is init → plan → apply, and state records what was created.

terraform {
  required_providers {
    netbox = { source = "e-breuninger/netbox", version = "~> 3.9" }
  }
}
resource "netbox_vlan" "users" {
  name = "users"
  vid  = 120
}
BlockPurpose
providerAPI connection and credentials
resourceManaged object
dataRead existing objects
variable / outputInputs / exported values

OpenTofu is command-compatible (tofu plan) with Terraform 1.5-era configurations.

ReferenceImportant terms & boundaries2 sections · depth on demand

What this shows and what it does not

Configuration valid ≠ infrastructure safe to change; remote reads, credentials, state and lifecycle behavior still determine the plan.

Mechanics

Durable intent is versioned HCL configuration, provider constraints, variable values, backend/state policy and reviewed plan; stable identity is workspace/backend, state lineage/serial, resource address, provider instance and remote object ID. The consumer-visible target is the remote infrastructure objects represented by the state and provider read-back. The operating invariants are that resource identity is stable, state locking is respected, plan/apply versions are controlled, secrets are not leaked and remote state is refreshed before decisions. Follow the chain of components HCL/config → init/providers → backend/state lock → plan graph → provider API → remote object → refreshed state → consumer verification and record which layer currently owns truth.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Lifecycle

A fresh noninteractive execution should be reproducible from source-controlled intent plus documented prerequisites, and the release must retain enough identity to tie every result back to workspace/backend, state lineage/serial, resource address, provider instance and remote object ID.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docOpenTofu/Terraform infrastructure automation current

Authoritative/upstream documentation reviewed for bounded claims in Terraform / OpenTofu > Terraform / OpenTofu Fundamentals. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://opentofu.org/docs/ · confidence 94%
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
Terraform / OpenTofu Fundamentalsterraform / opentofu fundamentalsTerraform OpenTofu Terraform / OpenTofu Fundamentals
Embedded reference data

Quick lookup tables

Terraform / OpenTofu Fundamentals IaC proof-boundary map

Fast definition/state/plan/execution/target-proof boundaries for Terraform / OpenTofu Fundamentals.

BoundaryHealthy evidenceSuspicious evidence
Definition / inputsExact revision, toolchain and effective inputs are reproducibleDifferent runner/version/input context changes evaluation
State / planningCorrect backend/state/lock, fresh reads and reviewed graph/planWrong state/workspace, stale reads, unsafe replacement/destroy or missing lock
ExecutionExpected provider/API operations complete and state persistsPartial apply, auth/API error, ambiguous retry or failed state write
Target proofIndependent read-back plus fresh plan confirm intended convergenceEngine success treated as workload acceptance or drift remains unexplained
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

Capture at minimum workspace, backend/state lineage/serial, plan/apply ID, resource address, action, provider/version, remote object ID, diagnostics and refreshed state.

Confirmation

Confirm action

Continue?