-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoption-40-MicrosoftMonitoringAgent.tf
42 lines (34 loc) · 1.18 KB
/
option-40-MicrosoftMonitoringAgent.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
/*
Example:
monitoringAgent = {
log_analytics_workspace_name = "somename"
log_analytics_workspace_resource_group_name = "someRGName"
}
*/
variable "monitoringAgent" {
description = "Should the VM be monitored"
default = null
}
resource "azurerm_virtual_machine_extension" "MicrosoftMonitoringAgent" {
count = var.monitoringAgent == null ? 0 : 1
name = "MicrosoftMonitoringAgent"
depends_on = [azurerm_virtual_machine_extension.DAAgentForWindows]
location = var.location
resource_group_name = var.resource_group_name
virtual_machine_name = azurerm_virtual_machine.VM.name
publisher = "Microsoft.EnterpriseCloud.Monitoring"
type = "MicrosoftMonitoringAgent"
type_handler_version = "1.0"
auto_upgrade_minor_version = true
settings = <<SETTINGS
{
"workspaceId": "${var.monitoringAgent.workspace_id}"
}
SETTINGS
protected_settings = <<PROTECTED_SETTINGS
{
"workspaceKey": "${var.monitoringAgent.primary_shared_key}"
}
PROTECTED_SETTINGS
tags = var.tags
}