diff --git a/cyral/core/error_handlers.go b/cyral/core/error_handlers.go index acb373cd..1e2530e2 100644 --- a/cyral/core/error_handlers.go +++ b/cyral/core/error_handlers.go @@ -27,6 +27,14 @@ func (h *IgnoreNotFoundByMessage) HandleError( ) error { tflog.Debug(ctx, "==> Init HandleError core.IgnoreNotFoundByMessage") + // If this is a 404 already, then we don't need to actually match the error message + httpError, _ := err.(*client.HttpError) + if httpError.StatusCode == http.StatusNotFound { + tflog.Debug(ctx, "===> Ignoring regex matching as the status code is already 404") + r.SetId("") + return nil + } + matched, regexpError := regexp.MatchString( h.MessageMatches, err.Error(),