logDrift must only be called while the lock is held. It will log the output of `terraform show`, which will show which resources have drifted from the known state.
(ctx, killCtx context.Context, planfilePath string, logr logSink)
| 412 | // logDrift must only be called while the lock is held. |
| 413 | // It will log the output of `terraform show`, which will show which resources have drifted from the known state. |
| 414 | func (e *executor) logDrift(ctx, killCtx context.Context, planfilePath string, logr logSink) { |
| 415 | stdout, stdoutDone := resourceReplaceLogWriter(logr, e.logger) |
| 416 | stderr, stderrDone := logWriter(logr, proto.LogLevel_ERROR) |
| 417 | defer func() { |
| 418 | _ = stdout.Close() |
| 419 | _ = stderr.Close() |
| 420 | <-stdoutDone |
| 421 | <-stderrDone |
| 422 | }() |
| 423 | |
| 424 | err := e.showPlan(ctx, killCtx, stdout, stderr, planfilePath) |
| 425 | if err != nil { |
| 426 | e.server.logger.Debug(ctx, "failed to log state drift", slog.Error(err)) |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | // resourceReplaceLogWriter highlights log lines relating to resource replacement by elevating their log level. |
| 431 | // This will help template admins to visually find problematic resources easier. |