in terraform/terraform.go [178:218]
func NewBlocks(mod *tfconfig.Module) (*Blocks, error) {
result := Blocks{}
for _, v := range mod.ModuleCalls {
b, err := NewModuleBlock(v)
if err != nil {
return nil, fmt.Errorf("could not parse Module Calls: %s", err)
}
result = append(result, b)
}
for _, v := range mod.ManagedResources {
b, err := NewResourceBlock(v)
if err != nil {
return nil, fmt.Errorf("could not parse ManagedResources: %s", err)
}
result = append(result, b)
}
for _, v := range mod.DataResources {
b, err := NewResourceBlock(v)
if err != nil {
return nil, fmt.Errorf("could not parse DataResources: %s", err)
}
result = append(result, b)
}
for _, v := range mod.Variables {
b, err := NewVariableBlock(v)
if err != nil {
return nil, fmt.Errorf("could not parse Variables: %s", err)
}
result = append(result, b)
}
sort.Slice(result, func(i, j int) bool {
return result[i].Start < result[j].Start
})
return &result, nil
}