Loading Bicep to Terraform Converter...

How to Convert Bicep to Terraform - Step by Step Guide

Step 1

Paste Your Bicep Code

Copy your Azure Bicep code into the left editor. The converter reads params, vars, resources, modules and outputs, including nested child resources, decorators and multi-line strings.

•
Paste directly: Copy your Bicep code and paste it into the input editor
•
Upload a file: Click Upload to open a .bicep file
•
Try the sample: Click Sample to load a small storage account template
Step 2

Review the Terraform HCL Output

Known Bicep resource types are written as Terraform azurerm provider resources. Params become variables, vars become locals and outputs stay outputs. The # Note lines at the top of the output list anything that was skipped or kept as quoted text.

•
Resource mapping: Microsoft.Storage/storageAccounts becomes azurerm_storage_account; existing resources become data blocks
•
Parameters: @secure() adds sensitive = true, and @allowed or @minValue become validation blocks
•
Loops and conditions: if (...) becomes count = cond ? 1 : 0, and [for ...] becomes count = length(list)
Step 3

Download or Copy Terraform Configuration

Export the Terraform HCL. It starts with the azurerm provider blocks and is meant as a first draft: property names are copied in snake_case and still need to be checked against the azurerm arguments.

•
Copy to clipboard: Paste the code straight into your project
•
Download as file: Save it as main.tf
•
Errors: A Bicep syntax mistake shows the line and column instead of output
Step 4

Initialize and Plan with Terraform

Run Terraform CLI commands against your Azure subscription. If you have an ARM template instead of a Bicep file, the ARM to Terraform converter takes the JSON directly.

•
Initialize: Run terraform init to download the provider
•
Check: Run terraform validate and terraform plan to see what still needs fixing
•
Apply: Run terraform apply only after you have reviewed the plan

Frequently Asked Questions

What does the converter turn into Terraform?

Each param becomes a variable block with its type, default and description; @secure() adds sensitive = true, and @allowed, @minValue, @maxValue, @minLength and @maxLength become validation blocks. Each var goes into a locals block, outputs become output blocks, and modules become module blocks that point at the same path without the .bicep ending. Resources of a known Azure type become azurerm resource blocks, and resources marked existing become data blocks.

Which Azure resource types are mapped?

A fixed list of about 35 common types, such as storage accounts and blob containers, virtual networks and subnets, network interfaces, public IPs, network security groups, virtual machines, App Service plans and sites, SQL servers and databases, Key Vault and its secrets, AKS, container registries, Application Insights, Log Analytics, managed identities, role assignments and resource groups. A resource of any other type is skipped, and a note at the top of the output names it so nothing disappears quietly.

Are the resource properties renamed to the azurerm arguments?

No. Keys inside properties, plus sku, kind and other top-level keys, are copied into the block with their names in snake_case, so addressSpace becomes address_space. The azurerm provider often uses different names and nested blocks, and most resources also need resource_group_name, so treat the output as a first draft and let terraform validate tell you what to rename.

How are expressions, loops and conditions handled?

References to params, vars, resources and module outputs become var.x, local.x, azurerm_x.name and module.x references, and string interpolation like '${prefix}-plan' becomes "${local.prefix}-plan". A resource behind if (cond) gets count = cond ? 1 : 0, and a [for x in list: {...}] resource gets count = length(list) with the loop item read from the list. dependsOn and parent become depends_on. A few functions (toLower, concat, format, json, split, join, empty and similar) are translated; anything else, such as uniqueString() or lambdas, is kept as quoted text and listed in a note.

Will long IDs, prices or quoted text change?

No. Numbers are written with the digits you typed, so 8901240544102066246 comes out exactly the same, json('14.50') becomes 14.50, and '00501' stays a string. Quotes, backslashes and line breaks are escaped for HCL, and a literal ${ or %{ is written as $${ or %%{ so Terraform does not try to fill it in.

What if my Bicep file has a mistake?

The converter reads the file properly, so an unclosed brace or string, a double-quoted string or a stray word gives a message with the line and column instead of half-converted output. If you paste an ARM template (JSON) or Terraform code by mistake, it tells you that too.

Is my Bicep file 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 applying the result, run terraform init, terraform validate and terraform plan, and use terraform import for resources that already exist in Azure.