admin管理员组文章数量:1186702
I have a helm chart that i am trying to deploy with terraform. I have a requirement where i need to pass a condition in the values like i need to pass annotation ["test=foo"] for us-east-1 region and ["test=bar","test=foo"] for us-east-2 region. My main.tf looks like below
resource "helm_release" "chart_name" {
name = "resource-name"
chart = "${path.module}"
namespace = "namespcae_name"
values = [
{
flag = var.region == "us-east-1" ? ["test=foo"] : ["test=foo","test=bar"]
}
]
but i am getting an error Error: Invalid expression
I have a helm chart that i am trying to deploy with terraform. I have a requirement where i need to pass a condition in the values like i need to pass annotation ["test=foo"] for us-east-1 region and ["test=bar","test=foo"] for us-east-2 region. My main.tf looks like below
resource "helm_release" "chart_name" {
name = "resource-name"
chart = "${path.module}"
namespace = "namespcae_name"
values = [
{
flag = var.region == "us-east-1" ? ["test=foo"] : ["test=foo","test=bar"]
}
]
but i am getting an error Error: Invalid expression
Share Improve this question asked Jan 26 at 13:54 AbhinavAbhinav 811 silver badge11 bronze badges 1 |1 Answer
Reset to default 1The values
parameter should be a list(string)
type, and not a list(map(string))
type. You need to modify the value to a list(string)
where each string
is in "raw YAML format" (most easily accomplished with yamlencode
function to encode from HCL2):
values = [yamlencode({flag = var.region == "us-east-1" ? ["test=foo"] : ["test=foo","test=bar"]})]
本文标签: kubernetes helmPass conditions in valuesyaml through terraformStack Overflow
版权声明:本文标题:kubernetes helm - Pass conditions in values.yaml through terraform - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738313572a2074172.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
values = [flag = var.region == "us-east-1" ? ["test=foo"] : ["test=foo", "test=bar"] ]
. Not sure if that would work though, but it might be worth a try. – Marko E Commented Jan 27 at 11:27