Skip to content

Make Grafana admin credentials configurable #1331

@hkujath

Description

@hkujath

Problem description

*Is your feature request related to a problem? If so, please give us a clear and concise description of what the problem is.

Im using the admin credentials to configure dashboards inside Grafana. Now i saw that the attributes "grafana_initial_admin_user" and "grafana_initial_admin_password" are marked as deprecated. How can i configure in the future the grafana instance through terraform if this will be removed?

output "cse_obs_grafana_username" {
  description = "Observability instance Grafana dashboard username"
  value       = stackit_observability_instance.kacls-monitoring.grafana_initial_admin_user
}

output "cse_obs_grafana_password" {
  description = "Observability instance Grafana dashboard password"
  value       = stackit_observability_instance.kacls-monitoring.grafana_initial_admin_password
  sensitive   = true
}

Proposed solution

Instead i suggest two new attributes "grafana_admin_password" and "grafana_admin_user" to set these data by the user.

resource "random_string" "username" {
  length  = 10
  special = false
  upper   = false
}

# Generiert ein hochsicheres Passwort
resource "random_password" "password" {
  length           = 32
  special          = true
  override_special = "!#$%&*()-_=+[]{}<>:?"
}

resource "stackit_observability_instance" "kacls-monitoring" {
  project_id = var.project_id
  name       = "kacls-monitoring-${var.cse_truncated_id}"
  plan_name  = var.obs_plan_name
  acl        = var.allowed_acl

  # C5 Audit compliance
  metrics_retention_days = 365
  alert_config           = var.cse_stage == "prod" ? local.alert_config_prod : local.alert_config_dev
  grafana_admin_user = "tech-user-${random_string.username.result}"
  grafana_admin_password = random_password.password.result
}

Alternative solutions (optional)

There are no alternative solutions. We need an account to configure Grafana through automation.

Additional information

Feel free to add any additional information here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions