From 7f914856b22d0d65d56ff1a9dab12013e1444411 Mon Sep 17 00:00:00 2001 From: Megan Bang Date: Wed, 11 Dec 2019 12:23:43 -0600 Subject: [PATCH] do not retry if sql api returns 409 for deleted instance name --- third_party/terraform/utils/error_retry_predicates.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/third_party/terraform/utils/error_retry_predicates.go b/third_party/terraform/utils/error_retry_predicates.go index d02614392a9d..c5d02726fc45 100644 --- a/third_party/terraform/utils/error_retry_predicates.go +++ b/third_party/terraform/utils/error_retry_predicates.go @@ -33,6 +33,10 @@ func pubsubTopicProjectNotReady(err error) (bool, string) { func isSqlOperationInProgressError(err error) (bool, string) { if gerr, ok := err.(*googleapi.Error); ok && gerr.Code == 409 { + if strings.Contains(gerr.Body, "you cannot reuse the name of the deleted instance until one week from the deletion date.") { + return false, "" + } + return true, "Waiting for other concurrent Cloud SQL operations to finish" } return false, ""