Skip to content

Commit

Permalink
feat: [mig] Add "autoscaling_mode" variable (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
legal90 committed Jan 19, 2022
1 parent d4e0e87 commit 019e3a4
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions autogen/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ resource "google_compute_region_autoscaler" "autoscaler" {
max_replicas = var.max_replicas
min_replicas = var.min_replicas
cooldown_period = var.cooldown_period
mode = var.autoscaling_mode
dynamic "scale_in_control" {
for_each = local.autoscaling_scale_in_enabled ? [var.autoscaling_scale_in_control] : []
content {
Expand Down
6 changes: 6 additions & 0 deletions autogen/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ variable "cooldown_period" {
default = 60
}

variable "autoscaling_mode" {
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"
type = string
default = null
}

variable "autoscaling_cpu" {
description = "Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#cpu_utilization"
type = list(map(number))
Expand Down
1 change: 1 addition & 0 deletions modules/mig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The current version is 2.X. The following guides are available to assist with up
| autoscaling\_enabled | Creates an autoscaler for the managed instance group | `string` | `"false"` | no |
| 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 |
| 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 |
| 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 |
| 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 |
| cooldown\_period | The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. | `number` | `60` | no |
| 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 |
Expand Down
1 change: 1 addition & 0 deletions modules/mig/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ resource "google_compute_region_autoscaler" "autoscaler" {
max_replicas = var.max_replicas
min_replicas = var.min_replicas
cooldown_period = var.cooldown_period
mode = var.autoscaling_mode
dynamic "scale_in_control" {
for_each = local.autoscaling_scale_in_enabled ? [var.autoscaling_scale_in_control] : []
content {
Expand Down
6 changes: 6 additions & 0 deletions modules/mig/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ variable "cooldown_period" {
default = 60
}

variable "autoscaling_mode" {
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"
type = string
default = null
}

variable "autoscaling_cpu" {
description = "Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#cpu_utilization"
type = list(map(number))
Expand Down
1 change: 1 addition & 0 deletions modules/mig_with_percent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The current version is 2.X. The following guides are available to assist with up
| autoscaling\_enabled | Creates an autoscaler for the managed instance group | `string` | `"false"` | no |
| 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 |
| 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 |
| 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 |
| 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 |
| cooldown\_period | The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. | `number` | `60` | no |
| 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 |
Expand Down
1 change: 1 addition & 0 deletions modules/mig_with_percent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ resource "google_compute_region_autoscaler" "autoscaler" {
max_replicas = var.max_replicas
min_replicas = var.min_replicas
cooldown_period = var.cooldown_period
mode = var.autoscaling_mode
dynamic "scale_in_control" {
for_each = local.autoscaling_scale_in_enabled ? [var.autoscaling_scale_in_control] : []
content {
Expand Down
6 changes: 6 additions & 0 deletions modules/mig_with_percent/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ variable "cooldown_period" {
default = 60
}

variable "autoscaling_mode" {
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"
type = string
default = null
}

variable "autoscaling_cpu" {
description = "Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#cpu_utilization"
type = list(map(number))
Expand Down

0 comments on commit 019e3a4

Please sign in to comment.