536c80da23
The enhanced backends (local and remote) need to be able to render diagnostics during operations. Prior to this commit, this functionality was supported with a per-backend `ShowDiagnostics` function pointer. In order to allow users of these backends to control how diagnostics are rendered, this commit moves that function pointer to the `Operation` type. This means that a diagnostic renderer is configured for each operation, rather than once per backend initialization. Some secondary consequences of this change: - The `ReportResult` method on the backend is now moved to the `Operation` type, as it needs to access the `ShowDiagnostics` callback (and nothing else from the backend); - Tests which assumed that diagnostics would be written to the backend's `cli.Ui` instance are migrated to using a new record/playback diags helper function; - Apply, plan, and refresh commands now pass a pointer to the `Meta` struct's `showDiagnostics` method. This commit should not change how Terraform works, and is refactoring in preparation for more changes which move UI code out of the backend. |
||
---|---|---|
.. | ||
testdata | ||
backend.go | ||
backend_apply.go | ||
backend_apply_test.go | ||
backend_common.go | ||
backend_context.go | ||
backend_context_test.go | ||
backend_mock.go | ||
backend_plan.go | ||
backend_plan_test.go | ||
backend_state.go | ||
backend_state_test.go | ||
backend_test.go | ||
cli.go | ||
colorize.go | ||
remote_test.go | ||
testing.go |