• James Bardin's avatar
    DebugInfo and DebugGraph · 797a1b33
    James Bardin authored
    Implement debugInfo and the DebugGraph
    
    DebugInfo will be a global variable through which graph debug
    information can we written to a compressed archive. The DebugInfo
    methods are all safe for concurrent use, and noop with a nil receiver.
    The API outside of the terraform package will be to call SetDebugInfo
    to create the archive, and CloseDebugInfo() to properly close the file.
    Each write to the archive will be flushed and sync'ed individually, so
    in the event of a crash or a missing call to Close, the archive can
    still be recovered.
    
    The DebugGraph is a representation of a terraform Graph to be written to
    the debug archive, currently in dot format. The DebugGraph also contains
    an internal buffer with Printf and Write methods to add to this buffer.
    The buffer will be written to an accompanying file in the debug archive
    along with the graph.
    
    This also adds a GraphNodeDebugger interface. Any node implementing
    `NodeDebug() string` can output information to annotate the debug graph
    node, and add the data to the log. This interface may change or be
    removed to provide richer options for debugging graph nodes.
    
    The new graph builders all delegate the build to the BasicGraphBuilder.
    Having a Name field lets us differentiate the actual builder
    implementation in the debug graphs.
    797a1b33