【发布时间】:2019-12-13 22:09:04
【问题描述】:
我正在将 Terraform 与 Kubernetes Provider 一起使用。 现在,在创建 ConfigMap 时,我希望它们的名称具有内容后缀。 通常是内容的哈希。
这样,它应该在使用时强制执行部署。
所以我希望它的工作方式类似于:
resource "kubernetes_config_map" "prometheus_config" {
metadata {
name = "prometheus-" + computeHash(file("${path.module}/alerts.yml"), file("${path.module}/recordings.yml"), "abcd")
}
data = {
"foo" = file("${path.module}/alerts.yml")
"bar" = file("${path.module}/recordings.yml")
"txt" = "abcd"
}
}
有没有办法实现像computeHash 这样的自定义函数?
或者以其他方式实现这一目标?
【问题讨论】:
标签: kubernetes terraform terraform-provider-kubernetes