github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/azure/terraform-azure-actiongroup-example/main.tf (about) 1 # --------------------------------------------------------------------------------------------------------------------- 2 # DEPLOY AN ACTION GROUP 3 # This is an example of how to deploy an Azure Action Group to be used for Azure Alerts 4 # --------------------------------------------------------------------------------------------------------------------- 5 6 # --------------------------------------------------------------------------------------------------------------------- 7 # CONFIGURE OUR AZURE CONNECTION 8 # --------------------------------------------------------------------------------------------------------------------- 9 10 provider "azurerm" { 11 features {} 12 } 13 14 # --------------------------------------------------------------------------------------------------------------------- 15 # DEPLOY A RESOURCE GROUP 16 # --------------------------------------------------------------------------------------------------------------------- 17 18 resource "azurerm_resource_group" "rg" { 19 name = var.resource_group_name 20 location = var.location 21 } 22 23 # --------------------------------------------------------------------------------------------------------------------- 24 # DEPLOY AN AZURE APP SERVICE PLAN 25 # --------------------------------------------------------------------------------------------------------------------- 26 27 resource "azurerm_monitor_action_group" "actionGroup" { 28 name = var.app_name 29 resource_group_name = azurerm_resource_group.rg.name 30 short_name = var.short_name 31 tags = azurerm_resource_group.rg.tags 32 33 dynamic "email_receiver" { 34 for_each = var.enable_email ? ["email_receiver"] : [] 35 content { 36 name = var.email_name 37 email_address = var.email_address 38 use_common_alert_schema = true 39 } 40 } 41 42 dynamic "sms_receiver" { 43 for_each = var.enable_sms ? ["sms_receiver"] : [] 44 content { 45 name = var.sms_name 46 country_code = var.sms_country_code 47 phone_number = var.sms_phone_number 48 } 49 } 50 51 dynamic "webhook_receiver" { 52 for_each = var.enable_webhook ? ["webhook_receiver"] : [] 53 content { 54 name = var.webhook_name 55 service_uri = var.webhook_service_uri 56 use_common_alert_schema = true 57 } 58 } 59 60 }