hmcts / dtsse-shared-infrastructure

0 stars 0 forks source link

Adds an alert when we get to 90% of grafana budget (£500) #82

Closed jasonpaige closed 1 year ago

jasonpaige commented 1 year ago

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[X] No
hmcts-jenkins-d-to-i[bot] commented 1 year ago

Plan Result

Plan: 3 to add, 1 to change, 0 to destroy.
Change Result (Click me) ```hcl # azurerm_consumption_budget_resource_group.grafana-budget-alert[0] will be created + resource "azurerm_consumption_budget_resource_group" "grafana-budget-alert" { + amount = 500 + etag = (known after apply) + id = (known after apply) + name = "grafana-budget-alert" + resource_group_id = "/subscriptions/1c4f0704-a29e-403d-b719-b90c34ef14c9/resourceGroups/dtsse-aat" + time_grain = "Monthly" + filter { + dimension { + name = "ResourceId" + operator = "In" + values = [ + "/subscriptions/1c4f0704-a29e-403d-b719-b90c34ef14c9/resourceGroups/dtsse-aat/providers/Microsoft.Dashboard/grafana/dtsse-grafana-aat", ] } } + notification { + contact_emails = [] + contact_groups = [ + "DTSSE Alert (aat)", ] + contact_roles = [] + enabled = true + operator = "GreaterThanOrEqualTo" + threshold = 90 + threshold_type = "Forecasted" } + time_period { + end_date = (known after apply) + start_date = "2023-09-01T00:00:00Z" } } # azurerm_key_vault_secret.alert_action_group_name will be created + resource "azurerm_key_vault_secret" "alert_action_group_name" { + id = (known after apply) + key_vault_id = "/subscriptions/1c4f0704-a29e-403d-b719-b90c34ef14c9/resourceGroups/dtsse-aat/providers/Microsoft.KeyVault/vaults/dtsse-aat" + name = "alert-action-group-name" + resource_id = (known after apply) + resource_versionless_id = (known after apply) + value = (sensitive value) + version = (known after apply) + versionless_id = (known after apply) } # module.alert-action-group.azurerm_resource_group_template_deployment.action-group will be created + resource "azurerm_resource_group_template_deployment" "action-group" { + deployment_mode = "Incremental" + id = (known after apply) + name = "DTSSE_Alert" + output_content = (known after apply) + parameters_content = (sensitive value) + resource_group_name = "dtsse-aat" + template_content = jsonencode( { + "$schema" = "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#" + contentVersion = "1.0.0.0" + parameters = { + actionGroupName = { + type = "string" } + emailReceiverAddress = { + metadata = { + description = "Email address of the receiver" } + type = "string" } + emailReceiverName = { + metadata = { + description = "Name of the email receiver" } + type = "string" } + location = { + defaultValue = "global" + type = "string" } + shortName = { + type = "string" } } + resources = [ + { + apiVersion = "2017-04-01" + location = "[parameters('location')]" + name = "[parameters('actionGroupName')]" + properties = { + emailReceivers = [ + { + emailAddress = "[parameters('emailReceiverAddress')]" + name = "[parameters('emailReceiverName')]" }, ] + enabled = true + groupShortName = "[parameters('shortName')]" + smsReceivers = [] + webhookReceivers = [] } + tags = {} + type = "microsoft.insights/actionGroups" }, ] } ) } # module.key-vault.azurerm_monitor_diagnostic_setting.kv-ds will be updated in-place ~ resource "azurerm_monitor_diagnostic_setting" "kv-ds" { id = "/subscriptions/1c4f0704-a29e-403d-b719-b90c34ef14c9/resourceGroups/dtsse-aat/providers/Microsoft.KeyVault/vaults/dtsse-aat|dtsse-aat" name = "dtsse-aat" # (3 unchanged attributes hidden) - metric { - category = "AllMetrics" -> null - enabled = false -> null - retention_policy { - days = 0 -> null - enabled = false -> null } } # (3 unchanged blocks hidden) } Plan: 3 to add, 1 to change, 0 to destroy. ```