Skip to content
Back to skills

Opentofu

ASecurity

Manage infrastructure via OpenTofu (Terraform fork). Use when: provisioning servers, DNS, or cloud resources. Covers: init, plan, apply, destroy, import.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added August 31, 2026
ai-agentsgobashkubernetesterraformgit

Works with

  • cli

Security analysis

A100/100

Scanned August 31, 2026

npx -y skills add Yesterday-AI/skills --skill opentofu --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Opentofu?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Opentofu
[![Security: A β€” Skills Directory](https://www.skillsdirectory.com/api/skills/yesterday-ai-opentofu/badge)](https://www.skillsdirectory.com/skills/yesterday-ai-opentofu)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: opentofu
description: Manage infrastructure via OpenTofu (Terraform fork). Use when: provisioning servers, DNS, or cloud resources. Covers: init, plan, apply, destroy, import.
metadata:
  author: EmmettTheDoc
  version: "1.0"
  category: ops
compatibility: Requires `tofu` CLI.
---

# OpenTofu Skill πŸ₯š

Infrastructure as Code using OpenTofu.

## When to Use

βœ… **USE this skill when:**
- Creating/modifying cloud resources (Servers, DNS, S3)
- Managing stateful infrastructure
- Reviewing `.tf` files

❌ **DON'T use this skill when:**
- Configuring OS internals (use `ssh` or `ansible`)
- Running one-off scripts
- Managing Kubernetes resources inside a cluster (use `kubectl` / `helm`)

## Workflow

### 1. Init
Always run init first to download providers/modules.
```bash
tofu init
```

### 2. Plan (Dry Run)
Check what will happen. **Mandatory** before apply.
```bash
tofu plan -out=tfplan
```

### 3. Apply
Execute the changes.
```bash
tofu apply tfplan
```

### 4. Format
Keep code clean.
```bash
tofu fmt -recursive
```

## Best Practices

- **State:** Never commit `.tfstate` files. Use remote state (S3/Consul) or local state in `.gitignore`.
- **Secrets:** Never hardcode secrets. Use `variable "token" {}` and pass via `TF_VAR_token` environment variable.
- **Locking:** Ensure state locking works to prevent race conditions.

## Common Providers

### Hetzner Cloud (`hcloud`)
```hcl
provider "hcloud" {
  token = var.hcloud_token
}
resource "hcloud_server" "web" { ... }
```

### Hetzner DNS
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`

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.