From d01b7c822cbccff647a05d9365196e8fa54be50c Mon Sep 17 00:00:00 2001 From: Ryn Daniels Date: Thu, 15 Aug 2019 12:55:36 +0200 Subject: [PATCH] Final retry deleting iot types --- aws/resource_aws_iot_thing_type.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_iot_thing_type.go b/aws/resource_aws_iot_thing_type.go index ac483df1d35..02748c45004 100644 --- a/aws/resource_aws_iot_thing_type.go +++ b/aws/resource_aws_iot_thing_type.go @@ -185,7 +185,7 @@ func resourceAwsIotThingTypeDelete(d *schema.ResourceData, meta interface{}) err } log.Printf("[DEBUG] Deleting IoT Thing Type: %s", deleteParams) - return resource.Retry(6*time.Minute, func() *resource.RetryError { + err = resource.Retry(6*time.Minute, func() *resource.RetryError { _, err := conn.DeleteThingType(deleteParams) if err != nil { @@ -204,4 +204,14 @@ func resourceAwsIotThingTypeDelete(d *schema.ResourceData, meta interface{}) err return nil }) + if isResourceTimeoutError(err) { + _, err = conn.DeleteThingType(deleteParams) + if isAWSErr(err, iot.ErrCodeResourceNotFoundException, "") { + return nil + } + } + if err != nil { + return fmt.Errorf("Error deleting IOT thing type: %s", err) + } + return nil }