From 62dfb3e359827b8e52d9a05ec27b0fd0b2d147c1 Mon Sep 17 00:00:00 2001 From: Ryn Daniels Date: Thu, 4 Jul 2019 17:38:39 +0200 Subject: [PATCH] final retry when waiting for transfer user deletion --- aws/resource_aws_transfer_user.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_transfer_user.go b/aws/resource_aws_transfer_user.go index dddcb86d9d9..03a03ecce3c 100644 --- a/aws/resource_aws_transfer_user.go +++ b/aws/resource_aws_transfer_user.go @@ -231,7 +231,7 @@ func waitForTransferUserDeletion(conn *transfer.Transfer, serverID, userName str UserName: aws.String(userName), } - return resource.Retry(10*time.Minute, func() *resource.RetryError { + err := resource.Retry(10*time.Minute, func() *resource.RetryError { _, err := conn.DescribeUser(params) if isAWSErr(err, transfer.ErrCodeResourceNotFoundException, "") { @@ -244,4 +244,15 @@ func waitForTransferUserDeletion(conn *transfer.Transfer, serverID, userName str return resource.RetryableError(fmt.Errorf("Transfer User (%s) for Server (%s) still exists", userName, serverID)) }) + + if isResourceTimeoutError(err) { + _, err = conn.DescribeUser(params) + } + if isAWSErr(err, transfer.ErrCodeResourceNotFoundException, "") { + return nil + } + if err != nil { + return fmt.Errorf("Error decoding transfer user ID: %s", err) + } + return nil }