I am using terraform with helm provider to deploy a helm chart, everything works with terraform, the problem is when the application is already running and I changed the image tag from the gitlab pipeline.
So the next time that I run terraform the image tag deployed from gitlab will be change to the previous one.
I tried to use lifecycle, this is my terraform code:
resource "helm_release" "app1" {
name = "app1"
namespace = "money"
chart = "stable/perl"
set {
name = "image.repository"
value = "docker.registry.local/app1-api"
}
set {
name = "replicaCount"
value = "2"
}
set {
name = "image.tag"
value = "1.0.1"
}
set {
name = "image.pullPolicy"
value = "Always"
}
set {
name = "service.type"
value = "ClusterIP"
}
lifecycle {
ignore_changes = [for s in set : s.name if s.name == "image.tag"]
}
}
terraform apply:
A static list expression is required.