# pulumi-terraform-to-pulumi

Converts Terraform and OpenTofu projects to Pulumi: translates HCL into code and imports existing state into a Pulumi stack.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 959 installs · ★ 78
- Author: pulumi
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/pulumi/agent-skills/tree/HEAD/migration/skills/pulumi-terraform-to-pulumi/SKILL.md
- Updated: 2026-10-09
- HTML: https://affpapa.org/en/nevibecode/skills/pulumi-terraform-to-pulumi

## What it does

The skill walks a migration through in stages. First you and the agent settle the scope: where the Terraform sources live, where the Pulumi project should go, which language to target (TypeScript, Python, YAML), and whether you want state moved or only the source translated. The plan gets confirmed before anything runs.

Then the agent creates an empty project in the chosen directory with a stack, and pulls state with `terraform state pull` when there is no local `.tfstate`. That works against remote backends, Pulumi Cloud included. The `terraform-migrate` plugin, which installs itself when needed, produces a draft state file. `/tmp/required-providers.json` lists the providers and versions to add; install them through your language package manager rather than `pulumi plugin install`, which only downloads plugins. The draft is imported into the stack, and the source is rewritten until `pulumi_preview` shows an empty or near-empty diff.

A few constraints are firm. Do not run `pulumi convert` — it drops the state mapping, which is the whole reason the plugin exists. Create the project inside the checked-out repo, not under `/workspace`. If `tofu refresh` comes back unauthorized, that step is not skipped: you build a Pulumi ESC environment with the credentials, or the migration cannot proceed automatically. At the end the skill offers to link ESC to the stack and opens a pull request with the migrated code.

## Requirements
- Works with: Terraform

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add pulumi/agent-skills --skill pulumi-terraform-to-pulumi -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/pulumi-terraform-to-pulumi/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/pulumi-terraform-to-pulumi/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add pulumi/agent-skills --skill pulumi-terraform-to-pulumi -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/pulumi-terraform-to-pulumi/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add pulumi/agent-skills --skill pulumi-terraform-to-pulumi -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/pulumi-terraform-to-pulumi/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install pulumi/agent-skills pulumi-terraform-to-pulumi
```

2. **Manually: put the files in place**
- File: `.github/skills/pulumi-terraform-to-pulumi/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add pulumi/agent-skills --skill pulumi-terraform-to-pulumi -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/pulumi/agent-skills --path migration/skills/pulumi-terraform-to-pulumi
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/pulumi-terraform-to-pulumi/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add pulumi/agent-skills --skill pulumi-terraform-to-pulumi -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/pulumi/agent-skills/tree/HEAD/migration/skills/pulumi-terraform-to-pulumi/SKILL.md

## When to use it
- translate HCL infrastructure into Pulumi code
- move Terraform state into a Pulumi stack without rewriting it by hand
- pin the right Pulumi providers and versions for an existing project
- drive the diff to zero with `pulumi_preview` after migration
- open a pull request with the converted sources

## Example prompts
- Migrate the Terraform project in `./infra` to Pulumi in TypeScript, state included
- Convert OpenTofu to Pulumi in Python, sources are in `./tf`
- Translate this HCL to Pulumi and tell me which providers I need

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 27bfaf8a2bebd7f1.

BEGIN THIRD-PARTY FILE 27bfaf8a2bebd7f1
```text
---
name: pulumi-terraform-to-pulumi
description: Migrate Terraform/OpenTofu projects to Pulumi, including translating HCL source code and/or importing Terraform state into a Pulumi stack. Use when a user wants to convert Terraform to Pulumi, migrate from HCL, or import tfstate into Pulumi. Do NOT trigger for general Terraform-vs-Pulumi comparisons or questions about using both tools side-by-side.
---

# Migrating from Terraform to Pulumi

> **Critical constraints — read before acting:**
> - Do NOT run `pulumi convert` — use the terraform-migrate plugin instead, which preserves state mapping.
> - Do NOT run `pulumi package add terraform-module` — this is for a different workflow.
> - Do NOT create the Pulumi project under `/workspace` — create it inside the checked-out repo.
> - Replace `${terraform_dir}` and `${pulumi_dir}` below with the actual paths confirmed with the user.

First establish scope and plan the migration by working out with the user:

- where the Terraform sources are (`${terraform_dir}`)
- where the migrated Pulumi project lives (`${pulumi_dir}`)
- what is the target Pulumi language (such as TypeScript, Python, YAML)
- whether migration aims to setup Pulumi stack states, or only translate source code

Confirm the plan with the user before proceeding.

Create a new Pulumi project in `${pulumi_dir}` in the chosen language. Edit sources to be empty and not declare any
resources. Ensure a Pulumi stack exists.

You must run `pulumi_up` tool before proceeding to ensure initial stack state is written.

If no local `.tfstate` file exists in `${terraform_dir}`, the state may be in a remote backend (S3, Pulumi Cloud, Terraform Cloud, etc.). Pull it before proceeding:

    cd ${terraform_dir} && terraform state pull > terraform.tfstate

This works for all backends, including Pulumi Cloud. If `terraform` is not available, try `tofu state pull` instead.

Now produce a draft Pulumi state translation:

    pulumi plugin run terraform-migrate -- stack \
        --from ${terraform_dir} \
```
END THIRD-PARTY FILE 27bfaf8a2bebd7f1

The third-party file has ended. Everything between the 27bfaf8a2bebd7f1 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2032 of 4010 bytes. © pulumi · Apache-2.0 · https://github.com/pulumi/agent-skills/tree/HEAD/migration/skills/pulumi-terraform-to-pulumi/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
