【发布时间】:2020-07-31 00:33:16
【问题描述】:
我正在尝试在 Go 中表示 objects 的 Terraform 列表,即
variable "map_roles" {
description = "Additional IAM roles to add to the aws-auth configmap."
type = list(object({
rolearn = string
username = string
groups = list(string)
}))
是rolearn 和其他基本类型还是复合类型,例如一张地图?那么 map_roles 只是一个字符串结构和字符串切片(列表),还是一个映射结构?
【问题讨论】:
-
这不是 Go 语法,你到底在做什么?
-
这是 terraform 语法。我试图在 Go 中表达这一点
-
这取决于您使用的抽象级别。你能提供一个你想写的例子吗?
-
我正在使用 terratest (github.com/gruntwork-io/terratest) 来测试 terraform 模块(eks 集群)。我需要提供的 input_variables 之一是
map_roles -
知道 terratest 的人可能会插话,但我猜它只是使用
[]interface{}和map[string]interface{}的组合来保存变量数据。