I’m using Grafana 9.2.4 on Fedora 29 and I’m trying to provision a datasource with a dashboard using the terraform provider as explained here.
When I run terraform plan I get the following error:
terraform plan
╷
│ Error: Provider configuration not present
│
│ To work with grafana_data_source.play-ds-grafana-elevation its original provider configuration at provider["registry.terraform.io/grafana/grafana"].play is required, but it has been removed. This occurs
│ when a provider configuration is removed while objects created by that provider still exist in the state. Re-add the provider configuration to destroy grafana_data_source.play-ds-grafana-elevation,
│ after which you can remove the provider configuration again.
╵
I was expecting to see the provisioning plan.
I have two files on my terraform folder. First one is called 'main.tf':
```hcl
terraform {
required_providers {
grafana = {
source = "grafana/grafana"
version = "1.36.1"
}
}
}
/*
* Example:
* https://grafana.com/docs/grafana/latest/administration/api-keys/
* bearer="XXXXFQUG52NjFBNGNZRERETEtTYVhXcGMiLCJuIjoicHJvdmlzaW9uZXIiLCJpZCI6MX0="
* curl --headers "Authorization: Bearer $bearer" \
* https://machine.example.com:3000/api/dashboards/home
*/
variable "grafana_auth" {
default = "eyJrIjoiZm1YUEpFam12NlFQUG52NjFBNGNZRERETEtTYVhXcGMiLCJuIjoicHJvdmlzaW9uZXIiLCJpZCI6MX0="
}
variable "grafana_staging_url" {
default = "https://grafana.example.com:3000/"
}
provider "grafana" {
url = var.grafana_staging_url
auth = var.grafana_auth
}
And my data source on ‘datasources.tf’:
resource "grafana_data_source" "play-ds-grafana-one" {
provider = grafana.play
type = "marcusolsson-json-datasource"
name = "My cool datasource"
url = "http://ds.example.com/infrastructure/elevation_data.json"
uid = "N4f7zrFVZ"
is_default = false
}
I’m using the following:
Terraform v1.4.2
on linux_amd64
+ provider registry.terraform.io/grafana/grafana v1.36.1
Has anyone encountered this issue?
Thanks.