Note: Use hcloud_zone and hcloud_zone_rrset resources within the hcloud provider for DNS management.
Troubleshooting
Lock Error:tofu force-unlock <LOCK_ID> (Use with extreme caution!)
State Drift:tofu refresh
1---2name: opentofu3description: OpenTofu Skill 🥚4---56# OpenTofu Skill 🥚78Infrastructure as Code using OpenTofu.910## When to Use1112✅ **USE this skill when:**13- Creating/modifying cloud resources (Servers, DNS, S3)14- Managing stateful infrastructure15- Reviewing `.tf` files1617❌ **DON'T use this skill when:**18- Configuring OS internals (use `ssh` or `ansible`)19- Running one-off scripts20- Managing Kubernetes resources inside a cluster (use `kubectl` / `helm`)2122## Workflow2324### 1. Init25Always run init first to download providers/modules.26```bash27tofu init28```2930### 2. Plan (Dry Run)31Check what will happen. **Mandatory** before apply.32```bash33tofu plan -out=tfplan34```3536### 3. Apply37Execute the changes.38```bash39tofu apply tfplan40```4142### 4. Format43Keep code clean.44```bash45tofu fmt -recursive46```4748## Best Practices4950- **State:** Never commit `.tfstate` files. Use remote state (S3/Consul) or local state in `.gitignore`.51- **Secrets:** Never hardcode secrets. Use `variable "token" {}` and pass via `TF_VAR_token` environment variable.52- **Locking:** Ensure state locking works to prevent race conditions.5354## Common Providers5556### Hetzner Cloud (`hcloud`)57```hcl58provider "hcloud" {59 token = var.hcloud_token60}61resource "hcloud_server" "web" { ... }62```6364### Hetzner DNS65Note: Use `hcloud_zone` and `hcloud_zone_rrset` resources within the `hcloud` provider for DNS management.6667## Troubleshooting6869- **Lock Error:** `tofu force-unlock <LOCK_ID>` (Use with extreme caution!)70- **State Drift:** `tofu refresh`
Run npx skillmds@latest add yesterday-ai/opentofu in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
OpenTofu Skill 🥚 It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Yesterday-AI (@yesterday-ai) published this skill. Their other Agent Skills are listed on their SkillMD profile.