Skip to content

Commit

Permalink
Secure Web Proxy deleteSWGAutoGenRouter wait the operation to finish (#…
Browse files Browse the repository at this point in the history
…12600) (#20817)

[upstream:4e86784f2ed69f1afa7ee3b0ff6e4846f246e4e6]

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Jan 6, 2025
1 parent d2c0fc3 commit a3ed6de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/12600.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
networkservices: fix `google_network_services_gateway` resource so that it correctly waits for the router to be deleted on `terraform destroy`
```
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
"github.com/hashicorp/terraform-provider-google/google/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
"github.com/hashicorp/terraform-provider-google/google/verify"

tpgcompute "github.com/hashicorp/terraform-provider-google/google/services/compute"
)

// Checks if there is another gateway under the same location.
Expand Down Expand Up @@ -127,7 +129,7 @@ func deleteSWGAutoGenRouter(d *schema.ResourceData, config *transport_tpg.Config
return err
}

_, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Config: config,
Method: "DELETE",
Project: billingProject,
Expand All @@ -145,6 +147,10 @@ func deleteSWGAutoGenRouter(d *schema.ResourceData, config *transport_tpg.Config
return err
}

err = tpgcompute.ComputeOperationWaitTime(
config, res, billingProject, "Deleting autogen router", userAgent,
d.Timeout(schema.TimeoutDelete))

return nil
}

Expand Down

0 comments on commit a3ed6de

Please sign in to comment.