MR
Mayur Rathi
@sickn33
⭐ 47.3k GitHub stars

opentofu-migration

opentofu-migration is an engineering AI skill with a core value of Migrate from Terraform to OpenTofu with state compatibility, provider registry setup, and CI/CD pipeline updates. It helps developers solve real-world problems in the engineering domain, boosting efficiency, automating repetitive tasks, and optimizing workflows.

Migrate from Terraform to OpenTofu with state compatibility, provider registry setup, and CI/CD pipeline updates. Use when adopting the open-source Terraform fork or evaluating license-free IaC.

Last verified on: 2026-10-06

Quick Facts

Category engineering
Works With Claude
Source sickn33/antigravity-awesome-skills
Stars ⭐ 47.3k
Last Verified 2026-10-06
Risk Level Low
mkdir -p ./skills/opentofu-migration && curl -sfL https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/skills/opentofu-migration/SKILL.md -o ./skills/opentofu-migration/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# OpenTofu Migration


Migrate infrastructure-as-code from HashiCorp Terraform to the open-source OpenTofu fork.


When to Use This Skill


Use this skill when:

- Migrating from Terraform to OpenTofu for licensing reasons

- Setting up a new IaC project and evaluating OpenTofu vs Terraform

- Updating CI/CD pipelines to use OpenTofu

- Configuring the OpenTofu provider registry


Prerequisites


- Existing Terraform codebase (0.13+)

- OpenTofu CLI installed

- State backend access (S3, GCS, Azure Blob, etc.)


Install OpenTofu


bash
# macOS
brew install opentofu

# Linux (Debian/Ubuntu)
curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh \
  -o install-opentofu.sh
chmod +x install-opentofu.sh
./install-opentofu.sh --install-method deb
rm install-opentofu.sh

# Linux (RPM)
./install-opentofu.sh --install-method rpm

# Docker
docker run --rm -v $(pwd):/workspace -w /workspace \
  ghcr.io/opentofu/opentofu:latest init

# Verify installation
tofu --version

Migration Checklist


1. Verify Compatibility


bash
# OpenTofu reads Terraform state files directly — no migration needed
# Check your Terraform version (must be <= 1.6.x for full compat)
terraform version

# Run plan with OpenTofu against existing state
tofu init
tofu plan

2. Replace CLI Commands


| Terraform | OpenTofu |

|-----------|----------|

| `terraform init` | `tofu init` |

| `terraform plan` | `tofu plan` |

| `terraform apply` | `tofu apply` |

| `terraform destroy` | `tofu destroy` |

| `terraform fmt` | `tofu fmt` |

| `terraform validate` | `tofu validate` |

| `terraform state` | `tofu state` |

| `terraform import` | `tofu import` |


3. Update Provider Lock File


bash
# Remove Terraform lock and regenerate for OpenTofu
rm .terraform.lock.hcl
tofu init -upgrade

# Verify providers resolve correctly
tofu providers

4. Update State Backend


State files are compatible — no migration needed. Just verify:


hcl
# backend.tf — works identically with OpenTofu
terraform {
  backend "s3" {
    bucket         = "mycompany-tfstate"
    key            = "prod/infrastructure.tfstate"
    region         = "us-east-1"
    dynamodb_table = "terraform-locks"
    encrypt        = true
  }
}

bash
# Verify state access
tofu init
tofu state list

5. Provider Registry


OpenTofu uses its own registry but mirrors most Terraform providers:


hcl
# versions.tf
terraform {
  required_version = ">= 1.6.0"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = "~> 2.25"
    }
    # OpenTofu-specific providers
    random = {
      source  = "hashicorp/random"
      version = "~> 3.6"
    }
  }
}

OpenTofu-Specific Features


State Encryption (Not in Terraform)


hcl
# OpenTofu supports native state encryption
terraform {
  encryption {
    key_provider "pbkdf2" "my_key" {
      passphrase = var.state_passphrase
    }
    method "aes_gcm" "encrypt" {
      keys = key_provider.pbkdf2.my_key
    }
    state {
      method   = method.aes_gcm.encrypt
      enforced = true
    }
    plan {
      method   = method.aes_gcm.encrypt
      enforced = true
    }
  }
}

Early Variable/Local Evaluation


hcl
# OpenTofu allows variables in backend config and module sources
terraform {
  backend "s3" {
    bucket = var.state_bucket  # Works in OpenTofu, not Terraform
    key    = "${var.project}/terraform.tfstate"
    region = var.aws_region
  }
}

CI/CD Pipeline Updates


GitHub Actions


yaml
# .github/workflows/tofu.yml
name: OpenTofu
on:
  pull_request:
    paths: ["infra/**"]
  push:
    branches: [main]
    paths: ["infra/**"]

permissions:
  id-token: write
  contents: read
  pull-requests: write

jobs:
  plan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup OpenTofu
        uses: opentofu/setup-opentofu@v1
        with:
     

🎯 Best For

  • Claude users
  • AI users

💡 Use Cases

  • Using opentofu-migration in daily workflow
  • Automating repetitive engineering tasks

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply opentofu-migration to Your Work

    Provide context for your task — paste source material, describe your audience, or share existing work to guide the AI.

  4. 4

    Review and Refine

    Edit the AI output for accuracy, tone, and completeness. Add human insight where the AI lacks context.

❓ Frequently Asked Questions

How do I install opentofu-migration?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/opentofu-migration/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Not reading the full skill

Skills contain important context and edge cases beyond the quick start.

🔗 Related Skills