4 "github.com/hashicorp/terraform/dag"
7 // CountBoundaryTransformer adds a node that depends on everything else
8 // so that it runs last in order to clean up the state for nodes that
9 // are on the "count boundary": "foo.0" when only one exists becomes "foo"
10 type CountBoundaryTransformer struct{}
12 func (t *CountBoundaryTransformer) Transform(g *Graph) error {
13 node := &NodeCountBoundary{}
16 // Depends on everything
17 for _, v := range g.Vertices() {
18 // Don't connect to ourselves
24 g.Connect(dag.BasicEdge(node, v))