grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.54k stars 3.41k forks source link

Terraform and helm charts not working correctly #9968

Open Konn1nn opened 1 year ago

Konn1nn commented 1 year ago

Describe the bug When using Terraform to deploy Loki and the repo being used is "https://grafana.github.io/helm-charts" and the chart I want to use is "loki". I get an error saying Error: could not download chart: Chart.yaml file is missing. I think this might be because the helm-chart repo link is directed to the old loki folder in the helm-chart github repo which is deprecated, or that is my best guess.

To Reproduce Run the code below in a terraform setup:

provider "helm" {
  kubernetes {
    host                   = data.aws_eks_cluster.cluster.endpoint
    cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
    exec {
      api_version = "client.authentication.k8s.io/v1beta1"
      args        = ["eks", "get-token", "--cluster-name", data.aws_eks_cluster.cluster.name]
      command     = "aws"
    }
  }
}

resource "helm_release" "loki" {
  name = "loki"
  repository = "https://grafana.github.io/helm-charts"
  chart = "loki"

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

Expected behavior Terraform would deploy this to my kubernetes cluster on AWS.

Environment:

Screenshots, Promtail config, or terminal output Here is the error Terraform is giving me:

│ Error: could not download chart: Chart.yaml file is missing
│ 
│   with helm_release.loki,
│   on helm_release.tf line 13, in resource "helm_release" "loki":
│   13: resource "helm_release" "loki" {

Idea to a solution I am not sure how this repo works, but if the helm-chart repo could be linked to this repo also or a new helm-chart repo could be created just for loki could be the solution. But I'm not familiar with how helm-chart repos work, just my best guess.

Konn1nn commented 1 year ago

Update: By changing the repository field in terraform to the local version of the grafana repository (which should be the same). I can deploy loki.

sham97 commented 1 year ago

resource "helm_release" "loki" {

count = var.loki_enabled && var.loki_mode == "distributed" ? 1 : 0

name = "loki" repository = "https://grafana.github.io/helm-charts" chart = "grafana/loki" namespace = "monitoring" version = ""

values = [ file("${path.module}/loki-values.yaml"),

Customize Loki configuration using a values file

]

values = [

templatefile("${path.module}/loki-values.yaml.tpl", {

aws_region = "${var.region}"

bucket_name = "${var.bucket}"

})

]

} when i run this i get an error below,

Error: could not download chart: chart "grafana/loki" not found in https://grafana.github.io/helm-charts repository │ │ with module.loki.helm_release.loki, │ on ......\Monitoring-Stack\loki\loki.tf line 1, in resource "helm_release" "loki": │ 1: resource "helm_release" "loki" { │