如何在 terraform 0.12 中解析这种数据类型
variable "groups" {
type = list(object({
group_id = string
permissions = list(string)
}))
}
例子:
groups = [
{
group_id = "gcp-org-admin"
permissions = [ "roles/resourcemanager.organizationAdmin",
"roles/resourcemanager.folderViewer",
"roles/viewer",
"roles/iam.organizationRoleViewer",
"roles/orgpolicy.policyViewer"
]
},
{
group_id = "gcp-security-ops"
permissions = [ "roles/resourcemanager.folderViewer",
"roles/logging.viewer",
"roles/monitoring.editor",
"roles/iam.securityReviewer"
]
}]
对于每个组,我想将 group_id 和每个权限配对
{
group_id = "gcp-org-admin"
permissions = "roles/resourcemanager.organizationAdmin"
},
{
group_id = "gcp-org-admin"
permissions = "roles/resourcemanager.folderViewer"
},
{
group_id = "gcp-org-admin"
permissions = "roles/viewer"
}
想创建 organization_iam_resource
对于每个 group_id 中的每个权限,我必须创建一个资源。
有什么办法可以做到这一点