Convert ENV to HCL

Turn ENV files into HCL. Each KEY=value line becomes a key in file order; export prefixes, quotes, escapes and trailing comments are handled, and unquoted numbers and booleans are typed.

Converted in an isolated sandbox on our serversDeleted after 24 hours

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

Dotenv lines as HCL attributes.Each KEY=value line becomes an attribute in the same order as the file.

  1. What you get

    One HCL file. Each line of the ENV file becomes a key, in file order. Export prefixes, quotes, escapes and trailing comments are handled.

    Unquoted numbers and booleans are typed, so they are written as numbers and booleans, not as text.

  2. How values are treated

    A key with no value becomes null, and null stays null in the HCL. A repeated key becomes a list.

    References such as ${VAR} stay as written. They are not looked up or filled in.

  3. How the HCL is written

    The output is written as HCL attributes. Keys at the top level must be identifiers. A top-level list becomes the attribute items, and nested keys are quoted.

    To go the other way, use HCL to ENV.

ENV and HCL.What each format is.

The formats

From · ENV

Dotenv

KEY=value lines that hold environment variables for an app.

Extensions
.env
MIME type
text/x-env
Kind
Text and data
To · 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

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

terminal
$ cv convert report.env report.hcl
$ cv convert report.env report.hcl

Questions.What people ask about ENV to HCL.

01OF 04

Yes. Each key follows the order of the lines in the ENV file.

It becomes null, and it stays null in the HCL.

The repeated key becomes a list.

No. They stay as written.

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