Use it when configuring, checking or troubleshooting Apply in Infrastructure as Code.
Apply · Infrastructure as Code
Apply executes an approved or freshly calculated change graph against providers and persists resulting management state.
1. Apply executes the plan.
2. Use saved plans in CI.
3. Approvals for production.
4. Verify with a follow-up plan.
5. Handle partial failures (state updated for completed resources).
plan → apply → state updated → verify
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
Healthy evidence: The intended plan executes, state persists successfully, provider read-back matches and target acceptance checks pass.
Step 2 Failure modes and next checks Narrow the fault
Suspicious evidence: Apply is partial, state persistence fails, provider reports success while workload checks fail, or subsequent plan still shows unexpected changes.
Successful apply ≠ workload acceptance; provider success can precede application readiness or downstream health.
Step 3 Common mistakes Narrow the fault
apply -auto-approvein production without review.- Applying from a different commit than the reviewed plan.
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.
- Successful apply ≠ workload acceptance; provider success can precede application readiness or downstream health.
- 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.
terraform apply tfplan— apply saved plan- Apply in CI with approvals — control
terraform plan -detailed-exitcode (after apply)— verify no drift
ReferenceWhat it is1 section · depth on demand
What it is
Apply executes the planned changes against the real infrastructure and updates state. Apply the saved, reviewed plan so nothing else sneaks in.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Apply is the step where an IaC tool makes changes in the real world. Because it can create, modify and destroy infrastructure, applying should only happen after the planned changes have been reviewed, ideally from a pipeline rather than a laptop.
Safe apply practice:
| Practice | Why |
|---|---|
| Apply a saved, reviewed plan | What is applied equals what was approved |
| Run from CI with service credentials | Consistent environment, audit trail |
| State locking | No concurrent applies |
| Small changes | Easier review and rollback |
| Post-apply verification | Confirm the service works, not only that the API accepted it |
Watch the plan summary for destroys and replacements (-/+), which often mean downtime or data loss.
Example
terraform plan -out=tfplan
terraform apply tfplan
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Infrastructure as Code > Apply. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://opentofu.org/docs/ · confidence 94%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.
Quick lookup tables
Apply IaC proof-boundary map
Fast definition/state/plan/execution/target-proof boundaries for Apply.
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Definition / inputs | Exact revision, toolchain and effective inputs are reproducible | Different runner/version/input context changes evaluation |
| State / planning | Correct backend/state/lock, fresh reads and reviewed graph/plan | Wrong state/workspace, stale reads, unsafe replacement/destroy or missing lock |
| Execution | Expected provider/API operations complete and state persists | Partial apply, auth/API error, ambiguous retry or failed state write |
| Target proof | Independent read-back plus fresh plan confirm intended convergence | Engine success treated as workload acceptance or drift remains unexplained |