Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Terraform / OpenTofu

Direct answer

Terraform and OpenTofu are separate IaC implementations that evaluate HCL-style configuration, resolve providers/modules, maintain state and execute dependency-aware plans against infrastructure APIs.

When to use this

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

First 30 seconds

1. Terraform/OpenTofu: HCL, providers, state, modules.

2. OpenTofu is the open-source fork (MPL) — mostly compatible.

3. Pin CLI and providers.

4. Remote state with locking.

5. Plans in CI with approvals.

Operational verification

HCL → init → plan → apply → state

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Terraform-compatible Infrastructure as Code / OpenTofu
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.

PlatformTerraform-compatible Infrastructure as Code / OpenTofu · Terraform
Key commandterraform fmt
Scope / prerequisiteUse it when configuring, checking or troubleshooting Terraform / OpenTofu.
Reference · 2
What next?3 suggested next steps
Child topics (this level)24
Catalog command links2
Evidence2
On this pageJump to a specific section
Automation command reference

Primary Commands

Configuration and operational commands for this Topic.

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

tool/version + HCL/revision → init/provider/module/backend resolution → effective variables/locals → selected workspace/state + refresh → dependency graph → plan → approval → apply/import/destroy → provider API → state write/lock release → target read-back → fresh plan

  • Capture exact Terraform/OpenTofu binary/version, repository revision, dependency lock context, working directory and selected workspace/backend.
  • Resolve effective variables/locals, provider aliases/credentials, module versions and state identity before trusting validate/plan results.
  • Preserve the plan/action summary, provider/API responses, lock/state-write outcome and any partial-apply recovery artifacts.
  • Verify real target state/workload acceptance and run a fresh plan under the same intended context before declaring convergence.

Healthy evidence: The exact binary/version, configuration revision, dependency lock/provider sources, backend/state and target identity are explicit for each run.

Step 2 Verify plan identity, apply result, refreshed state and platform resource Verify boundary

Record the Terraform / OpenTofu configuration revision, provider lock versions, workspace/backend and plan digest. Review the bounded plan for the intended resource actions, apply that exact saved plan when the workflow supports it, and capture the resource addresses/results. Run a fresh plan with refresh after apply and expect no unintended changes, then query the cloud/hypervisor/network platform directly for critical resource attributes. Finally repeat the original service test. An empty post-apply plan shows reconciliation under the provider model, not application functionality or every external dependency.

Step 3 Target-state verification ladder Verify boundary

Terraform / OpenTofu uses a strict target-state ladder for plan/apply state and provider target state: request accepted → job/task succeeded → target object changed → effective runtime state confirmed → original workload verified.

Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: A workflow assumes the two tools are interchangeable or silently changes binary/provider/module/backend behavior between plan and apply.

It does not show every downstream workload, external dependency or unmanaged object. Terraform/OpenTofu similarity ≠ universal interchangeability; behavior, features, registries and compatibility must be verified against pinned tool/provider/module versions. The limit of what it shows ends where provider/state evidence stops and target-domain acceptance begins.

Next check: Continue from the first step that has not been verified: reproduce the same revision/tool/backend/workspace/input context, confirm provider/module resolution and state identity, refresh the intended target, preserve plan plus provider/API/state-write evidence, then read back target/workload state and generate a fresh bounded plan before retrying.

Step 5 Separate configuration, state, provider and remote-platform failures Narrow the fault

If Terraform / OpenTofu fails before planning, validate syntax/configuration and provider initialization first. If plan shows unexpected replacement or drift, inspect resource address, imported/state identity and provider refresh data before applying. If state locking fails, identify the active operation and backend lease rather than force-unlocking blindly. If apply fails after partial changes, use the resource-specific provider error and refresh current remote state before retrying. If the configuration is unchanged but plan differs across runners, compare provider lock file, variables, credentials and backend workspace. Plan success does not show apply or workload health.

Evidence references

Evidence · 2 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 · 1command output · 1
Drill down

Subtopics

Go one level deeper into this subject.

Subtopic Terraform / OpenTofu Fundamentals

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

Subtopic HCL

HCL expresses blocks, arguments, expressions, references and values used by Terraform/OpenTofu to build an evaluated infrastructure graph.

Subtopic Providers

Terraform/OpenTofu providers are separately versioned plugins that supply resource/data-source schemas and implement API operations against target systems.

Subtopic Resources

Terraform/OpenTofu resource blocks declare managed resource instances whose remote identities are tracked in state and reconciled by provider lifecycle operations.

Subtopic Data Sources

Terraform/OpenTofu data sources read external information during evaluation and feed values into the graph without owning those source objects.

Subtopic Variables

Terraform/OpenTofu input variables parameterize root/module configuration with typed values supplied through supported input mechanisms.

Subtopic Local Values

Local values name derived expressions inside a module to simplify reuse and make evaluated relationships explicit.

Subtopic Outputs

Terraform/OpenTofu outputs expose selected root/module values for operators and downstream configurations or automation.

Subtopic Modules

Terraform/OpenTofu modules compose reusable resource graphs through explicit sources, versions, inputs, outputs and provider mappings.

Subtopic State

Terraform/OpenTofu state maps configured resource instances to remote objects and stores metadata required for planning and lifecycle operations.

Subtopic Remote State

Remote state stores state in a shared backend or collaboration service so automation and teams can coordinate around the same management record.

Subtopic State Locking

Terraform/OpenTofu state locking prevents concurrent state-writing operations when the selected backend supports a locking mechanism.

Subtopic Backend

The backend determines where Terraform/OpenTofu persists state and may also provide coordination capabilities such as locking.

Subtopic Init

Init prepares a working directory by configuring the backend and installing/resolving required providers and modules for later operations.

Subtopic Validate

Validate checks Terraform/OpenTofu configuration syntax and internal consistency within the initialized module context.

Subtopic Plan

Terraform/OpenTofu plan compares evaluated configuration, selected state and provider reads to propose concrete resource actions.

Subtopic Apply

Terraform/OpenTofu apply executes a saved or freshly generated plan, updates remote resources through providers and persists resulting state.

Subtopic Destroy

Terraform/OpenTofu destroy plans and applies removal of managed resources for the selected state and configuration scope.

Subtopic Import

Terraform/OpenTofu import associates an existing remote object with a resource address so it can enter managed state under configuration.

Subtopic Lifecycle

Lifecycle settings influence Terraform/OpenTofu resource replacement, destruction protection, change ignoring and dependency-trigger behavior.

Subtopic Dependencies

Terraform/OpenTofu dependencies arise primarily from expression references and may be supplemented by explicit dependency metadata when no data reference exists.

Subtopic Workspaces

Terraform/OpenTofu CLI workspaces select separate state instances for one configuration/backend context and can support repeated deployments with shared configuration.

Subtopic Drift

Terraform/OpenTofu drift appears when provider refresh/read shows the remote object differs from the last managed expectation or current configuration.

Subtopic Terraform / OpenTofu Troubleshooting

Terraform/OpenTofu troubleshooting isolates failures across binary/version, HCL evaluation, init/dependency resolution, backend/state/locking, provider credentials/schema, graph/plan and target API execution.

Key points
  • Terraform/OpenTofu similarity ≠ universal interchangeability; behavior, features, registries and compatibility must be verified against pinned tool/provider/module versions.
  • 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 / tofu version — CLI and provider versions
  • terraform fmt -check && terraform validate — static checks
  • terraform plan — preview
ReferenceWhat it is1 section · depth on demand

What it is

Terraform: Declarative Infrastructure, Provider, Resource, State.

Close with Compare plan and state with an independent provider/resource read, wait for effective readiness conditions, then execute the original consumer transaction. and state what the evidence does not show.

ReferenceWhy it matters2 sections · depth on demand

When to use it

Use Terraform when the problem concerns data models, APIs, code, orchestration, infrastructure as code, controllers or AI-assisted workflows.

Terraform and OpenTofu reconcile configuration, state and provider-observed infrastructure

Terraform / OpenTofu build a dependency graph from configuration and provider schemas, compare desired configuration with state and provider refresh results, then propose an execution plan. State contains resource identity and attributes used for reconciliation; it is not a substitute for the real platform, and stale or manually edited remote objects can create drift. Provider version, backend/locking and variable inputs are part of the reproducible execution context. A saved plan is meaningful only for the configuration, state snapshot and provider context from which it was created.

ReferenceImportant terms & boundaries3 sections · depth on demand

What this shows and what it does not

Terraform/OpenTofu similarity ≠ universal interchangeability; behavior, features, registries and compatibility must be verified against pinned tool/provider/module versions. The limit of what it shows ends where provider/state evidence stops and target-domain acceptance begins.

Key operational limits

  • Desired state, source of truth, rendered change, apply result and realized infrastructure state are distinct
  • Validate schema, identity, authorization, idempotency, error handling and partial failure
  • Preview/diff, limit blast radius, verify read-after-write and preserve rollback/audit evidence

In depth

Terraform and OpenTofu (its open-source fork) are Infrastructure as Code tools. You declare resources in HCL, the tool compares that with its state file and the real infrastructure, shows a plan of creates, updates and destroys, and then applies it through provider plugins (AWS, Azure, vSphere, NetBox, Cisco and many more).

CommandPurpose
initDownload providers, configure backend
fmt / validateFormat and check syntax
planShow proposed changes
applyMake the changes
destroyRemove managed resources
stateInspect or move state entries

Store state remotely with locking, pin provider versions, and always review the plan — a renamed resource can mean destroy-and-recreate.

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

Concrete configuration contract

Concrete configuration/input contract for Terraform / OpenTofu.

terraform { required_version = ">= 1.8" }
# pin provider constraints and backend explicitly
# review plan before apply; refresh/read back remote state afterward
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 docTerraform-compatible Infrastructure as Code / OpenTofu 2026/current

Lowest-Good remediation source for Terraform / OpenTofu. Documentation authority supports bounded reference claims only; it is not observed lab/production Evidence.

Basis: https://opentofu.org/docs/ · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
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
terraformTerraform / OpenTofuautomation terraformterraform / opentofuTerraform OpenTofu Terraform / OpenTofuTerraform troubleshooting
Embedded reference data

Quick lookup tables

Terraform / OpenTofu IaC proof-boundary map

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

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

Terraform evidence chain

Configuration, operational state, counters and downstream proof remain separate.

BoundaryQuestionEvidenceDoes not prove
DefinitionWhat is configured or intended?running configuration / controller policylive operation
Local stateIs the feature active at the expected scope?terraform planremote success
CountersDid controlled traffic or an event reach this stage?scoped counters/timestampscomplete return path
Next boundaryWhat consumes or transports this state?source of truth/input → schema/model → authentication/authorization → plan/diff → controlled execution → task/result → realized-state assertionapplication success
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Concrete output contract

Concrete output contract for Terraform / OpenTofu. The minimum retained result is: workspace, configuration_revision, plan_summary, resource_address, action, provider_version, remote_id, apply_result, refreshed_state.

Confirmation

Confirm action

Continue?