providers/aws: if no reservations, no instance
This commit is contained in:
parent
0a8cebdb82
commit
6e995feb5e
|
@ -145,6 +145,11 @@ func resource_aws_instance_refresh(
|
||||||
return s, err
|
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]
|
instance := &resp.Reservations[0].Instances[0]
|
||||||
|
|
||||||
// If the instance is terminated, then it is gone
|
// If the instance is terminated, then it is gone
|
||||||
|
|
|
@ -132,6 +132,9 @@ func (t *Terraform) refreshWalkFn(result *State) depgraph.WalkFunc {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if rs == nil {
|
||||||
|
rs = new(ResourceState)
|
||||||
|
}
|
||||||
|
|
||||||
// Fix the type to be the type we have
|
// Fix the type to be the type we have
|
||||||
rs.Type = r.State.Type
|
rs.Type = r.State.Type
|
||||||
|
|
Loading…
Reference in New Issue