Without this patch terraform will scale down the MIG which could cause
packets to be dropped when the auto scaler has scaled the group up in
response to traffic.
This patch follows the guidlines of the target_size terraform
documentation. "This value should always be explicitly set unless this
resource is attached to an autoscaler, in which case it should never be
set."
Resolves: #27
Example output:
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# module.multinic.google_compute_autoscaler.multinic["us-west1-b"] will be updated in-place
~ resource "google_compute_autoscaler" "multinic" {
creation_timestamp = "2020-12-23T11:35:29.284-08:00"
id = "projects/multinic-networks-534d/zones/us-west1-b/autoscalers/multinic-us-west1-b"
name = "multinic-us-west1-b"
project = "multinic-networks-534d"
self_link = "https://www.googleapis.com/compute/v1/projects/multinic-networks-534d/zones/us-west1-b/autoscalers/multinic-us-west1-b"
target = "https://www.googleapis.com/compute/v1/projects/multinic-networks-534d/zones/us-west1-b/instanceGroupManagers/multinic-us-west1-b"
zone = "https://www.googleapis.com/compute/v1/projects/multinic-networks-534d/zones/us-west1-b"
~ autoscaling_policy {
cooldown_period = 45
max_replicas = 4
~ min_replicas = 1 -> 2
mode = "ON"
cpu_utilization {
target = 0.2
}
}
}
# module.multinic.google_compute_autoscaler.multinic["us-west1-c"] will be updated in-place
~ resource "google_compute_autoscaler" "multinic" {
creation_timestamp = "2020-12-23T11:35:29.306-08:00"
id = "projects/multinic-networks-534d/zones/us-west1-c/autoscalers/multinic-us-west1-c"
name = "multinic-us-west1-c"
project = "multinic-networks-534d"
self_link = "https://www.googleapis.com/compute/v1/projects/multinic-networks-534d/zones/us-west1-c/autoscalers/multinic-us-west1-c"
target = "https://www.googleapis.com/compute/v1/projects/multinic-networks-534d/zones/us-west1-c/instanceGroupManagers/multinic-us-west1-c"
zone = "https://www.googleapis.com/compute/v1/projects/multinic-networks-534d/zones/us-west1-c"
~ autoscaling_policy {
cooldown_period = 45
max_replicas = 4
~ min_replicas = 1 -> 2
mode = "ON"
cpu_utilization {
target = 0.2
}
}
}
Plan: 0 to add, 2 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
module.multinic.google_compute_autoscaler.multinic["us-west1-b"]: Modifying... [id=projects/multinic-networks-534d/zones/us-west1-b/autoscalers/multinic-us-west1-b]
module.multinic.google_compute_autoscaler.multinic["us-west1-c"]: Modifying... [id=projects/multinic-networks-534d/zones/us-west1-c/autoscalers/multinic-us-west1-c]
module.multinic.google_compute_autoscaler.multinic["us-west1-c"]: Still modifying... [id=projects/multinic-networks-534d/zones/us-west1-c/autoscalers/multinic-us-west1-c, 10s elapsed]
module.multinic.google_compute_autoscaler.multinic["us-west1-b"]: Still modifying... [id=projects/multinic-networks-534d/zones/us-west1-b/autoscalers/multinic-us-west1-b, 10s elapsed]
module.multinic.google_compute_autoscaler.multinic["us-west1-c"]: Modifications complete after 12s [id=projects/multinic-networks-534d/zones/us-west1-c/autoscalers/multinic-us-west1-c]
module.multinic.google_compute_autoscaler.multinic["us-west1-b"]: Modifications complete after 13s [id=projects/multinic-networks-534d/zones/us-west1-b/autoscalers/multinic-us-west1-b]
Apply complete! Resources: 0 added, 2 changed, 0 destroyed.
Without this patch terraform will scale down the MIG which could cause packets to be dropped when the auto scaler has scaled the group up in response to traffic.
This patch follows the guidlines of the target_size terraform documentation. "This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set."
Resolves: #27
Example output: