OpenTofu Fundamentals
OpenTofu is an infrastructure as code tool. You describe cloud, on-premises, and service resources in configuration files, then review and apply a plan that manages those resources through provider APIs.
itInfrastructure and operations | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — OpenTofu Fundamentals
OpenTofu is a way to write down the infrastructure you want, then make a machine show you the consequences before it starts making phone calls to cloud APIs. This is called infrastructure as code, which sounds grand until you notice that the alternative is often a browser tab named something like final-final-really-final.
The trick has four moving parts. Configuration describes the target. Providers translate that description into requests for remote platforms and services. State remembers which declared resource corresponds to which real object. A plan compares all of that and proposes the actions required to bring them together. Nothing is useful if you remember only one part. A configuration without state has forgotten its history; state without configuration has lost its instructions.
The usual ritual is write, initialize, format, validate, plan, review, and apply. tofu init prepares the working directory, including its backend and dependencies. tofu plan is the important pause. It may propose creation, update, replacement, or destruction, but it does not perform them. tofu apply executes approved actions. That gap is not ceremonial. It is where a harmless-looking edit discovers it would replace something carrying a great deal of real work.
The surprising part is that a valid plan is not a safety certificate. OpenTofu can calculate a path from configuration and state to remote objects. It cannot decide whether a replacement is acceptable, whether a credential should exist in provider settings, or whether a service can tolerate an outage. The tool is politely literal in this respect, which is better than being imaginatively destructive.
Start with one disposable resource and local state. The Cheatsheet holds the command loop and the meanings of addresses, modules, and backends. The Reference tab is where the official details live once a command or configuration block needs exact handling. Then move to shared state, locking, version controls, plan review, recovery, import, testing, policy checks, and controlled automation. The mental model remains stubbornly compact: configuration names the target, providers reach the APIs, state keeps the mapping, and plans control change.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://opentofu.org/docs/intro/
Supports
- Infrastructure as code definition and supported resource scope
- Provider connection to platform and service APIs
- Write, plan, and apply workflow
- Declarative configuration and dependency graph
- State and module overview
- https://opentofu.org/docs/cli/commands/
Supports
- Core command names and purposes
- Working-directory behavior
- https://opentofu.org/docs/cli/init/
Supports
- Working-directory initialization
- Backend, provider, and child-module preparation
- Reinitialization after relevant changes
- Dependency lock file creation and use
- https://opentofu.org/docs/cli/commands/plan/
Supports
- Plan comparison and proposed action behavior
- Non-executing and speculative plan behavior
- Saved plan workflow
- Exceptional use of resource targeting
- https://opentofu.org/docs/cli/commands/apply/
Supports
- Execution of automatic and saved plans
- Approval behavior
- https://opentofu.org/docs/language/providers/configuration/
Supports
- Provider configuration in the root module
- Provider requirements, source addresses, and versions
- Provider settings and credentials
- https://opentofu.org/docs/language/modules/syntax/
Supports
- Root and child module concepts
- Module source and version arguments
- Reinitialization after module changes
- Child-module encapsulation through outputs
- https://opentofu.org/docs/language/values/variables/
Supports
- Input variables as module customization values
- https://opentofu.org/docs/language/values/outputs/
Supports
- Output values as selected module results
- https://opentofu.org/docs/language/state/purpose/
Supports
- State requirement and real-object mapping
- State metadata and cached attributes
- Shared state for team operation
- https://opentofu.org/docs/language/state/backends/
Supports
- Backend state storage
- Optional backend locking support
- Local and remote state behavior
- State sensitivity and manual state operations
- https://opentofu.org/docs/language/resources/tf-data/
Supports
- Built-in terraform_data resource lifecycle without configured provider
- State-only practice exercise and output behavior
- https://opentofu.org/docs/cli/state/recover/
Supports
- State lock recovery and force-unlock caution
- State backup and direct state recovery operations
- https://www.terraform.io/
Supports
- Landscape comparison entry for Terraform
- https://www.pulumi.com/
Supports
- Landscape comparison entry for Pulumi
- https://aws.amazon.com/cloudformation/
Supports
- Landscape comparison entry for AWS CloudFormation
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/overview
Supports
- Landscape comparison entry for Azure Bicep
