providers/aws: handle eventual consistency of AWS in aws_vpc

This commit is contained in:
Mitchell Hashimoto 2014-07-07 12:23:04 -07:00
parent 4f10569037
commit 6deea2a93b
1 changed files with 6 additions and 2 deletions

View File

@ -126,8 +126,12 @@ func VPCStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeVpcs([]string{id}, ec2.NewFilter())
if err != nil {
log.Printf("Error on VPCStateRefresh: %s", err)
return nil, "", err
if ec2err, ok := err.(*ec2.Error); ok && ec2err.Code == "InvalidVpcID.NotFound" {
resp = nil
} else {
log.Printf("Error on VPCStateRefresh: %s", err)
return nil, "", err
}
}
if resp == nil {