stackruntime: Emit "pending" events for component instance plan/apply

Previously we did have an event for planning but it wasn't in quite the
right place, and so could potentially appear "late" and mess up the
event sequence. Now we'll always emit the pending event immediately before
the planning or applying event, which is perhaps a little redundant but
having these separated means that we might be able to create some space
between them later if we find that we need to do some additional work
after we know about a component instance but before we're reading to
say that we're planning or applying it.
pull/34738/head
Martin Atkins 3 years ago
parent 0d308110da
commit 5d9cac85bc

@ -444,6 +444,7 @@ func (c *ComponentInstance) CheckModuleTreePlan(ctx context.Context) (*plans.Pla
addr := c.Addr()
h := hooksFromContext(ctx)
hookSingle(ctx, hooksFromContext(ctx).PendingComponentInstancePlan, c.Addr())
seq, ctx := hookBegin(ctx, h.BeginComponentInstancePlan, h.ContextAttach, addr)
decl := c.call.Declaration(ctx)
@ -612,6 +613,7 @@ func (c *ComponentInstance) ApplyModuleTreePlan(ctx context.Context, plan *plans
decl := c.call.Declaration(ctx)
h := hooksFromContext(ctx)
hookSingle(ctx, hooksFromContext(ctx).PendingComponentInstanceApply, c.Addr())
seq, ctx := hookBegin(ctx, h.BeginComponentInstanceApply, h.ContextAttach, addr)
moduleTree := c.call.Config(ctx).ModuleTree(ctx)
@ -733,6 +735,7 @@ func (c *ComponentInstance) ApplyModuleTreePlan(ctx context.Context, plan *plans
hookMore(ctx, seq, h.ReportComponentInstanceApplied, &hooks.ComponentInstanceChange{
Addr: addr,
// TODO: include counts for each type of change
})
}
@ -850,8 +853,6 @@ func (c *ComponentInstance) PlanChanges(ctx context.Context) ([]stackplan.Planne
var changes []stackplan.PlannedChange
var diags tfdiags.Diagnostics
hookSingle(ctx, hooksFromContext(ctx).PendingComponentInstancePlan, c.Addr())
_, moreDiags := c.CheckInputVariableValues(ctx, PlanPhase)
diags = diags.Append(moreDiags)

Loading…
Cancel
Save