diff --git a/aws/resource_aws_ec2_transit_gateway.go b/aws/resource_aws_ec2_transit_gateway.go index 13228ab1475..5d3b01a8000 100644 --- a/aws/resource_aws_ec2_transit_gateway.go +++ b/aws/resource_aws_ec2_transit_gateway.go @@ -215,13 +215,17 @@ func resourceAwsEc2TransitGatewayDelete(d *schema.ResourceData, meta interface{} } log.Printf("[DEBUG] Deleting EC2 Transit Gateway (%s): %s", d.Id(), input) - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(2*time.Minute, func() *resource.RetryError { _, err := conn.DeleteTransitGateway(input) if isAWSErr(err, "IncorrectState", "has non-deleted Transit Gateway Attachments") { return resource.RetryableError(err) } + if isAWSErr(err, "IncorrectState", "has non-deleted DirectConnect Gateway Attachments") { + return resource.RetryableError(err) + } + if isAWSErr(err, "IncorrectState", "has non-deleted VPN Attachments") { return resource.RetryableError(err) } @@ -233,6 +237,10 @@ func resourceAwsEc2TransitGatewayDelete(d *schema.ResourceData, meta interface{} return nil }) + if isResourceTimeoutError(err) { + _, err = conn.DeleteTransitGateway(input) + } + if isAWSErr(err, "InvalidTransitGatewayID.NotFound", "") { return nil }