INNER CODE UNIT · Go
addElement
pcasteran/terraform-graph-beautifier · cytoscape/writer.go:65
addElement = func(parent *tfgraph.Module, element tfgraph.ConfigElement) {
// Add a node for the element.
node := &Node{
Data: NodeData{
ID: element.GetQualifiedName(),
Label: element.GetName(),
Type: element.GetTfType(),
},
Classes: []string{element.GetTfType()},
}
if parent != nil {
parentName := parent.GetQualifiedName()
node.Data.Parent = &parentName
}
nodes = append(nodes, node)
// If the element is a module, recursively add its children.
module, ok := element.(*tfgraph.Module)