terraform/backend/remote
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
..
testdata clean up go mod for go-tfe 2019-09-27 14:16:41 -07:00
backend.go backend: Add per-operation diagnostic rendering 2021-02-12 14:30:35 -05:00
backend_apply.go cli: Remove deprecated destroy -force flag 2021-02-03 15:05:05 -05:00
backend_apply_test.go backend/local: Replace CLI with view instance 2021-02-18 12:08:08 -05:00
backend_common.go only print horizontal rule at first attempt 2021-02-10 20:47:50 -05:00
backend_context.go clistate: Update clistate.Locker for command views 2021-02-16 07:19:22 -05:00
backend_context_test.go clistate: Update clistate.Locker for command views 2021-02-16 07:19:22 -05:00
backend_mock.go backend: Validate remote backend Terraform version 2020-11-19 13:19:40 -05:00
backend_plan.go clistate: Update clistate.Locker for command views 2021-02-16 07:19:22 -05:00
backend_plan_test.go backend/local: Replace CLI with view instance 2021-02-18 12:08:08 -05:00
backend_state.go state: remove deprecated state package (#25490) 2020-08-11 11:43:01 -04:00
backend_state_test.go refactor tests to use modern states.State in favor of terraform.State where possible 2020-09-30 16:07:54 -04:00
backend_test.go backend/remote: No version check for local ops 2021-01-05 09:11:19 -05:00
cli.go backend: Add per-operation diagnostic rendering 2021-02-12 14:30:35 -05:00
colorize.go backend/remote: implement the Local interface 2018-11-26 20:50:25 +01:00
remote_test.go backend: Faster remote backend tests 2020-11-18 16:00:05 -05:00
testing.go backend/local: Replace CLI with view instance 2021-02-18 12:08:08 -05:00