Skip to content

Deprecate beta fields for (R)IGM. #2156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions google/resource_compute_instance_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,17 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
"update_strategy": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "RESTART",
ValidateFunc: validation.StringInSlice([]string{"RESTART", "NONE", "ROLLING_UPDATE"}, false),
Default: "REPLACE",
ValidateFunc: validation.StringInSlice([]string{"RESTART", "NONE", "ROLLING_UPDATE", "REPLACE"}, false),
DiffSuppressFunc: func(key, old, new string, d *schema.ResourceData) bool {
if old == "REPLACE" && new == "RESTART" {
return true
}
if old == "RESTART" && new == "REPLACE" {
return true
}
return false
},
},

"target_pools": &schema.Schema{
Expand Down Expand Up @@ -438,7 +447,7 @@ func resourceComputeInstanceGroupManagerRead(d *schema.ResourceData, meta interf
d.Set("self_link", ConvertSelfLinkToV1(manager.SelfLink))
update_strategy, ok := d.GetOk("update_strategy")
if !ok {
update_strategy = "RESTART"
update_strategy = "REPLACE"
}
d.Set("update_strategy", update_strategy.(string))
d.Set("auto_healing_policies", flattenAutoHealingPolicies(manager.AutoHealingPolicies))
Expand All @@ -463,7 +472,7 @@ func resourceComputeInstanceGroupManagerRead(d *schema.ResourceData, meta interf
// and rolling update policy (PROACTIVE, OPPORTUNISTIC). Updates performed by API
// are OPPORTUNISTIC by default.
func performZoneUpdate(config *Config, id string, updateStrategy string, rollingUpdatePolicy *computeBeta.InstanceGroupManagerUpdatePolicy, versions []*computeBeta.InstanceGroupManagerVersion, project string, zone string) error {
if updateStrategy == "RESTART" {
if updateStrategy == "RESTART" || updateStrategy == "REPLACE" {
managedInstances, err := config.clientComputeBeta.InstanceGroupManagers.ListManagedInstances(project, zone, id).Do()
if err != nil {
return fmt.Errorf("Error getting instance group managers instances: %s", err)
Expand Down
21 changes: 12 additions & 9 deletions google/resource_compute_region_instance_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
},

"version": &schema.Schema{
Type: schema.TypeList,
Optional: true,
Computed: true,
Type: schema.TypeList,
Optional: true,
Computed: true,
Deprecated: "Use the region_instance_group_manager resource in the google-beta provider instead. See https://terraform.io/docs/providers/google/provider-versions.html for more details.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Expand Down Expand Up @@ -171,9 +172,10 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
},

"auto_healing_policies": &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Deprecated: "Use the region_instance_group_manager resource in the google-beta provider instead. See https://terraform.io/docs/providers/google/provider-versions.html for more details.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"health_check": &schema.Schema{
Expand Down Expand Up @@ -204,9 +206,10 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource {
},

"rolling_update_policy": &schema.Schema{
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Deprecated: "Use the region_instance_group_manager resource in the google-beta provider instead. See https://terraform.io/docs/providers/google/provider-versions.html for more details.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"minimal_action": &schema.Schema{
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/compute_instance_group_manager.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ The following arguments are supported:
* `project` - (Optional) The ID of the project in which the resource belongs. If it
is not provided, the provider project is used.

* `update_strategy` - (Optional, Default `"RESTART"`) If the `instance_template`
* `update_strategy` - (Optional, Default `"REPLACE"`) If the `instance_template`
resource is modified, a value of `"NONE"` will prevent any of the managed
instances from being restarted by Terraform. A value of `"RESTART"` will
instances from being restarted by Terraform. A value of `"REPLACE"` will
restart all of the instances at once. `"ROLLING_UPDATE"` is supported as [Beta feature].
A value of `"ROLLING_UPDATE"` requires `rolling_update_policy` block to be set

Expand Down