github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/types/hcl.md (about) 1 # `hcl` 2 3 > HashiCorp Configuration Language (HCL) 4 5 ## Description 6 7 The description below is taken from the HCL git repository's [README](https://github.com/hashicorp/hcl): 8 9 > HCL (HashiCorp Configuration Language) is a configuration language built by 10 > HashiCorp. The goal of HCL is to build a structured configuration language 11 > that is both human and machine friendly for use with command-line tools, but 12 > specifically targeted towards DevOps tools, servers, etc. 13 > 14 > HCL is also fully JSON compatible. That is, JSON can be used as completely 15 > valid input to a system expecting HCL. This helps makes systems interoperable 16 > with other systems. 17 18 HCL support within Murex is pretty mature however it is not considered a 19 primitive. Which means, while it is a recommended builtin which you should 20 expect in most deployments of Murex, it's still an optional package and 21 thus may not be present in some edge cases. This is because it relies on 22 external source packages for the shell to compile. 23 24 ## Examples 25 26 ``` 27 terraform { 28 required_version = "~> 0.11.5" 29 } 30 31 data "aws_availability_zones" "available" {} 32 33 data "aws_vpc" "vpc" { 34 id = "${var.vpc_id}" 35 } 36 37 data "aws_route53_zone" "external" { 38 zone_id = "${var.external_hosted_zone_id}" 39 } 40 41 data "aws_iam_policy_document" "assume_role_policy" { 42 statement { 43 actions = ["sts:AssumeRole"] 44 effect = "Allow" 45 46 principals { 47 identifiers = ["ec2.amazonaws.com"] 48 type = "Service" 49 } 50 } 51 } 52 ``` 53 54 See the HashiCorp's [documentation](https://github.com/hashicorp/hcl) for HCL syntax. 55 56 ## Default Associations 57 58 * **Extension**: `hcl` 59 * **Extension**: `tf` 60 * **Extension**: `tfvars` 61 * **MIME**: `application/hcl` 62 * **MIME**: `application/x-hcl` 63 * **MIME**: `text/hcl` 64 * **MIME**: `text/x-hcl` 65 66 67 ## Supported Hooks 68 69 * `Marshal()` 70 Supported via a JSON marshaller because HCL is designed to be written by humans but "compiled" into JSON 71 * `ReadArray()` 72 Works with HCL arrays. Maps are converted into arrays 73 * `ReadArrayWithType()` 74 Works with HCL arrays. Maps are converted into arrays. Elements data-type in Murex mirrors the HCL type of the element 75 * `ReadIndex()` 76 Works against all properties in HCL 77 * `ReadMap()` 78 Works with HCL maps 79 * `ReadNotIndex()` 80 Works against all properties in HCL 81 * `Unmarshal()` 82 Supported 83 * `WriteArray()` 84 Works with HCL arrays 85 86 ## See Also 87 88 * [`[[ Element ]]`](../parser/element.md): 89 Outputs an element from a nested structure 90 * [`cast`](../commands/cast.md): 91 Alters the data type of the previous function without altering it's output 92 * [`format`](../commands/format.md): 93 Reformat one data-type into another data-type 94 * [`json`](../types/json.md): 95 JavaScript Object Notation (JSON) 96 * [`jsonl`](../types/jsonl.md): 97 JSON Lines 98 * [`open`](../commands/open.md): 99 Open a file with a preferred handler 100 * [`pretty`](../commands/pretty.md): 101 Prettifies JSON to make it human readable 102 * [`runtime`](../commands/runtime.md): 103 Returns runtime information on the internal state of Murex 104 * [`yaml`](../types/yaml.md): 105 YAML Ain't Markup Language (YAML) 106 * [index](../parser/item-index.md): 107 Outputs an element from an array, map or table 108 * [mxjson](../types/mxjson.md): 109 Murex-flavoured JSON (deprecated) 110 111 ### Read more about type hooks 112 113 - [`ReadIndex()` (type)](../apis/ReadIndex.md): Data type handler for the index, `[`, builtin 114 - [`ReadNotIndex()` (type)](../apis/ReadNotIndex.md): Data type handler for the bang-prefixed index, `: Read from a data type one array element at a time 116 - [`WriteArray()` (type)](../apis/WriteArray.md): Write a data type, one array element at a time 117 - [`ReadMap()` (type)](../apis/ReadMap.md): Treat data type as a key/value structure and read its contents 118 - [`Marshal()` (type)](../apis/Marshal.md): Converts structured memory into a structured file format (eg for stdio) 119 - [`Unmarshal()` (type)](../apis/Unmarshal.md): Converts a structured file format into structured memory 120 121 <hr/> 122 123 This document was generated from [builtins/types/hcl/hcl_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/types/hcl/hcl_doc.yaml).