This module will deploy an AppService running Grafana (pulled from docker hub) and creating it with system managed identity auth. Grafana version OSS.
This could be usefull if you want to have some control over Grafana without deploying the a full VM. Azure recently created a managed version of Grafana using PaaS link here.
The agent from where you are running terraform needs powershell core installed. Also, you need to have rights to handle AD assignment for the RBAC and Managed Identity.
prefix = prefix to be used to name resources. [string] / REQUIRED
azure_region = Region where resources will be created. [string] / REQUIRED
app_settings = Map of settings to be included in the app. These can include runtime settings, secrets, keyvault references, ecc... [map] / OPTIONAL
deploy_render = This will deploy an extra AppService to host the image render. docs info [bool] / OPTIONAL
deploy_cdn = Set to true to deploy an azure CDN on top of Grafana [bool] / OPTIONAL
smtp_on = Set to true configure Grafana to use a SMTP Server to send emails. If you set this to true, you need to configure: smtp_host, smtp_password, smtp_user, smtp_from_address, smtp_from_name [bool] / OPTIONAL
grafana_docker_version = Use a different Grafana Version. Default to 9.1.1 [string] / OPTIONAL
image_render_docker_version = Use a different Image Render Version. Default to latest [string] / OPTIONAL
grafana_plan_sku = SKU Plan for AppService info [string] / OPTIONAL
grafana_plan_size = SKU Size for AppService info [string] / OPTIONAL
image_render_plan_sku = SKU Plan for AppService info [string] / OPTIONAL
image_render_plan_size = SKU Size for AppService info [string] / OPTIONAL
Classic: No Cdn and No Image Render
module "deploy_grafana" {
source = "./grafana/"
prefix = "alef"
azure_region = "West Europe"
}
CDN: Cdn and No Image Render
module "deploy_grafana" {
source = "./grafana/"
prefix = "alef"
azure_region = "West Europe"
deploy_cdn = true
}
Image Render: No Cdn and Image Render
module "deploy_grafana" {
source = "./grafana/"
prefix = "alef"
azure_region = "West Europe"
deploy_render = true
}
Full: Cdn and Image Render
module "deploy_grafana" {
source = "./grafana/"
prefix = "alef"
azure_region = "West Europe"
deploy_render = true
deploy_cdn = true
}
Full: Cdn and Image Render using SMTP
module "deploy_grafana" {
source = "./grafana/"
prefix = "alef"
azure_region = "West Europe"
deploy_render = true
deploy_cdn = true
smtp_on = true
smtp_host = "smtp.sendgrid.net:587"
smtp_password = "*****"
smtp_user = "hello-there"
smtp_from_address = "myemail@email.com"
smtp_from_name = "email user"
}
Any other Grafana setting can be set by using the variable app_settings. Grafana configs start with a "GF_" docs here
This diagram is for the full setup only.
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service_plan
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service