Convert HCL to ENV
Turn HCL files into Dotenv. Each top-level key becomes a KEY=value line, with characters a variable name cannot hold turned into underscores, and a top-level list numbers its entries from 0 under items, so the name of the first entry becomes items_0_name.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop HCL files on the dialor turn it to pick what to do
HCL settings as KEY=value lines.Each top-level key becomes one line in a single ENV file.
What you get
One Dotenv file with a KEY=value line for each top-level key in the HCL. Characters that a variable name cannot hold are turned into underscores.
Text with spaces or symbols is double-quoted, with escapes. A null value leaves the part after the equals sign empty.
How structure is flattened
A dotenv file has no nesting, so nested objects and lists become quoted JSON text on a single line. Blocks nest by type and label, and expressions become ${...} text.
A top-level list numbers its entries from 0 under items. The name of the first entry becomes items_0_name.
Going the other way
To turn KEY=value lines back into HCL, use ENV to HCL. Other targets for HCL are listed under every HCL conversion.
HCL and ENV.What each format is.
The formats
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
Dotenv
KEY=value lines that hold environment variables for an app.
- Extensions
- .env
- MIME type
- text
/x -env - Kind
- Text and data
In your code.The same HCL to ENV conversion through the API, for your app or your agent.
$ cv convert report.hcl report.env$ cv convert report.hcl report.envQuestions.What people ask about HCL to ENV.
Characters a variable name cannot hold are turned into underscores.
They become quoted JSON text in the value of one line.
Its entries are numbered from 0 under items, so the name of the first entry becomes items_0_name.
The line is written with an empty value.