Skip to content

Commit

Permalink
Expose distribution_policy_target_shape setting for MIGs
Browse files Browse the repository at this point in the history
  • Loading branch information
tpdownes committed Jul 18, 2023
1 parent 31a9d8e commit b4f2251
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 3 deletions.
3 changes: 2 additions & 1 deletion autogen/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ resource "google_compute_region_instance_group_manager" "{{ module_name }}" {
}
}

distribution_policy_zones = local.distribution_policy_zones
distribution_policy_target_shape = var.distribution_policy_target_shape
distribution_policy_zones = local.distribution_policy_zones
dynamic "update_policy" {
for_each = var.update_policy
content {
Expand Down
7 changes: 7 additions & 0 deletions autogen/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,19 @@ variable "target_pools" {
default = []
}

variable "distribution_policy_target_shape" {
description = "MIG target distribution shape (EVEN, BALANCED, ANY, ANY_SINGLE_ZONE)"
type = string
default = null
}

variable "distribution_policy_zones" {
description = "The distribution policy, i.e. which zone(s) should instances be create in. Default is all zones in given region."
type = list(string)
default = []
}


#################
# Stateful disks
#################
Expand Down
1 change: 1 addition & 0 deletions modules/mig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The current version is 2.X. The following guides are available to assist with up
| 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#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\_target\_shape | MIG target distribution shape (EVEN, BALANCED, ANY, ANY\_SINGLE\_ZONE) | `string` | `null` | 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 |
| health\_check | Health check to determine whether instances are responsive and able to do work | <pre>object({<br> type = string<br> initial_delay_sec = number<br> check_interval_sec = number<br> healthy_threshold = number<br> timeout_sec = number<br> unhealthy_threshold = number<br> response = string<br> proxy_header = string<br> port = number<br> request = string<br> request_path = string<br> host = string<br> enable_logging = bool<br> })</pre> | <pre>{<br> "check_interval_sec": 30,<br> "enable_logging": false,<br> "healthy_threshold": 1,<br> "host": "",<br> "initial_delay_sec": 30,<br> "port": 80,<br> "proxy_header": "NONE",<br> "request": "",<br> "request_path": "/",<br> "response": "",<br> "timeout_sec": 10,<br> "type": "",<br> "unhealthy_threshold": 5<br>}</pre> | no |
| health\_check\_name | Health check name. When variable is empty, name will be derived from var.hostname. | `string` | `""` | no |
Expand Down
3 changes: 2 additions & 1 deletion modules/mig/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ resource "google_compute_region_instance_group_manager" "mig" {
}
}

distribution_policy_zones = local.distribution_policy_zones
distribution_policy_target_shape = var.distribution_policy_target_shape
distribution_policy_zones = local.distribution_policy_zones
dynamic "update_policy" {
for_each = var.update_policy
content {
Expand Down
7 changes: 7 additions & 0 deletions modules/mig/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,19 @@ variable "target_pools" {
default = []
}

variable "distribution_policy_target_shape" {
description = "MIG target distribution shape (EVEN, BALANCED, ANY, ANY_SINGLE_ZONE)"
type = string
default = null
}

variable "distribution_policy_zones" {
description = "The distribution policy, i.e. which zone(s) should instances be create in. Default is all zones in given region."
type = list(string)
default = []
}


#################
# Stateful disks
#################
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 @@ -25,6 +25,7 @@ The current version is 2.X. The following guides are available to assist with up
| 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#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\_target\_shape | MIG target distribution shape (EVEN, BALANCED, ANY, ANY\_SINGLE\_ZONE) | `string` | `null` | 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 |
| health\_check | Health check to determine whether instances are responsive and able to do work | <pre>object({<br> type = string<br> initial_delay_sec = number<br> check_interval_sec = number<br> healthy_threshold = number<br> timeout_sec = number<br> unhealthy_threshold = number<br> response = string<br> proxy_header = string<br> port = number<br> request = string<br> request_path = string<br> host = string<br> enable_logging = bool<br> })</pre> | <pre>{<br> "check_interval_sec": 30,<br> "enable_logging": false,<br> "healthy_threshold": 1,<br> "host": "",<br> "initial_delay_sec": 30,<br> "port": 80,<br> "proxy_header": "NONE",<br> "request": "",<br> "request_path": "/",<br> "response": "",<br> "timeout_sec": 10,<br> "type": "",<br> "unhealthy_threshold": 5<br>}</pre> | no |
| health\_check\_name | Health check name. When variable is empty, name will be derived from var.hostname. | `string` | `""` | no |
Expand Down
3 changes: 2 additions & 1 deletion modules/mig_with_percent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ resource "google_compute_region_instance_group_manager" "mig_with_percent" {
}
}

distribution_policy_zones = local.distribution_policy_zones
distribution_policy_target_shape = var.distribution_policy_target_shape
distribution_policy_zones = local.distribution_policy_zones
dynamic "update_policy" {
for_each = var.update_policy
content {
Expand Down
7 changes: 7 additions & 0 deletions modules/mig_with_percent/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,19 @@ variable "target_pools" {
default = []
}

variable "distribution_policy_target_shape" {
description = "MIG target distribution shape (EVEN, BALANCED, ANY, ANY_SINGLE_ZONE)"
type = string
default = null
}

variable "distribution_policy_zones" {
description = "The distribution policy, i.e. which zone(s) should instances be create in. Default is all zones in given region."
type = list(string)
default = []
}


#################
# Stateful disks
#################
Expand Down

0 comments on commit b4f2251

Please sign in to comment.