mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-25 16:31:10 -06:00
Make sure each GraphBuilder has a Name
Ensure that each instance of BasucGraphBuilder gets a name corresponding to the Builder which created it. This allows us to differentiate the graphs in the logs.
This commit is contained in:
parent
bb137f4bfb
commit
3df3b99276
@ -30,7 +30,7 @@ type BasicGraphBuilder struct {
|
|||||||
func (b *BasicGraphBuilder) Build(path []string) (*Graph, error) {
|
func (b *BasicGraphBuilder) Build(path []string) (*Graph, error) {
|
||||||
g := &Graph{Path: path}
|
g := &Graph{Path: path}
|
||||||
|
|
||||||
debugName := "build-graph.json"
|
debugName := "graph.json"
|
||||||
if b.Name != "" {
|
if b.Name != "" {
|
||||||
debugName = b.Name + "-" + debugName
|
debugName = b.Name + "-" + debugName
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ func (b *BuiltinGraphBuilder) Build(path []string) (*Graph, error) {
|
|||||||
basic := &BasicGraphBuilder{
|
basic := &BasicGraphBuilder{
|
||||||
Steps: b.Steps(path),
|
Steps: b.Steps(path),
|
||||||
Validate: b.Validate,
|
Validate: b.Validate,
|
||||||
Name: "builtin",
|
Name: "BuiltinGraphBuilder",
|
||||||
}
|
}
|
||||||
|
|
||||||
return basic.Build(path)
|
return basic.Build(path)
|
||||||
|
@ -40,7 +40,7 @@ func (b *ApplyGraphBuilder) Build(path []string) (*Graph, error) {
|
|||||||
return (&BasicGraphBuilder{
|
return (&BasicGraphBuilder{
|
||||||
Steps: b.Steps(),
|
Steps: b.Steps(),
|
||||||
Validate: true,
|
Validate: true,
|
||||||
Name: "apply",
|
Name: "ApplyGraphBuilder",
|
||||||
}).Build(path)
|
}).Build(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ func (b *DestroyPlanGraphBuilder) Build(path []string) (*Graph, error) {
|
|||||||
return (&BasicGraphBuilder{
|
return (&BasicGraphBuilder{
|
||||||
Steps: b.Steps(),
|
Steps: b.Steps(),
|
||||||
Validate: true,
|
Validate: true,
|
||||||
Name: "destroy",
|
Name: "DestroyPlanGraphBuilder",
|
||||||
}).Build(path)
|
}).Build(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ func (b *ImportGraphBuilder) Build(path []string) (*Graph, error) {
|
|||||||
return (&BasicGraphBuilder{
|
return (&BasicGraphBuilder{
|
||||||
Steps: b.Steps(),
|
Steps: b.Steps(),
|
||||||
Validate: true,
|
Validate: true,
|
||||||
|
Name: "ImportGraphBuilder",
|
||||||
}).Build(path)
|
}).Build(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ func (b *PlanGraphBuilder) Build(path []string) (*Graph, error) {
|
|||||||
return (&BasicGraphBuilder{
|
return (&BasicGraphBuilder{
|
||||||
Steps: b.Steps(),
|
Steps: b.Steps(),
|
||||||
Validate: true,
|
Validate: true,
|
||||||
Name: "plan",
|
Name: "PlanGraphBuilder",
|
||||||
}).Build(path)
|
}).Build(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,11 @@ func (n *GraphNodeConfigResource) DynamicExpand(ctx EvalContext) (*Graph, error)
|
|||||||
steps = append(steps, &RootTransformer{})
|
steps = append(steps, &RootTransformer{})
|
||||||
|
|
||||||
// Build the graph
|
// Build the graph
|
||||||
b := &BasicGraphBuilder{Steps: steps, Validate: true}
|
b := &BasicGraphBuilder{
|
||||||
|
Steps: steps,
|
||||||
|
Validate: true,
|
||||||
|
Name: "GraphNodeConfigResource",
|
||||||
|
}
|
||||||
return b.Build(ctx.Path())
|
return b.Build(ctx.Path())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,10 @@ func (n *NodeDestroyResource) DynamicExpand(ctx EvalContext) (*Graph, error) {
|
|||||||
steps = append(steps, &RootTransformer{})
|
steps = append(steps, &RootTransformer{})
|
||||||
|
|
||||||
// Build the graph
|
// Build the graph
|
||||||
b := &BasicGraphBuilder{Steps: steps}
|
b := &BasicGraphBuilder{
|
||||||
|
Steps: steps,
|
||||||
|
Name: "NodeResourceDestroy",
|
||||||
|
}
|
||||||
return b.Build(ctx.Path())
|
return b.Build(ctx.Path())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,10 @@ func (n *NodePlannableResource) DynamicExpand(ctx EvalContext) (*Graph, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build the graph
|
// Build the graph
|
||||||
b := &BasicGraphBuilder{Steps: steps, Validate: true}
|
b := &BasicGraphBuilder{
|
||||||
|
Steps: steps,
|
||||||
|
Validate: true,
|
||||||
|
Name: "NodePlannableResource",
|
||||||
|
}
|
||||||
return b.Build(ctx.Path())
|
return b.Build(ctx.Path())
|
||||||
}
|
}
|
||||||
|
@ -142,6 +142,7 @@ func (t *CBDEdgeTransformer) depMap(
|
|||||||
&AttachStateTransformer{State: t.State},
|
&AttachStateTransformer{State: t.State},
|
||||||
&ReferenceTransformer{},
|
&ReferenceTransformer{},
|
||||||
},
|
},
|
||||||
|
Name: "CBDEdgeTransformer",
|
||||||
}).Build(nil)
|
}).Build(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user