Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Infrastructure as Code

Direct answer

Infrastructure as Code expresses infrastructure intent in versioned machine-readable definitions so changes can be reviewed, planned, applied and verified repeatedly.

When to use this

Use it when configuring, checking or troubleshooting Infrastructure as Code.

First 30 seconds

1. IaC manages infrastructure as versioned, reviewed code.

2. Plan, review, apply.

3. Remote locked state.

4. Modules for reuse.

5. Scan for misconfigurations.

Operational verification

code → plan → review → apply → state

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
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.

PlatformInfrastructure as Code / OpenTofu
Scope / prerequisiteUse it when configuring, checking or troubleshooting Infrastructure as Code.
What next?3 suggested next steps
Child topics (this level)18
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.

3 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: The definition, effective inputs, state, provider observations and target acceptance checks align for the intended scope.

Step 2 Target-state verification ladder Verify boundary

Infrastructure as Code uses a strict target-state ladder for declarative infrastructure change: request accepted → job/task succeeded → target object changed → effective runtime state confirmed → original workload verified.

Step 3 Failure modes and next checks Narrow the fault

Suspicious evidence: The code looks correct but the active state, credentials, provider behavior or real target differs from the reviewed assumptions.

It does not show every downstream workload, external dependency or unmanaged object. Code review shows the definition was reviewed, not that the target is converged or healthy. 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.

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
Drill down

Subtopics

Go one level deeper into this subject.

Subtopic IaC Fundamentals

IaC fundamentals separate desired infrastructure intent from execution mechanics, provider behavior, persisted state and independent target verification.

Subtopic Declarative Infrastructure

Declarative infrastructure describes the desired outcome while the engine and provider determine the operations needed to reconcile current and desired state.

Subtopic Desired State

Desired state is the intended infrastructure condition represented by configuration and resolved inputs, not a guarantee that the live environment already matches it.

Subtopic State

IaC state records management bindings and metadata used to correlate configuration objects with remote infrastructure and prior observations.

Subtopic Plan

A plan is an execution proposal calculated from configuration, effective inputs, state and provider observations at a particular point in time.

Subtopic Apply

Apply executes an approved or freshly calculated change graph against providers and persists resulting management state.

Subtopic Destroy

Destroy reconciles managed infrastructure toward absence and must be treated as a destructive lifecycle operation with explicit scope and dependency review.

Subtopic Resources

IaC resources represent infrastructure objects whose lifecycle is managed through provider-defined create, read, update and delete behavior.

Subtopic Data Sources

Data sources read external or provider-managed information for use during evaluation without transferring lifecycle ownership to the IaC configuration.

Subtopic Providers

Providers are plugins or integrations that translate IaC resource and data-source semantics into calls against infrastructure APIs and services.

Subtopic Modules

IaC modules package reusable configuration behind explicit inputs, outputs and provider/dependency contracts.

Subtopic Variables

IaC variables provide external inputs that shape the evaluated configuration and therefore the resulting graph, plan and target scope.

Subtopic Outputs

IaC outputs expose selected values from a configuration or module for humans and downstream automation after evaluation and apply.

Subtopic Dependencies

IaC dependencies define graph ordering and value flow through references and, where necessary, explicit dependency declarations.

Subtopic State Locking

State locking serializes supported state-writing operations so multiple IaC writers do not concurrently mutate the same state snapshot.

Subtopic Drift

Drift is divergence between intended configuration/state expectations and the live remote infrastructure caused by out-of-band change, failed reconciliation or provider-side behavior.

Subtopic Import

Import binds an existing remote object to an IaC resource address so future plans can manage it under configuration and state.

Subtopic IaC Troubleshooting

IaC troubleshooting localizes failure across definition, inputs, module/provider resolution, backend/state/locking, graph/plan, provider API execution and real target verification.

Key points
  • Code review proves the definition was reviewed, not that the target is converged or healthy.
  • State or engine metadata ≠ authoritative live-service health; always confirm with provider read-back and target acceptance checks.
  • A green execution step ≠ complete convergence when later state persistence, external dependencies or workload readiness remain unverified.
  • Provider/API success ≠ business outcome; keep engine evidence and target-domain evidence separate.
Key checks
  • terraform plan — preview
  • checkov -d . / tfsec . — security scan
  • terraform state list — managed resources
ReferenceWhy it matters1 section · depth on demand

How it works in operation

Path: Automation → Infrastructure as Code. Local intent: Infrastructure as Code expresses infrastructure intent in versioned machine-readable definitions so changes can be reviewed, planned, applied and verified repeatedly.

ReferenceImportant terms & boundaries2 sections · depth on demand

What this shows and what it does not

Code review shows the definition was reviewed, not that the target is converged or healthy. The limit of what it shows ends where provider/state evidence stops and target-domain acceptance begins.

In depth

Infrastructure as Code (IaC) manages infrastructure — networks, VMs, cloud resources, DNS — through machine-readable definition files in version control instead of manual console clicks. Tools turn the definitions into API calls.

ToolStyle
Terraform/OpenTofuDeclarative HCL, many providers
PulumiGeneral-purpose languages
CloudFormation / BicepAWS / Azure native
AnsibleProcedural-ish, also used for provisioning
CrossplaneKubernetes-native

Benefits: repeatable environments, reviewed changes, and documentation that is always current because it is the code that built the system.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
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 docInfrastructure as Code / OpenTofu 2026/current

Lowest-Good remediation source for Infrastructure as Code. 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
Infrastructure as Codeinfrastructure as codeIaC Infrastructure as Code
Embedded reference data

Quick lookup tables

Infrastructure as Code IaC proof-boundary map

Fast definition/state/plan/execution/target-proof boundaries for Infrastructure as Code.

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

Interpret plan, apply, drift and state output

Treat Infrastructure as Code output as a sequence of decision artifacts, not as a single success line. Preserve the configuration revision/workspace, the reviewed plan, the apply result and a post-apply refresh/read-back so the operator can tell what was proposed, what was attempted and what the provider reports afterward.

A normalized plan/apply result can be read like this:

workspace=prod-eu
configuration_revision=8c4a7b1
plan_actions: add=1 change=1 destroy=0
resource=module.web.instance.app[0] action=update fields=image_id
resource=module.web.lb_member.app[0] action=create
apply_status=completed changed=2 failed=0
readback: remote_id=i-07f2... image_id=img-2026-09 drift=none

Interpret plan actions before mutation: an unexpected destroy/replace or a resource outside the intended address scope is a stop signal even if syntax validates. During apply, distinguish a provider/API error on one resource from a fully completed transaction and retain the first failed resource address plus diagnostic. apply_status=completed shows the IaC engine reached its terminal success state; closure still requires refreshed state and, for service-bearing resources, a consumer-visible check. If refreshed state differs from the just-applied intent, classify it as drift, eventual convergence or provider/read-after-write behavior before retrying. Never use a fresh plan showing “no changes” as evidence that an earlier partial apply did not alter remote infrastructure unless the exact workspace/backend and remote object identities are confirmed.

Confirmation

Confirm action

Continue?