Terraform 参数列表解包

Terraform 参数列表解包,terraform,Terraform,我当前正在尝试检索列表中包含的最大值,但是max()内置函数接受可变数量的浮点值,而不是单个列表 variable "my_list" { default = [1, 2] } output map_out { value = "${max(var.my_list)}" } Error: output.map_out: At column 3, line 1: max: argument 1 should be type float, got type list in: 有

我当前正在尝试检索列表中包含的最大值,但是
max()
内置函数接受可变数量的浮点值,而不是单个列表

variable "my_list" {
    default = [1, 2]
}

output map_out {
    value = "${max(var.my_list)}"
}

Error: output.map_out: At column 3, line 1: max: argument 1 should be type float, got type list in:
有办法做到这一点吗? 我想我需要一些类似于Python中的参数列表解包的东西,但我不知道如何在Terraform中做到这一点。

函数“map”不接受列表,它只接受单个浮点数

因此,只有这种格式才能起作用

输出映射输出{
value=“${max(var.my_列表[0],var.my_列表[1])”
}