Convert HCL to TOML

Turn HCL files into TOML. The same keys and values as TOML, with plain values written before tables, and a top-level list is written under the key items, as [[items]] tables when its entries are objects.

Converted in an isolated sandbox on our serversDeleted after 24 hours

Drop HCL files on the dialor turn it to pick what to do

Terraform settings as TOML.The same keys and values, written as one TOML file.

  1. What you get

    A TOML file with the same keys and values as the HCL file. Plain values are written before tables, as TOML expects.

    Blocks nest by type and label. Expressions become ${...} text.

  2. Lists at the top level

    A top-level list is written under the key items. When its entries are objects, they come out as [[items]] tables.

  3. What fails or is dropped

    A null in an object is dropped with a warning. TOML has no null, so the key does not appear in the output.

    A null inside a list fails the conversion, because TOML cannot hold it. An integer beyond the signed 64-bit range fails for the same reason.

    A file that cannot be parsed stops with input_corrupted.

HCL and TOML.What each format is.

The formats

From · HCL

HCL

HashiCorp Configuration Language, what Terraform and Packer files are written in.

Extensions
.hcl .tf .tfvars
MIME type
application/x-hcl
Kind
Text and data
To · TOML

TOML

TOML configuration files, the format of Cargo and pyproject.

Extensions
.toml
MIME type
application/toml
Kind
Text and data

In your code.The same HCL to TOML conversion through the API, for your app or your agent.

terminal
$ cv convert report.hcl report.toml
$ cv convert report.hcl report.toml

Questions.What people ask about HCL to TOML.

01OF 04

Yes. The output has the same keys and values as the HCL file, written as TOML.

They become ${...} text in the TOML file.

The file could not be parsed as HCL. The conversion stops there.

Yes. TOML to HCL goes the other way.

More conversions.Other ways in and out of HCL and TOML.