-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoscaling.tf
56 lines (51 loc) · 1.46 KB
/
autoscaling.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" "scale_out" {
count = var.create_service_plan == true ? 1 : 0
name = azurerm_service_plan.this[0].name
resource_group_name = var.resource_group_name
location = var.location
target_resource_id = azurerm_service_plan.this[0].id
profile {
name = "Scale out condition"
capacity {
default = 1
minimum = 1
maximum = 6
}
rule {
metric_trigger {
metric_name = "CpuPercentage"
metric_resource_id = azurerm_service_plan.this[0].id
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "GreaterThan"
threshold = 60
}
scale_action {
direction = "Increase"
type = "ChangeCount"
value = "2"
cooldown = "PT5M"
}
}
rule {
metric_trigger {
metric_name = "CpuPercentage"
metric_resource_id = azurerm_service_plan.this[0].id
time_grain = "PT1M"
statistic = "Average"
time_window = "PT5M"
time_aggregation = "Average"
operator = "LessThan"
threshold = 40
}
scale_action {
direction = "Decrease"
type = "ChangeCount"
value = "2"
cooldown = "PT2M"
}
}
}
}