我的Terraform语法是:
buyers(data) {
return new Promise(function (resolve, reject) {
this.$axios.get(`/buyers?${data}`)
.then(response => {
resolve(response.data)
})
.catch(error => {
reject(error.response.data)
})
})
}
在输出中,我得到:
resource "null_resource" "pkt_ip_list_check" {
count = "${var.num_nodes}"
triggers {
incorrect_node_pkt_ip_list = "${(var.num_media_ip != 1 && var.num_media_ip == length(var.node_pkt_private_ips_map[count.index+1]) || var.num_media_ip == 1) == true ? 0 : 1}"
}
}
locals {
incorrect_pkt_ip_list = "${null_resource.pkt_ip_list_check.*.triggers.incorrect_node_pkt_ip_list}"
#incorrect_pkt_ip_list = ["0","0"]
real_val = "${null_resource.pkt_ip_list_check.*.triggers.incorrect_node_pkt_ip_list}"
}
output "incorrect_pkt_ip_list" {
value = "${local.incorrect_pkt_ip_list}"
}
output "real_val" {
value = "${local.real_val}"
}
/*
resource "null_resource" "check_pkt" {
count= "${contains(local.incorrect_pkt_ip_list, "1") ? 1 : 0}"
"ERROR: node_pkt_private_ips_map values should correspond to num_media_ip value. Invalid number of Pkt Ips given." = true
}
*/
如果我取消对断言“ check_pkt”的评论,那么我就会出错
Outputs:
incorrect_pkt_ip_list = [
0,
0
]
real_val = [
0,
0
]
如果我提供了预定义的列表:
Error: null_resource.check_pkt: : invalid or unknown key: ERROR: node_pkt_private_ips_map values should correspond to num_media_ip value. Invalid number of Pkt Ips given.
然后我的断言似乎有效,但是计算出的值也相同。不应该。
此外,即使我将断言修改为:
incorrect_pkt_ip_list = ["0","0"]
我仍然会收到错误,但是无论哪种情况,计数都应该为0,对吗?我想念什么吗?