github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/string/indent.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: indent - Functions - Configuration Language
     4  description: |-
     5    The indent function adds a number of spaces to the beginnings of all but the
     6    first line of a given multi-line string.
     7  ---
     8  
     9  # `indent` Function
    10  
    11  `indent` adds a given number of spaces to the beginnings of all but the first
    12  line in a given multi-line string.
    13  
    14  ```hcl
    15  indent(num_spaces, string)
    16  ```
    17  
    18  ## Examples
    19  
    20  This function is useful for inserting a multi-line string into an
    21  already-indented context in another string:
    22  
    23  ```shell-session
    24  > "  items: %{indent(2, "[\n  foo,\n  bar,\n]\n")}"
    25    items: [
    26      foo,
    27      bar,
    28    ]
    29  ```
    30  
    31  The first line of the string is not indented so that, as above, it can be
    32  placed after an introduction sequence that has already begun the line.