terraform: Type should always be set on ResourceState

This commit is contained in:
Mitchell Hashimoto 2014-06-25 18:29:36 -07:00
parent d64ba66edb
commit 84a645712b
2 changed files with 9 additions and 0 deletions

View File

@ -133,6 +133,9 @@ func (t *Terraform) refreshWalkFn(result *State) depgraph.WalkFunc {
return nil, err
}
// Fix the type to be the type we have
rs.Type = r.State.Type
l.Lock()
result.Resources[r.Id] = rs
l.Unlock()

View File

@ -219,6 +219,12 @@ func TestTerraformRefresh(t *testing.T) {
if !reflect.DeepEqual(s.Resources["aws_instance.web"], rpAWS.RefreshReturn) {
t.Fatalf("bad: %#v", s.Resources)
}
for _, r := range s.Resources {
if r.Type == "" {
t.Fatalf("no type: %#v", r)
}
}
}
func TestTerraformRefresh_state(t *testing.T) {