Skip to content

Commit 109ce50

Browse files
feat(compute): Promote instanceLifecyclePolicy.onRepair.allowChanging… (#18104)
1 parent fea0fa5 commit 109ce50

8 files changed

Lines changed: 4 additions & 52 deletions

mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager.go.tmpl

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ func ResourceComputeInstanceGroupManager() *schema.Resource {
378378
Description: `Specifies whether to apply the group's latest configuration when repairing a VM. Valid options are: YES, NO. If YES and you updated the group's instance template or per-instance configurations after the VM was created, then these changes are applied when VM is repaired. If NO (default), then updates are applied in accordance with the group's update policy type.`,
379379
},
380380

381-
{{- if ne $.TargetVersionName `ga` }}
382381
"on_repair": {
383382
Type: schema.TypeList,
384383
Computed: true,
@@ -397,7 +396,6 @@ func ResourceComputeInstanceGroupManager() *schema.Resource {
397396
},
398397
},
399398
},
400-
{{- end }}
401399

402400
},
403401
},
@@ -1822,9 +1820,7 @@ func expandInstanceLifecyclePolicy(configured []interface{}) *compute.InstanceGr
18221820
instanceLifecyclePolicy.DefaultActionOnFailure = data["default_action_on_failure"].(string)
18231821
instanceLifecyclePolicy.OnFailedHealthCheck = data["on_failed_health_check"].(string)
18241822

1825-
{{- if ne $.TargetVersionName `ga` }}
18261823
instanceLifecyclePolicy.OnRepair = expandOnRepair(data["on_repair"].([]any))
1827-
{{- end }}
18281824
}
18291825
return instanceLifecyclePolicy
18301826
}
@@ -1837,14 +1833,11 @@ func expandInstanceLifecyclePolicyV2(configured []interface{}) map[string]interf
18371833
instanceLifecyclePolicy["defaultActionOnFailure"] = data["default_action_on_failure"].(string)
18381834
instanceLifecyclePolicy["onFailedHealthCheck"] = data["on_failed_health_check"].(string)
18391835

1840-
{{- if ne $.TargetVersionName `ga` }}
18411836
instanceLifecyclePolicy["onRepair"] = expandOnRepairV2(data["on_repair"].([]any))
1842-
{{- end }}
18431837
}
18441838
return instanceLifecyclePolicy
18451839
}
18461840

1847-
{{ if ne $.TargetVersionName `ga` -}}
18481841
func expandOnRepair(configured []any) *compute.InstanceGroupManagerInstanceLifecyclePolicyOnRepair {
18491842
onRepair := &compute.InstanceGroupManagerInstanceLifecyclePolicyOnRepair{}
18501843
for _, raw := range configured {
@@ -1862,7 +1855,6 @@ func expandOnRepairV2(configured []any) map[string]interface{} {
18621855
}
18631856
return onRepair
18641857
}
1865-
{{- end }}
18661858

18671859
func expandStandbyPolicy(d *schema.ResourceData) *compute.InstanceGroupManagerStandbyPolicy {
18681860
standbyPolicy := &compute.InstanceGroupManagerStandbyPolicy{}
@@ -2124,9 +2116,7 @@ func flattenInstanceLifecyclePolicy(instanceLifecyclePolicy *compute.InstanceGro
21242116
ilp["default_action_on_failure"] = instanceLifecyclePolicy.DefaultActionOnFailure
21252117
ilp["on_failed_health_check"] = instanceLifecyclePolicy.OnFailedHealthCheck
21262118

2127-
{{ if ne $.TargetVersionName `ga` -}}
21282119
ilp["on_repair"] = flattenOnRepair(instanceLifecyclePolicy.OnRepair)
2129-
{{- end }}
21302120
results = append(results, ilp)
21312121
}
21322122
return results
@@ -2141,15 +2131,12 @@ func flattenInstanceLifecyclePolicyV2(raw interface{}) []map[string]interface{}
21412131
ilp["default_action_on_failure"] = stringFromMap(instanceLifecyclePolicy, "defaultActionOnFailure")
21422132
ilp["on_failed_health_check"] = stringFromMap(instanceLifecyclePolicy, "onFailedHealthCheck")
21432133

2144-
{{ if ne $.TargetVersionName `ga` -}}
21452134
ilp["on_repair"] = flattenOnRepairV2(instanceLifecyclePolicy["onRepair"])
2146-
{{- end }}
21472135
results = append(results, ilp)
21482136
}
21492137
return results
21502138
}
21512139

2152-
{{ if ne $.TargetVersionName `ga` -}}
21532140
func flattenOnRepair(onRepair *compute.InstanceGroupManagerInstanceLifecyclePolicyOnRepair) []map[string]any {
21542141
results := []map[string]any{}
21552142
if onRepair != nil {
@@ -2170,7 +2157,6 @@ func flattenOnRepairV2(raw interface{}) []map[string]any {
21702157
}
21712158
return results
21722159
}
2173-
{{- end }}
21742160

21752161
func expandAllInstancesConfig(old []interface{}, new []interface{}) *compute.InstanceGroupManagerAllInstancesConfig {
21762162
var properties *compute.InstancePropertiesPatch

mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_meta.yaml.tmpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ fields:
2626
- api_field: 'instanceLifecyclePolicy.defaultActionOnFailure'
2727
- api_field: 'instanceLifecyclePolicy.onFailedHealthCheck'
2828
- api_field: 'instanceLifecyclePolicy.forceUpdateOnRepair'
29-
{{- if ne $.TargetVersionName "ga" }}
3029
- api_field: 'instanceLifecyclePolicy.onRepair.allowChangingZone'
31-
{{- end }}
3230
- api_field: 'listManagedInstancesResults'
3331
- api_field: 'name'
3432
- api_field: 'namedPorts.name'

mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.tmpl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ func TestAccInstanceGroupManager_update(t *testing.T) {
176176
resource.TestCheckResourceAttr("google_compute_instance_group_manager.igm-update", "instance_lifecycle_policy.0.default_action_on_failure", "DO_NOTHING"),
177177
resource.TestCheckResourceAttr("google_compute_instance_group_manager.igm-update", "instance_lifecycle_policy.0.on_failed_health_check", "DO_NOTHING"),
178178

179-
{{- if ne $.TargetVersionName "ga" }}
180179
resource.TestCheckResourceAttr("google_compute_instance_group_manager.igm-update", "instance_lifecycle_policy.0.on_repair.0.allow_changing_zone", "NO"),
181-
{{- end }}
182180
),
183181
},
184182
{
@@ -193,9 +191,7 @@ func TestAccInstanceGroupManager_update(t *testing.T) {
193191
resource.TestCheckResourceAttr("google_compute_instance_group_manager.igm-update", "instance_lifecycle_policy.0.default_action_on_failure", "REPAIR"),
194192
resource.TestCheckResourceAttr("google_compute_instance_group_manager.igm-update", "instance_lifecycle_policy.0.on_failed_health_check", "REPAIR"),
195193

196-
{{- if ne $.TargetVersionName "ga" }}
197194
resource.TestCheckResourceAttr("google_compute_instance_group_manager.igm-update", "instance_lifecycle_policy.0.on_repair.0.allow_changing_zone", "NO"),
198-
{{- end }}
199195
),
200196
},
201197
{
@@ -995,11 +991,9 @@ resource "google_compute_instance_group_manager" "igm-update" {
995991
default_action_on_failure = "REPAIR"
996992
on_failed_health_check = "REPAIR"
997993
998-
{{- if ne $.TargetVersionName "ga" }}
999994
on_repair {
1000995
allow_changing_zone = "NO"
1001996
}
1002-
{{- end }}
1003997
}
1004998
}
1005999
`, template1, target1, target2, template2, description, igm)

mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.tmpl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource {
602602
Description: `Specifies whether to apply the group's latest configuration when repairing a VM. Valid options are: YES, NO. If YES and you updated the group's instance template or per-instance configurations after the VM was created, then these changes are applied when VM is repaired. If NO (default), then updates are applied in accordance with the group's update policy type.`,
603603
},
604604

605-
{{- if ne $.TargetVersionName `ga` }}
606605
"on_repair": {
607606
Type: schema.TypeList,
608607
Computed: true,
@@ -621,7 +620,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource {
621620
},
622621
},
623622
},
624-
{{- end }}
625623

626624
},
627625
},
@@ -2258,12 +2256,10 @@ func flattenRegionInstanceLifecyclePolicy(raw interface{}) []map[string]interfac
22582256
"default_action_on_failure": ilp["defaultActionOnFailure"],
22592257
"on_failed_health_check": ilp["onFailedHealthCheck"],
22602258
}
2261-
{{- if ne $.TargetVersionName "ga" }}
22622259
if onRepair, ok := ilp["onRepair"].(map[string]interface{}); ok && onRepair != nil {
22632260
onRepairEntry := map[string]any{"allow_changing_zone": onRepair["allowChangingZone"]}
22642261
entry["on_repair"] = []map[string]any{onRepairEntry}
22652262
}
2266-
{{- end }}
22672263
return append(results, entry)
22682264
}
22692265

mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_meta.yaml.tmpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ fields:
110110
- api_field: 'instanceLifecyclePolicy.defaultActionOnFailure'
111111
- api_field: 'instanceLifecyclePolicy.onFailedHealthCheck'
112112
- api_field: 'instanceLifecyclePolicy.forceUpdateOnRepair'
113-
{{- if ne $.TargetVersionName "ga" }}
114113
- api_field: 'instanceLifecyclePolicy.onRepair.allowChangingZone'
115-
{{- end }}
116114
- api_field: 'listManagedInstancesResults'
117115
- api_field: 'name'
118116
- api_field: 'namedPorts.name'

mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.tmpl

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,8 @@ func TestAccRegionInstanceGroupManager_update(t *testing.T) {
9595
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.default_action_on_failure", "DO_NOTHING"),
9696
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.on_failed_health_check", "DO_NOTHING"),
9797

98-
{{- if ne $.TargetVersionName "ga" }}
9998
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.force_update_on_repair", "NO"),
10099
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.on_repair.0.allow_changing_zone", "NO"),
101-
{{- end }}
102-
103100
),
104101
},
105102
{
@@ -114,11 +111,8 @@ func TestAccRegionInstanceGroupManager_update(t *testing.T) {
114111
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.default_action_on_failure", "REPAIR"),
115112
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.on_failed_health_check", "REPAIR"),
116113

117-
{{- if ne $.TargetVersionName "ga" }}
118114
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.force_update_on_repair", "YES"),
119115
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.on_repair.0.allow_changing_zone", "YES"),
120-
{{- end }}
121-
122116
),
123117
},
124118
{
@@ -133,11 +127,8 @@ func TestAccRegionInstanceGroupManager_update(t *testing.T) {
133127
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.default_action_on_failure", "REPAIR"),
134128
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.on_failed_health_check", "REPAIR"),
135129

136-
{{- if ne $.TargetVersionName "ga" }}
137130
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.force_update_on_repair", "YES"),
138131
resource.TestCheckResourceAttr("google_compute_region_instance_group_manager.igm-update", "instance_lifecycle_policy.0.on_repair.0.allow_changing_zone", "YES"),
139-
{{- end }}
140-
141132
),
142133
},
143134
{
@@ -803,11 +794,7 @@ resource "google_compute_region_instance_group_manager" "igm-update" {
803794
}
804795
805796
instance_lifecycle_policy {
806-
{{- if ne $.TargetVersionName "ga" }}
807797
force_update_on_repair = "NO"
808-
{{- else }}
809-
force_update_on_repair = "YES"
810-
{{- end }}
811798
812799
default_action_on_failure = "DO_NOTHING"
813800
on_failed_health_check = "DO_NOTHING"
@@ -920,17 +907,10 @@ resource "google_compute_region_instance_group_manager" "igm-update" {
920907
default_action_on_failure = "REPAIR"
921908
on_failed_health_check = "REPAIR"
922909
923-
{{- if ne $.TargetVersionName "ga" }}
924910
force_update_on_repair = "YES"
925-
{{- else }}
926-
force_update_on_repair = "NO"
927-
{{- end }}
928-
929-
{{- if ne $.TargetVersionName "ga" }}
930911
on_repair {
931912
allow_changing_zone = "YES"
932913
}
933-
{{- end }}
934914
935915
}
936916
}

mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ instance_lifecycle_policy {
313313
force_update_on_repair = "YES"
314314
default_action_on_failure = "DO_NOTHING"
315315
on_failed_health_check = "DO_NOTHING"
316-
on_repair { //google-beta only
316+
on_repair {
317317
allow_changing_zone = "YES"
318318
}
319319
}
@@ -322,7 +322,7 @@ instance_lifecycle_policy {
322322
* `force_update_on_repair` - (Optional), Specifies whether to apply the group's latest configuration when repairing a VM. Valid options are: `YES`, `NO`. If `YES` and you updated the group's instance template or per-instance configurations after the VM was created, then these changes are applied when VM is repaired. If `NO` (default), then updates are applied in accordance with the group's update policy type.
323323
* `default_action_on_failure` - (Optional), Specifies the action that a MIG performs on a failed VM. If the value of the `on_failed_health_check` field is `DEFAULT_ACTION`, then the same action also applies to the VMs on which your application fails a health check. Valid options are: `DO_NOTHING`, `REPAIR`. If `DO_NOTHING`, then MIG does not repair a failed VM. If `REPAIR` (default), then MIG automatically repairs a failed VM by recreating it. For more information, see about repairing VMs in a MIG.
324324
* `on_failed_health_check` - (Optional), Specifies the action that a MIG performs on an unhealthy VM. A VM is marked as unhealthy when the application running on that VM fails a health check. Valid options are: `DEFAULT_ACTION`, `DO_NOTHING`, `REPAIR`. If `DEFAULT_ACTION` (default), then MIG uses the same action configured for the `default_action_on_failure` field. If `DO_NOTHING`, then MIG does not repair unhealthy VM. If `REPAIR`, then MIG automatically repairs an unhealthy VM by recreating it. For more information, see about repairing VMs in a MIG.
325-
* `on_repair` - (Optional, [Beta](../guides/provider_versions.html.markdown)), Configuration for VM repairs in the MIG. Structure is [documented below](#nested_on_repair).
325+
* `on_repair` - (Optional), Configuration for VM repairs in the MIG. Structure is [documented below](#nested_on_repair).
326326
- - -
327327

328328
<a name="nested_on_repair"></a>The `on_repair` block supports:

mmv1/third_party/terraform/website/docs/r/compute_region_instance_group_manager.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ instance_lifecycle_policy {
268268
force_update_on_repair = "YES"
269269
default_action_on_failure = "DO_NOTHING"
270270
on_failed_health_check = "DO_NOTHING"
271-
on_repair { //google-beta only
271+
on_repair {
272272
allow_changing_zone = "YES"
273273
}
274274
}
@@ -277,7 +277,7 @@ instance_lifecycle_policy {
277277
* `force_update_on_repair` - (Optional), Specifies whether to apply the group's latest configuration when repairing a VM. Valid options are: `YES`, `NO`. If `YES` and you updated the group's instance template or per-instance configurations after the VM was created, then these changes are applied when VM is repaired. If `NO` (default), then updates are applied in accordance with the group's update policy type.
278278
* `default_action_on_failure` - (Optional), Specifies the action that a MIG performs on a failed VM. If the value of the `on_failed_health_check` field is `DEFAULT_ACTION`, then the same action also applies to the VMs on which your application fails a health check. Valid options are: `DO_NOTHING`, `REPAIR`. If `DO_NOTHING`, then MIG does not repair a failed VM. If `REPAIR` (default), then MIG automatically repairs a failed VM by recreating it. For more information, see about repairing VMs in a MIG.
279279
* `on_failed_health_check` - (Optional), Specifies the action that a MIG performs on an unhealthy VM. A VM is marked as unhealthy when the application running on that VM fails a health check. Valid options are: `DEFAULT_ACTION`, `DO_NOTHING`, `REPAIR`. If `DEFAULT_ACTION` (default), then MIG uses the same action configured for the `default_action_on_failure` field. If `DO_NOTHING`, then MIG does not repair unhealthy VM. If `REPAIR`, then MIG automatically repairs an unhealthy VM by recreating it. For more information, see about repairing VMs in a MIG.
280-
* `on_repair` - (Optional, [Beta](../guides/provider_versions.html.markdown)), Configuration for VM repairs in the MIG. Structure is [documented below](#nested_on_repair).
280+
* `on_repair` - (Optional), Configuration for VM repairs in the MIG. Structure is [documented below](#nested_on_repair).
281281
- - -
282282

283283
<a name="nested_on_repair"></a>The `on_repair` block supports:

0 commit comments

Comments
 (0)