Skip to content

Commit dd71466

Browse files
authored
fix: Set target_size to null when autoscaling is enabled in MIG (#65)
* Fixes #64 Signed-off-by: Ali Sattari <[email protected]> * plz work Signed-off-by: Ali Sattari <[email protected]> * Adding some pause for MIG to spinup new instances that match min_replicas Signed-off-by: Ali Sattari <[email protected]>
1 parent 8308fa0 commit dd71466

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

.kitchen.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ suites:
5555
command_timeout: 1800
5656
root_module_directory: test/fixtures/mig/simple
5757
- name: mig_autoscaler
58+
lifecycle:
59+
pre_verify:
60+
# Wait for instances to be created
61+
- local: sleep 300
5862
driver:
5963
name: terraform
6064
command_timeout: 1800

autogen/main.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ resource "google_compute_region_instance_group_manager" "{{ module_name }}" {
7171
}
7272
}
7373
target_pools = var.target_pools
74-
target_size = var.autoscaling_enabled ? var.min_replicas : var.target_size
74+
target_size = var.autoscaling_enabled ? null : var.target_size
7575

7676
dynamic "auto_healing_policies" {
7777
for_each = local.healthchecks

modules/mig/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ resource "google_compute_region_instance_group_manager" "mig" {
5353
}
5454
}
5555
target_pools = var.target_pools
56-
target_size = var.autoscaling_enabled ? var.min_replicas : var.target_size
56+
target_size = var.autoscaling_enabled ? null : var.target_size
5757

5858
dynamic "auto_healing_policies" {
5959
for_each = local.healthchecks

modules/mig_with_percent/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ resource "google_compute_region_instance_group_manager" "mig_with_percent" {
6161
}
6262
}
6363
target_pools = var.target_pools
64-
target_size = var.autoscaling_enabled ? var.min_replicas : var.target_size
64+
target_size = var.autoscaling_enabled ? null : var.target_size
6565

6666
dynamic "auto_healing_policies" {
6767
for_each = local.healthchecks

0 commit comments

Comments
 (0)