From 7216ee58d2640dab992ce8c9a55ac7ccba974b0c Mon Sep 17 00:00:00 2001 From: Adam Skubis Date: Fri, 21 Jul 2023 07:28:46 +0000 Subject: [PATCH 1/3] migrate lifecyclePolicy.updateOnRepair to GA --- .../resource_compute_instance_group_manager.go.erb | 12 ------------ ...urce_compute_region_instance_group_manager.go.erb | 8 -------- ...source_compute_instance_group_manager_test.go.erb | 6 ------ ...compute_region_instance_group_manager_test.go.erb | 4 ---- 4 files changed, 30 deletions(-) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager.go.erb index 28c1a0eb6b4f..ca89eddea57c 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager.go.erb @@ -286,7 +286,6 @@ func ResourceComputeInstanceGroupManager() *schema.Resource { }, }, - <% unless version == "ga" -%> "instance_lifecycle_policy": { Computed: true, Type: schema.TypeList, @@ -305,7 +304,6 @@ func ResourceComputeInstanceGroupManager() *schema.Resource { }, }, }, - <% end -%> <% unless version == "ga" -%> "all_instances_config": { @@ -581,9 +579,7 @@ func resourceComputeInstanceGroupManagerCreate(d *schema.ResourceData, meta inte AutoHealingPolicies: expandAutoHealingPolicies(d.Get("auto_healing_policies").([]interface{})), Versions: expandVersions(d.Get("version").([]interface{})), UpdatePolicy: expandUpdatePolicy(d.Get("update_policy").([]interface{})), - <% unless version == "ga" -%> InstanceLifecyclePolicy: expandInstanceLifecyclePolicy(d.Get("instance_lifecycle_policy").([]interface{})), - <% end -%> <% unless version == "ga" -%> AllInstancesConfig: expandAllInstancesConfig(nil, d.Get("all_instances_config").([]interface{})), <% end -%> @@ -806,11 +802,9 @@ func resourceComputeInstanceGroupManagerRead(d *schema.ResourceData, meta interf if err = d.Set("update_policy", flattenUpdatePolicy(manager.UpdatePolicy)); err != nil { return fmt.Errorf("Error setting update_policy in state: %s", err.Error()) } - <% unless version == "ga" -%> if err = d.Set("instance_lifecycle_policy", flattenInstanceLifecyclePolicy(manager.InstanceLifecyclePolicy)); err != nil { return fmt.Errorf("Error setting instance lifecycle policy in state: %s", err.Error()) } - <% end -%> <% unless version == "ga" -%> if manager.AllInstancesConfig != nil { if err = d.Set("all_instances_config", flattenAllInstancesConfig(manager.AllInstancesConfig)); err != nil { @@ -883,12 +877,10 @@ func resourceComputeInstanceGroupManagerUpdate(d *schema.ResourceData, meta inte change = true } - <% unless version == "ga" -%> if d.HasChange("instance_lifecycle_policy") { updatedManager.InstanceLifecyclePolicy = expandInstanceLifecyclePolicy(d.Get("instance_lifecycle_policy").([]interface{})) change = true } - <% end -%> <% unless version == "ga" -%> if d.HasChange("all_instances_config") { @@ -1225,7 +1217,6 @@ func expandFixedOrPercent(configured []interface{}) *compute.FixedOrPercent { return fixedOrPercent } -<% unless version == "ga" -%> func expandInstanceLifecyclePolicy(configured []interface{}) *compute.InstanceGroupManagerInstanceLifecyclePolicy { instanceLifecyclePolicy := &compute.InstanceGroupManagerInstanceLifecyclePolicy{} @@ -1235,7 +1226,6 @@ func expandInstanceLifecyclePolicy(configured []interface{}) *compute.InstanceGr } return instanceLifecyclePolicy } -<% end -%> func expandUpdatePolicy(configured []interface{}) *compute.InstanceGroupManagerUpdatePolicy { updatePolicy := &compute.InstanceGroupManagerUpdatePolicy{} @@ -1381,7 +1371,6 @@ func flattenUpdatePolicy(updatePolicy *compute.InstanceGroupManagerUpdatePolicy) return results } -<% unless version == "ga" -%> func flattenInstanceLifecyclePolicy(instanceLifecyclePolicy *compute.InstanceGroupManagerInstanceLifecyclePolicy) []map[string]interface{} { results := []map[string]interface{}{} if instanceLifecyclePolicy != nil { @@ -1391,7 +1380,6 @@ func flattenInstanceLifecyclePolicy(instanceLifecyclePolicy *compute.InstanceGro } return results } -<% end -%> <% unless version == "ga" -%> func expandAllInstancesConfig(old []interface{}, new []interface{}) *compute.InstanceGroupManagerAllInstancesConfig { diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.erb index 89f5b93082ef..c88d69cda94c 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.erb @@ -250,7 +250,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource { Description: `The shape to which the group converges either proactively or on resize events (depending on the value set in updatePolicy.instanceRedistributionType).`, }, - <% unless version == "ga" -%> "instance_lifecycle_policy": { Computed: true, Type: schema.TypeList, @@ -269,7 +268,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, }, - <% end -%> "update_policy": { Type: schema.TypeList, @@ -555,9 +553,7 @@ func resourceComputeRegionInstanceGroupManagerCreate(d *schema.ResourceData, met AutoHealingPolicies: expandAutoHealingPolicies(d.Get("auto_healing_policies").([]interface{})), Versions: expandVersions(d.Get("version").([]interface{})), UpdatePolicy: expandRegionUpdatePolicy(d.Get("update_policy").([]interface{})), - <% unless version == "ga" -%> InstanceLifecyclePolicy: expandInstanceLifecyclePolicy(d.Get("instance_lifecycle_policy").([]interface{})), - <% end -%> <% unless version == "ga" -%> AllInstancesConfig: expandAllInstancesConfig(nil, d.Get("all_instances_config").([]interface{})), <% end -%> @@ -753,11 +749,9 @@ func resourceComputeRegionInstanceGroupManagerRead(d *schema.ResourceData, meta if err := d.Set("update_policy", flattenRegionUpdatePolicy(manager.UpdatePolicy)); err != nil { return fmt.Errorf("Error setting update_policy in state: %s", err.Error()) } - <% unless version == "ga" -%> if err = d.Set("instance_lifecycle_policy", flattenInstanceLifecyclePolicy(manager.InstanceLifecyclePolicy)); err != nil { return fmt.Errorf("Error setting instance lifecycle policy in state: %s", err.Error()) } - <% end -%> <% unless version == "ga" -%> if manager.AllInstancesConfig != nil { if err = d.Set("all_instances_config", flattenAllInstancesConfig(manager.AllInstancesConfig)); err != nil { @@ -834,12 +828,10 @@ func resourceComputeRegionInstanceGroupManagerUpdate(d *schema.ResourceData, met change = true } - <% unless version == "ga" -%> if d.HasChange("instance_lifecycle_policy") { updatedManager.InstanceLifecyclePolicy = expandInstanceLifecyclePolicy(d.Get("instance_lifecycle_policy").([]interface{})) change = true } - <% end -%> <% unless version == "ga" -%> if d.HasChange("stateful_internal_ip") || d.HasChange("stateful_external_ip") || d.HasChange("stateful_disk") { diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb index 3642b4c57775..87fd43a866c4 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_group_manager_test.go.erb @@ -671,11 +671,9 @@ resource "google_compute_instance_group_manager" "igm-update" { } <% end -%> -<% unless version == "ga" -%> instance_lifecycle_policy { force_update_on_repair = "YES" } -<% end -%> } `, template, target, description, igm) } @@ -779,11 +777,9 @@ resource "google_compute_instance_group_manager" "igm-update" { } <% end -%> -<% unless version == "ga" -%> instance_lifecycle_policy { force_update_on_repair = "NO" } -<% end -%> } `, template1, target1, target2, template2, description, igm) } @@ -1797,11 +1793,9 @@ resource "google_compute_instance_group_manager" "igm-basic" { } } <% end -%> -<% unless version == "ga" -%> instance_lifecycle_policy { force_update_on_repair = "YES" } -<% end -%> wait_for_instances = true wait_for_instances_status = "UPDATED" } diff --git a/mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb index ae6d2404c2f7..b9db83038622 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb @@ -547,11 +547,9 @@ resource "google_compute_region_instance_group_manager" "igm-update" { } <% end -%> -<% unless version == "ga" -%> instance_lifecycle_policy { force_update_on_repair = "YES" } -<% end -%> } `, template, target, igm) } @@ -655,11 +653,9 @@ resource "google_compute_region_instance_group_manager" "igm-update" { } <% end -%> -<% unless version == "ga" -%> instance_lifecycle_policy { force_update_on_repair = "NO" } -<% end -%> } `, template1, target1, target2, template2, igm) } From 44aa4068ae06aa6944c14d533b9d3539dc710748 Mon Sep 17 00:00:00 2001 From: Adam Skubis Date: Wed, 26 Jul 2023 08:33:45 +0000 Subject: [PATCH 2/3] remove mention of Beta from documentation --- .../docs/r/compute_instance_group_manager.html.markdown | 3 ++- .../docs/r/compute_region_instance_group_manager.html.markdown | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown index 8312acd499d5..46c46929f38a 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown @@ -1,3 +1,4 @@ + --- subcategory: "Compute Engine" description: |- @@ -208,7 +209,7 @@ instance_lifecycle_policy { } ``` -* `force_update_on_repair` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)), 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. +* `force_update_on_repair` - (Optional, (https://terraform.io/docs/providers/google/guides/provider_versions.html)), 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. - - - diff --git a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_group_manager.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_group_manager.html.markdown index 45e90554be0e..4b5bca0017e5 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_group_manager.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_group_manager.html.markdown @@ -218,7 +218,7 @@ instance_lifecycle_policy { } ``` -* `force_update_on_repair` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)), 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. +* `force_update_on_repair` - (Optional, (https://terraform.io/docs/providers/google/guides/provider_versions.html)), 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. - - - The `all_instances_config` block supports: From 7ae6d1c51691be531349558d0b5d629e4d1cbe32 Mon Sep 17 00:00:00 2001 From: Adam Skubis Date: Thu, 27 Jul 2023 07:04:55 +0000 Subject: [PATCH 3/3] removed accidental whitespace --- .../website/docs/r/compute_instance_group_manager.html.markdown | 1 - 1 file changed, 1 deletion(-) diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown index 46c46929f38a..a38d999c59e6 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance_group_manager.html.markdown @@ -1,4 +1,3 @@ - --- subcategory: "Compute Engine" description: |-