terraform-provider-stackit
terraform-provider-stackit copied to clipboard
stackit_observability_instance add an option to load dashboards
Hello!
It will be great to add an option to import dashboards in the observability instance using:
- dashboard id
- URL to a JSON file
- the JSON file
Regards,
Hi @fjvela,
thanks for opening this issue. We'll have a look on this.
This code might be helpful for you.
terraform {
required_version = "~> 1.9.1"
required_providers {
grafana = {
source = "grafana/grafana"
version = "~> 3.7.0"
}
}
}
provider "grafana" {
auth = "${var.grafana_username}:${var.grafana_password}"
url = var.grafana_url
}
...
resource "grafana_folder" "services" {
title = "Services"
}
resource "grafana_folder_permission" "services_folder_permissions" {
folder_uid = grafana_folder.services.uid
permissions {
role = "Editor"
permission = "Edit"
}
permissions {
role = "Viewer"
permission = "View"
}
}
resource "grafana_dashboard" "backup-service" {
folder = grafana_folder.services.uid
config_json = templatefile("${path.module}/configs/backup-service.json", {
stage = var.stage
region = var.region
})
overwrite = true
}
For credentials we use the grafana_initial_admin_* values from our observability instance created in terraform https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/resources/observability_instance#read-only