Moving from HCL to CDK for Terraform is much faster when the boilerplate is written for you. The CDKTF Language Mapper parses your pasted .tf and produces CDKTF stub code in TypeScript, Python or Go, mapping each resource to its provider construct and its attributes to constructor arguments. CDKTF lets you define infrastructure in a real programming language with loops, functions and unit tests, but the first translation step is tedious and error prone, especially across dozens of resources with nested blocks. This tool removes that step by reading your existing resources and emitting a faithful starting point you can refine. The parse is genuinely real: a client-side HCL parser extracts every resource block, its type, its name and all of its attributes, so nothing is guessed and no attribute is dropped. Whether you are migrating a small module or planning a larger rewrite, seeing the code shape immediately helps you estimate effort and spot gaps before you commit to a conversion. Everything runs locally in your browser, so your configuration never leaves your machine and no network call is made at any point. You can switch languages to compare idioms, paste a revised config, and re-generate as often as you like, then copy the result into a new CDKTF project. The generated stubs are intentionally skeletal: they give you correct type names, imports and attribute placement, and you layer on the application logic, conditionals and testing afterwards. Because the mapper never sends your configuration anywhere, you can safely paste production-shaped code into it during the planning phase without exposing secrets in transit. The output is a foundation, not a finished application, which keeps the tool simple, fast and focused on the hardest part of any migration: the mechanical translation of resources into code.
Terraform to CDKTF Language Mapper
Convert pasted .tf resources into CDKTF stubs (TypeScript / Python / Go).
Your generated stubs will appear here.
About Terraform to CDKTF Language Mapper
Features
- Real parse - reads resource blocks with a real HCL parser.
- Three languages - TypeScript, Python and Go output.
- Provider mapping - aws, azurerm and google resources map to their constructs.
- Attributes - carried into constructors as properly typed arguments.
- Validation - errors on empty or unparseable input, and on unknown languages chosen.
- Output stats - shows resource and line counts after every conversion.
- Wrap toggle - wrap long generated lines for comfortable easy reading.
- Copy / Download / Print - export the generated stubs anywhere.
- Import lines - correct provider package imports per target language.
- Private - parsed in your browser only, always.
- Multi provider - mixes aws, azurerm and google in one file.
- Deterministic - same input yields the same stubs every run.
- Zero setup - no CDKTF install needed to preview the output.
How to Use
- Paste your .tf containing one or more resource blocks.
- Pick a target language from the dropdown: TypeScript, Python or Go.
- Click Convert to generate the CDKTF stubs directly from the parsed resources.
- Review the output and resolve any parse errors shown in the alert panel.
- Read the stats row to confirm how many resources and lines were produced.
- Use the Wrap button if the generated code is too wide to read on a narrow screen or mobile device.
- Copy, download or print the stubs and paste them into a CDKTF project.
- Refine by hand - add loops, conditionals and tests as needed to finish the migration into production.
Examples
Example - an aws_instance "web" becomes new aws.Instance(this, "web", { ami: "ami-123", instanceType: "t2.micro" }) in TypeScript, with the ami and instance_type attributes carried across as constructor arguments. In Python the same resource reads aws.Instance(self, "web", ami="ami-123", instance_type="t2.micro"), and in Go it becomes aws.NewInstance(stack, jsii.String("web"), &aws.InstanceConfig{ Ami: jsii.String("ami-123"), InstanceType: jsii.String("t2.micro") }). A mixed config with aws and azurerm yields the correct import lines for both provider packages, and the stats row reports the resource and line totals. The Go output uses jsii wrapped values exactly as the CDKTF Go bindings expect, so the generated file compiles once you add the module dependencies.
Benefits
- Fast migration - HCL to working code in seconds.
- Accurate - real parsing, no guessing of attributes.
- Portable - works with any provider source you can name.
- Private - browser only, nothing uploaded or transmitted.
- Comparable - switch languages to learn the idioms side by side quickly.
- Reusable - export a skeleton you keep refining into production code.