Loading Pulumi to Terraform Converter...

How to Convert Pulumi to Terraform

Step 1

Paste your Pulumi TypeScript

Copy the Pulumi TypeScript program from your index.ts into the left editor. Plain JavaScript works too. Python, Go, C# and YAML programs are recognised and you get a message instead of a half-read result.

•
Paste directly: put the code in the input editor; it is converted a moment after you stop typing
•
Upload a file: click Upload to open a .ts or .js file
•
Try the sample: click Sample to load a small AWS program with config values, a bucket, a VPC and a subnet
Step 2

Read the Terraform HCL

Each Pulumi resource becomes a Terraform resource block, config values become variables and exports become outputs. The comment lines at the top of the output tell you what still needs a human: types named by convention, settings kept as quoted text, and anything that was skipped.

const vpc = new aws.ec2.Vpc("main-vpc", {
    cidrBlock: "10.0.0.0/16",
    tags: { Name: `${environment}-vpc` },
});

becomes

resource "aws_vpc" "vpc" {
  cidr_block = "10.0.0.0/16"
  tags = {
    Name = "${var.environment}-vpc"
  }
}
•
Resource names: the TypeScript variable name in snake_case becomes the resource label, so references like vpc.id become aws_vpc.vpc.id
•
Config: pulumi.Config values become variable blocks; a default written after || or ?? becomes the variable default
•
Providers: a terraform block with required_providers and a provider block are written for the packages you import
Step 3

Copy or download main.tf

Copy the HCL or download it as main.tf. Both always match what is in the input editor at that moment, even if you click right after typing.

•
Copy: puts the whole configuration on your clipboard
•
Download: saves it as main.tf
•
Errors: if the TypeScript does not parse, you get the line and column instead of output
Step 4

Initialise, validate and import

Run the Terraform CLI against the file. For infrastructure Pulumi already manages, use terraform import so nothing gets recreated, and only remove the stack from Pulumi once Terraform owns everything.

•
Initialise: run terraform init to download the providers
•
Validate: run terraform validate; it points at argument names or blocks that need adjusting
•
Plan: run terraform plan and read it before any apply

Going the other way? The Terraform to Pulumi converter turns HCL into Pulumi TypeScript, and CloudFormation to Terraform handles stacks written as templates.

Frequently Asked Questions

What does the converter turn into Terraform?

It reads the program the way TypeScript would and looks at the top-level statements. config.get, require, getNumber, getBoolean, getObject and the secret versions become variable blocks with a matching type; a default after || or ?? becomes the default, and secrets get sensitive = true. Each new aws.s3.Bucket("name", {...}) style call becomes a resource block, other top-level constants go into locals, getAmi-style lookups become data blocks, and every export const becomes an output.

Which resource types are mapped?

About 55 common AWS types (S3, VPC and subnets, security groups, EC2, Lambda, IAM, RDS, DynamoDB, SQS, SNS, ECS, EKS, load balancers and more) and a handful of Azure classic types are mapped from a fixed list. Other AWS, Azure classic, GCP, Kubernetes and Random resources get a type name built from the Pulumi name, with a note asking you to check it in the Terraform registry. Resources from azure-native, awsx, component resources and packages the page does not know are skipped and named in a note.

Are the arguments renamed to the provider schema?

Only to snake_case: cidrBlock becomes cidr_block and forceDestroy becomes force_destroy, which matches most AWS arguments, but nothing is checked against the provider schema. Nested settings are written as name = { ... }; where Terraform expects a nested block, remove the equals sign. Keys inside tags, labels, annotations and similar maps are kept exactly as you wrote them.

How are references, templates and resource options handled?

vpc.id becomes aws_vpc.vpc.id, a config value becomes var.name, template strings and pulumi.interpolate become HCL strings with ${...} inside, and JSON.stringify becomes jsonencode. The dependsOn option becomes depends_on, protect becomes prevent_destroy and ignoreChanges becomes ignore_changes. Anything that only runs at deploy time, such as .apply(), pulumi.all, loops or functions, cannot be written in HCL: it is kept as quoted text or skipped, and a note at the top of the output says which line.

Will long IDs, prices or quoted text change?

No. Numbers are written with the digits you typed, so 8901240544102066246 stays exactly that and 14.50 keeps its trailing zero, while "00501" stays a string. Quotes, backslashes and line breaks are escaped for HCL, and a literal ${ or %{ inside a string is written as $${ or %%{ so Terraform does not try to fill it in.

Is my code uploaded anywhere?

No. The conversion runs in your browser, nothing is sent to a server and nothing is kept, so a reload starts with an empty editor. Before you apply the result, run terraform init, terraform validate and terraform plan, and bring resources Pulumi already created under Terraform with terraform import instead of creating them again.