Skip to content

Commit

Permalink
provider/aws: Refresh aws_route from state if aws_route_table not
Browse files Browse the repository at this point in the history
found

Fixes #5288
Fixes #8388

```
TESTS TBC
```
  • Loading branch information
stack72 committed Aug 24, 2016
1 parent fbda254 commit de6161f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions builtin/providers/aws/resource_aws_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ func resourceAwsRouteRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
route, err := findResourceRoute(conn, d.Get("route_table_id").(string), d.Get("destination_cidr_block").(string))
if err != nil {
if ec2err, ok := err.(awserr.Error); ok && ec2err.Code() == "InvalidRouteTableID.NotFound" {
log.Printf("[WARN] AWS RouteTable not found. Removing Route from state")
d.SetId("")
return nil
}
return err
}
resourceAwsRouteSetResourceData(d, route)
Expand Down

0 comments on commit de6161f

Please sign in to comment.