I am using Terraform with Kubernetes Provider. Now when creating ConfigMaps, I want their names to have a content suffix. Usually it is a hash of the content.
This way, it should enforce a Deployment, where used.
So I would like it to work similar to:
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"
}
}
Is there any way of implementing a custom function like computeHash
?
Or to achieve this another way?