terraform-provider-helm: Getting Wrong Error: chart [...] version [...] not found in [...] repository
Terraform, Provider, Kubernetes and Helm Versions
Terraform version: 0.14.8
Provider version: 2.0.3
Kubernetes version: 1.19.1
Helm version: 3.5.2
Affected Resource(s)
- helm_release
Terraform Configuration Files
terraform {
required_providers {
helm = {
source = "hashicorp/helm"
version = "2.0.3"
}
}
}
provider "helm" {
kubernetes {
config_path = "~/.kube/config"
}
}
resource "helm_release" "nginx_ingress" {
name = "nginx-ingress"
repository = "https://kubernetes.github.io/ingress-nginx"
chart = "nginx-ingress"
version = "3.24.0"
namespace = "kube-system"
values = [
file("helm/nginx-ingress/values.yml")
]
}
Debug Output
For full log see:
I cannot find any useful information there but:
2021-03-13T03:19:40.079Z [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/hashicorp/helm/2.0.3/linux_amd64/terraform-provider-helm_v2.0.3_x5 args=[.terraform/providers/registry.terraform.io/hashicorp/helm/2.0.3/linux_amd64/terraform-provider-helm_v2.0.3_x5]
2021-03-13T03:19:40.081Z [DEBUG] plugin: plugin started: path=.terraform/providers/registry.terraform.io/hashicorp/helm/2.0.3/linux_amd64/terraform-provider-helm_v2.0.3_x5 pid=13458
2021-03-13T03:19:40.082Z [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hashicorp/helm/2.0.3/linux_amd64/terraform-provider-helm_v2.0.3_x5
2021-03-13T03:19:40.147Z [INFO] plugin.terraform-provider-helm_v2.0.3_x5: configuring server automatic mTLS: timestamp=2021-03-13T03:19:40.147Z
2021-03-13T03:19:40.223Z [DEBUG] plugin.terraform-provider-helm_v2.0.3_x5: plugin address: address=/tmp/plugin426193591 network=unix timestamp=2021-03-13T03:19:40.223Z
2021-03-13T03:19:40.223Z [DEBUG] plugin: using plugin: version=5
2021-03-13T03:19:40.301Z [INFO] plugin.terraform-provider-helm_v2.0.3_x5: 2021/03/13 03:19:40 [DEBUG] [resourceDiff: nginx-ingress] Start: timestamp=2021-03-13T03:19:40.300Z
2021/03/13 03:19:40 [WARN] Provider "registry.terraform.io/hashicorp/helm" produced an invalid plan for helm_release.nginx_ingress, 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:
- .atomic: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .lint: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .verify: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .wait: planned value cty.True does not match config value cty.NullVal(cty.Bool)
- .cleanup_on_fail: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .replace: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .timeout: planned value cty.NumberIntVal(300) does not match config value cty.NullVal(cty.Number)
- .dependency_update: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .disable_webhooks: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .force_update: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .disable_crd_hooks: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .skip_crds: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .disable_openapi_validation: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .recreate_pods: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .reuse_values: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .create_namespace: planned value cty.False does not match config value cty.NullVal(cty.Bool)
- .max_history: planned value cty.NumberIntVal(0) does not match config value cty.NullVal(cty.Number)
ty.NullVal(cty.Bool)
- .reset_values: planned value cty.False does not match config value cty.NullVal(cty.Bool)
helm_release.nginx_ingress: Creating...
2021/03/13 03:19:40 [DEBUG] EvalApply: ProviderMeta config value set
2021/03/13 03:19:40 [DEBUG] helm_release.nginx_ingress: applying the planned Create change
2021-03-13T03:19:40.367Z [INFO] plugin.terraform-provider-helm_v2.0.3_x5: 2021/03/13 03:19:40 [DEBUG] setting computed for "metadata" from ComputedKeys: timestamp=2021-03-13T03:19:40.366Z
2021-03-13T03:19:40.367Z [INFO] plugin.terraform-provider-helm_v2.0.3_x5: 2021/03/13 03:19:40 [DEBUG] [resourceReleaseCreate: nginx-ingress] Started: timestamp=2021-03-13T03:19:40.367Z
2021-03-13T03:19:40.367Z [INFO] plugin.terraform-provider-helm_v2.0.3_x5: 2021/03/13 03:19:40 [DEBUG] [resourceReleaseCreate: nginx-ingress] Getting helm configuration: timestamp=2021-03-13T03:19:40.367Z
2021-03-13T03:19:40.367Z [INFO] plugin.terraform-provider-helm_v2.0.3_x5: 2021/03/13 03:19:40 [DEBUG] [INFO] GetHelmConfiguration start: timestamp=2021-03-13T03:19:40.367Z
2021-03-13T03:19:40.367Z [INFO] plugin.terraform-provider-helm_v2.0.3_x5: 2021/03/13 03:19:40 [DEBUG] Using kubeconfig: /home/runner/.kube/config: timestamp=2021-03-13T03:19:40.367Z
2021-03-13T03:19:40.367Z [INFO] plugin.terraform-provider-helm_v2.0.3_x5: 2021/03/13 03:19:40 [INFO] Successfully initialized kubernetes config: timestamp=2021-03-13T03:19:40.367Z
2021-03-13T03:19:40.367Z [INFO] plugin.terraform-provider-helm_v2.0.3_x5: 2021/03/13 03:19:40 [DEBUG] [INFO] GetHelmConfiguration success: timestamp=2021-03-13T03:19:40.367Z
2021-03-13T03:19:40.367Z [INFO] plugin.terraform-provider-helm_v2.0.3_x5: 2021/03/13 03:19:40 [DEBUG] [resourceReleaseCreate: nginx-ingress] Getting chart: timestamp=2021-03-13T03:19:40.367Z
2021/03/13 03:19:40 [DEBUG] helm_release.nginx_ingress: apply errored, but we're indicating that via the Error pointer rather than returning it: chart "nginx-ingress" version "3.24.0" not found in https://kubernetes.github.io/ingress-nginx repository
Error: chart "nginx-ingress" version "3.24.0" not found in https://kubernetes.github.io/ingress-nginx repository
on main.tf line 16, in resource "helm_release" "nginx_ingress":
16: resource "helm_release" "nginx_ingress" {
2021-03-13T03:19:40.404Z [WARN] plugin.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-03-13T03:19:40.405Z [DEBUG] plugin: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/helm/2.0.3/linux_amd64/terraform-provider-helm_v2.0.3_x5 pid=13458
2021-03-13T03:19:40.405Z [DEBUG] plugin: plugin exited
Error: Terraform exited with code 1.
Error: Process completed with exit code 1.
Steps to Reproduce
- Use
https://kubernetes.github.io/ingress-nginxas ahelm_releaserepository with chartnginx-ingressand version3.24.0 - See https://github.com/pathob/tf_helm/blob/main/main.tf
- See https://github.com/pathob/tf_helm/blob/main/.github/workflows/test.yml
- See https://github.com/pathob/tf_helm/runs/2095542326?check_suite_focus=true
Expected Behavior
- Terraform should find the chart like e.g. with using repository
https://helm.nginx.com/stableand chartnginx-ingressand version0.8.0(but there is something else odd with this chart); - See https://github.com/pathob/tf_helm/blob/working/main.tf
- See https://github.com/pathob/tf_helm/blob/working/.github/workflows/test.yml
- See https://github.com/pathob/tf_helm/runs/2093139142?check_suite_focus=true
Actual Behavior
Terraform cannot find the chart like mentioned in the expected behaviour, although I’m using the same chart / version / repo with Helm / Helmfile and the chart with that version in that repo definetly exists, see https://kubernetes.github.io/ingress-nginx/index.yaml
Workaround
I’m currently using the full chart URL as the chart without repo and version like so: https://github.com/kubernetes/ingress-nginx/releases/download/helm-chart-3.24.0/ingress-nginx-3.24.0.tgz
Important Factoids
I think none.
References
I think none.
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
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 25
- Comments: 18
I was having the same issue trying to install the consul. Usually to do that manually I run:
so the naive approach for me was to use following resource configuration:
It fails with the same error everyone else is having so I tried to “bruteforce” it and found the way to make it work:
The more I think of it the more sense it makes. When I run
helm repo lsit returns:so to install the chart from that specific repo I have to prefix my chart name with a repo name,
hashicorp/consul, while Terraform Helm provider does not need that prefix.I was getting the same error. My work around was to do away with the repository and version arguments.
Instead of this
I retrieved the install link from Artifacthub and supplied that to the chart argument
Also note that the version is part of the install link, so no need to specify the version argument as well. More about the chart argument here.
I’ll double post instead of edit because I think it may be useful to other people.
When using the format:
It fails with the mentioned error:
But, if you manually add your repo with helm:
And change your code to rely on your local list:
It works perfectly. So it seems that whatever is the problem, is when terraform tries to add the repository.
I was to just post this comment, but I decided to try another thing. Just to see if I could reproduce the problem, I deleted the prometheus-community repository from the
~/.config/helm/repositories.yamlfile. And then I tried again with the first method:And it worked as expected.
Then, again to see if I can reproduce some problem, I added the repo again to the
~/.config/helm/repositories.yamlfile:And applied again with the last format, and it still worked as expected.
So it seems that messing with the
~/.config/helm/repositories.yamlfile can fix the problem, even when theoretically terraform doesn’t use it, since all the information is in the code.My conclusion is, I know nothing.
EDIT: Ignore this post… this was working locally because Terraform Helm was using my local Helm configuration which has the configuration for ChartMuseum. Check this post instead https://github.com/hashicorp/terraform-provider-helm/issues/707#issuecomment-844548333
👎
I can confirm that this solution worked for me. Using a private ChartMuseum repository with basic HTTP auth and it does not with the provider versions
Not working
Working
Hello @pathob ! My workaround is to downgrade to 1.3.2 https://registry.terraform.io/providers/hashicorp/helm/1.3.2/docs/data-sources/repository and using
helm_repositorydata resource.