This repository has been archived by the owner on Jun 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
44 lines (36 loc) · 1.79 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#----------------------------------------------------------
# Resource Group, Log Analytics Data Resources
#----------------------------------------------------------
data "azurerm_resource_group" "rg" {
name = var.resource_group_name
}
data "azurerm_log_analytics_workspace" "logws" {
name = var.log_analytics_workspace_name
resource_group_name = data.azurerm_resource_group.rg.name
}
#----------------------------------------------------------
# Current Subscription Data Resources
#----------------------------------------------------------
data "azurerm_subscription" "current" {}
#----------------------------------------------------------
# Azure Security Center Workspace Resource
#----------------------------------------------------------
resource "azurerm_security_center_workspace" "main" {
scope = var.scope_resource_id == null ? data.azurerm_subscription.current.id : var.scope_resource_id
workspace_id = data.azurerm_log_analytics_workspace.logws.id
}
#----------------------------------------------------------
# Azure Security Center Subscription Pricing Resources
#----------------------------------------------------------
resource "azurerm_security_center_subscription_pricing" "main" {
tier = var.security_center_subscription_pricing
}
#----------------------------------------------------------
# Azure Security Center Contact Resources
#----------------------------------------------------------
resource "azurerm_security_center_contact" "main" {
email = lookup(var.security_center_contacts, "email")
phone = lookup(var.security_center_contacts, "phone", null)
alert_notifications = lookup(var.security_center_contacts, "alert_notifications", true)
alerts_to_admins = lookup(var.security_center_contacts, "alerts_to_admins", true)
}