Skip to content

Commit

Permalink
Fix OpsGenie integration for non-production environments
Browse files Browse the repository at this point in the history
Added conditional logic to disable OpsGenie API key retrieval outside of production by introducing a `count` parameter. This prevents unnecessary calls to Key Vault in non-production setups, ensuring cleaner and more efficient configuration.

Signed-off-by: Fabio Felici <[email protected]>
  • Loading branch information
ffppa committed Jan 7, 2025
1 parent 2e136d1 commit 148ab83
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/aks-platform/05_monitoring.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ module "kubernetes_event_exporter" {

# OpsGenie integrations
enable_opsgenie = true
opsgenie_api_key = data.azurerm_key_vault_secret.opsgenie_kubexporter_api_key.value
opsgenie_api_key = data.azurerm_key_vault_secret.opsgenie_kubexporter_api_key.0.value
}

data "azurerm_key_vault_secret" "opsgenie_kubexporter_api_key" {
count = var.env_short != "p" ? 0 : 1
key_vault_id = data.azurerm_key_vault.kv.id
name = "opsgenie-infra-kubexporter-webhook-token"
}
Expand Down

0 comments on commit 148ab83

Please sign in to comment.