github.com/codeherentuk/terraform@v0.11.12-beta1/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  }