The "az-managed-grafana.tf" file will perform below:-
1. Create one or more AAD Group(s) using terraform "count" and "length". The Names of the AAD group(s) are passed as an array - list(string).
2. The owners of the AAD Group(s) are referenced in Terraform Data block as they already exists.
3. Create a single resource group.
4. Create one or more Azure Managed Grafana instance(s) using terraform "count" and "length". The Names of the Azure Managed Grafana instance(s) are passed as an array - list(string).
5. The resource group under which one or more Azure Managed Grafana instance(s) gets deployed is referenced as "Implicit Dependency".
6. If else block is used for - "zone redundancy", "api key", "outbound IP" and "public network access".
7. The id of each Azure Managed Grafana Instance and Object id of each AAD Group is stored as "Terraform Output". RBAC was then created by counting output ids of Azure Managed Grafana instance(s) which is the scope. Role definition defined here is static (For Example - "Grafana Admin") which is mapped to Object id of the Azure AD Group referenced here as array index.
If the variable "var.az-grafana-zone-redundancy" is equal to NULL, then the value is "true". If not, then the value is, what is defined for the variable.
TERRAFORM (data.tf):-
# Data source to retrieve User object ID
data "azuread_users" "az-aad-grp-owner" {
user_principal_names = var.az-aad-group-owner
ignore_missing = true
}
NOTE:-
Terraform Data block to retrieve already existing User Principal name(s).
TERRAFORM (output.tf):-
output "az-grafana-id" {
value = azurerm_dashboard_grafana.az-grafana.*.id
}
output "az-aad-group-id" {
value = azuread_group.az-aad-group.*.id
}
NOTE:-
Terraform output block to retrieve the id(s) of one or more Azure Managed Grafana Instances and object id(s) of one or more Azure AD Group(s).
TERRAFORM (variables.tf):-
variable "az-aad-group-name" {
type = list(string)
description = "Names of the Azure Active Directory Group."
}
variable "az-aad-group-owner" {
type = list(string)
description = "List of Users added as owner of the Azure Active Directory Group."
}
variable "rg-name" {
type = string
description = "Name of the Resource Group."
}
variable "location" {
type = string
description = "Location of the Resource Group and Resources."
}
variable "az-grafana-name" {
type = list(string)
description = "Name of the Azure Managed Grafana."
}
variable "az-grafana-zone-redundancy" {
type = string
description = "Enable zone redundancy setting of the Grafana Instance."
}
variable "az-grafana-api-key" {
type = string
description = "Enable the api key setting of the Grafana Instance."
}
variable "az-grafana-outbound-ip" {
type = string
description = "Enable the Grafana Instance to use Deterministic outbound IPs."
}
variable "az-grafana-public-access" {
type = string
description = "To enable traffic over the Public Interface."
}
variable "az-grafana-identity" {
type = string
description = "System Assigned Managed Identity"
}
Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.
Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.
Top comments (0)