'Terraform fail to download existing bitnami chart

I am planning to setup jenkins pipeline on K8S using terraform to provising my CI/CD environment.

I am using Terraform v0.12.18

My terraform file has following resource

resource "helm_release" "jenkins-master" {
  name = "jenkins"
  chart = "jenkins"
  version = "7.0.3"
  repository = "https://charts.bitnami.com/bitnami"


  set {
    name = "jenkinsUser"
    value = "admin"
  }
  set {
    name = "jenkinsPassword"
    value = "admin"
  }
}

When I ran terraform apply -input=false provision-plan

I am getting following error.

Error: failed to download "https://charts.bitnami.com/bitnami/jenkins-7.0.3.tgz" (hint: running `helm repo update` may help)

But when I ran direct helm install using

helm install my-jenkins bitnami/jenkins --version 7.0.3

then jenkins get install.

If I click on the linke https://charts.bitnami.com/bitnami/jenkins-7.0.3.tgz then also I am able to download the chart.

Can someone please helm to find the issue ?

Thanks Alpesh



Solution 1:[1]

The issue is caused because helm-terraform-provider uses verify = true by default.

The equivalent helm command would be

helm install my-jenkins bitnami/jenkins --version 7.0.3 --verify --debug

Which will triggers the following error:

> helm install my-jenkins bitnami/jenkins --version 7.0.3 --verify --debug
install.go:172: [debug] Original chart version: "7.0.3"
Error: failed to fetch provenance "https://charts.bitnami.com/bitnami/jenkins-7.0.3.tgz.prov"
helm.go:81: [debug] failed to fetch provenance "https://charts.bitnami.com/bitnami/jenkins-7.0.3.tgz.prov"

This is an issue with the upstream chart and we are looking into it.

As a temporary workaround, setting verify = false should fix the issue.

If the problem persists, adding HELM_DEBUG=1 to your terraform apply command would provide helpful information to determine the root cause of the issue.

Solution 2:[2]

Solution/Workaround: Download the chart-file by hand, save it to a local file and set

chart = "<path-to-your-local-file>"

Solution 3:[3]

If the repo is not added to your local helm repo list then you get an error like;

Error: failed to download "https://github.com/kubernetes/autoscaler/releases/download/cluster-autoscaler-chart-9.13.1/cluster-autoscaler-9.13.1.tgz" at version "9.13.1"

then if you add the target repo to your local everything should be fine

helm repo add [NAME] [URL]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman
Solution 2 Roland Kopetsch
Solution 3