Standard Library List Functions

function

index

index gets the entry from a list at the specified index.

Inputs

  • Name
    list
    Required
    optional
    Type
    array[string] | array[integer] | array[buffer]
    Description

    The list to retrieve an entry from.

  • Name
    index
    Required
    optional
    Type
    integer
    Description

    The index of the entry to retrieve.

Output

  • Name
    value
    Type
    string
    Description

    The entry from list at the specified index

Example using index

output "entry" { 
    value = index(['a', 'b', 'c'], 1)
}
> entry: b


Was this page helpful?