-
Notifications
You must be signed in to change notification settings - Fork 0
/
r-extensions.tf
62 lines (56 loc) · 2.15 KB
/
r-extensions.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
locals {
common_extensions = [
{
name = "NetworkWatcherAgent"
publisher = "Microsoft.Azure.NetworkWatcher"
type = format("NetworkWatcherAgent%s", local.image_full.operating_system)
type_handler_version = "1.0"
auto_upgrade_minor_version = true
automatic_upgrade_enabled = true
},
{
name = "AzureMonitorAgent"
publisher = "Microsoft.Azure.Monitor"
type = format("AzureMonitor%sAgent", local.image_full.operating_system)
type_handler_version = "1.0"
auto_upgrade_minor_version = true
automatic_upgrade_enabled = true
},
{
name = "AzurePolicy"
publisher = "Microsoft.GuestConfiguration"
type = format("Configurationfor%s", local.image_full.operating_system)
type_handler_version = "1.0"
auto_upgrade_minor_version = true
automatic_upgrade_enabled = true
},
]
windows_extenstion = [
{
name = "AntiMalware"
publisher = "Microsoft.Azure.Security"
type = "IaaSAntimalware"
type_handler_version = "1.0"
auto_upgrade_minor_version = true
automatic_upgrade_enabled = false
},
]
linux_extensions = []
}
resource "azurerm_virtual_machine_extension" "this" {
for_each = { for element in
concat(
local.common_extensions,
(local.is_windows ? local.windows_extenstion : []),
(local.is_linux ? local.linux_extensions : [])
) :
element.name => element if contains(var.extensions, element.name) && var.allow_extension_operations
}
virtual_machine_id = local.virtual_machine.id
auto_upgrade_minor_version = each.value.auto_upgrade_minor_version
automatic_upgrade_enabled = each.value.automatic_upgrade_enabled
name = each.value.name
publisher = each.value.publisher
type = each.value.type
type_handler_version = each.value.type_handler_version
}