in internal/terraform/state.go [62:76]
func GetInstancesForType(resources []*states.Resource, kind string) ([]map[string]interface{}, error) {
var instances []map[string]interface{}
for _, r := range resources {
if r.Addr.Resource.Type == kind {
for _, i := range r.Instances {
var instance map[string]interface{}
if err := json.Unmarshal(i.Current.AttrsJSON, &instance); err != nil {
return nil, fmt.Errorf("unmarshal json: %v", err)
}
instances = append(instances, instance)
}
}
}
return instances, nil
}