【发布时间】:2020-03-19 09:54:40
【问题描述】:
我声明我的列表类型变量如下
variable service_account_email {
description = "The email of the service account for the instance template."
default = "default"
}
variable service_account_scopes {
description = "List of scopes for the instance template service account"
type = "list"
default = [
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring.write",
"https://www.googleapis.com/auth/devstorage.full_control",
]
}
但在尝试使用如下变量时,出现如下错误:
service_account {
email = "${var.service_account_email}"
scopes = ["${var.service_account_scopes}"]
}
错误:属性值类型不正确
在 pure_testing\main.tf 第 22 行,在资源中 “google_compute_instance”“默认”:22:范围 = ["${var.service_account_scopes}"]
属性“范围”的值不合适:元素 0:字符串 必填。
如果我做错了,请你帮我澄清一下 terraform 中列表变量的概念。
提前致谢。
【问题讨论】:
标签: terraform terraform-provider-gcp