Terraform-provider-helm: could not find : Stat : The system cannot find the path specified

Created on 12 Feb 2020  路  11Comments  路  Source: hashicorp/terraform-provider-helm

Hello, getting an undocumented error using helm provider for TF 0.12. Unclear to what this error is.

Terraform Version

Terraform version: 0.12.20
Go runtime version: go1.12.13

  • provider.azurerm v1.42.0
  • provider.external v1.2.0
  • provider.helm v1.0.0
  • provider.kubernetes v1.11.0
  • provider.random v2.2.1

Affected Resource(s)

  • helm_release

Terraform Configuration Files

resource "helm_release" "base" {
  name                              = "chart_name"
  chart                              = "<acr_repo_name>/chart_name"
  dependency_update     = true
  namespace                    = "some-namespace"
  values                             = [file("file.yaml")]
}

Debug Output

2020/02/12 11:08:18 [DEBUG] module.aks-helm.helm_release.base: apply errored, but we're indicating that via the Error pointer rather than returning it: could not find : Stat : The system cannot find the path specified.
2020/02/12 11:08:18 [ERROR] module.aks-helm: eval: *terraform.EvalApplyPost, err: could not find : Stat : The system cannot find the path specified.
2020/02/12 11:08:18 [ERROR] module.aks-helm: eval: *terraform.EvalSequence, err: could not find : Stat : The system cannot find the path specified.

Expected Behavior

Helm release to be deployed to k8s cluster

Actual Behavior

"Error: could not find : Stat : The system cannot find the path specified."

Steps to Reproduce

  1. terraform apply

Important Factoids

Using Windows 10 Device running TF locally, experiencing the same issue on another Windows device.

UPDATE
Changing the chart variable to the local file path of the uncompressed umbrella chart and running 'helm dep up' (within the chart directory) is performing the release. This is a short term workaround until it's known how umbrella charts from an external repo and using the requirements.yaml file to pull child charts from an external repo too.

UPDATE 2
Added quotes to the above example values file path.

acknowledged documentation enhancement

Most helpful comment

Good morning. I had exactly the same issue caused by dependency to another chart.
The workaround is to execute helm dependency update which will download dependent charts as .tgz files into local machine into charts directory. Then Terraform provider will no longer comply.

All 11 comments

Hello! Try changing to:

values = [file("file.yaml")]

Note the quotes around the file name.

Hi @relu, thanks for the response. They are quoted in my codebase, I'll update the example above to reflect that.

@colin-lyman Try using the absolute path via path.module variable, which is auto-defined by terraform, e.q.:

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

https://www.terraform.io/docs/configuration/functions/file.html#examples

Notes:

  1. You should use forward slash (/) in the path string, even on Windows (ref: https://github.com/hashicorp/terraform/issues/14986#issuecomment-448756885)
  2. Make sure that file.yaml exist't in the source folder of the module where you define you helm_release resource.
    From the debug log you've provided I can guess that it should be in your module module.aks-helm, but not the root module directory where you run terraform command.

P.s. In any case, this issue is not related directly to helm provider

Hi @legal90,

Thanks for the response, however, the issue is not with pulling the config file. I've had the charts installed locally instead of in Azure CR and has worked fine.

Also if Values = "", the error is still generated.

Switching TF_LOG to TRACE I can see the following outputs (with empty values param):
2020-03-04T14:24:19.633Z [DEBUG] plugin.terraform-provider-helm_v1.0.0_x4.exe: 2020/03/04 14:24:19 [DEBUG] Got Chart from Helm
2020-03-04T14:24:19.634Z [DEBUG] plugin.terraform-provider-helm_v1.0.0_x4.exe: 2020/03/04 14:24:19 ---[ values.yaml ]-----------------------------------
2020-03-04T14:24:19.634Z [DEBUG] plugin.terraform-provider-helm_v1.0.0_x4.exe: {}
2020-03-04T14:24:19.634Z [DEBUG] plugin.terraform-provider-helm_v1.0.0_x4.exe:
2020/03/04 14:24:19 [DEBUG] module.aks-helm.helm_release.release[0]: apply errored, but we're indicating that via the Error pointer rather than returning it: could not find : Stat : The system cannot find the path specified.

@colin-lyman ,

Also if Values = "", the error is still generated.

Ah, ok. Then I would suggest to avoid using / in the chart name and set the repo with repository attribute instead, e.q.:

resource "helm_release" "base" {
  name              = "chart_name"
  repository        = "<acr_repo_name_or_url>"
  chart             = "<chart_name>"
  dependency_update = true
  namespace         = "some-namespace"
  values            = [file("file.yaml")]
}

Does the issue still persist?

@legal90 Thanks for the reply. I think I've narrowed the problem further. This only seems to happen with umbrella charts that have dependencies on other charts.

Although with dependency_update = true I would have expected helm to retrieve the dependencies from their respective repositories.

I encounter the same issue. Same scenario as @colin-lyman, with an umbrella chart that has a dependency on another chart.

helm.tf

resource "helm_release" "cert_manager" {
  name      = "cert-manager"
  namespace = kubernetes_namespace.cert_manager.metadata.0.name
  chart     = "${path.module}/k8s/cert-manager"
  dependency_update = true
}

k8s/cert-manager/Chart.yaml

apiVersion: v1
name: cert-manager
version: 1.0.0
dependencies:
- name: cert-manager
  version: 0.14.0
  repository: https://charts.jetstack.io

Output:

helm_release.cert_manager: Creating...

Error: could not find : stat : no such file or directory

  on helm.tf line 116, in resource "helm_release" "cert_manager":
 116: resource "helm_release" "cert_manager" {

Happy to assist with any debugging!

Good morning. I had exactly the same issue caused by dependency to another chart.
The workaround is to execute helm dependency update which will download dependent charts as .tgz files into local machine into charts directory. Then Terraform provider will no longer comply.

Same here and, temporarily, resolved by running a null_resource with always_run to perform the helm dependency update. Unfortunately this is not a nice solution at all because now my terraform plan or terraform apply will always execute these null_resource resources, resulting in diffs for every terraform run.

resource "null_resource" "helm_dependency_update" {
  provisioner "local-exec" {
    command = "helm dependency update ./helm/service-a/"
  }

  triggers = {
    always_run = "${timestamp()}"
  }
}

I faced same issue when was deploying helm_release with dependancies from GitlabCI pipeline.
The strange thing that terraform was applying fine locally, but not from Gitlab runner container.

I have a chart installation from filesystem, not from registry. So I tried both relative path, like
chart = "./k8s"
and absolute path, like
chart = var.chart_path with -var "chart_path=$CI_PROJECT_DIR/k8s"
but error still persist.

So making dependency update as a separate step - helm dep update $CI_PROJECT_DIR/k8s and switching dependency_update = false in terraform code helped.
Thank you guys for workaround!

Any updates?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfry picture dfry  路  14Comments

alexkreidler picture alexkreidler  路  71Comments

aaronmell picture aaronmell  路  22Comments

eeeschwartz picture eeeschwartz  路  23Comments

pdecat picture pdecat  路  14Comments