Skip to content

Commit 22843de

Browse files
authored
feat: Adds replacement_method key to update_policy input to support Stateful MIG (#189)
BREAKING CHANGE: `update_policy` must now include `replacement_method`.
1 parent 87c753f commit 22843de

File tree

9 files changed

+9
-2
lines changed

9 files changed

+9
-2
lines changed

autogen/main.tf.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ resource "google_compute_region_instance_group_manager" "{{ module_name }}" {
101101
max_unavailable_fixed = lookup(update_policy.value, "max_unavailable_fixed", null)
102102
max_unavailable_percent = lookup(update_policy.value, "max_unavailable_percent", null)
103103
min_ready_sec = lookup(update_policy.value, "min_ready_sec", null)
104+
replacement_method = lookup(update_policy.value, "replacement_method", null)
104105
minimal_action = update_policy.value.minimal_action
105106
type = update_policy.value.type
106107
}

autogen/variables.tf.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ variable "update_policy" {
9898
max_unavailable_fixed = number
9999
max_unavailable_percent = number
100100
min_ready_sec = number
101+
replacement_method = string
101102
minimal_action = string
102103
type = string
103104
}))

examples/mig/full/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ variable "update_policy" {
193193
max_unavailable_fixed = number
194194
max_unavailable_percent = number
195195
min_ready_sec = number
196+
replacement_method = string
196197
minimal_action = string
197198
type = string
198199
}))

modules/mig/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The current version is 2.X. The following guides are available to assist with up
4343
| subnetwork\_project | The project that subnetwork belongs to | `string` | `""` | no |
4444
| target\_pools | The target load balancing pools to assign this group to. | `list(string)` | `[]` | no |
4545
| target\_size | The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set. | `number` | `1` | no |
46-
| update\_policy | The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager.html#rolling_update_policy | <pre>list(object({<br> max_surge_fixed = number<br> instance_redistribution_type = string<br> max_surge_percent = number<br> max_unavailable_fixed = number<br> max_unavailable_percent = number<br> min_ready_sec = number<br> minimal_action = string<br> type = string<br> }))</pre> | `[]` | no |
46+
| update\_policy | The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager.html#rolling_update_policy | <pre>list(object({<br> max_surge_fixed = number<br> instance_redistribution_type = string<br> max_surge_percent = number<br> max_unavailable_fixed = number<br> max_unavailable_percent = number<br> min_ready_sec = number<br> replacement_method = string<br> minimal_action = string<br> type = string<br> }))</pre> | `[]` | no |
4747
| wait\_for\_instances | Whether to wait for all instances to be created/updated before returning. Note that if this is set to true and the operation does not succeed, Terraform will continue trying until it times out. | `string` | `"false"` | no |
4848

4949
## Outputs

modules/mig/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ resource "google_compute_region_instance_group_manager" "mig" {
8585
max_unavailable_fixed = lookup(update_policy.value, "max_unavailable_fixed", null)
8686
max_unavailable_percent = lookup(update_policy.value, "max_unavailable_percent", null)
8787
min_ready_sec = lookup(update_policy.value, "min_ready_sec", null)
88+
replacement_method = lookup(update_policy.value, "replacement_method", null)
8889
minimal_action = update_policy.value.minimal_action
8990
type = update_policy.value.type
9091
}

modules/mig/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ variable "update_policy" {
8383
max_unavailable_fixed = number
8484
max_unavailable_percent = number
8585
min_ready_sec = number
86+
replacement_method = string
8687
minimal_action = string
8788
type = string
8889
}))

modules/mig_with_percent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The current version is 2.X. The following guides are available to assist with up
4444
| subnetwork\_project | The project that subnetwork belongs to | `string` | `""` | no |
4545
| target\_pools | The target load balancing pools to assign this group to. | `list(string)` | `[]` | no |
4646
| target\_size | The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set. | `number` | `1` | no |
47-
| update\_policy | The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager.html#rolling_update_policy | <pre>list(object({<br> max_surge_fixed = number<br> instance_redistribution_type = string<br> max_surge_percent = number<br> max_unavailable_fixed = number<br> max_unavailable_percent = number<br> min_ready_sec = number<br> minimal_action = string<br> type = string<br> }))</pre> | `[]` | no |
47+
| update\_policy | The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager.html#rolling_update_policy | <pre>list(object({<br> max_surge_fixed = number<br> instance_redistribution_type = string<br> max_surge_percent = number<br> max_unavailable_fixed = number<br> max_unavailable_percent = number<br> min_ready_sec = number<br> replacement_method = string<br> minimal_action = string<br> type = string<br> }))</pre> | `[]` | no |
4848
| wait\_for\_instances | Whether to wait for all instances to be created/updated before returning. Note that if this is set to true and the operation does not succeed, Terraform will continue trying until it times out. | `string` | `"false"` | no |
4949

5050
## Outputs

modules/mig_with_percent/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ resource "google_compute_region_instance_group_manager" "mig_with_percent" {
9494
max_unavailable_fixed = lookup(update_policy.value, "max_unavailable_fixed", null)
9595
max_unavailable_percent = lookup(update_policy.value, "max_unavailable_percent", null)
9696
min_ready_sec = lookup(update_policy.value, "min_ready_sec", null)
97+
replacement_method = lookup(update_policy.value, "replacement_method", null)
9798
minimal_action = update_policy.value.minimal_action
9899
type = update_policy.value.type
99100
}

modules/mig_with_percent/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ variable "update_policy" {
9191
max_unavailable_fixed = number
9292
max_unavailable_percent = number
9393
min_ready_sec = number
94+
replacement_method = string
9495
minimal_action = string
9596
type = string
9697
}))

0 commit comments

Comments
 (0)