All Products
Search
Document Center

Resource Orchestration Service:Fn::Indent

Last Updated:Mar 28, 2024

The built-in function Fn::Indent adjusts the indentation format of a string.

Declaration

  • JSON

    {
      "Fn::Indent": [
        "String",
        "Level",
        "Size"
      ]
     }
  • YAML

    Fn::Indent:
      - String
      - Level
      - Size

Parameters

  • String: the string whose indentation format you want to adjust.

  • Level: the indentation level. Valid values: 0 to 20.

  • Size: the indentation size. This parameter is optional. Valid values: 0 to 4. Default value: 2. A value of 2 indicates that the content at each level is indented by two spaces.

Return value

The string whose indentation format is adjusted.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  p1:
    Default: |-
      [client]
      port=3306
      password=123
    Type: String
Outputs:
  result:
    Value:
      'Fn::Sub':
        - |
          data:
          ${p1}
        - p1:
            'Fn::Indent':
              - Ref: p1
              - 1

Result before the format is adjusted

data:
[client]
port=3306
password=123

Result after the format is adjusted

data:
  [client]
  port=3306
  password=123

Supported functions

Ref