Skip to content

Commit ab12ca9

Browse files
feat: allow set filter on mig autoscaling metric
1 parent e226d89 commit ab12ca9

File tree

5 files changed

+7
-3
lines changed

5 files changed

+7
-3
lines changed

autogen/main.tf.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ resource "google_compute_region_autoscaler" "autoscaler" {
174174
name = lookup(metric.value, "name", null)
175175
target = lookup(metric.value, "target", null)
176176
type = lookup(metric.value, "type", null)
177+
filter = lookup(metric.value, "filter", null)
177178
}
178179
}
179180
dynamic "load_balancing_utilization" {

modules/mig/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The current version is 2.X. The following guides are available to assist with up
2222
| autoscaling\_cpu | Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#cpu_utilization | <pre>list(object({<br> target = number<br> predictive_method = string<br> }))</pre> | `[]` | no |
2323
| autoscaling\_enabled | Creates an autoscaler for the managed instance group | `string` | `"false"` | no |
2424
| autoscaling\_lb | Autoscaling, load balancing utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#load_balancing_utilization | `list(map(number))` | `[]` | no |
25-
| autoscaling\_metric | Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#metric | <pre>list(object({<br> name = string<br> target = number<br> type = string<br> }))</pre> | `[]` | no |
25+
| autoscaling\_metric | Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#metric-1 | <pre>list(object({<br> name = string<br> target = number<br> type = string<br> filter = optional(string)<br> }))</pre> | `[]` | no |
2626
| autoscaling\_mode | Operating mode of the autoscaling policy. If omitted, the default value is ON. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_autoscaler#mode | `string` | `null` | no |
2727
| autoscaling\_scale\_in\_control | Autoscaling, scale-in control block. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#scale_in_control | <pre>object({<br> fixed_replicas = number<br> percent_replicas = number<br> time_window_sec = number<br> })</pre> | <pre>{<br> "fixed_replicas": null,<br> "percent_replicas": null,<br> "time_window_sec": null<br>}</pre> | no |
2828
| cooldown\_period | The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. | `number` | `60` | no |

modules/mig/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ resource "google_compute_region_autoscaler" "autoscaler" {
158158
name = lookup(metric.value, "name", null)
159159
target = lookup(metric.value, "target", null)
160160
type = lookup(metric.value, "type", null)
161+
filter = lookup(metric.value, "filter", null)
161162
}
162163
}
163164
dynamic "load_balancing_utilization" {

modules/mig/metadata.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,13 @@ spec:
224224
}))
225225
defaultValue: []
226226
- name: autoscaling_metric
227-
description: Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#metric
227+
description: Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#metric-1
228228
varType: |-
229229
list(object({
230230
name = string
231231
target = number
232232
type = string
233+
filter = optional(string)
233234
}))
234235
defaultValue: []
235236
- name: autoscaling_lb

modules/mig/variables.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,12 @@ variable "autoscaling_cpu" {
206206
}
207207

208208
variable "autoscaling_metric" {
209-
description = "Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#metric"
209+
description = "Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#metric-1"
210210
type = list(object({
211211
name = string
212212
target = number
213213
type = string
214+
filter = optional(string)
214215
}))
215216
default = []
216217
}

0 commit comments

Comments
 (0)