Skip to content

Commit

Permalink
Add condition to make admin user an optional value
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael Lognseth committed Jul 7, 2022
1 parent 0ee2217 commit ac31fb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ provider "azurerm" {
}

resource "azurerm_role_assignment" "grafana_admin" {
count = var.grafana_admin_object_id != null ? 1 : 0

scope = data.azurerm_resource_group.rg.id
role_definition_name = "Grafana Admin"
principal_id = var.admin_user_object_id
principal_id = var.grafana_admin_object_id
}
3 changes: 2 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ variable "log_analytics_workspace" {
description = "Whether or not you want to deploy a log analytics workspace for the Grafana instance, set to false if you already have an instance."
}

variable "admin_user_object_id" {
variable "grafana_admin_object_id" {
type = string
default = null
description = "The object ID of the user or group you want to grant admin access on the Grafana instance."
}

0 comments on commit ac31fb7

Please sign in to comment.