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:
parent
0dd17c646b
commit
6ea53e5e3c
|
@ -197,6 +197,11 @@ func resourceAwsRouteRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
conn := meta.(*AWSClient).ec2conn
|
conn := meta.(*AWSClient).ec2conn
|
||||||
route, err := findResourceRoute(conn, d.Get("route_table_id").(string), d.Get("destination_cidr_block").(string))
|
route, err := findResourceRoute(conn, d.Get("route_table_id").(string), d.Get("destination_cidr_block").(string))
|
||||||
if err != nil {
|
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
|
return err
|
||||||
}
|
}
|
||||||
resourceAwsRouteSetResourceData(d, route)
|
resourceAwsRouteSetResourceData(d, route)
|
||||||
|
|
Loading…
Reference in New Issue