Loading Terraform to Pulumi Converter...

How to Convert Terraform to Pulumi - Step by Step Guide

Step 1

Paste Your Terraform Configuration

Copy your Terraform HCL into the left editor, or upload a .tf or .hcl file with the Upload button. It reads variables, locals, resources, data sources and outputs; AWS resource types are mapped to Pulumi classes, and anything it does not map is listed in a Notes comment.

•
Paste directly: Copy your Terraform HCL and paste it into the input editor
•
Upload a file: Click Upload to select a .tf or .hcl file
•
Try the sample: Click Sample to load an example Terraform configuration
Step 2

Review the Pulumi TypeScript Output

Common AWS resource types are mapped to their @pulumi/aws class, variables become config reads and outputs become exports. Resource references and interpolations become TypeScript identifiers and pulumi.interpolate.

•
Resource mapping: aws_s3_bucket becomes aws.s3.Bucket
•
Variable conversion: Terraform variables become Pulumi config values
•
Notes comment: Anything left as undefined is named at the top of the file
Step 3

Download or Copy the Pulumi Code

Copy the converted Pulumi TypeScript or download it as a .ts file. The code starts with the imports for the detected provider and the Notes comment.

•
Copy to clipboard: One-click copying for pasting into your project
•
Download as file: Save as a .ts file for your Pulumi project
•
Check mark: Appears once a program has been produced
Step 4

Deploy with Pulumi CLI

Start a Pulumi project and deploy the converted code. You can import existing resourceswith pulumi import so you do not recreate infrastructure.

•
Initialize project: Run pulumi new aws-typescript
•
Install dependencies: Run npm install @pulumi/aws
•
Deploy: Run pulumi preview then pulumi up

Frequently Asked Questions

What does this converter turn into Pulumi code?

Each variable block becomes a pulumi.Config read — config.get, getNumber, getBoolean or getObject, with the default after ?? and config.require when there is no default. locals become plain const values, resources of a mapped AWS type become new aws.* objects, and every output becomes an exported constant. References such as aws_vpc.main.id and an interpolated string become identifiers and pulumi.interpolate, and depends_on becomes the dependsOn option.

Which resource types does it handle?

Around forty common AWS types are mapped, including S3 buckets, EC2 instances, VPCs, subnets, security groups, route tables, RDS instances, Lambda functions, IAM roles and policies, DynamoDB tables, SNS and SQS, load balancers and ECS. A resource whose type is not mapped — including Azure, Google Cloud and Kubernetes resources — is written as a const set to undefined and named in the Notes comment at the top, so references still compile and nothing is dropped without a trace.

Are the property names ready for @pulumi/aws?

They are camelCased from the Terraform argument names, so cidr_block becomes cidrBlock. Tag keys and other map keys are kept exactly as you wrote them. The Pulumi AWS provider renames or nests a few properties differently, so run tsc or let your editor check the program against the @pulumi/aws types and fix whatever it flags.

Will numbers and quoted values stay exact?

Yes. A number is written with the digits you typed, so 14.50 stays 14.50 and a long id like 8901240544102066246 is not rounded in the code. A quoted "00501" stays a string, and quotes, backslashes and interpolation markers are escaped so every string is valid TypeScript. Keep in mind that a JavaScript number only holds about 15 digits exactly, so a value that long is best passed as a string.

What about count, for_each and provisioners?

Loops (count and for_each), provisioner, connection and dynamic blocks, conditionals and for expressions have no one-to-one Pulumi form, so they are not guessed. Each is named in the Notes comment, and you rewrite that part as an ordinary TypeScript loop or expression.

How do I run the converted program?

Create a project with pulumi new aws-typescript, replace index.ts with the downloaded file, set any config values with pulumi config set, and run pulumi preview before pulumi up. If the infrastructure already exists, import it with pulumi import instead of creating duplicates.

Is my configuration uploaded anywhere?

No. The HCL is read and converted in your browser, nothing is sent to a server and nothing is kept, so reloading the page starts with an empty editor.