Skip to content

Commit

Permalink
chore: [PAYMCLOUD-253] Enable conditional deployment of Prometheus ad…
Browse files Browse the repository at this point in the history
…don for aks weu dev environment (#2779)

* Enable Prometheus addon conditionally for dev environment

Added a conditional `count` to the `prometheus_managed_addon` module, ensuring it is only deployed in the development environment. This change helps avoid unnecessary resource deployment in non-dev environments.

Signed-off-by: Fabio Felici <[email protected]>

* Add conditional logic for dev environment in monitoring setup

Introduce a conditional count for "azurerm_monitor_workspace" to handle dev environment-specific configurations. Adjust references to workspace attributes for compatibility with the count feature.

Signed-off-by: Fabio Felici <[email protected]>

---------

Signed-off-by: Fabio Felici <[email protected]>
  • Loading branch information
ffppa authored Feb 11, 2025
1 parent dee99a7 commit 397d661
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/aks-platform/05_monitoring.tf
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,19 @@ resource "kubernetes_manifest" "service_monitor" {

# Refer: Resource created on next-core 02_monitor.tf
data "azurerm_monitor_workspace" "workspace" {
count = var.env == "dev" ? 1 : 0
name = "pagopa-${var.env_short}-${var.location}-monitor-workspace"
resource_group_name = "pagopa-${var.env_short}-monitor-rg"
}

module "prometheus_managed_addon" {
count = var.env == "dev" ? 1 : 0
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//kubernetes_prometheus_managed?ref=v8.80.0"
cluster_name = module.aks.name
resource_group_name = module.aks.aks_resource_group_name
location = var.location
monitor_workspace_name = data.azurerm_monitor_workspace.workspace.name
monitor_workspace_rg = data.azurerm_monitor_workspace.workspace.resource_group_name
monitor_workspace_name = data.azurerm_monitor_workspace.workspace.0.name
monitor_workspace_rg = data.azurerm_monitor_workspace.workspace.0.resource_group_name
grafana_name = "pagopa-${var.env_short}-${var.location_short}-grafana"
grafana_resource_group = "pagopa-${var.env_short}-${var.location_short}-grafana-rg"
tags = var.tags
Expand Down

0 comments on commit 397d661

Please sign in to comment.