github.com/richardbowden/terraform@v0.6.12-0.20160901200758-30ea22c25211/terraform/transform_transitive_reduction.go (about)

     1  package terraform
     2  
     3  // TransitiveReductionTransformer is a GraphTransformer that performs
     4  // finds the transitive reduction of the graph. For a definition of
     5  // transitive reduction, see Wikipedia.
     6  type TransitiveReductionTransformer struct{}
     7  
     8  func (t *TransitiveReductionTransformer) Transform(g *Graph) error {
     9  	// If the graph isn't valid, skip the transitive reduction.
    10  	// We don't error here because Terraform itself handles graph
    11  	// validation in a better way, or we assume it does.
    12  	if err := g.Validate(); err != nil {
    13  		return nil
    14  	}
    15  
    16  	// Do it
    17  	g.TransitiveReduction()
    18  
    19  	return nil
    20  }