Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could not find : Stat : The system cannot find the path specified #405

Closed
colin-lyman opened this issue Feb 12, 2020 · 12 comments
Closed

could not find : Stat : The system cannot find the path specified #405

colin-lyman opened this issue Feb 12, 2020 · 12 comments

Comments

@colin-lyman
Copy link

colin-lyman commented Feb 12, 2020

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.

@relu
Copy link
Contributor

relu commented Feb 13, 2020

Hello! Try changing to:

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

Note the quotes around the file name.

@colin-lyman
Copy link
Author

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

@legal90
Copy link
Contributor

legal90 commented Feb 14, 2020

@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: Windows ${path.module} doesn't handle relative paths terraform#14986 (comment))
  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

@colin-lyman
Copy link
Author

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.

@legal90
Copy link
Contributor

legal90 commented Mar 4, 2020

@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?

@colin-lyman
Copy link
Author

colin-lyman commented Mar 5, 2020

@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.

@nathan-vp
Copy link

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!

@tomaszszlek
Copy link

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.

@mrtnfchs
Copy link

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()}"
  }
}

@eugene-burachevskiy
Copy link

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!

seansund added a commit to cloud-native-toolkit/terraform-tools-artifactory that referenced this issue Jun 25, 2020
* Updates pipeline to the latest version (including change to use release-drafter for release)
* Wraps all the config into a single helm chart with dependencies
* Manually adds subcharts from dependencies to workaround helm terraform provider bug (hashicorp/terraform-provider-helm#405)
* Sets fail-fast to false
* Sets disable_openapi_validation to true
* Waits for sccs to be deleted
* Updates validate deploy logic
@JesterOrNot
Copy link

Any updates?

@github-actions
Copy link

Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!

@github-actions github-actions bot added the stale label Jan 10, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 9, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants