Terraform to Pulumi TypeScript Converter

Rewrite Terraform HCL as a Pulumi program in TypeScript, using @pulumi/aws resources, Pulumi config and exported outputs.

Your codeTerraform (HCL)
Drop the file to load it
Tab indents · Esc, Tab exits
ResultPulumi (TypeScript)
Your Pulumi (TypeScript) will appear hereClick Convert to Pulumi or press Ctrl Enter
index.ts
Don't paste secrets

How to convert Terraform to Pulumi TypeScript

  1. Add your codePaste it into the Terraform (HCL) editor, drag in a file, or keep the sample to see how it works.
  2. Convert to PulumiClick the button or press Ctrl + Enter. The result streams into the right-hand editor.
  3. Review and use itCopy or download the result, then test it before you rely on it. AI output is a strong first draft, not a guarantee.

How Terraform maps to a Pulumi program

Pulumi's AWS provider mirrors the Terraform AWS provider closely, so most resources map one to one. resource "aws_sns_topic" "alerts" becomes new aws.sns.Topic("alerts", { ... }), arguments become camelCase properties, variable blocks become pulumi.Config values, and output blocks become export const statements.

The main new concept is Output<T>. Values such as topic.arn aren't known until deployment, so you pass them straight into other resources, and build strings from them with pulumi.interpolate or .apply(). The converter uses these where Terraform used interpolation.

For whole projects, Pulumi also provides its own pulumi convert --from terraform command and a Terraform migration guide, including importing existing resources from Terraform state. This converter is handy for single files, quick comparisons, and learning the Pulumi equivalent of a snippet.

Converting the code doesn't adopt your deployed resources. Import them into the Pulumi stack first, or pulumi up will try to create duplicates.

Tips for better results

  • Set names explicitly if they matter. Pulumi adds a random suffix to physical names by default. Keep a fixed name, such as name: "ops-alerts", when other systems depend on it.
  • Move variables to config. Required variables become config.require("alertEmail"). Set them with pulumi config set alertEmail ....
  • Use pulumi.interpolate for strings. Concatenating an Output with + or a plain template literal won't give you the resolved value.
  • Preview before deploying. Run pulumi preview and check it only creates or imports what you expect.
  • Convert one module at a time. A Terraform module maps naturally to a Pulumi ComponentResource.

Frequently asked questions

Does Pulumi have an official Terraform converter?

Yes. Pulumi's CLI includes pulumi convert --from terraform, which converts whole Terraform projects. This tool is a quick alternative for individual files and snippets.

Will my Terraform-managed resources move to Pulumi?

Not by converting code. Import them into your Pulumi stack, as described in Pulumi's Terraform migration guide, then remove them from Terraform state so only one tool manages each resource.

What is Output<T> and why does the code use it?

Resource attributes such as ARNs are only known after deployment, so Pulumi wraps them in Output values. You can pass them directly to other resources, and use pulumi.interpolate or .apply() when you need to build a string from them.

Why do my resource names have random suffixes?

Pulumi auto-names resources by adding a random suffix, which lets it replace resources without name clashes. Set an explicit name property when you need an exact physical name.