Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/aws_ec2_transit_gateway: Add retry on DirectConnect Attachments error #8752

Merged
merged 1 commit into from
May 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion aws/resource_aws_ec2_transit_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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
}
Expand Down