JSON to Terraform HCL

Convert JSON configuration objects to Terraform HCL format. Generate locals blocks, variable definitions, and resource configurations.

Input JSON
Terraform HCL

Features

🏗️ Three Output Modes

  • Raw HCL key = value assignments
  • Wrapped in a locals block
  • Individual variable blocks
  • Automatic mode switching

📐 Aligned Formatting

  • Optional = sign alignment
  • Consistent indentation
  • Proper HCL block syntax
  • Nested object support

Type Handling

  • Strings double-quoted
  • Numbers and booleans raw
  • Arrays of primitives inline
  • Nested objects as HCL blocks

Terraform HCL Guide

HCL Syntax Basics

HCL (HashiCorp Configuration Language) uses unquoted keys and = for assignments. Objects become blocks with braces, and primitive arrays use square bracket syntax.

resource_group = "myapp-prod"
location       = "eastus"
vm_size        = "Standard_D2s_v3"

tags = {
  env  = "production"
  team = "platform"
}