terraform/backend/local
Martin Atkins 7c6e78bcb0 plans: Track both the previous run and prior states in the plan
Until now we've not really cared much about the state snapshot produced
by the previous Terraform operation, except to use it as a jumping-off
point for our refresh step.

However, we'd like to be able to report to an end-user whenever Terraform
detects a change that occurred outside of Terraform, because that's often
helpful context for understanding why a plan contains changes that don't
seem to have corresponding changes in the configuration.

As part of reporting that we'll need to keep track of the state as it
was before we did any refreshing work, so we can then compare that against
the state after refreshing. To retain enough data to achieve that, the
existing Plan field State is now two fields: PrevRunState and PriorState.

This also includes a very shallow change in the core package to make it
populate something somewhat-reasonable into this field so that integration
tests can function reasonably. However, this shallow implementation isn't
really sufficient for real-world use of PrevRunState because we'll
actually need to update PrevRunState as part of planning in order to
incorporate the results of any provider-specific state upgrades to make
the PrevRunState objects compatible with the current provider schema, or
else our diffs won't be valid. This deeper awareness of PrevRunState in
Terraform Core will follow in a subsequent commit, prior to anything else
making use of Plan.PrevRunState.
2021-05-05 15:11:05 -07:00
..
testdata cli: Move resource count code to command package 2021-01-29 15:29:35 -05:00
backend.go backend/local: Replace CLI with view instance 2021-02-18 12:08:08 -05:00
backend_apply.go cli: Add JSON logs for operations commands 2021-04-30 11:37:36 -04:00
backend_apply_test.go command+backend: generalized "plan mode" 2021-04-27 08:23:54 -07:00
backend_local.go core: Minimal initial implementation of -replace=... option 2021-04-30 10:30:56 -07:00
backend_local_test.go clistate: Update clistate.Locker for command views 2021-02-16 07:19:22 -05:00
backend_plan.go plans: Track both the previous run and prior states in the plan 2021-05-05 15:11:05 -07:00
backend_plan_test.go command+backend: generalized "plan mode" 2021-04-27 08:23:54 -07:00
backend_refresh.go backend: Replace ShowDiagnostics with view.Diagnostics 2021-02-25 11:26:05 -05:00
backend_refresh_test.go backend: Replace ShowDiagnostics with view.Diagnostics 2021-02-25 11:26:05 -05:00
backend_test.go Implement the remote enhanced backend 2018-11-06 16:29:46 +01:00
cli.go backend/local: Replace CLI with view instance 2021-02-18 12:08:08 -05:00
hook_state.go state: remove deprecated state package (#25490) 2020-08-11 11:43:01 -04:00
hook_state_test.go state: remove deprecated state package (#25490) 2020-08-11 11:43:01 -04:00
local_test.go use a single log writer 2020-10-19 14:29:54 -04:00
testing.go backend: Replace ShowDiagnostics with view.Diagnostics 2021-02-25 11:26:05 -05:00