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