Skip to content

Commit

Permalink
Remove wait for instances stable on IGM and RIGM deletion. (#9781) (#…
Browse files Browse the repository at this point in the history
…6829)

[upstream:322748e9e7f49197ba404b851cb7d3ad057d107d]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jan 9, 2024
1 parent 1a744ca commit ba796fa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .changelog/9781.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
compute: fixed an issue where we would `wait_for_instances` before deleting on `google_*_compute_instance_manager`
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package compute
import (
"fmt"
"log"
"regexp"
"sort"
"strings"
"time"
Expand Down Expand Up @@ -959,21 +958,6 @@ func resourceComputeInstanceGroupManagerUpdate(d *schema.ResourceData, meta inte
func resourceComputeInstanceGroupManagerDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*transport_tpg.Config)

if d.Get("wait_for_instances").(bool) {
err := computeIGMWaitForInstanceStatus(d, meta)
if err != nil {
notFound, reErr := regexp.MatchString(`not found`, err.Error())
if reErr != nil {
return reErr
}
if notFound {
// manager was not found, we can exit gracefully
return nil
}
return err
}
}

userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package compute
import (
"fmt"
"log"
"regexp"
"strings"
"time"

Expand Down Expand Up @@ -902,21 +901,6 @@ func resourceComputeRegionInstanceGroupManagerUpdate(d *schema.ResourceData, met
func resourceComputeRegionInstanceGroupManagerDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*transport_tpg.Config)

if d.Get("wait_for_instances").(bool) {
err := computeRIGMWaitForInstanceStatus(d, meta)
if err != nil {
notFound, reErr := regexp.MatchString(`not found`, err.Error())
if reErr != nil {
return reErr
}
if notFound {
// manager was not found, we can exit gracefully
return nil
}
return err
}
}

userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
if err != nil {
return err
Expand Down

0 comments on commit ba796fa

Please sign in to comment.