Skip to content

Commit

Permalink
feat(autoscale): Added metric filter for autoscale regional MIG (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
horiagunica authored Dec 16, 2024
1 parent 73cd8f3 commit f45c72b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion examples/vpc_peering_common_with_autoscale/example.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,11 @@ autoscale_common = {
autoscaler_metrics = {
"custom.googleapis.com/VMSeries/panSessionUtilization" = {
target = 70
filter = "resource.type = \"gce_instance\""
}
"custom.googleapis.com/VMSeries/panSessionThroughputKbps" = {
target = 700000
filter = "resource.type = \"gce_instance\""
}
}
}
Expand Down Expand Up @@ -339,4 +341,5 @@ lbs_external = {
http_health_check_port = "80"
http_health_check_request_path = "/php/login.php"
}
}
}

5 changes: 4 additions & 1 deletion examples/vpc_peering_dedicated_with_autoscale/example.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,11 @@ autoscale_common = {
autoscaler_metrics = {
"custom.googleapis.com/VMSeries/panSessionUtilization" = {
target = 70
filter = "resource.type = \"gce_instance\""
}
"custom.googleapis.com/VMSeries/panSessionThroughputKbps" = {
target = 700000
filter = "resource.type = \"gce_instance\""
}
}
}
Expand Down Expand Up @@ -391,4 +393,5 @@ lbs_external = {
http_health_check_port = "80"
http_health_check_request_path = "/php/login.php"
}
}
}

4 changes: 3 additions & 1 deletion modules/autoscale/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ resource "google_compute_region_autoscaler" "regional" {
name = metric.key
type = try(metric.value.type, "GAUGE")
target = metric.value.target
filter = try(metric.value.filter, null)
}
}

Expand Down Expand Up @@ -374,4 +375,5 @@ resource "google_project_iam_member" "delicensing_cfn_invoker" {
project = var.project_id
role = "roles/run.invoker"
member = "serviceAccount:${data.google_compute_default_service_account.main.email}"
}
}

0 comments on commit f45c72b

Please sign in to comment.