From 087de28935b2af58bba3b22ddbd4f66f2dea5300 Mon Sep 17 00:00:00 2001 From: Trevor Robinson Date: Wed, 18 Jul 2018 10:49:58 -0700 Subject: [PATCH] Handle hook 404 --- bitbucket/resource_hook.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bitbucket/resource_hook.go b/bitbucket/resource_hook.go index 5cd628bf..777265ef 100644 --- a/bitbucket/resource_hook.go +++ b/bitbucket/resource_hook.go @@ -193,6 +193,13 @@ func resourceHookExists(d *schema.ResourceData, m interface{}) (bool, error) { )) if err != nil { + log.Printf("[DEBUG] Req: %+v, Err: %+v", hook_req, err) + // If the hook was not found, we get the message "is not a valid hook". + // Return nil so we can show that the hook is gone. + if hook_req.StatusCode == 404 { + return false, nil + } + panic(err) }