Skip to content

Commit

Permalink
when deleting region and zone make unschedulable first
Browse files Browse the repository at this point in the history
  • Loading branch information
rmb938 committed Feb 9, 2018
1 parent 5f6d470 commit 873c502
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion sandwich/resource_sandwich_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ func resourceRegionDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
regionClient := config.SandwichClient.Region()

err := regionClient.Delete(d.Id())
err := regionClient.ActionSchedule(d.Id(), false)
if err != nil {
return err
}

err = regionClient.Delete(d.Id())
if err != nil {
return err
}
Expand Down
7 changes: 6 additions & 1 deletion sandwich/resource_sandwich_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ func resourceZoneDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
zoneClient := config.SandwichClient.Zone()

err := zoneClient.Delete(d.Id())
err := zoneClient.ActionSchedule(d.Id(), false)
if err != nil {
return err
}

err = zoneClient.Delete(d.Id())
if err != nil {
return err
}
Expand Down

0 comments on commit 873c502

Please sign in to comment.