我有一个自定义 terraform 提供程序,其资源将列表作为其输入之一。
当我声明列表时,它需要设置为多个块,如下所示:
active_service_policies {
policies {
name = "foobar"
namespace = "shared"
}
policies {
name = "batz"
namespace = "shared"
}
}
相反,我希望能够像下面这样声明它:
active_service_policies {
policies = [
{
name = "foobar"
namespace = "shared"
},
{
name = "batz"
namespace = "shared"
}
]
}
这会导致以下错误:
Error: Unsupported argument
on main.tf line 79, in resource "volterra_http_loadbalancer" "sp":
79: policies = [
An argument named "policies" is not expected here. Did you mean to define a block
of type "policies"?
为什么我不能使用有序列表,如何允许使用它?
这个问题policies
是因为它Type: schema.TypeList,
应该是一个TypeSet
还是其他一些对象?