This module provides a Terraform configuration for deploying various Azure resources as part of your infrastructure. The configuration includes the deployment of resource groups, monitor-alerts.
To use this module, you should have Terraform installed and configured for AZURE. This module provides the necessary Terraform configuration for creating AZURE resources, and you can customize the inputs as needed. Below is an example of how to use this module:
module "azmonitor-action-groups" {
source = "git::https://github.com/opsstation/terraform-azure-monitor-alerts.git?ref=v1.0.0"
name = "app"
environment = "test"
actionGroups = {
"group1" = {
actionGroupName = "AlertEscalationGroup"
actionGroupShortName = "alertesc"
actionGroupRGName = module.resource_group.resource_group_name
actionGroupEnabled = "true"
actionGroupEmailReceiver = [
{
name = "example"
email_address = "[email protected]"
use_common_alert_schema = "true"
},
{
name = "test"
email_address = "yadxxxxxxxxxxxxgmail.com"
use_common_alert_schema = "true"
}
]
}
}
}
module "alerts" {
depends_on = [data.azurerm_monitor_action_group.example, ]
source = "git::https://github.com/opsstation/terraform-azure-monitor-alerts.git?ref=v1.0.0"
name = "app"
environment = "test"
activity_log_alert = {
"test1" = {
alertname = "vm-restart"
alertrg = module.resource_group.resource_group_name
alertscopes = [module.resource_group.resource_group_id]
description = "Administrative alerts for vm"
operation_name = "Microsoft.Compute/virtualMachines/restart/action"
actionGroupID = data.azurerm_monitor_action_group.example.id
category = "Administrative"
},
"test2" = {
alertname = "vm-powerOff"
alertrg = module.resource_group.resource_group_name
alertscopes = [module.resource_group.resource_group_id]
description = "Administrative alerts for vm"
operation_name = "Microsoft.Compute/virtualMachines/powerOff/action"
actionGroupID = data.azurerm_monitor_action_group.example.id
category = "Administrative"
}
}
}
module "azmonitor-metric-alerts" {
depends_on = [data.azurerm_monitor_action_group.example, data.azurerm_kubernetes_cluster.example]
source = "git::https://github.com/opsstation/terraform-azure-monitor-alerts.git?ref=v1.0.0"
name = "app"
environment = "test"
metricAlerts = {
"alert1" = {
alertName = "testing-alert"
alertResourceGroupName = module.resource_group.resource_group_name
alertScopes = [
data.azurerm_kubernetes_cluster.example.id
]
alertDescription = ""
alertEnabled = "true"
dynCriteriaMetricNamespace = "Microsoft.ContainerService/managedClusters"
dynCriteriaMetricName = "node_cpu_usage_percentage"
dynCriteriaAggregation = "Average"
dynCriteriaOperator = "GreaterThan"
dynCriteriathreshold = "1"
alertAutoMitigate = "true"
alertFrequency = "PT1M"
alertTargetResourceType = "Microsoft.ContainerService/managedClusters"
alertTargetResourceLoc = data.azurerm_kubernetes_cluster.example.location
actionGroupID = data.azurerm_monitor_action_group.example.id
},
"alert2" = {
alertName = "testing-alert2"
alertResourceGroupName = module.resource_group.resource_group_name
alertScopes = [
data.azurerm_kubernetes_cluster.example.id
]
alertDescription = ""
alertEnabled = "true"
dynCriteriaMetricNamespace = "Microsoft.ContainerService/managedClusters"
dynCriteriaMetricName = "node_memory_working_set_percentage"
dynCriteriaAggregation = "Average"
dynCriteriaOperator = "GreaterThan"
dynCriteriathreshold = "1"
alertAutoMitigate = "true"
alertFrequency = "PT1M"
alertTargetResourceType = "Microsoft.ContainerService/managedClusters"
alertTargetResourceLoc = data.azurerm_kubernetes_cluster.example.location
actionGroupID = data.azurerm_monitor_action_group.example.id
}
}
}
This example demonstrates how to create various AZURE resources using the provided modules. Adjust the input values to suit your specific requirements.
For detailed examples on how to use this module, please refer to the Examples directory within this repository.
This Terraform module is provided under the MIT License. Please see the LICENSE file for more details.
Your Name Replace MIT and Cypik with the appropriate license and your information. Feel free to expand this README with additional details or usage instructions as needed for your specific use case.
Name | Version |
---|---|
terraform | >= 1.0.0 |
azurerm | >=2.90.0 |
Name | Version |
---|---|
azurerm | >=2.90.0 |
Name | Source | Version |
---|---|---|
labels | git::https://github.com/opsstation/terraform-azure-labels.git | v1.0.0 |
Name | Type |
---|---|
azurerm_monitor_action_group.group | resource |
azurerm_monitor_activity_log_alert.main | resource |
azurerm_monitor_metric_alert.alert | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
actionGroups | n/a | map(object({ |
{} |
no |
activity_log_alert | n/a | map(object({ |
{} |
no |
environment | Environment (e.g. prod , dev , staging ). |
string |
"" |
no |
label_order | Label order, e.g. name ,application . |
list(any) |
[ |
no |
managedby | ManagedBy, eg 'OpsStation'. | string |
"" |
no |
metricAlerts | n/a | map(object({ |
{} |
no |
name | Name (e.g. app or cluster ). |
string |
"" |
no |
repository | Terraform current module repo | string |
"" |
no |
Name | Description |
---|---|
ag | n/a |
metric-alerts | n/a |