provider/aws: Refresh `aws_route` from state if `aws_route_table` not (#8443)

found

Fixes #5288
Fixes #8388

```
TESTS TBC
```
This commit is contained in:
Paul Stack 2016-08-26 07:50:14 +01:00 committed by GitHub
parent 0dd17c646b
commit 6ea53e5e3c
1 changed files with 5 additions and 0 deletions

View File

@ -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)