DevTools Surf logoDevTools Surf
AI / Modern DevAnimation / CSSAPI / Config
Sign in
DevTools Surf logoDevTools Surf
AI / Modern DevAnimation / CSSAPI / Config
Sign in
HomeConvertersHCL (Terraform) ↔ JSON

About HCL (Terraform) ↔ JSON

HCL (Terraform) ↔ JSON preview - Converters tool

Convert between HCL/Terraform config and JSON. Part of the DevTools Surf developer suite. Browse more tools in the Converters collection.

Use Cases

  • DevOps engineers generating Terraform configs programmatically
  • Platform teams validating infrastructure-as-code changes in CI
  • Cloud architects comparing Terraform modules across environments
  • Automation scripts that need to read and modify Terraform state

Tips

  • Validate Terraform blocks as JSON for programmatic editing
  • Use JSON output to compare Terraform configs across envs
  • Convert JSON back to HCL for human-readable pull requests

Fun Facts

  • HCL (HashiCorp Configuration Language) was created by Mitchell Hashimoto in 2014 specifically for HashiCorp tools — it combines the readability of YAML with the precision of JSON.
  • Terraform supports both HCL (.tf) and JSON (.tf.json) natively, making bidirectional conversion a built-in design feature of the language.
  • HCL2, released with Terraform 0.12 in 2019, added first-class expressions and for-each loops, making it a near-programming language rather than just a config format.

FAQ

What is HCL?
HashiCorp Configuration Language — the syntax Terraform, Packer, and Vault use for configuration. HCL2 supports expressions and type definitions.
Does it execute expressions?
No — the tool is a syntactic converter. `${var.name}` is preserved as a string literal. To resolve expressions, Terraform plan/validate is the right path.
What about heredoc strings?
Preserved as multi-line JSON strings. The HCL form `<<EOF ... EOF` becomes a `\n`-separated string in JSON.
Can I convert back?
Yes — JSON is a valid Terraform input format. The generated HCL style is clean but may differ in whitespace from hand-written HCL.

Related Converters Tools

JSON to XMLJSON to CSVJSON to YAMLJSON to TSVJSON to StringXML to JSONXML to CSVXML to String
New · Flagshipsimple REST client

REST Handler — Collections, env vars, history, cURL converter

Send requests, save collections (nested), swap environments, and convert between cURL / Collection JSON / REST Handler YAML.

Open

Popular tools

The most-used tools on DevToolsSurf, one click away.

Encoding & crypto

  • Base64 Encode
  • Base64 Decode
  • URL Encoder
  • URL Decoder
  • Hash Generator
  • JWT Decoder
  • JWT Encoder
  • UUID Generator
  • ULID Generator
  • Password Generator
  • Bcrypt Hash Tester

Converters

  • CSV to JSON
  • JSON to CSV
  • XML to JSON
  • JSON to XML
  • HTML → Markdown
  • HTML → React JSX
  • cURL to Code
  • Collection JSON → cURL
  • Swagger to Collection JSON
  • JSON → Go Struct
  • JSON → TypeScript Types

JSON & YAML

  • JSON Formatter
  • JSON Validator
  • JSON Viewer
  • JSON Minifier
  • JSON Diff
  • JSONPath Tester
  • YAML Formatter
  • YAML to JSON
  • JSON to YAML

Text & regex

  • Regex Tester
  • Text Diff
  • Case Converter
  • Word Counter
  • Markdown Preview
  • Slug Generator
  • Lorem Ipsum Generator
  • Markdown → PDF

CSS & color

  • CSS Beautifier
  • Minify CSS
  • Color Converter
  • Gradient Generator
  • Contrast Checker
  • Color Palette Generator
  • Flexbox Playground
  • Tailwind → CSS

Generators

  • QR Code Generator
  • Mock Data Generator
  • Favicon Generator
  • .gitignore Builder
  • README.md Generator
  • Dockerfile Generator
  • Sitemap Generator

API & networking

  • REST Handler
  • HTTP Header Analyzer
  • IP Address Lookup
  • CIDR Calculator
  • User-Agent Parser
  • HTTP Status Reference
  • OpenAPI Viewer

Date & time

  • Timestamp Converter
  • Timezone Converter
  • Cron Expression Parser
  • Duration Calculator
  • Age Calculator
  • Date Format Converter

Images

  • Image Converter
  • Image Resizer (Batch)
  • SVG Optimizer
  • Base64 ↔ Image
  • WebP ↔ AVIF Converter
  • Image Compressor

PDF tools

  • PDF Merger
  • PDF Splitter
  • PDF Compressor
  • Markdown → PDF
  • EPUB → PDF
  • MOBI / AZW → PDF
  • DOCX → PDF
  • HTML → PDF

Resources

  • Community feed
  • Themes marketplace
  • Pricing & credits
  • Privacy policy
  • Terms of service
  • Sitemap
  • robots.txt

Your account

  • Sign in
  • Dashboard
  • Run history
  • My profile
  • Settings
DevTools Surf logo
DevTools Surf919+ tools

Fast · privacy-first · client-side · © 2026

Home·Feed·ThemesPricing·Sign inPrivacy·Sitemap Feedback