From db57cc8f323585a0de5883ecd6e677950a1048a8 Mon Sep 17 00:00:00 2001 From: John Schmidt Date: Wed, 30 Jan 2019 16:29:24 -0800 Subject: [PATCH] Added test case for PR https://github.com/terraform-providers/terraform-provider-azurerm/pull/2806 --- examples/vmss-ubuntu/main.tf | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/examples/vmss-ubuntu/main.tf b/examples/vmss-ubuntu/main.tf index 4701a0bc3551..82fb2a28b991 100644 --- a/examples/vmss-ubuntu/main.tf +++ b/examples/vmss-ubuntu/main.tf @@ -127,3 +127,59 @@ resource "azurerm_virtual_machine_scale_set" "scaleset" { version = "latest" } } + +resource "azurerm_autoscale_setting" "autoscale-cpu" { + name = "autoscale-cpu" + target_resource_id = "${azurerm_virtual_machine_scale_set.scaleset.id}" + location = "${azurerm_resource_group.rg.location}" + resource_group_name = "${azurerm_resource_group.rg.name}" + + profile { + name = "autoscale-cpu" + + capacity { + default = "${var.instance_count}" + minimum = 0 + maximum = 1000 + } + + rule { + metric_trigger { + metric_name = "Percentage CPU" + metric_resource_id = "${azurerm_virtual_machine_scale_set.scaleset.id}" + time_grain = "PT1M" + statistic = "Average" + time_window = "PT5M" + time_aggregation = "Average" + operator = "GreaterThan" + threshold = 75 + } + + scale_action { + direction = "Increase" + type = "ChangeCount" + value = "1" + cooldown = "PT1M" + } + } + + rule { + metric_trigger { + metric_name = "Percentage CPU" + metric_resource_id = "${azurerm_virtual_machine_scale_set.scaleset.id}" + time_grain = "PT1M" + statistic = "Average" + time_window = "PT5M" + time_aggregation = "Average" + operator = "LessThan" + threshold = 15 + } + scale_action { + direction = "Decrease" + type = "ChangeCount" + value = "1" + cooldown = "PT1M" + } + } + } +}