From 14a412945fd6d802dcdb8bd2ead14891268334b4 Mon Sep 17 00:00:00 2001 From: askubis Date: Mon, 26 Feb 2024 19:34:13 +0100 Subject: [PATCH] Promote (R)IGM.AllInstancesConfig to V1 (#9964) --- ...urce_compute_instance_group_manager.go.erb | 25 ------------------- ...compute_instance_group_manager_test.go.erb | 6 ----- ...mpute_region_instance_group_manager.go.erb | 21 ---------------- ..._region_instance_group_manager_test.go.erb | 4 --- ...mpute_instance_group_manager.html.markdown | 6 ++--- ...egion_instance_group_manager.html.markdown | 6 ++--- 6 files changed, 6 insertions(+), 62 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 d61f2457be99..878c8c2a2545 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 @@ -316,7 +316,6 @@ func ResourceComputeInstanceGroupManager() *schema.Resource { }, }, - <% unless version == "ga" -%> "all_instances_config": { Type: schema.TypeList, Optional: true, @@ -341,7 +340,6 @@ func ResourceComputeInstanceGroupManager() *schema.Resource { }, }, }, - <% end -%> "wait_for_instances": { Type: schema.TypeBool, Optional: true, @@ -353,12 +351,7 @@ func ResourceComputeInstanceGroupManager() *schema.Resource { Optional: true, Default: "STABLE", ValidateFunc: validation.StringInSlice([]string{"STABLE", "UPDATED"}, false), - - <% if version == "ga" -%> - Description: `When used with wait_for_instances specifies the status to wait for. When STABLE is specified this resource will wait until the instances are stable before returning. When UPDATED is set, it will wait for the version target to be reached and any per instance configs to be effective as well as all instances to be stable before returning.`, - <% else -%> Description: `When used with wait_for_instances specifies the status to wait for. When STABLE is specified this resource will wait until the instances are stable before returning. When UPDATED is set, it will wait for the version target to be reached and any per instance configs to be effective and all instances configs to be effective as well as all instances to be stable before returning.`, - <% end -%> }, "stateful_internal_ip": { Type: schema.TypeList, @@ -454,7 +447,6 @@ func ResourceComputeInstanceGroupManager() *schema.Resource { }, }, }, - <% unless version == "ga" -%> "all_instances_config": { Type: schema.TypeList, Computed: true, @@ -469,7 +461,6 @@ func ResourceComputeInstanceGroupManager() *schema.Resource { }, }, }, - <% end -%> "stateful": { Type: schema.TypeList, Computed: true, @@ -589,9 +580,7 @@ func resourceComputeInstanceGroupManagerCreate(d *schema.ResourceData, meta inte Versions: expandVersions(d.Get("version").([]interface{})), UpdatePolicy: expandUpdatePolicy(d.Get("update_policy").([]interface{})), InstanceLifecyclePolicy: expandInstanceLifecyclePolicy(d.Get("instance_lifecycle_policy").([]interface{})), - <% unless version == "ga" -%> AllInstancesConfig: expandAllInstancesConfig(nil, d.Get("all_instances_config").([]interface{})), - <% end -%> StatefulPolicy: expandStatefulPolicy(d), // Force send TargetSize to allow a value of 0. @@ -815,13 +804,11 @@ func resourceComputeInstanceGroupManagerRead(d *schema.ResourceData, meta interf 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()) } - <% unless version == "ga" -%> if manager.AllInstancesConfig != nil { if err = d.Set("all_instances_config", flattenAllInstancesConfig(manager.AllInstancesConfig)); err != nil { return fmt.Errorf("Error setting all_instances_config in state: %s", err.Error()) } } - <% end -%> if err = d.Set("status", flattenStatus(manager.Status)); err != nil { return fmt.Errorf("Error setting status in state: %s", err.Error()) } @@ -892,7 +879,6 @@ func resourceComputeInstanceGroupManagerUpdate(d *schema.ResourceData, meta inte change = true } - <% unless version == "ga" -%> if d.HasChange("all_instances_config") { oldAic, newAic := d.GetChange("all_instances_config") if newAic == nil || len(newAic.([]interface{})) == 0 { @@ -902,7 +888,6 @@ func resourceComputeInstanceGroupManagerUpdate(d *schema.ResourceData, meta inte } change = true } - <% end -%> if d.HasChange("stateful_internal_ip") || d.HasChange("stateful_external_ip") || d.HasChange("stateful_disk") { updatedManager.StatefulPolicy = expandStatefulPolicy(d) @@ -1045,11 +1030,7 @@ func resourceComputeInstanceGroupManagerDelete(d *schema.ResourceData, meta inte func computeIGMWaitForInstanceStatus(d *schema.ResourceData, meta interface{}) error { waitForUpdates := d.Get("wait_for_instances_status").(string) == "UPDATED" conf := resource.StateChangeConf{ - <% if version == "ga" -%> - Pending: []string{"creating", "error", "updating per instance configs", "reaching version target"}, - <% else -%> Pending: []string{"creating", "error", "updating per instance configs", "reaching version target", "updating all instances config"}, - <% end -%> Target: []string{"created"}, Refresh: waitForInstancesRefreshFunc(getManager, waitForUpdates, d, meta), Timeout: d.Timeout(schema.TimeoutCreate), @@ -1400,7 +1381,6 @@ func flattenInstanceLifecyclePolicy(instanceLifecyclePolicy *compute.InstanceGro return results } -<% unless version == "ga" -%> func expandAllInstancesConfig(old []interface{}, new []interface{}) *compute.InstanceGroupManagerAllInstancesConfig { var properties *compute.InstancePropertiesPatch for _, raw := range new { @@ -1456,7 +1436,6 @@ func flattenAllInstancesConfig(allInstancesConfig *compute.InstanceGroupManagerA results = append(results, props) return results } -<% end -%> func flattenStatus(status *compute.InstanceGroupManagerStatus) []map[string]interface{} { results := []map[string]interface{}{} @@ -1465,11 +1444,9 @@ func flattenStatus(status *compute.InstanceGroupManagerStatus) []map[string]inte "stateful": flattenStatusStateful(status.Stateful), "version_target": flattenStatusVersionTarget(status.VersionTarget), } - <% unless version == "ga" -%> if status.AllInstancesConfig != nil { data["all_instances_config"] = flattenStatusAllInstancesConfig(status.AllInstancesConfig) } - <% end -%> results = append(results, data) return results } @@ -1502,7 +1479,6 @@ func flattenStatusVersionTarget(versionTarget *compute.InstanceGroupManagerStatu return results } -<% unless version == "ga" -%> func flattenStatusAllInstancesConfig(allInstancesConfig *compute.InstanceGroupManagerStatusAllInstancesConfig) []map[string]interface{} { results := []map[string]interface{}{} data := map[string]interface{}{ @@ -1511,7 +1487,6 @@ func flattenStatusAllInstancesConfig(allInstancesConfig *compute.InstanceGroupMa results = append(results, data) return results } -<% end -%> func resourceInstanceGroupManagerStateImporter(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { if err := d.Set("wait_for_instances", false); err != nil { diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.erb index 7c3322419219..c02ed9a13c1b 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.erb @@ -660,7 +660,6 @@ resource "google_compute_instance_group_manager" "igm-update" { name = "customhttp" port = 8080 } -<% unless version == "ga" -%> all_instances_config { metadata = { foo = "bar" @@ -669,7 +668,6 @@ resource "google_compute_instance_group_manager" "igm-update" { doo = "dad" } } -<% end -%> instance_lifecycle_policy { force_update_on_repair = "YES" @@ -766,7 +764,6 @@ resource "google_compute_instance_group_manager" "igm-update" { port = 8443 } -<% unless version == "ga" -%> all_instances_config { metadata = { doo = "dad" @@ -775,7 +772,6 @@ resource "google_compute_instance_group_manager" "igm-update" { foo = "bar" } } -<% end -%> instance_lifecycle_policy { force_update_on_repair = "NO" @@ -1780,7 +1776,6 @@ resource "google_compute_instance_group_manager" "igm-basic" { max_surge_fixed = 0 max_unavailable_percent = 50 } -<% unless version == "ga" -%> all_instances_config { metadata = { doo = "dad" @@ -1789,7 +1784,6 @@ resource "google_compute_instance_group_manager" "igm-basic" { foo = "bar" } } -<% end -%> instance_lifecycle_policy { force_update_on_repair = "YES" } 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 8530b1e3e6b5..46cfbffd60e9 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 @@ -208,12 +208,7 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource { Optional: true, Default: "STABLE", ValidateFunc: validation.StringInSlice([]string{"STABLE", "UPDATED"}, false), - - <% if version == "ga" -%> - Description: `When used with wait_for_instances specifies the status to wait for. When STABLE is specified this resource will wait until the instances are stable before returning. When UPDATED is set, it will wait for the version target to be reached and any per instance configs to be effective as well as all instances to be stable before returning.`, - <% else -%> Description: `When used with wait_for_instances specifies the status to wait for. When STABLE is specified this resource will wait until the instances are stable before returning. When UPDATED is set, it will wait for the version target to be reached and any per instance configs to be effective and all instances configs to be effective as well as all instances to be stable before returning.`, - <% end -%> }, "auto_healing_policies": { @@ -365,7 +360,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, }, - <% unless version == "ga" -%> "all_instances_config": { Type: schema.TypeList, Optional: true, @@ -390,7 +384,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, }, - <% end -%> "stateful_internal_ip": { Type: schema.TypeList, Optional: true, @@ -481,7 +474,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, }, - <% unless version == "ga" -%> "all_instances_config": { Type: schema.TypeList, Computed: true, @@ -496,7 +488,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, }, - <% end -%> "stateful": { Type: schema.TypeList, Computed: true, @@ -562,9 +553,7 @@ func resourceComputeRegionInstanceGroupManagerCreate(d *schema.ResourceData, met Versions: expandVersions(d.Get("version").([]interface{})), UpdatePolicy: expandRegionUpdatePolicy(d.Get("update_policy").([]interface{})), InstanceLifecyclePolicy: expandInstanceLifecyclePolicy(d.Get("instance_lifecycle_policy").([]interface{})), - <% unless version == "ga" -%> AllInstancesConfig: expandAllInstancesConfig(nil, d.Get("all_instances_config").([]interface{})), - <% end -%> DistributionPolicy: expandDistributionPolicy(d), StatefulPolicy: expandStatefulPolicy(d), // Force send TargetSize to allow size of 0. @@ -602,11 +591,7 @@ func resourceComputeRegionInstanceGroupManagerCreate(d *schema.ResourceData, met func computeRIGMWaitForInstanceStatus(d *schema.ResourceData, meta interface{}) error { waitForUpdates := d.Get("wait_for_instances_status").(string) == "UPDATED" conf := resource.StateChangeConf{ - <% if version == "ga" -%> - Pending: []string{"creating", "error", "updating per instance configs", "reaching version target"}, - <% else -%> Pending: []string{"creating", "error", "updating per instance configs", "reaching version target", "updating all instances config"}, - <% end -%> Target: []string{"created"}, Refresh: waitForInstancesRefreshFunc(getRegionalManager, waitForUpdates, d, meta), Timeout: d.Timeout(schema.TimeoutCreate), @@ -674,11 +659,9 @@ func waitForInstancesRefreshFunc(f getInstanceManagerFunc, waitForUpdates bool, if !m.Status.VersionTarget.IsReached { return false, "reaching version target", nil } - <% unless version == "ga" -%> if !m.Status.AllInstancesConfig.Effective { return false, "updating all instances config", nil } - <% end -%> } return true, "created", nil } else { @@ -763,13 +746,11 @@ func resourceComputeRegionInstanceGroupManagerRead(d *schema.ResourceData, meta 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()) } - <% unless version == "ga" -%> if manager.AllInstancesConfig != nil { if err = d.Set("all_instances_config", flattenAllInstancesConfig(manager.AllInstancesConfig)); err != nil { return fmt.Errorf("Error setting all_instances_config in state: %s", err.Error()) } } - <% end -%> if err = d.Set("stateful_disk", flattenStatefulPolicy(manager.StatefulPolicy)); err != nil { return fmt.Errorf("Error setting stateful_disk in state: %s", err.Error()) } @@ -852,7 +833,6 @@ func resourceComputeRegionInstanceGroupManagerUpdate(d *schema.ResourceData, met change = true } - <% unless version == "ga" -%> if d.HasChange("all_instances_config") { oldAic, newAic := d.GetChange("all_instances_config") if newAic == nil || len(newAic.([]interface{})) == 0 { @@ -862,7 +842,6 @@ func resourceComputeRegionInstanceGroupManagerUpdate(d *schema.ResourceData, met } change = true } - <% end -%> if d.HasChange("list_managed_instances_results") { updatedManager.ListManagedInstancesResults = d.Get("list_managed_instances_results").(string) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.erb b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.erb index a5470d09b032..4e4ef9645074 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.erb +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.erb @@ -562,7 +562,6 @@ resource "google_compute_region_instance_group_manager" "igm-update" { port = 8080 } -<% unless version == "ga" -%> all_instances_config { metadata = { foo = "bar" @@ -571,7 +570,6 @@ resource "google_compute_region_instance_group_manager" "igm-update" { doo = "dad" } } -<% end -%> instance_lifecycle_policy { force_update_on_repair = "YES" @@ -668,7 +666,6 @@ resource "google_compute_region_instance_group_manager" "igm-update" { port = 8443 } -<% unless version == "ga" -%> all_instances_config { metadata = { doo = "dad" @@ -677,7 +674,6 @@ resource "google_compute_region_instance_group_manager" "igm-update" { foo = "bar" } } -<% end -%> instance_lifecycle_policy { force_update_on_repair = "NO" 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 f6dead3b4382..a79b67e8c81c 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 @@ -153,7 +153,7 @@ The following arguments are supported: * `auto_healing_policies` - (Optional) The autohealing policies for this managed instance group. You can specify only one value. Structure is [documented below](#nested_auto_healing_policies). For more information, see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/creating-groups-of-managed-instances#monitoring_groups). -* `all_instances_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) +* `all_instances_config` - (Optional) Properties to set on all instances in the group. After setting allInstancesConfig on the group, you must update the group's instances to apply the configuration. @@ -226,9 +226,9 @@ all_instances_config { } ``` -* `metadata` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)), The metadata key-value pairs that you want to patch onto the instance. For more information, see [Project and instance metadata](https://cloud.google.com/compute/docs/metadata#project_and_instance_metadata). +* `metadata` - (Optional), The metadata key-value pairs that you want to patch onto the instance. For more information, see [Project and instance metadata](https://cloud.google.com/compute/docs/metadata#project_and_instance_metadata). -* `labels` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)), The label key-value pairs that you want to patch onto the instance. +* `labels` - (Optional), The label key-value pairs that you want to patch onto the instance. - - - 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 0a16ac30b14f..cad9a1343d81 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 @@ -155,7 +155,7 @@ The following arguments are supported: * `auto_healing_policies` - (Optional) The autohealing policies for this managed instance group. You can specify only one value. Structure is documented below. For more information, see the [official documentation](https://cloud.google.com/compute/docs/instance-groups/creating-groups-of-managed-instances#monitoring_groups). -* `all_instances_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) +* `all_instances_config` - (Optional) Properties to set on all instances in the group. After setting allInstancesConfig on the group, you must update the group's instances to apply the configuration. @@ -235,9 +235,9 @@ all_instances_config { } ``` -* `metadata` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)), The metadata key-value pairs that you want to patch onto the instance. For more information, see [Project and instance metadata](https://cloud.google.com/compute/docs/metadata#project_and_instance_metadata). +* `metadata` - (Optional), The metadata key-value pairs that you want to patch onto the instance. For more information, see [Project and instance metadata](https://cloud.google.com/compute/docs/metadata#project_and_instance_metadata). -* `labels` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)), The label key-value pairs that you want to patch onto the instance. +* `labels` - (Optional), The label key-value pairs that you want to patch onto the instance. - - -