diff --git a/terraform/terraform.go b/terraform/terraform.go index ea265c0e3..c93145a4e 100644 --- a/terraform/terraform.go +++ b/terraform/terraform.go @@ -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() diff --git a/terraform/terraform_test.go b/terraform/terraform_test.go index f0fdbd616..110777eae 100644 --- a/terraform/terraform_test.go +++ b/terraform/terraform_test.go @@ -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) {