terraforminfrastructureterraform-provider-helm

How to update the helm release through terraform


helm ls
NAME    NAMESPACE   REVISION    UPDATED                 STATUS  CHART       APP VERSION
portworx    default     1       2022-08-25 06:01:24.991655337 +0000 UTC deployed 
    

Can someone help me in updating the above helm resources using terraform ?

resource "helm_release" "portworx" {
  chart         = "https://raw.githubusercontent.com/IBM/charts/master/repo/community/"
  name          = "portworx"
  reuse_values  = true
  dependency_update= true
  force_update  = true
  recreate_pods = false
  wait          = true
  max_history   = 1
}

I have written above code but instead of updating the chart it is trying to create again. Can someone please help me on this ?


Solution

  • To answer your question, that should be fairly easy to do, just use version argument [1] in the helm_resource:

    resource "helm_release" "portworx" {
      chart             = "https://raw.githubusercontent.com/IBM/charts/master/repo/community/"
      name              = "portworx"
      reuse_values      = true
      dependency_update = true
      force_update      = true
      recreate_pods     = false
      wait              = true
      max_history       = 1
      version           = "2.9.1"
    }
    

    [1] https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release#version