0
votes

I'm able to install grafana using the stable/grafana chart, using Terraform and the Helm provider. I'm trying to configure grafana with a new grafana.ini file, which should be possible using a set, however it doesn't appear to pick up the configuration at all.

I've also tried using the Helm release resources values key to merge in the same config in yaml format (with a top-level grafana.ini key), also with no success.

What I'm trying to achieve is a file containing my config, in ini or yml format, passed to the grafana Helm chart so I can configure grafana correctly (ultimately I need to configure OAuth providers via the config) using Terraform.

Relevant config snips below.

grafana.ini

[security]
admin_user = username

main.tf (excerpt)

resource "helm_release" "grafana" {
  chart = "stable/grafana"
  name = "grafana"

  set {
    name = "grafana.ini"
    value = file("grafana.ini")
  }
}
1

1 Answers

2
votes

I eventually found the correct way of merging the values key - it turns out (no surprise) I had the format of grafana.ini wrong when converting to YAML. Here's the working config:

config.yaml

grafana.ini:
  default:
    instance_name: my-server
  auth.basic:
    enabled: true

main.tf

resource "helm_release" "grafana" {
  chart = "stable/grafana"
  name = "grafana"
  values = [file("config.yaml")]
}