Skip to content

Commit

Permalink
Do not retry errors that are not recognized
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossg committed Jun 3, 2016
1 parent f4b90ef commit e1c79dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
15 changes: 6 additions & 9 deletions builtin/providers/aws/resource_aws_internet_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,12 @@ func resourceAwsInternetGatewayAttach(d *schema.ResourceData, meta interface{})
if err == nil {
return nil
}
ec2err, ok := err.(awserr.Error)
if !ok {
log.Printf("[INFO] RetryableError attaching InternetGateway ID: %s %s", d.Id(), err)
return resource.RetryableError(err)
}
switch ec2err.Code() {
case "InvalidInternetGatewayID.NotFound":
log.Printf("[INFO] RetryableError attaching InternetGateway ID: %s %s", d.Id(), err)
return resource.RetryableError(err) // retry
if ec2err, ok := err.(awserr.Error); ok {
switch ec2err.Code() {
case "InvalidInternetGatewayID.NotFound":
log.Printf("[INFO] RetryableError attaching InternetGateway ID: %s %s", d.Id(), err)
return resource.RetryableError(err) // retry
}
}
log.Printf("[INFO] NonRetryableError attaching InternetGateway ID: %s %s", d.Id(), err)
return resource.NonRetryableError(err)
Expand Down
15 changes: 6 additions & 9 deletions builtin/providers/aws/resource_aws_route_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,12 @@ func resourceAwsRouteTableUpdate(d *schema.ResourceData, meta interface{}) error
if err == nil {
return nil
}
ec2err, ok := err.(awserr.Error)
if !ok {
log.Printf("[INFO] RetryableError creating route for RouteTable ID: %s %s", d.Id(), err)
return resource.RetryableError(err)
}
switch ec2err.Code() {
case "InvalidRouteTableID.NotFound":
log.Printf("[INFO] RetryableError creating route for RouteTable ID: %s %s", d.Id(), err)
return resource.RetryableError(err) // retry
if ec2err, ok := err.(awserr.Error); ok {
switch ec2err.Code() {
case "InvalidRouteTableID.NotFound":
log.Printf("[INFO] RetryableError creating route for RouteTable ID: %s %s", d.Id(), err)
return resource.RetryableError(err) // retry
}
}
log.Printf("[INFO] NonRetryableError creating route for RouteTable ID: %s %s", d.Id(), err)
return resource.NonRetryableError(err)
Expand Down

0 comments on commit e1c79dd

Please sign in to comment.