github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/indent.html.md (about)

     1  ---
     2  layout: "functions"
     3  page_title: "indent - Functions - Configuration Language"
     4  sidebar_current: "docs-funcs-string-indent"
     5  description: |-
     6    The indent function adds a number of spaces to the beginnings of all but the
     7    first line of a given multi-line string.
     8  ---
     9  
    10  # `indent` Function
    11  
    12  -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and
    13  earlier, see
    14  [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html).
    15  
    16  `indent` adds a given number of spaces to the beginnings of all but the first
    17  line in a given multi-line string.
    18  
    19  ```hcl
    20  indent(num_spaces, string)
    21  ```
    22  
    23  ## Examples
    24  
    25  This function is useful for inserting a multi-line string into an
    26  already-indented context in another string:
    27  
    28  ```
    29  > "  items: %{indent(2, "[\n  foo,\n  bar,\n]\n")}"
    30    items: [
    31      foo,
    32      bar,
    33    ]
    34  ```
    35  
    36  The first line of the string is not indented so that, as above, it can be
    37  placed after an introduction sequence that has already begun the line.