terraform/backend
Alisdair McDiarmid 68558ccd54 backend/local: Replace CLI with view instance
This commit extracts the remaining UI logic from the local backend,
and removes access to the direct CLI output. This is replaced with an
instance of a `views.Operation` interface, which codifies the current
requirements for the local backend to interact with the user.

The exception to this at present is interactivity: approving a plan
still depends on the `UIIn` field for the backend. This is out of scope
for this commit and can be revisited separately, at which time the
`UIOut` field can also be removed.

Changes in support of this:

- Some instances of direct error output have been replaced with
  diagnostics, most notably in the emergency state backup handler. This
  requires reformatting the error messages to allow the diagnostic
  renderer to line-wrap them;
- The "in-automation" logic has moved out of the backend and into the
  view implementation;
- The plan, apply, refresh, and import commands instantiate a view and
  set it on the `backend.Operation` struct, as these are the only code
  paths which call the `local.Operation()` method that requires it;
- The show command requires the plan rendering code which is now in the
  views package, so there is a stub implementation of a `views.Show`
  interface there.

Other refactoring work in support of migrating these commands to the
common views code structure will come in follow-up PRs, at which point
we will be able to remove the UI instances from the unit tests for those
commands.
2021-02-18 12:08:08 -05:00
..
init backend: remove deprecated atlas backend 2020-10-26 14:05:18 -04:00
local backend/local: Replace CLI with view instance 2021-02-18 12:08:08 -05:00
remote backend/local: Replace CLI with view instance 2021-02-18 12:08:08 -05:00
remote-state backend/azure: azure state refreshes outside of grabbing the lock #26561 2021-02-17 15:14:47 -08:00
backend.go backend/local: Replace CLI with view instance 2021-02-18 12:08:08 -05:00
backend_test.go helper: deprecate pathorcontents 2020-10-08 08:42:16 -04:00
cli.go command: Use the new terminal.Streams object 2021-01-13 15:37:04 -08:00
operation_type.go Version tools per Go convention under tools.go 2019-10-17 22:23:39 +02:00
operationtype_string.go stringer: Regenerate files with latest version 2019-05-13 15:34:27 +01:00
testing.go test locks in non-default workspace 2020-10-13 08:18:54 -07:00
unparsed_value.go Remove deprecation on undeclared variable, docs, and summary adjustment (#27795) 2021-02-18 11:11:52 -05:00
unparsed_value_test.go Remove deprecation on undeclared variable, docs, and summary adjustment (#27795) 2021-02-18 11:11:52 -05:00