Loading CloudFormation to Terraform Converter...

How to Convert CloudFormation to Terraform

Step 1

Input Your CloudFormation Template

Start by providing your AWS CloudFormation template. Whether you're migrating from CloudFormation to Terraform or modernizing your Infrastructure as Code, you have multiple options:

•
Paste directly: Copy your CloudFormation template (JSON or YAML) and paste it into the input editor
•
Upload files: Click "Upload" to select your .template, .json, or .yaml files
•
Try the sample: Click "Sample" to load a small YAML template with an EC2 instance and a security group
•
JSON or YAML: Both are read, including the YAML short tags such as !Ref, !Sub and !GetAtt
Step 2

Automatic Conversion Process

The converter reads the template and writes a first draft in Terraform HCL:

•
Resource mapping: 36 common CloudFormation resource types become resource blocks for the Terraform AWS provider; their properties are copied in snake_case and still need checking against the provider's argument names
•
Intrinsic functions: Translates Ref, !GetAtt, !Sub, !Join, !Select and !FindInMap to Terraform expressions; anything else is written as null and listed in a note
•
Parameters → Variables: CloudFormation Parameters become Terraform variables with a type, description and default, and NoEcho parameters are marked sensitive
•
Outputs preserved: CloudFormation Outputs are converted to Terraform outputs maintaining descriptions and values
•
Provider setup: Automatically generates terraform required_providers block and AWS provider configuration
Step 3

Review Generated Terraform Code

Review the generated main.tf configuration in the output panel. Treat it as a draft; the comment lines at the top tell you what was skipped:

•
Terraform blocks: Includes required_version and required_providers for AWS
•
Variables defined: Every CloudFormation Parameter becomes a typed Terraform variable
•
Resources written: EC2, VPC, S3, RDS, Lambda, IAM and the other supported types become resource blocks; rename any property the aws provider calls something else
•
Outputs exported: CloudFormation Outputs become Terraform outputs for use in other modules or stacks
Step 4

Download and Deploy with Terraform

Once the draft looks right, download it and let Terraform check it before anything is created:

•
Download the file: Click "Download" to save main.tf to your Terraform project directory
•
Initialize Terraform: Run terraform init to download the AWS provider
•
Validate and plan: Run terraform validate to catch argument names that need fixing, then terraform plan to see what would be created
•
Apply changes: Run terraform apply to provision your AWS infrastructure
•
Import existing resources: Use terraform import to manage resources that already exist in your AWS account

Quick Start Commands

Essential Terraform CLI commands:

# Initialize Terraform
terraform init
# Preview changes
terraform plan
# Apply infrastructure
terraform apply

Frequently Asked Questions

How does the CloudFormation to Terraform conversion work?

The template is read as JSON or YAML, including the short YAML tags such as !Ref, !Sub and !GetAtt. Parameters become variable blocks, Mappings become a locals block, every resource with a known type becomes a resource block for the hashicorp/aws provider, and Outputs become output blocks. A comment at the top of the result lists anything that was skipped or could not be translated.

Which AWS resource types are converted?

A fixed list of 36 common types: EC2 instances, security groups, VPCs, subnets, internet gateways, route tables, routes, Elastic IPs and EBS volumes; Lambda functions and permissions; S3 buckets and bucket policies; RDS instances and subnet groups; DynamoDB tables; IAM roles, policies, users, groups and instance profiles; ALB/NLB load balancers, target groups and listeners; Auto Scaling groups and launch configurations; CloudWatch alarms and log groups; SNS topics; SQS queues; API Gateway REST APIs, resources and methods; and ECS clusters, services and task definitions. Any other type, including custom resources and nested stacks, is skipped and named in the notes.

Are the properties matched to the Terraform aws provider arguments?

Not one by one. Each property is copied with its name in snake_case, so BucketName becomes bucket_name and SecurityGroupIngress becomes security_group_ingress. Tags lists are turned into the tags map Terraform expects and IAM policy documents are wrapped in jsonencode(), but many aws provider arguments have different names or shapes (an S3 bucket's name is bucket, for example). Run terraform validate and fix what it reports.

Which intrinsic functions and pseudo parameters are translated?

Ref becomes var.name for a parameter or type.name.id for a resource, Fn::GetAtt becomes an attribute reference, Fn::Sub becomes string interpolation (including the form with a variable map), and Fn::Join, Fn::Select, Fn::Split, Fn::Base64 and Fn::FindInMap become join(), element(), split(), base64encode() and a lookup in local.mappings. AWS::Region becomes var.aws_region, AWS::AccountId and AWS::Partition read from data sources, and AWS::StackName becomes a variable you set. Fn::If, Fn::ImportValue, Conditions and the other functions are written as null and listed in the notes so you can replace them by hand.

Will long IDs, prices or text with quotes change?

No. Numbers keep the digits you typed, so 8901240544102066246 and 14.50 come out exactly as written, and 00501 stays the text 00501 whether it was quoted or not. Tag values are always written as text. Quotes, backslashes and line breaks are escaped, and a literal ${ or %{ is written as $${ or %%{ so Terraform does not treat it as interpolation.

What happens to DependsOn, Conditions and DeletionPolicy?

DependsOn entries that point at a converted resource become depends_on. A resource Condition, DeletionPolicy, UpdatePolicy and similar settings are kept as comments inside the resource block; in Terraform you would usually express them with count and a lifecycle block.

Is my CloudFormation template 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.