MCPcopy Index your code
hub / github.com/coder/coder / logDrift

Method logDrift

provisioner/terraform/executor.go:414–428  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
414func (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.

Callers 1

planMethod · 0.95

Calls 5

showPlanMethod · 0.95
resourceReplaceLogWriterFunction · 0.85
logWriterFunction · 0.70
CloseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected