Skip to content

Commit ca091a1

Browse files
committed
fix: reordered logging of init calls
1 parent bfc5687 commit ca091a1

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Fixed
2+
body: Reordered logging of init calls
3+
time: 2024-12-13T11:04:59.38062843+01:00

internal/runner/graph.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ func (gr *GraphRunner) TerraformApply(ctx context.Context, dg *graph.Graph, opts
142142
if !terraformIsInitialized(ctx, n.Path()) || opts.ForceInit {
143143
log.Ctx(ctx).Info().Msgf("Running terraform init for %s", n.Path())
144144
out, err := terraform.Init(ctx, n.Path())
145+
log.Ctx(ctx).Info().Msg(out)
145146
if err != nil {
146147
return err
147148
}
148-
log.Ctx(ctx).Info().Msg(out)
149149
} else {
150150
log.Ctx(ctx).Info().Msgf("Skipping terraform init for %s", n.Path())
151151
}
@@ -200,10 +200,10 @@ func (gr *GraphRunner) TerraformValidate(ctx context.Context, dg *graph.Graph) e
200200
return gr.run(ctx, dg, func(ctx context.Context, n graph.Node) error {
201201
log.Ctx(ctx).Info().Msgf("Running terraform init without backend for %s", n.Path())
202202
out, err := terraform.Init(ctx, n.Path(), terraform.InitWithDisableBackend())
203+
log.Ctx(ctx).Info().Msg(out)
203204
if err != nil {
204205
return err
205206
}
206-
log.Ctx(ctx).Info().Msg(out)
207207

208208
log.Ctx(ctx).Info().Msgf("Running terraform validate for %s", n.Path())
209209

@@ -224,10 +224,10 @@ func (gr *GraphRunner) TerraformPlan(ctx context.Context, dg *graph.Graph, opts
224224
if !terraformIsInitialized(ctx, n.Path()) || opts.ForceInit {
225225
log.Ctx(ctx).Info().Msgf("Running terraform init for %s", n.Path())
226226
out, err := terraform.Init(ctx, n.Path())
227+
log.Ctx(ctx).Info().Msg(out)
227228
if err != nil {
228229
return err
229230
}
230-
log.Ctx(ctx).Info().Msg(out)
231231
} else {
232232
log.Ctx(ctx).Info().Msgf("Skipping terraform init for %s", n.Path())
233233
}
@@ -286,10 +286,10 @@ func (gr *GraphRunner) TerraformProxy(ctx context.Context, dg *graph.Graph, opts
286286
}
287287

288288
out, err := utils.RunTerraform(ctx, n.Path(), opts.Command...)
289+
log.Ctx(ctx).Info().Msg(out)
289290
if err != nil {
290291
err = fmt.Errorf("failed to proxy %s: %w", n.Identifier(), err)
291292
}
292-
log.Ctx(ctx).Info().Msg(out)
293293
return err
294294
}, opts.IgnoreChangeDetection); err != nil {
295295
return err
@@ -303,10 +303,10 @@ func (gr *GraphRunner) TerraformShow(ctx context.Context, dg *graph.Graph, opts
303303
if !terraformIsInitialized(ctx, n.Path()) || opts.ForceInit {
304304
log.Ctx(ctx).Info().Msgf("Running terraform init for %s", n.Path())
305305
out, err := terraform.Init(ctx, n.Path())
306+
log.Ctx(ctx).Info().Msg(out)
306307
if err != nil {
307308
return err
308309
}
309-
log.Ctx(ctx).Info().Msg(out)
310310
} else {
311311
log.Ctx(ctx).Info().Msgf("Skipping terraform init for %s", n.Path())
312312
}
@@ -350,10 +350,10 @@ func (gr *GraphRunner) TerraformShow(ctx context.Context, dg *graph.Graph, opts
350350
func (gr *GraphRunner) TerraformInit(ctx context.Context, dg *graph.Graph) error {
351351
if err := gr.run(ctx, dg, func(ctx context.Context, n graph.Node) error {
352352
out, err := terraform.Init(ctx, n.Path())
353+
log.Ctx(ctx).Info().Msg(out)
353354
if err != nil {
354355
err = fmt.Errorf("failed to init %s: %w", n.Identifier(), err)
355356
}
356-
log.Ctx(ctx).Info().Msg(out)
357357
return err
358358
}, true); err != nil {
359359
return err

0 commit comments

Comments
 (0)