We have three services that we are trying to deploy to a k8s cluster with Terraform helm_release. Each service has something similar to
release.tf
resource "helm_release" "someService" {
count = var.deploy_apps ? 1 : 0
name = "someService"
version = "2.1.3"
namespace = "app"
timeout = 600
values = [yamlencode({
image = {
tag = var.terraform_version
}
envVars = {
k8env = local.environment
}
})]
}
variables.tf
variable "deploy_apps" {
type = bool
default = true
description = "deploy someService"
}
With the only difference being the service name. Each service is in its own Git repo, each repo has its own variables.tf
file which contains its own deploy_apps
variable, and they are all deployed to the same namespace.
When any of the services is deployed, it destroys the other two.
How can we prevent that from happening?