Skip to content

Commit 7c6eddd

Browse files
authored
direct: internal: move all graph construction to planning phase (#3509)
## Why Previously we did one fix-up in apply phase for removed resources. Conceptually it's nice that graph is ready in plan stage and it requires less code.
1 parent 9126491 commit 7c6eddd

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

bundle/terranova/apply.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@ func (m *terranovaApplyMutator) Apply(ctx context.Context, b *bundle.Bundle) dia
4040
return nil
4141
}
4242

43-
for node, action := range b.PlannedActions {
44-
if !b.Graph.HasNode(node) {
45-
if action == deployplan.ActionTypeDelete {
46-
// it is expected that this node is not seen by makeResourceGraph because it is not in config
47-
b.Graph.AddNode(node)
48-
} else {
49-
// it's internal error today because plan cannot be outdated. In the future when we load serialized plan, this will become user error
50-
logdiag.LogError(ctx, fmt.Errorf("cannot %s %s.%s: internal error, plan is outdated", action, node.Group, node.Key))
51-
}
52-
}
53-
}
54-
5543
if logdiag.HasError(ctx) {
5644
return nil
5745
}

bundle/terranova/plan.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ func CalculatePlanForDeploy(ctx context.Context, b *bundle.Bundle) error {
217217
continue
218218
}
219219
b.PlannedActions[n] = deployplan.ActionTypeDelete
220+
b.Graph.AddNode(n)
220221
}
221222
}
222223

0 commit comments

Comments
 (0)