last update
Jun 24, 2026
license
MITv1.0.0
format
SKILL.md
- Install
// Downloads SKILL.md into ~/.claude/skills/opentofu-iac/
$ curl -fsSL --create-dirs -o ~/.claude/skills/opentofu-iac/SKILL.md https://claudeskil.com/skills/opentofu-iac/SKILL.md - Invoke
// Inside Claude Code, type the skill name as a slash command
> /opentofu-iac wire up a GitHub Actions deploy - Or copy this from the README
// extracted bash block
$ curl -fsSL --create-dirs -o ~/.claude/skills/opentofu-iac/SKILL.md https://claudeskil.com/skills/opentofu-iac/SKILL.md tofu init # reuses .terraform.lock.hcl + existing state tofu plan # expect a no-op diff right after migrating
- name:
- OpenTofu Migrator
- slug:
- opentofu-iac
- version:
- v1.0.0
- license:
- MIT
- author:
- @chiragthummar16
- categories:
- tags:
- #opentofu#terraform#iac#state-encryption#migration
- description:
OpenTofu/HCL authoring, drop-in Terraform migration, client-side state encryption, and tofu-only features.
README.md
OpenTofu Migrator
OpenTofu Migrator helps you move existing Terraform configurations to OpenTofu and then take advantage of the features that only exist in the fork. It covers the in-place migration path, client-side state encryption, and OpenTofu-specific HCL constructs that the upstream Terraform CLI rejects. It is aimed at platform and DevOps engineers who already run terraform in CI and want a low-risk switch without rewriting modules.
When to use it
- You want to swap
terraformfortofuin CI/CD and need the state, provider lockfile, and.tffiles to keep working untouched. - You need state encrypted at rest with a key you control, not just relying on backend bucket encryption.
- You want OpenTofu-only language features such as variables/locals evaluated early enough to parameterize a
backendblock or a modulesource. - You are writing provider-defined functions and want them resolved by
tofu.
How it works
Migration is intentionally boring: tofu init reads your existing .terraform.lock.hcl and remote state as-is, so a project usually moves over by replacing the binary. The skill helps with the CI swap (changing terraform invocations to tofu), checking provider compatibility in the lockfile, and the tofu plan/tofu apply sanity loop after switching.
For encryption it authors an encryption block under terraform {}, wiring a key_provider (pbkdf2 with a passphrase, aws_kms, or gcp_kms) to a method "aes_gcm" and attaching it to state and plan. It supports the unencrypted fallback used during rollout and key rotation via a second method.
It also authors tofu-only constructs: early variable evaluation in backend and module source, and provider:: namespaced function calls.
Usage
curl -fsSL --create-dirs -o ~/.claude/skills/opentofu-iac/SKILL.md https://claudeskil.com/skills/opentofu-iac/SKILL.md
tofu init # reuses .terraform.lock.hcl + existing state
tofu plan # expect a no-op diff right after migrating
terraform {
encryption {
key_provider "pbkdf2" "k" {
passphrase = var.state_passphrase
}
method "aes_gcm" "m" {
keys = key_provider.pbkdf2.k
}
state { method = method.aes_gcm.m }
plan { method = method.aes_gcm.m }
}
}
Tips & gotchas
- Set
TF_ENCRYPTION(or theencryptionblock) consistently across every machine and CI runner — once state is encrypted, a runner without the key cannot read it. - To roll encryption out gradually, add an
unencrypted {}fallback sotofucan read old plaintext state, then remove it after the first encrypted apply. - The PBKDF2 passphrase must be at least 16 characters; shorter ones fail at init.
- Encrypted state is opaque to tools that parse
terraform.tfstatedirectly — decrypt viatofufirst.
FAQ
Can I migrate back to Terraform later? Only if you avoided tofu-only features and left state unencrypted; encrypted state and provider:: functions are not readable by the Terraform CLI.
Does my provider lockfile still work? Yes — tofu init consumes the existing .terraform.lock.hcl and matching provider hashes.
Is key rotation supported? Yes, by defining a second method and listing both keys so old state decrypts while new writes use the new key.
authored by
@chiragthummar16Android Jetpack Pro
Ship Jetpack Compose screens, ViewModels, and Gradle config with idiomatic best practices baked in.
0iOS SwiftUI Architect
Design SwiftUI apps with clean architecture: MV pattern, @Observable, and Swift Concurrency.
0PPT Deck Designer
Turn a rough outline into a visually polished pitch deck with on-brand layouts and speaker notes.
0Video Cut Assistant
Produce edit decision lists, trim plans, and subtitle cues from raw footage transcripts.
0
$ cat reviews/