Terraform Unable to find Helm Release charts

12/22/2020

I'm running Kubernetes on GCP and doing changes via Terraform v0.11.14 When running terraform plan I'm getting the error messages here

Error: Error refreshing state: 2 errors occurred:
        * module.cls-xxx-us-central1-a-dev.helm_release.cert-manager: 1 error occurred:
        * module.cls-xxx-us-central1-a-dev.helm_release.cert-manager: helm_release.cert-manager: error installing: the server could not find the requested resource


        * module.cls-xxx-us-central1-a-dev.helm_release.nginx: 1 error occurred:
        * module.cls-xxx-us-central1-a-dev.helm_release.nginx: helm_release.nginx: error installing: the server could not find the requested resource

Here's a copy of my helm.tf

resource "helm_release" "nginx" {
  depends_on = ["google_container_node_pool.tally-np"]
  name       = "ingress-nginx"
  chart      = "ingress-nginx/ingress-nginx"
  namespace  = "kube-system"
}

resource "helm_release" "cert-manager" {
  depends_on = ["google_container_node_pool.tally-np"]
  name       = "cert-manager"
  chart      = "stable/cert-manager"
  namespace  = "kube-system"

  set {
    name  = "ingressShim.defaultIssuerName"
    value = "letsencrypt-production"
  }

  set {
    name  = "ingressShim.defaultIssuerKind"
    value = "ClusterIssuer"
  }

  provisioner "local-exec" {
    command = "gcloud container clusters get-credentials ${var.cluster_name} --zone ${google_container_cluster.cluster.zone} && kubectl create -f ${path.module}/letsencrypt-prod.yaml"
  }
}

I've read that Helm deprecated most of the old chart repos so I tried adding the repositories and installing the charts locally under the namespace kube-system but so far the issue is still persisting.

Here's the list of versions for Terraform and it's providers Terraform v0.11.14

  • provider.google v2.17.0
  • provider.helm v0.10.2
  • provider.kubernetes v1.9.0
  • provider.random v2.2.1
-- rax
kubernetes
kubernetes-helm
terraform
terraform-provider-gcp

1 Answer

12/22/2020

As the community is moving towards Helm v3, the maintainers have depreciated the old helm model where we had a single mono repo called stable. The new model is like each product having its own repo. On November 13, 2020 the stable and incubator charts repository reached the end of development and became archives.

The archived charts are now hosted at a new URL. To continue using the archived charts, you will have to make some tweaks in your helm workflow.

Sample workaround:

helm repo add new-stable https://charts.helm.sh/stable
helm fetch new-stable/prometheus-operator
-- Abhishek Jaisingh
Source: StackOverflow