| name | tofu |
| description | OpenTofu infrastructure-as-code reference for HCL syntax, state management,
module design, and provider configuration. Use when working with OpenTofu
configurations (.tf files), running tofu commands, troubleshooting state
issues, or designing modules. Includes Proxmox provider patterns.
Triggers: tofu, opentofu, tfstate, .tf files, HCL, modules, providers.
|
| agent | tofu-expert |
OpenTofu Skill
Infrastructure-as-code reference for OpenTofu configurations, state management, and provider patterns.
OpenTofu is the open-source fork of Terraform, maintained by the Linux Foundation. Commands and syntax are nearly identical to Terraform.
Quick Reference
tofu init
tofu validate
tofu fmt -recursive
tofu plan
tofu apply
tofu state list
tofu state show <resource>
tofu graph | dot -Tsvg > graph.svg
TF_LOG=DEBUG tofu plan 2>debug.log
Core Workflow
init → validate → fmt → plan → apply
- init: Download providers, initialize backend
- validate: Check syntax and configuration validity
- fmt: Ensure consistent formatting
- plan: Preview what will change (review carefully)
- apply: Execute changes
Terraform Migration
OpenTofu is a drop-in replacement for Terraform:
terraform init → tofu init
terraform plan → tofu plan
terraform apply → tofu apply
Key differences:
- Different binary name (
tofu vs terraform)
- Some newer Terraform features may not be available yet
- Provider registry defaults differ (can be configured)
Reference Files
Load on-demand based on task:
Validation Checklist
Before tofu apply:
Variable Precedence
(highest to lowest)
-var flag: tofu apply -var="name=value"
-var-file flag: tofu apply -var-file=prod.tfvars
*.auto.tfvars files (alphabetically)
terraform.tfvars file
TF_VAR_* environment variables
- Variable defaults in
variables.tf
Provider Configuration
# versions.tf
terraform {
required_version = ">= 1.6.0" # OpenTofu version
required_providers {
proxmox = {
source = "Telmate/proxmox"
version = "~> 3.0"
}
}
}