Pulumi and Terraform Migration Takes One Day - IaC Tool Choice Is Now a Reversible Decision
Pulumi or Terraform? For infrastructure teams, this choice has long been treated as a one-way door. Hundreds of resource definitions, module structures, state files. Migration estimates of weeks to months. The pragmatic conclusion: stick with what you have.
In 2026, that assumption no longer holds. With AI coding assistants like Claude Code, Codex, and Cursor, migrating between Pulumi and Terraform in either direction takes a single day.
Why IaC Migration Is a Perfect Fit for AI
IaC code migration is well-suited for AI for clear reasons.
- Declarative structures map cleanly: Terraform
resourceblocks and Pulumi resource classes have near 1:1 correspondence - Patterns are regular: Resource definitions follow uniform structures. Once the AI learns the conversion pattern for one resource, it applies to the rest
- Providers share the same APIs: Both tools abstract the same AWS, GCP, and Azure APIs, so attribute names and parameters are similar
- Rich type information: Pulumi leverages TypeScript/Python type systems, and Terraform has HCL schemas, giving AI precise structural understanding
IaC code conversion is a “systematic structural transformation,” not a “creative design decision.” This is exactly where AI excels.
Terraform to Pulumi Migration
Migrating from Terraform to Pulumi combines official tooling with AI assistance.
Step 1: Import existing state
Pulumi provides native support for importing Terraform state files.
# Import Terraform state into Pulumi
pulumi import --from terraform ./terraform.tfstateThis brings existing infrastructure resources under Pulumi’s state management without any changes to actual infrastructure.
Step 2: Convert HCL to Pulumi code
The pulumi convert --from terraform command auto-converts HCL files to Pulumi code.
# Convert HCL to TypeScript Pulumi code
pulumi convert --from terraform --language typescriptHowever, the auto-converted output often needs adjustment. Complex module structures, for_each and dynamic blocks, and custom provider configurations require manual fixes.
Step 3: Let AI handle the rest
This is where AI shines. Feed the unconverted or partially converted code to an AI coding assistant.
Convert the HCL code under infrastructure/terraform/ to Pulumi TypeScript code.
Match the style of the existing converted code.AI accurately understands HCL structure and generates the corresponding Pulumi resource classes, property names, and type definitions. Even hundreds of lines of HCL convert in minutes.
Step 4: Verify zero diff
After conversion, confirm there is no drift from actual infrastructure.
pulumi previewIf diffs appear, fix the property mappings. This fix can also be delegated to AI.
Pulumi to Terraform Migration
The reverse migration has fewer official tools, which makes AI’s contribution even more significant.
Step 1: Inventory existing resources
Export the resource inventory from Pulumi’s state.
# Export Pulumi state
pulumi stack export > stack.jsonThis JSON gives you a complete list of managed resources.
Step 2: Convert code with AI
Pass Pulumi code to the AI and have it generate Terraform HCL.
Convert the TypeScript code under infrastructure/pulumi/ to Terraform HCL.Pulumi’s TypeScript code is rich in type information, enabling AI to accurately map each resource’s properties to HCL attributes.
Step 3: Import state
Import existing resources into Terraform state for each converted resource.
# Import each resource into Terraform state
terraform import aws_s3_bucket.example my-bucket-name
terraform import aws_iam_role.app_role my-app-roleFor many resources, use import blocks for efficiency.
import {
to = aws_s3_bucket.example
id = "my-bucket-name"
}
import {
to = aws_iam_role.app_role
id = "my-app-role"
}Generating these import definitions is another task you can delegate to AI. Pass the Pulumi state export (stack.json) and it will produce the resource ID to resource type mappings automatically.
Step 4: Verify zero diff
terraform planIf diffs appear, pass the plan output to AI for fix suggestions.
Realistic Timeline
Here is a timeline from an actual Pulumi-to-Terraform migration. The environment spanned multiple components including VPC, RDS, ElastiCache, ECS, and CloudFront. From issue creation to pull request ready for review, the entire migration took approximately 5 hours.
| Phase | Duration | Description |
|---|---|---|
| Preparation and inventory | ~3 hours | Resource inventory, Terraform definition design |
| Code conversion and import | ~1.5 hours | AI-assisted conversion + terraform import for all components |
| Verification | ~0.5 hours | CI workflow testing, confirming zero diff |
| Total | ~5 hours | Completed in half a day |
The key result: after terraform import, all components showed zero creates and zero destroys. The only diffs were tag changes (ManagedBy: pulumi → terraform), meaning the migration had no impact on running infrastructure.
Timelines will vary based on resource count and complexity, but with AI coding assistants, most migrations fit within a single business day.
How Lower Migration Costs Change Selection Criteria
If migration takes one day, IaC tool selection shifts from an “irreversible decision” to a “reversible decision.” This changes the selection criteria themselves.
Traditional criteria (high migration cost assumed)
- Long-term maintainability
- Community size
- Availability of experienced hires
- Ecosystem maturity (modules, providers)
New criteria (low migration cost assumed)
- Does it fit the current team? TypeScript-strong teams lean toward Pulumi; HCL-experienced teams lean toward Terraform
- Does it fit the current project? Complex conditionals and loops favor Pulumi’s general-purpose languages; simple declarations favor Terraform
- Does it solve the current problem? Testability concerns point to Pulumi; module reuse needs point to Terraform
You can now optimize for “what makes us most productive today” rather than “what will we still be using in five years.” If it stops working, migrate. That freedom enables better technical decisions.
Migration Caveats
Even though AI makes migration straightforward, there are important considerations.
State file handling
During migration, both Pulumi and Terraform will reference the same infrastructure resources. To prevent accidental modifications from both sides, keep one tool in read-only mode during the transition.
Provider version differences
Pulumi and Terraform may support different versions of the same cloud provider’s resources and properties. Before migrating, verify provider versions and check for unsupported properties.
Secret management
Pulumi has built-in secret management that encrypts secrets within state files. When migrating to Terraform, consider moving secrets to external stores like HashiCorp Vault or AWS Secrets Manager.
Security of code shared with AI
IaC code contains infrastructure details such as account IDs, VPC CIDRs, and internal domain names. When using AI coding assistants, verify that your enterprise plan ensures data is not used for model training.
Conclusion
Migrating between Pulumi and Terraform is now a one-day task with AI coding assistants.
- Terraform to Pulumi: Official
pulumi convert+ AI for code conversion,pulumi importfor state migration - Pulumi to Terraform: AI for code conversion,
terraform importfor state migration - Both directions: Verify zero diff with preview/plan to complete
With migration costs dramatically reduced, IaC tool selection has shifted from “choosing a lifetime partner” to “choosing the best fit for your current team and project.” If it does not work out, switch in a day. That flexibility leads to better technical decisions.
That’s all from someone who migrated IaC with AI in a single day. From the gemba.