grafana / grafonnet

Jsonnet library for generating Grafana dashboards.
https://grafana.github.io/grafonnet/
Apache License 2.0
322 stars 19 forks source link

Couldn't open import │ "github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet": #146

Closed ebattat closed 8 months ago

ebattat commented 8 months ago

Starting to get the following error when using Terraform:

 RUNTIME ERROR: couldn't open import
│ "github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet": no
│ match locally or in the Jsonnet library paths
│   /app/jsonnet/g.libsonnet:2:1-74 $
│   /app/jsonnet/main.libsonnet:1:11-31 thunk <g> from <$>
│   /app/jsonnet/main.libsonnet:8:1-2   
│   During evaluation

Do you familiar with it ?

malcolmholmes commented 8 months ago

You may have to tell the Jsonnet Terraform provider where to find your libraries. The docs for it say:

provider "jsonnet" {
    jsonnet_path = "${root.module}/lib:/usr/local/share/jsonnet/grafonnet-lib"
}

You will want to include the path to where your Grafonnet is vendored, so if it is just the vendor dir, then (I think) like so:

provider "jsonnet" {
    jsonnet_path = "${root.module}/vendor"
}
ebattat commented 8 months ago

Thx, I will try it