|
1 | | -# resource "azurerm_log_analytics_workspace" "this" { |
2 | | -# name = "workspace-01" |
3 | | -# location = azurerm_resource_group.example.location |
4 | | -# resource_group_name = azurerm_resource_group.example.name |
5 | | -# } |
6 | | - |
7 | 1 | resource "azurerm_monitor_action_group" "this" { |
8 | 2 | name = var.name |
9 | 3 | resource_group_name = var.resource_group_name |
10 | 4 | short_name = var.short_name |
11 | 5 |
|
12 | | - # arm_role_receiver { |
13 | | - # name = "armroleaction" |
14 | | - # role_id = "de139f84-1756-47ae-9be6-808fbbe84772" |
15 | | - # use_common_alert_schema = true |
16 | | - # } |
17 | | - |
18 | | - # automation_runbook_receiver { |
19 | | - # name = "action_name_1" |
20 | | - # automation_account_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-runbooks/providers/Microsoft.Automation/automationAccounts/aaa001" |
21 | | - # runbook_name = "my runbook" |
22 | | - # webhook_resource_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-runbooks/providers/Microsoft.Automation/automationAccounts/aaa001/webHooks/webhook_alert" |
23 | | - # is_global_runbook = true |
24 | | - # service_uri = "https://s13events.azure-automation.net/webhooks?token=randomtoken" |
25 | | - # use_common_alert_schema = true |
26 | | - # } |
27 | | - |
28 | | - # azure_app_push_receiver { |
29 | | - # name = "pushtoadmin" |
30 | | - # email_address = "admin@contoso.com" |
31 | | - # } |
32 | | - |
33 | | - # azure_function_receiver { |
34 | | - # name = "funcaction" |
35 | | - # function_app_resource_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-funcapp/providers/Microsoft.Web/sites/funcapp" |
36 | | - # function_name = "myfunc" |
37 | | - # http_trigger_url = "https://example.com/trigger" |
38 | | - # use_common_alert_schema = true |
39 | | - # } |
40 | | - |
41 | 6 | dynamic "email_receiver" { |
42 | | - for_each = toset(var.email_receiver) |
| 7 | + for_each = var.email_receiver != null ? var.email_receiver : {} |
43 | 8 | content { |
44 | 9 | name = email_receiver.value.name |
45 | 10 | email_address = email_receiver.value.email_address |
46 | 11 | use_common_alert_schema = email_receiver.value.use_common_alert_schema |
47 | 12 | } |
48 | 13 | } |
49 | 14 |
|
50 | | - # email_receiver { |
51 | | - # name = "sendtoadmin" |
52 | | - # email_address = "admin@contoso.com" |
53 | | - # } |
54 | | - |
55 | | - # email_receiver { |
56 | | - # name = "sendtodevops" |
57 | | - # email_address = "devops@contoso.com" |
58 | | - # use_common_alert_schema = true |
59 | | - # } |
60 | | - |
61 | | - # event_hub_receiver { |
62 | | - # name = "sendtoeventhub" |
63 | | - # event_hub_namespace = "eventhubnamespace" |
64 | | - # event_hub_name = "eventhub1" |
65 | | - # subscription_id = "00000000-0000-0000-0000-000000000000" |
66 | | - # use_common_alert_schema = false |
67 | | - # } |
68 | | - |
69 | | - # itsm_receiver { |
70 | | - # name = "createorupdateticket" |
71 | | - # workspace_id = "${data.azurerm_client_config.current.subscription_id}|${azurerm_log_analytics_workspace.example.workspace_id}" |
72 | | - # connection_id = "53de6956-42b4-41ba-be3c-b154cdf17b13" |
73 | | - # ticket_configuration = "{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}" |
74 | | - # region = "southcentralus" |
75 | | - # } |
76 | | - |
77 | | - # logic_app_receiver { |
78 | | - # name = "logicappaction" |
79 | | - # resource_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-logicapp/providers/Microsoft.Logic/workflows/logicapp" |
80 | | - # callback_url = "https://logicapptriggerurl/..." |
81 | | - # use_common_alert_schema = true |
82 | | - # } |
| 15 | + dynamic "event_hub_receiver" { |
| 16 | + for_each = var.event_hub_receiver != null ? var.event_hub_receiver : {} |
| 17 | + content { |
| 18 | + name = event_hub_receiver.value.name |
| 19 | + event_hub_namespace = event_hub_receiver.value.event_hub_namespace |
| 20 | + event_hub_name = event_hub_receiver.value.event_hub_name |
| 21 | + subscription_id = event_hub_receiver.value.subscription_id |
| 22 | + use_common_alert_schema = event_hub_receiver.value.use_common_alert_schema |
| 23 | + } |
| 24 | + } |
83 | 25 |
|
84 | | - # sms_receiver { |
85 | | - # name = "oncallmsg" |
86 | | - # country_code = "1" |
87 | | - # phone_number = "1231231234" |
88 | | - # } |
| 26 | + dynamic "sms_receiver" { |
| 27 | + for_each = var.sms_receiver != null ? var.sms_receiver : {} |
| 28 | + content { |
| 29 | + name = sms_receiver.value.name |
| 30 | + country_code = sms_receiver.value.country_code |
| 31 | + phone_number = sms_receiver.value.phone_number |
| 32 | + } |
| 33 | + } |
89 | 34 |
|
90 | | - # voice_receiver { |
91 | | - # name = "remotesupport" |
92 | | - # country_code = "86" |
93 | | - # phone_number = "13888888888" |
94 | | - # } |
| 35 | + dynamic "voice_receiver" { |
| 36 | + for_each = var.voice_receiver != null ? var.voice_receiver : {} |
| 37 | + content { |
| 38 | + name = voice_receiver.value.name |
| 39 | + country_code = voice_receiver.value.country_code |
| 40 | + phone_number = voice_receiver.value.phone_number |
| 41 | + } |
| 42 | + } |
95 | 43 |
|
96 | 44 | dynamic "webhook_receiver" { |
97 | | - for_each = toset(var.webhook_receiver) |
| 45 | + for_each = var.webhook_receiver != null ? var.webhook_receiver : {} |
98 | 46 | content { |
99 | 47 | name = webhook_receiver.value.name |
100 | 48 | service_uri = webhook_receiver.value.service_uri |
|
0 commit comments