forked from Azure/terraform-azurerm-caf-enterprise-scale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresources.management.tf
117 lines (89 loc) · 3.81 KB
/
resources.management.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
resource "azurerm_resource_group" "management" {
for_each = local.azurerm_resource_group_management
provider = azurerm.management
# Mandatory resource attributes
name = each.value.template.name
location = each.value.template.location
tags = each.value.template.tags
}
resource "azurerm_log_analytics_workspace" "management" {
for_each = local.azurerm_log_analytics_workspace_management
provider = azurerm.management
# Mandatory resource attributes
name = each.value.template.name
location = each.value.template.location
resource_group_name = each.value.template.resource_group_name
# Optional resource attributes
sku = each.value.template.sku
retention_in_days = each.value.template.retention_in_days
daily_quota_gb = each.value.template.daily_quota_gb
internet_ingestion_enabled = each.value.template.internet_ingestion_enabled
internet_query_enabled = each.value.template.internet_query_enabled
tags = each.value.template.tags
# Optional resource attributes (removed for backward
# compatibility with older azurerm provider versions,
# as not currently used by Enterprise-scale)/
# Requires version = "~> 2.48.0"
# reservation_capcity_in_gb_per_day = each.value.template.reservation_capcity_in_gb_per_day
# Set explicit dependency on Resource Group deployment
depends_on = [
azurerm_resource_group.management,
]
}
resource "azurerm_log_analytics_solution" "management" {
for_each = local.azurerm_log_analytics_solution_management
provider = azurerm.management
# Mandatory resource attributes
solution_name = each.value.template.solution_name
location = each.value.template.location
resource_group_name = each.value.template.resource_group_name
workspace_resource_id = each.value.template.workspace_resource_id
workspace_name = each.value.template.workspace_name
plan {
publisher = each.value.template.plan.publisher
product = each.value.template.plan.product
}
# Optional resource attributes
tags = each.value.template.tags
# Set explicit dependency on Resource Group, Log Analytics
# workspace and Automation Account to fix issue #109.
# Ideally we would limit to specific solutions, but the
# depends_on block only supports static values.
depends_on = [
azurerm_resource_group.management,
azurerm_log_analytics_workspace.management,
azurerm_automation_account.management,
azurerm_log_analytics_linked_service.management,
]
}
resource "azurerm_automation_account" "management" {
for_each = local.azurerm_automation_account_management
provider = azurerm.management
# Mandatory resource attributes
name = each.value.template.name
location = each.value.template.location
resource_group_name = each.value.template.resource_group_name
# Optional resource attributes
sku_name = each.value.template.sku_name
tags = each.value.template.tags
# Set explicit dependency on Resource Group deployment
depends_on = [
azurerm_resource_group.management,
]
}
resource "azurerm_log_analytics_linked_service" "management" {
for_each = local.azurerm_log_analytics_linked_service_management
provider = azurerm.management
# Mandatory resource attributes
resource_group_name = each.value.template.resource_group_name
workspace_id = each.value.template.workspace_id
# Optional resource attributes
read_access_id = each.value.template.read_access_id
write_access_id = each.value.template.write_access_id
# Set explicit dependency on Resource Group, Log Analytics workspace and Automation Account deployments
depends_on = [
azurerm_resource_group.management,
azurerm_log_analytics_workspace.management,
azurerm_automation_account.management,
]
}