
Pulumi Terraform To Pulumi
Convert an existing Terraform or OpenTofu repo into a Pulumi project with correct stack state mapping via the terraform-migrate plugin.
Overview
Pulumi Terraform to Pulumi is an agent skill for the Operate phase that migrates Terraform or OpenTofu projects to Pulumi using terraform-migrate and in-repo project layout.
Install
npx skills add https://github.com/pulumi/agent-skills --skill pulumi-terraform-to-pulumiWhat is this skill?
- Scopes migration paths: source-only vs full state import before any commands run
- Mandates terraform-migrate over pulumi convert to preserve state mapping
- Creates an empty Pulumi project in-repo (never under /workspace) in TypeScript, Python, or YAML
- Requires pulumi_up on the empty stack before continuing migration steps
- Explicitly excludes Terraform-vs-Pulumi debates and side-by-side dual-tool setups
- Critical constraint: do not run pulumi convert—use terraform-migrate instead
Adoption & trust: 570 installs on skills.sh; 56 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You have working Terraform or OpenTofu and tfstate but no safe, step-by-step way for an agent to land an equivalent Pulumi stack without breaking state mapping.
Who is it for?
Solo builders with an existing Terraform/OpenTofu repo who are committing to Pulumi and want agent steps that match Pulumi’s migrate plugin constraints.
Skip if: General Terraform-vs-Pulumi comparisons, running both tools indefinitely side-by-side, or quick experiments that skip user-confirmed paths and language choice.
When should I use this skill?
User wants to convert Terraform to Pulumi, migrate from HCL, or import tfstate into Pulumi—not general Terraform-vs-Pulumi comparisons or dual-tool side-by-side use.
What do I get? / Deliverables
You get a confirmed migration plan, an empty in-repo Pulumi project with a live stack, and a plugin-based path to translate HCL and optionally import state—ready for iterative resource cutover.
- Empty Pulumi project in the chosen language inside the repo
- Documented migration plan with confirmed paths and state strategy
- Initial Pulumi stack brought up via pulumi_up before further migration
Recommended Skills
Journey fit
IaC migration is a production infrastructure change that solo builders tackle when they standardize on Pulumi or need typed programs instead of HCL. Canonical shelf is infra because the workflow centers on translating HCL, importing tfstate, and aligning Pulumi stacks—not app feature work.
How it compares
Use this procedural migrate workflow instead of asking the agent to run generic pulumi convert or ad-hoc HCL copy-paste.
Common Questions / FAQ
Who is pulumi-terraform-to-pulumi for?
Indie and solo developers who already manage cloud with Terraform or OpenTofu and want a structured agent-guided conversion to Pulumi inside their git repo.
When should I use pulumi-terraform-to-pulumi?
Use it when you want to convert Terraform to Pulumi, migrate from HCL, or import tfstate into a Pulumi stack after agreeing on directories, language, and state goals.
Is pulumi-terraform-to-pulumi safe to install?
Migration touches production state and cloud APIs—review the Security Audits panel on this Prism page and validate every pulumi and terraform command in a non-production stack first.
SKILL.md
READMESKILL.md - Pulumi Terraform To Pulumi
# 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} \ --to ${pulumi_dir} \ --out /tmp/pulumi-state.json \ --plugins /tmp/required-providers.json Do NOT install the plugin as it will auto-install as needed. Sometimes terraform-migrate plugin fails because `tofu refresh` is not authorized. DO NOT skip this step. Work with the user to find or build a Pulumi ESC environment that provides the necessary credentials so the command can succeed. If setting up an ESC environment is not feasible, inform the user that the migration cannot proceed automatically. Read the generated `/tmp/required-providers.json` and install all these Pulumi providers into the new project, respecting the suggested versions even if they downgrade an already installed provider. The file will contain records such as `[{"name":"aws","version":"7.12.0"}]`. Install providers as project dependencies using the language-specific package manager (NOT `pulumi plugin install`, which only downloads plugins without adding dependencies): # TypeScript/JavaScript npm install @pulumi/aws@7.12.0 # Python pip install pulumi_aws==7.12.0 # Go go get github.com/pulumi/pulumi-aws/sdk/v7@v7.12.0 # C# dotnet add package Pulumi.Aws --version 7.12.0 Import the translated state draft (`/tmp/pulumi-state.json`) into the Pulumi stack: pulumi stack import --file /tmp/pulumi-state.json Translate source code to match both the Terraform source and the translated state. Aim for exact match. You can consult the state draft `/tmp/pulumi-state.json` for Pulumi resource types and names to use. Iterate on fixing the source code until `pulumi_preview` tool confirms that there are no changes to make and the diff is empty or almost empty. Provider diffs or diffs on tags may be OK. Offer the user to link an ESC environment to the stack so that each Pulumi stack can seamlessly have access to the provider credentials it needs. When all looks good, create a Pull Request with the migrated source code.