-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoscale.tf
56 lines (50 loc) · 1.52 KB
/
autoscale.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
resource "azurerm_monitor_autoscale_setting" "this" {
name = "autoscale"
resource_group_name = data.azurerm_resource_group.this.name
location = data.azurerm_resource_group.this.location
target_resource_id = azurerm_linux_virtual_machine_scale_set.sentry[0].id
profile {
name = "defaultProfile"
capacity {
default = var.desired_capacity
minimum = var.min_size
maximum = var.max_size
}
rule {
metric_trigger {
metric_name = "Percentage CPU"
metric_resource_id = azurerm_linux_virtual_machine_scale_set.sentry[0].id
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "GreaterThan"
threshold = 80
}
scale_action {
direction = "Increase"
type = "ChangeCount"
value = "1"
cooldown = "PT1M"
}
}
rule {
metric_trigger {
metric_name = "Percentage CPU"
metric_resource_id = azurerm_linux_virtual_machine_scale_set.sentry[0].id
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "LessThan"
threshold = 10
}
scale_action {
direction = "Decrease"
type = "ChangeCount"
value = "1"
cooldown = "PT1M"
}
}
}
}