Skip to content

Commit 019e3a4

Browse files
authored
feat: [mig] Add "autoscaling_mode" variable (#224)
1 parent d4e0e87 commit 019e3a4

File tree

8 files changed

+23
-0
lines changed

8 files changed

+23
-0
lines changed

autogen/main.tf.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ resource "google_compute_region_autoscaler" "autoscaler" {
132132
max_replicas = var.max_replicas
133133
min_replicas = var.min_replicas
134134
cooldown_period = var.cooldown_period
135+
mode = var.autoscaling_mode
135136
dynamic "scale_in_control" {
136137
for_each = local.autoscaling_scale_in_enabled ? [var.autoscaling_scale_in_control] : []
137138
content {

autogen/variables.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ variable "cooldown_period" {
176176
default = 60
177177
}
178178

179+
variable "autoscaling_mode" {
180+
description = "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"
181+
type = string
182+
default = null
183+
}
184+
179185
variable "autoscaling_cpu" {
180186
description = "Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#cpu_utilization"
181187
type = list(map(number))

modules/mig/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The current version is 2.X. The following guides are available to assist with up
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.html#load_balancing_utilization | `list(map(number))` | `[]` | no |
2525
| autoscaling\_metric | Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#metric | <pre>list(object({<br> name = string<br> target = number<br> type = string<br> }))</pre> | `[]` | no |
26+
| 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 |
2627
| autoscaling\_scale\_in\_control | Autoscaling, scale-in control block. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#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 |
2728
| cooldown\_period | The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. | `number` | `60` | no |
2829
| distribution\_policy\_zones | The distribution policy, i.e. which zone(s) should instances be create in. Default is all zones in given region. | `list(string)` | `[]` | no |

modules/mig/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ resource "google_compute_region_autoscaler" "autoscaler" {
116116
max_replicas = var.max_replicas
117117
min_replicas = var.min_replicas
118118
cooldown_period = var.cooldown_period
119+
mode = var.autoscaling_mode
119120
dynamic "scale_in_control" {
120121
for_each = local.autoscaling_scale_in_enabled ? [var.autoscaling_scale_in_control] : []
121122
content {

modules/mig/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ variable "cooldown_period" {
161161
default = 60
162162
}
163163

164+
variable "autoscaling_mode" {
165+
description = "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"
166+
type = string
167+
default = null
168+
}
169+
164170
variable "autoscaling_cpu" {
165171
description = "Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#cpu_utilization"
166172
type = list(map(number))

modules/mig_with_percent/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The current version is 2.X. The following guides are available to assist with up
2222
| autoscaling\_enabled | Creates an autoscaler for the managed instance group | `string` | `"false"` | no |
2323
| autoscaling\_lb | Autoscaling, load balancing utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#load_balancing_utilization | `list(map(number))` | `[]` | no |
2424
| autoscaling\_metric | Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#metric | <pre>list(object({<br> name = string<br> target = number<br> type = string<br> }))</pre> | `[]` | no |
25+
| 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 |
2526
| autoscaling\_scale\_in\_control | Autoscaling, scale-in control block. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#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 |
2627
| cooldown\_period | The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. | `number` | `60` | no |
2728
| distribution\_policy\_zones | The distribution policy, i.e. which zone(s) should instances be create in. Default is all zones in given region. | `list(string)` | `[]` | no |

modules/mig_with_percent/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ resource "google_compute_region_autoscaler" "autoscaler" {
125125
max_replicas = var.max_replicas
126126
min_replicas = var.min_replicas
127127
cooldown_period = var.cooldown_period
128+
mode = var.autoscaling_mode
128129
dynamic "scale_in_control" {
129130
for_each = local.autoscaling_scale_in_enabled ? [var.autoscaling_scale_in_control] : []
130131
content {

modules/mig_with_percent/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ variable "cooldown_period" {
169169
default = 60
170170
}
171171

172+
variable "autoscaling_mode" {
173+
description = "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"
174+
type = string
175+
default = null
176+
}
177+
172178
variable "autoscaling_cpu" {
173179
description = "Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#cpu_utilization"
174180
type = list(map(number))

0 commit comments

Comments
 (0)