Grafana provider needs a key to initialize

… But how can I generate a key prior to Grafana provider ?
it takes this :

provider "grafana" {
  url  = "http://grafana.example.com/"
  auth = var.grafana_auth
}

and to create a key :

resource "grafana_api_key" "bar" {
  name            = "key_bar"
  role            = "Admin"
  seconds_to_live = 30
}```

But, how can you create the key if this key is needed by the provider to start ?

You can’t. You have to provide some initial credentials external to Terraform, so Terraform is able to authenticate to Grafana to do whatever you want it to do.

1 Like

thanks, makes sense I guess,
an issue is the TTL on garfana’s side, max 1 month, so key have to be rotated before executing the plan again.
If anyone has work with Grafana provider, suggestion to pass the news keys to the provider is welcome .