providers/aws: if no reservations, no instance

This commit is contained in:
Mitchell Hashimoto 2014-06-26 09:58:38 -07:00
parent 0a8cebdb82
commit 6e995feb5e
2 changed files with 8 additions and 0 deletions

View File

@ -145,6 +145,11 @@ func resource_aws_instance_refresh(
return s, err
}
// If nothing was found, then return no state
if len(resp.Reservations) == 0 {
return nil, nil
}
instance := &resp.Reservations[0].Instances[0]
// If the instance is terminated, then it is gone

View File

@ -132,6 +132,9 @@ func (t *Terraform) refreshWalkFn(result *State) depgraph.WalkFunc {
if err != nil {
return nil, err
}
if rs == nil {
rs = new(ResourceState)
}
// Fix the type to be the type we have
rs.Type = r.State.Type