temporalio / helm-charts

Temporal Helm charts
MIT License
299 stars 329 forks source link

Can I use this helm package with the terraform provider? #355

Closed buckleyGI closed 3 months ago

buckleyGI commented 1 year ago

Hi,

I am using Terraform to install temporal

resource "helm_release" "temporal" { chart = "https://github.com/temporalio/helm-charts/archive/refs/tags/v1.19.1.tar.gz" name = "temporal-release" namespace = "temporal" create_namespace = true }

I think I am almost there. The above gives

Error: found in Chart.yaml, but missing in charts/ directory: cassandra, prometheus, elasticsearch, grafana

So I add

dependency_update = true

But now I am stuck with this error

Error: only unpacked charts can be updated

Does the Terraform helm provider support unpacking the tar.gz so it can install its dependencies? Or do I have to write Terraform that downloads, unpacks the tar.gz and then do the helm commands?

mostafahatem20 commented 1 year ago

@buckleyGI have you managed to get it working, if so please share your solution will be useful

buckleyGI commented 1 year ago

Hi @mostafahatem20

I have an open issue for this at https://github.com/hashicorp/terraform-provider-helm/issues/1043

mohamedazouz commented 1 year ago

@buckleyGI do you make it working with helm_release?

vishwa-trulioo commented 1 year ago

Well, Since Temporal doesn't publish an official helm chart, I tried it like this... It still produces and error.

variable "temporal_helm_chart_release" {
  default = "1.20.3"
}

resource "null_resource" "git_clone" {
  provisioner "local-exec" {
    command = <<EOT
      rm -rf helm-charts
      curl -o helm-charts.tar.gz -L https://github.com/temporalio/helm-charts/archive/refs/tags/v${var.temporal_helm_chart_release}.tar.gz
      tar -xf helm-charts.tar.gz
      rm *.gz
    EOT
  }
  triggers = {
    always_run = "${timestamp()}"
  }
}

resource "helm_release" "temporal" {
  name             = "temporal"
  chart            = "./helm-charts-${var.temporal_helm_chart_release}"
  namespace        = "temporal"
  create_namespace = true

  set {
    name  = "server.replicaCount"
    value = 1
  }
  set {
    name  = "cassandra.config.cluster_size"
    value = 1
  }
  set {
    name  = "prometheus.enabled"
    value = "false"
  }
  set {
    name  = "grafana.enabled="
    value = "false"
  }
  set {
    name  = "elasticsearch.enabled"
    value = "false"
  }
}

It ends up resulting this error.

@MVM tf % terraform apply -auto-approve
null_resource.git_clone: Refreshing state... [id=42779742339086823]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform planned the following actions, but then encountered a problem:

  # null_resource.git_clone must be replaced
-/+ resource "null_resource" "git_clone" {
      ~ id       = "42779742339086823" -> (known after apply)
      ~ triggers = { # forces replacement
          ~ "always_run" = "2023-05-19T16:58:42Z" -> (known after apply)
        }
    }

Plan: 1 to add, 0 to change, 1 to destroy.
╷
│ Error: found in Chart.yaml, but missing in charts/ directory: cassandra, prometheus, elasticsearch, grafana
│ 
│   with helm_release.temporal,
│   on helm.tf line 21, in resource "helm_release" "temporal":
│   21: resource "helm_release" "temporal" {

Here is a link I found which says what needs to be done to fix it. It is something to do with the chart structure itself. https://github.com/hashicorp/terraform-provider-helm/issues/735

expertonium commented 4 months ago

You can pull the release from here like this:


resource "helm_release" "temporal" {

  provider   = helm
  name       = "temporal"
  chart      = "https://github.com/temporalio/helm-charts/releases/download/temporal-0.36.0/temporal-0.36.0.tgz"

}
robholland commented 3 months ago

We publish packages to a helm repo: http://go.temporal.io/helm-charts. Please see if installing from that works, and re-open if not.