Convert HCL to BSON

Turn HCL files into BSON. One BSON document with the same keys in order; a top-level list is wrapped under the key items and any other value under value.

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 one BSON document.Keys keep their order, and types such as integers and booleans carry over.

  1. What you get

    One BSON document with the same keys in the same order as the HCL file. Integers, floats, booleans, null, text, nested objects and lists keep their types.

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

  2. How values are wrapped

    BSON needs a document at the top. If the file's top level is a list, it is wrapped under the key items. Any other single value is wrapped under the key value.

  3. What changes

    Dates stay text, so they are not turned into BSON dates. Integers beyond the signed 64-bit range become floats.

    To go the other way, use BSON to HCL.

HCL and BSON.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 · BSON

BSON

MongoDB's binary document encoding, JSON with dates and binary fields.

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

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

terminal
$ cv convert report.hcl report.bson
$ cv convert report.hcl report.bson

Questions.What people ask about HCL to BSON.

01OF 04

Yes. The document has the same keys in the same order as the HCL file.

They become text in the form ${...}. They are not evaluated.

No. Dates stay text.

Integers beyond the signed 64-bit range become floats.

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