Skip to content

Commit b1f75f3

Browse files
committed
chore: fix race condition on aggregating terraform logs
The logs could be aggregated before all cmd output was read
1 parent c3c059f commit b1f75f3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

provisioner/terraform/executor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ func (e *executor) plan(ctx, killCtx context.Context, env, vars []string, logr l
386386
}
387387
}
388388

389+
// DoneOut must be completed before we aggregate timings to ensure all logs have been processed.
390+
<-doneOut
389391
msg := &proto.PlanComplete{
390392
Parameters: state.Parameters,
391393
Resources: state.Resources,
@@ -617,6 +619,8 @@ func (e *executor) apply(
617619
return nil, xerrors.Errorf("read statefile %q: %w", statefilePath, err)
618620
}
619621

622+
// DoneOut must be completed before we aggregate timings to ensure all logs have been processed.
623+
<-doneOut
620624
agg := e.timings.aggregate()
621625
return &proto.ApplyComplete{
622626
Parameters: state.Parameters,

0 commit comments

Comments
 (0)