Convert HCL to YAML
Turn HCL files into YAML. Blocks nest by type and label as in the JSON form of HCL, and repeated blocks without labels become a list.
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 YAML.Blocks become nested keys, and the comments are left behind.
What you get
One YAML file built from your HCL. Blocks nest by type and label, the same way they do in the JSON form of HCL. A block of type resource with two labels becomes a key inside a key inside a key.
Repeated blocks that have no labels become a list.
What changes
Expressions are written as text. References, function calls and type names come out as
${...}strings, so they are kept as written but are no longer live expressions. An escaped${loses its escape and reads as${in the output.Comments are dropped. YAML output from this conversion does not carry any of the notes you wrote in the HCL file.
When it fails
If the file cannot be parsed, the conversion stops with
input_corrupted. The HCL has to be readable as HCL before it can become YAML.To go the other way, use YAML to HCL.
HCL and YAML.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
YAML
YAML configuration and data files.
- Extensions
- .yaml .yml
- MIME type
- application
/yaml - Kind
- Text and data
In your code.The same HCL to YAML conversion through the API, for your app or your agent.
$ cv convert report.hcl report.yaml$ cv convert report.hcl report.yamlQuestions.What people ask about HCL to YAML.
Files in HCL, such as those with the extensions hcl, tf or tfvars. The result is one YAML file.
No. Comments are dropped, and only the data and its structure are written to the YAML.
They become ${...} text in the YAML. The expression is kept as a string, not evaluated.
The file could not be parsed as HCL. The conversion stops with input_corrupted in that case.