terraform-provider-helm icon indicating copy to clipboard operation
terraform-provider-helm copied to clipboard

Couldn't download chart yet helm install CLI works.

Open sandipndev opened this issue 2 years ago • 8 comments

Terraform, Provider, Kubernetes and Helm Versions

Terraform version: v1.3.9
Provider version: v2.8.0
Kubernetes version: v2.16.1

Affected Resource(s)

  • helm_release

Terraform Configuration Files

resource "kubernetes_namespace" "gitea_ns" {
  metadata {
    name = "gitea"
  }
}

resource "helm_release" "gitea" {
  name       = "gitea"
  repository = "https://dl.gitea.io/charts/"
  chart      = "gitea"
  namespace  = kubernetes_namespace.gitea_ns.metadata[0].name

  values = [
    file("${path.module}/gitea.yml")
  ]

  dependency_update = true
}

Error Output

╷
│ Error: could not download chart: Chart.yaml file is missing
│
│   with module.gitea.helm_release.gitea,
│   on gitea/gitea.tf line 7, in resource "helm_release" "gitea":
│    7: resource "helm_release" "gitea" {
│
╵

Trace Logs: https://gist.github.com/sandipndev/40ca02e31616aa1b55fc56308e34f8db

Try using HELM CLI

Weird thing is when I did:

helm repo add gitea-charts https://dl.gitea.io/charts/
helm repo update
helm install -n gitea gitea gitea-charts/gitea

it worked.

Yet the helm_release via terraform is complaining about Chart.yaml not being present.

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

sandipndev avatar Feb 16 '23 07:02 sandipndev

Hello! Thank you for opening this issue @sandipndev, I used the same tf configuration that you provided and was successfully able to download the chart. Could you provide the logs by running TF_LOG=trace terraform apply?

BBBmau avatar Feb 17 '23 05:02 BBBmau

Looks like it works for some repos and for some not. For example i can't install livekit from https://helm.livekit.io while can do it with nginx-ingress from https://charts.bitnami.com/bitnami. From cli both fine.

helm cli:  3.11.2
helm provider: 2.19
terraform: 1.4.2

EnergoStalin avatar Apr 01 '23 21:04 EnergoStalin

I have the same issues. With Helm CLI i can download the charts, with the helm provider it doesn't work, especially with repositories hosted through githubpages (e.g. Grafana, Prometheus, Jaeger)

helm cli: 3.11.3 helm provider: 2.9.0 terraform: 1.4.2

madduci avatar May 06 '23 13:05 madduci

I am having the same issue with the gitlab-runner chart from https://charts.gitlab.io version 0.56.0.

helm provider: 2.11.0 helm cli: v3.12.3 terraform: v1.5.6

uluzox avatar Sep 08 '23 13:09 uluzox

Same for chart sealed-secrets from https://bitnami-labs.github.io/sealed-secrets

helm provider: 2.11.0 helm cli: v3.12.3 terraform: v1.5.6

Here are the debug logs for it

2023-09-11T11:57:07.579Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [DEBUG] [resourceDiff: sealed-secrets] Start: timestamp=2023-09-11T11:57:07.577Z
2023-09-11T11:57:07.579Z [WARN]  Provider "registry.terraform.io/hashicorp/helm" produced an invalid plan for module.sealed-secrets.helm_release.sealed-secrets, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .create_namespace: planned value cty.False for a non-computed attribute
      - .recreate_pods: planned value cty.False for a non-computed attribute
      - .verify: planned value cty.False for a non-computed attribute
      - .skip_crds: planned value cty.False for a non-computed attribute
      - .dependency_update: planned value cty.False for a non-computed attribute
      - .force_update: planned value cty.False for a non-computed attribute
      - .pass_credentials: planned value cty.False for a non-computed attribute
      - .reuse_values: planned value cty.False for a non-computed attribute
      - .timeout: planned value cty.NumberIntVal(300) for a non-computed attribute
      - .wait_for_jobs: planned value cty.False for a non-computed attribute
      - .disable_crd_hooks: planned value cty.False for a non-computed attribute
      - .disable_webhooks: planned value cty.False for a non-computed attribute
      - .render_subchart_notes: planned value cty.True for a non-computed attribute
      - .cleanup_on_fail: planned value cty.False for a non-computed attribute
      - .max_history: planned value cty.NumberIntVal(0) for a non-computed attribute
      - .wait: planned value cty.True for a non-computed attribute
      - .atomic: planned value cty.False for a non-computed attribute
      - .replace: planned value cty.False for a non-computed attribute
      - .reset_values: planned value cty.False for a non-computed attribute
      - .disable_openapi_validation: planned value cty.False for a non-computed attribute
      - .lint: planned value cty.False for a non-computed attribute
module.sealed-secrets.helm_release.sealed-secrets: Creating...
2023-09-11T11:57:07.580Z [INFO]  Starting apply for module.sealed-secrets.helm_release.sealed-secrets
2023-09-11T11:57:07.580Z [DEBUG] module.sealed-secrets.helm_release.sealed-secrets: applying the planned Create change
2023-09-11T11:57:07.579Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [DEBUG] [INFO] GetHelmConfiguration start: timestamp=2023-09-11T11:57:07.577Z
2023-09-11T11:57:07.580Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [INFO] Successfully initialized kubernetes config: timestamp=2023-09-11T11:57:07.578Z
2023-09-11T11:57:07.580Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [DEBUG] [INFO] GetHelmConfiguration success: timestamp=2023-09-11T11:57:07.578Z
2023-09-11T11:57:07.582Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [DEBUG] setting computed for "metadata" from ComputedKeys: timestamp=2023-09-11T11:57:07.581Z
2023-09-11T11:57:07.582Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [DEBUG] [resourceReleaseCreate: sealed-secrets] Started: timestamp=2023-09-11T11:57:07.582Z
2023-09-11T11:57:07.582Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [DEBUG] [resourceReleaseCreate: sealed-secrets] Getting helm configuration: timestamp=2023-09-11T11:57:07.582Z
2023-09-11T11:57:07.582Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [DEBUG] [INFO] GetHelmConfiguration start: timestamp=2023-09-11T11:57:07.582Z
2023-09-11T11:57:07.582Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [INFO] Successfully initialized kubernetes config: timestamp=2023-09-11T11:57:07.582Z
2023-09-11T11:57:07.582Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [DEBUG] [INFO] GetHelmConfiguration success: timestamp=2023-09-11T11:57:07.582Z
2023-09-11T11:57:07.582Z [INFO]  provider.terraform-provider-helm_v2.11.0_x5: 2023/09/11 11:57:07 [DEBUG] [resourceReleaseCreate: sealed-secrets] Getting chart: timestamp=2023-09-11T11:57:07.582Z
2023-09-11T11:57:07.582Z [ERROR] provider.terraform-provider-helm_v2.11.0_x5: Response contains error diagnostic: diagnostic_summary="could not download chart: Chart.yaml file is missing" tf_resource_type=helm_release tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:55 diagnostic_severity=ERROR diagnostic_detail= tf_proto_version=5.3 tf_provider_addr=provider tf_req_id=2b8fbc15-a193-a8c3-6546-140714e3b1a5 @module=sdk.proto timestamp=2023-09-11T11:57:07.582Z
2023-09-11T11:57:07.584Z [DEBUG] State storage *remote.State declined to persist a state snapshot
2023-09-11T11:57:07.584Z [ERROR] vertex "module.sealed-secrets.helm_release.sealed-secrets" error: could not download chart: Chart.yaml file is missing
2023-09-11T11:57:07.584Z [DEBUG] states/remote: state read serial is: 10; serial is: 10
2023-09-11T11:57:07.584Z [DEBUG] states/remote: state read lineage is: 93dd3394-5035-0085-1b63-34efd92d0507; lineage is: 93dd3394-5035-0085-1b63-34efd92d0507
╷
│ Error: could not download chart: Chart.yaml file is missing
│ 
│   with module.sealed-secrets.helm_release.sealed-secrets,
│   on sealed-secrets/main.tf line 1, in resource "helm_release" "sealed-secrets":
│    1: resource "helm_release" "sealed-secrets" {
│ 
╵

uluzox avatar Sep 11 '23 12:09 uluzox

I have come to realise that this is flaky. Since there's no other way around it, I have a retry: 3 step in my CI.

sandipndev avatar Sep 12 '23 08:09 sandipndev

I may have found the cause, see this comment: https://github.com/hashicorp/terraform-provider-helm/issues/1215#issuecomment-1976722131

cgroschupp avatar Mar 04 '24 14:03 cgroschupp