Skip to content

Commit 5bbf2a0

Browse files
Promote Suspend/Resume to GA (#12632)
1 parent b755d34 commit 5bbf2a0

6 files changed

+8
-38
lines changed

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

-12
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ func ResourceComputeInstanceGroupManager() *schema.Resource {
221221
},
222222
},
223223

224-
{{ if ne $.TargetVersionName `ga` -}}
225224
"standby_policy": {
226225
Computed: true,
227226
Type: schema.TypeList,
@@ -262,7 +261,6 @@ func ResourceComputeInstanceGroupManager() *schema.Resource {
262261
Optional: true,
263262
Description: `The target number of stopped instances for this managed instance group.`,
264263
},
265-
{{- end }}
266264

267265
"update_policy": {
268266
Computed: true,
@@ -657,11 +655,9 @@ func resourceComputeInstanceGroupManagerCreate(d *schema.ResourceData, meta inte
657655
TargetPools: tpgresource.ConvertStringSet(d.Get("target_pools").(*schema.Set)),
658656
AutoHealingPolicies: expandAutoHealingPolicies(d.Get("auto_healing_policies").([]interface{})),
659657
Versions: expandVersions(d.Get("version").([]interface{})),
660-
{{- if ne $.TargetVersionName "ga" }}
661658
StandbyPolicy: expandStandbyPolicy(d),
662659
TargetSuspendedSize: int64(d.Get("target_suspended_size").(int)),
663660
TargetStoppedSize: int64(d.Get("target_stopped_size").(int)),
664-
{{- end }}
665661
UpdatePolicy: expandUpdatePolicy(d.Get("update_policy").([]interface{})),
666662
InstanceLifecyclePolicy: expandInstanceLifecyclePolicy(d.Get("instance_lifecycle_policy").([]interface{})),
667663
AllInstancesConfig: expandAllInstancesConfig(nil, d.Get("all_instances_config").([]interface{})),
@@ -890,7 +886,6 @@ func resourceComputeInstanceGroupManagerRead(d *schema.ResourceData, meta interf
890886
if err := d.Set("version", flattenVersions(manager.Versions)); err != nil {
891887
return err
892888
}
893-
{{- if ne $.TargetVersionName "ga" }}
894889
if err = d.Set("standby_policy", flattenStandbyPolicy(manager.StandbyPolicy)); err != nil {
895890
return fmt.Errorf("Error setting standby_policy in state: %s", err.Error())
896891
}
@@ -900,7 +895,6 @@ func resourceComputeInstanceGroupManagerRead(d *schema.ResourceData, meta interf
900895
if err := d.Set("target_stopped_size", manager.TargetStoppedSize); err != nil {
901896
return fmt.Errorf("Error setting target_stopped_size: %s", err)
902897
}
903-
{{- end }}
904898
if err = d.Set("update_policy", flattenUpdatePolicy(manager.UpdatePolicy)); err != nil {
905899
return fmt.Errorf("Error setting update_policy in state: %s", err.Error())
906900
}
@@ -972,7 +966,6 @@ func resourceComputeInstanceGroupManagerUpdate(d *schema.ResourceData, meta inte
972966
change = true
973967
}
974968

975-
{{ if ne $.TargetVersionName `ga` -}}
976969
if d.HasChange("standby_policy") {
977970
updatedManager.StandbyPolicy = expandStandbyPolicy(d)
978971
change = true
@@ -989,7 +982,6 @@ func resourceComputeInstanceGroupManagerUpdate(d *schema.ResourceData, meta inte
989982
updatedManager.ForceSendFields = append(updatedManager.ForceSendFields, "TargetStoppedSize")
990983
change = true
991984
}
992-
{{- end }}
993985

994986
if d.HasChange("update_policy") {
995987
updatedManager.UpdatePolicy = expandUpdatePolicy(d.Get("update_policy").([]interface{}))
@@ -1315,7 +1307,6 @@ func expandInstanceLifecyclePolicy(configured []interface{}) *compute.InstanceGr
13151307
return instanceLifecyclePolicy
13161308
}
13171309

1318-
{{ if ne $.TargetVersionName `ga` -}}
13191310
func expandStandbyPolicy(d *schema.ResourceData) *compute.InstanceGroupManagerStandbyPolicy {
13201311
standbyPolicy := &compute.InstanceGroupManagerStandbyPolicy{}
13211312
for _, sp := range d.Get("standby_policy").([]any) {
@@ -1326,7 +1317,6 @@ func expandStandbyPolicy(d *schema.ResourceData) *compute.InstanceGroupManagerSt
13261317
}
13271318
return standbyPolicy
13281319
}
1329-
{{- end }}
13301320

13311321
func expandUpdatePolicy(configured []interface{}) *compute.InstanceGroupManagerUpdatePolicy {
13321322
updatePolicy := &compute.InstanceGroupManagerUpdatePolicy{}
@@ -1464,7 +1454,6 @@ func flattenStatefulPolicyStatefulIps(d *schema.ResourceData, ipfieldName string
14641454
return sorted
14651455
}
14661456

1467-
{{ if ne $.TargetVersionName `ga` -}}
14681457
func flattenStandbyPolicy(standbyPolicy *compute.InstanceGroupManagerStandbyPolicy) []map[string]any{
14691458
results := []map[string]any{}
14701459
if standbyPolicy != nil {
@@ -1475,7 +1464,6 @@ func flattenStandbyPolicy(standbyPolicy *compute.InstanceGroupManagerStandbyPoli
14751464
}
14761465
return results
14771466
}
1478-
{{- end }}
14791467

14801468
func flattenUpdatePolicy(updatePolicy *compute.InstanceGroupManagerUpdatePolicy) []map[string]interface{} {
14811469
results := []map[string]interface{}{}

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

-4
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ func TestAccInstanceGroupManager_stateful(t *testing.T) {
394394
})
395395
}
396396

397-
{{ if ne $.TargetVersionName `ga` -}}
398397
func TestAccInstanceGroupManager_stoppedSuspendedTargetSize(t *testing.T) {
399398
t.Parallel()
400399

@@ -428,7 +427,6 @@ func TestAccInstanceGroupManager_stoppedSuspendedTargetSize(t *testing.T) {
428427
},
429428
})
430429
}
431-
{{- end }}
432430

433431
func TestAccInstanceGroupManager_waitForStatus(t *testing.T) {
434432
t.Parallel()
@@ -1743,7 +1741,6 @@ resource "google_compute_instance_group_manager" "igm-basic" {
17431741
`, network, template, target, igm)
17441742
}
17451743

1746-
{{ if ne $.TargetVersionName `ga` -}}
17471744
func testAccInstanceGroupManager_stoppedSuspendedTargetSize(network, template, igm string) string {
17481745
return fmt.Sprintf(`
17491746
data "google_compute_image" "my_image" {
@@ -1835,7 +1832,6 @@ resource "google_compute_instance_group_manager" "sr-igm" {
18351832
}
18361833
`, network, template, igm)
18371834
}
1838-
{{- end }}
18391835

18401836
func testAccInstanceGroupManager_waitForStatus(template, target, igm, perInstanceConfig string) string {
18411837
return fmt.Sprintf(`

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

-8
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource {
326326
},
327327
},
328328

329-
{{- if ne $.TargetVersionName "ga" }}
330329
"standby_policy": {
331330
Type: schema.TypeList,
332331
Computed: true,
@@ -367,7 +366,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource {
367366
Optional: true,
368367
Description: `The target number of stopped instances for this managed instance group.`,
369368
},
370-
{{- end }}
371369

372370
"update_policy": {
373371
Type: schema.TypeList,
@@ -671,11 +669,9 @@ func resourceComputeRegionInstanceGroupManagerCreate(d *schema.ResourceData, met
671669
TargetPools: tpgresource.ConvertStringSet(d.Get("target_pools").(*schema.Set)),
672670
AutoHealingPolicies: expandAutoHealingPolicies(d.Get("auto_healing_policies").([]interface{})),
673671
Versions: expandVersions(d.Get("version").([]interface{})),
674-
{{- if ne $.TargetVersionName "ga" }}
675672
StandbyPolicy: expandStandbyPolicy(d),
676673
TargetSuspendedSize: int64(d.Get("target_suspended_size").(int)),
677674
TargetStoppedSize: int64(d.Get("target_stopped_size").(int)),
678-
{{- end }}
679675
InstanceFlexibilityPolicy: expandInstanceFlexibilityPolicy(d),
680676
UpdatePolicy: expandRegionUpdatePolicy(d.Get("update_policy").([]interface{})),
681677
InstanceLifecyclePolicy: expandInstanceLifecyclePolicy(d.Get("instance_lifecycle_policy").([]interface{})),
@@ -872,7 +868,6 @@ func resourceComputeRegionInstanceGroupManagerRead(d *schema.ResourceData, meta
872868
if err := d.Set("version", flattenVersions(manager.Versions)); err != nil {
873869
return err
874870
}
875-
{{- if ne $.TargetVersionName "ga" }}
876871
if err = d.Set("standby_policy", flattenStandbyPolicy(manager.StandbyPolicy)); err != nil {
877872
return fmt.Errorf("Error setting standby_policy in state: %s", err.Error())
878873
}
@@ -882,7 +877,6 @@ func resourceComputeRegionInstanceGroupManagerRead(d *schema.ResourceData, meta
882877
if err := d.Set("target_stopped_size", manager.TargetStoppedSize); err != nil {
883878
return fmt.Errorf("Error setting target_stopped_size: %s", err)
884879
}
885-
{{- end }}
886880
if err := d.Set("instance_flexibility_policy", flattenInstanceFlexibilityPolicy(manager.InstanceFlexibilityPolicy)); err != nil {
887881
return err
888882
}
@@ -977,7 +971,6 @@ func resourceComputeRegionInstanceGroupManagerUpdate(d *schema.ResourceData, met
977971
change = true
978972
}
979973

980-
{{- if ne $.TargetVersionName "ga" }}
981974
if d.HasChange("standby_policy") {
982975
updatedManager.StandbyPolicy = expandStandbyPolicy(d)
983976
change = true
@@ -994,7 +987,6 @@ func resourceComputeRegionInstanceGroupManagerUpdate(d *schema.ResourceData, met
994987
updatedManager.ForceSendFields = append(updatedManager.ForceSendFields, "TargetStoppedSize")
995988
change = true
996989
}
997-
{{- end }}
998990

999991
if d.HasChange("update_policy") {
1000992
updatedManager.UpdatePolicy = expandRegionUpdatePolicy(d.Get("update_policy").([]interface{}))

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

-4
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ func TestAccRegionInstanceGroupManager_stateful(t *testing.T) {
398398
}
399399

400400

401-
{{- if ne $.TargetVersionName "ga" }}
402401
func TestAccRegionInstanceGroupManager_stoppedSuspendedTargetSize(t *testing.T) {
403402
t.Parallel()
404403

@@ -432,7 +431,6 @@ func TestAccRegionInstanceGroupManager_stoppedSuspendedTargetSize(t *testing.T)
432431
},
433432
})
434433
}
435-
{{- end }}
436434

437435
func TestAccRegionInstanceGroupManager_instanceFlexibilityPolicy(t *testing.T) {
438436
t.Parallel()
@@ -1860,7 +1858,6 @@ resource "google_compute_region_instance_group_manager" "igm-basic" {
18601858
`, context)
18611859
}
18621860

1863-
{{- if ne $.TargetVersionName "ga" }}
18641861
func testAccRegionInstanceGroupManager_stoppedSuspendedTargetSize(network, template, igm string) string {
18651862
return fmt.Sprintf(`
18661863
data "google_compute_image" "my_image" {
@@ -1969,7 +1966,6 @@ resource "google_compute_region_instance_group_manager" "sr-igm" {
19691966
}
19701967
`, network, template, igm)
19711968
}
1972-
{{- end }}
19731969

19741970
func testAccRegionInstanceGroupManager_instanceFlexibilityPolicy(network, template, igm string) string {
19751971
return fmt.Sprintf(`

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,9 @@ resource "google_compute_instance_group_manager" "appserver" {
8989
}
9090
```
9191

92-
## Example Usage with standby policy (`google-beta` provider)
92+
## Example Usage with standby policy (`google` provider)
9393
```hcl
9494
resource "google_compute_instance_group_manager" "igm-sr" {
95-
provider = google-beta
9695
name = "tf-sr-igm"
9796
9897
base_instance_name = "tf-sr-igm-instance"
@@ -183,11 +182,11 @@ group. You can specify only one value. Structure is [documented below](#nested_a
183182
allInstancesConfig on the group, you must update the group's instances to
184183
apply the configuration.
185184

186-
* `standby_policy` - (Optional [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) The standby policy for stopped and suspended instances. Structure is documented below. For more information, see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/suspended-and-stopped-vms-in-mig) and [API](https://cloud.google.com/compute/docs/reference/rest/beta/regionInstanceGroupManagers/patch)
185+
* `standby_policy` - (Optional) The standby policy for stopped and suspended instances. Structure is documented below. For more information, see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/suspended-and-stopped-vms-in-mig).
187186

188-
* `target_suspended_size` - (Optional [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) The target number of suspended instances for this managed instance group.
187+
* `target_suspended_size` - (Optional) The target number of suspended instances for this managed instance group.
189188

190-
* `target_stopped_size` - (Optional [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) The target number of stopped instances for this managed instance group.
189+
* `target_stopped_size` - (Optional) The target number of stopped instances for this managed instance group.
191190

192191
* `stateful_disk` - (Optional) Disks created on the instances that will be preserved on instance delete, update, etc. Structure is [documented below](#nested_stateful_disk). For more information see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-disks-in-migs).
193192

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

+4-5
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ resource "google_compute_region_instance_group_manager" "appserver" {
9191
}
9292
}
9393
```
94-
## Example Usage with standby policy (`google-beta` provider)
94+
## Example Usage with standby policy (`google` provider)
9595
```hcl
9696
resource "google_compute_region_instance_group_manager" "igm-sr" {
97-
provider = google-beta
9897
name = "tf-sr-igm"
9998
10099
base_instance_name = "tf-sr-igm-instance"
@@ -184,11 +183,11 @@ group. You can specify only one value. Structure is documented below. For more i
184183
allInstancesConfig on the group, you must update the group's instances to
185184
apply the configuration.
186185

187-
* `standby_policy` - (Optional [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) The standby policy for stopped and suspended instances. Structure is documented below. For more information, see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/suspended-and-stopped-vms-in-mig) and [API](https://cloud.google.com/compute/docs/reference/rest/beta/regionInstanceGroupManagers/patch)
186+
* `standby_policy` - (Optional) The standby policy for stopped and suspended instances. Structure is documented below. For more information, see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/suspended-and-stopped-vms-in-mig).
188187

189-
* `target_suspended_size` - (Optional [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) The target number of suspended instances for this managed instance group.
188+
* `target_suspended_size` - (Optional) The target number of suspended instances for this managed instance group.
190189

191-
* `target_stopped_size` - (Optional [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) The target number of stopped instances for this managed instance group.
190+
* `target_stopped_size` - (Optional) The target number of stopped instances for this managed instance group.
192191

193192
* `update_policy` - (Optional) The update policy for this managed instance group. Structure is [documented below](#nested_update_policy). For more information, see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/updating-managed-instance-groups) and [API](https://cloud.google.com/compute/docs/reference/rest/beta/regionInstanceGroupManagers/patch)
194193

0 commit comments

Comments
 (0)