From a964453bb9f4f1c4c81eb63739b2f25f5b279633 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 2 Feb 2021 08:46:58 -0800 Subject: [PATCH] Made AppEngine requests retry if they fail due to a P4SA propagation delay. (#4453) (#8365) Fixed https://github.com/hashicorp/terraform-provider-google/issues/8333 Signed-off-by: Modular Magician --- .changelog/4453.txt | 3 +++ google/error_retry_predicates.go | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changelog/4453.txt diff --git a/.changelog/4453.txt b/.changelog/4453.txt new file mode 100644 index 00000000000..19ab13df7a3 --- /dev/null +++ b/.changelog/4453.txt @@ -0,0 +1,3 @@ +```release-note:bug +appengine: added retry for P4SA propagation delay +``` diff --git a/google/error_retry_predicates.go b/google/error_retry_predicates.go index 5aad56565d0..07ee330bf37 100644 --- a/google/error_retry_predicates.go +++ b/google/error_retry_predicates.go @@ -240,12 +240,15 @@ func isNotFilestoreQuotaError(err error) (bool, string) { } // Retry if App Engine operation returns a 409 with a specific message for -// concurrent operations. +// concurrent operations, or a 404 indicating p4sa has not yet propagated. func isAppEngineRetryableError(err error) (bool, string) { if gerr, ok := err.(*googleapi.Error); ok { if gerr.Code == 409 && strings.Contains(strings.ToLower(gerr.Body), "operation is already in progress") { return true, "Waiting for other concurrent App Engine changes to finish" } + if gerr.Code == 404 && strings.Contains(strings.ToLower(gerr.Body), "unable to retrieve P4SA") { + return true, "Waiting for P4SA propagation to GAIA" + } } return false, "" }