Convert HCL to XML
Turn HCL files into XML. Objects become elements inside one root element and every value becomes text, with characters a tag name cannot hold turned into underscores.
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 config as an XML document.Blocks become nested elements inside one root element.
What you get
One XML file. The whole HCL file sits inside a single root element, and objects become elements within it.
Blocks nest by type and label, so a resource block ends up as elements named for its type and its label. Expressions are written as
${...}text.How values are written
Every value becomes text. Characters that a tag name cannot hold are turned into underscores, so a key with such a character gets a changed element name.
Keys starting with @ become attributes. Lists and objects set as attributes are written as JSON text. A key named #text becomes the element's own text.
What changes with lists
A list repeats its element, once per item. An empty list therefore disappears from the output, and a list of lists is flattened into one run of repeated elements.
To go the other way, use XML to HCL.
HCL and XML.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
XML
XML documents and data.
- Extensions
- .xml
- MIME type
- application
/xml - Kind
- Text and data
In your code.The same HCL to XML conversion through the API, for your app or your agent.
$ cv convert report.hcl report.xml$ cv convert report.hcl report.xmlQuestions.What people ask about HCL to XML.
Yes. HCL files with the extensions hcl, tf and tfvars are all read as HCL.
No. Every value becomes text in the XML.
It disappears. A list repeats its element once per item, so an empty list leaves no element.
As ${...} text inside the element.