terraform/backend/local
Martin Atkins 31a4b44d2e backend/local: treat output changes as side-effects to be applied
This is a baby-step towards an intended future where all Terraform actions
which have side-effects in either remote objects or the Terraform state
can go through the plan+apply workflow.

This initial change is focused only on allowing plan+apply for changes to
root module output values, so that these can be written into a new state
snapshot (for consumption by terraform_remote_state elsewhere) without
having to go outside of the primary workflow by running
"terraform refresh".

This is also better than "terraform refresh" because it gives an
opportunity to review the proposed changes before applying them, as we're
accustomed to with resource changes.

The downside here is that Terraform Core was not designed to produce
accurate changesets for root module outputs. Although we added a place for
it in the plan model in Terraform 0.12, Terraform Core currently produces
inaccurate changesets there which don't properly track the prior values.

We're planning to rework Terraform Core's evaluation approach in a
forthcoming release so it would itself be able to distinguish between the
prior state and the planned new state to produce an accurate changeset,
but this commit introduces a temporary stop-gap solution of implementing
the logic up in the local backend code, where we can freeze a snapshot of
the prior state before we take any other actions and then use that to
produce an accurate output changeset to decide whether the plan has
externally-visible side-effects and render any changes to output values.

This temporary approach should be replaced by a more appropriately-placed
solution in Terraform Core in a release, which should then allow further
behaviors in similar vein, such as user-visible drift detection for
resource instances.
2020-05-29 07:36:40 -07:00
..
testdata backend/local: treat output changes as side-effects to be applied 2020-05-29 07:36:40 -07:00
backend.go Some deletions from static analysis 2020-01-13 15:22:34 -05:00
backend_apply.go backend/local: treat output changes as side-effects to be applied 2020-05-29 07:36:40 -07:00
backend_apply_test.go backend/local: refactor tests with modern state and default providers (#24524) 2020-04-06 09:24:23 -07:00
backend_local.go Deletions from backend local 2020-01-13 15:30:46 -05:00
backend_plan.go backend/local: treat output changes as side-effects to be applied 2020-05-29 07:36:40 -07:00
backend_plan_test.go backend/local: treat output changes as side-effects to be applied 2020-05-29 07:36:40 -07:00
backend_refresh.go terraform: Ugly huge change to weave in new State and Plan types 2018-10-16 19:11:09 -07:00
backend_refresh_test.go backend/local: refactor tests with modern state and default providers (#24524) 2020-04-06 09:24:23 -07:00
backend_test.go Implement the remote enhanced backend 2018-11-06 16:29:46 +01:00
cli.go command: Fix TestMetaBackend_configuredChangeCopy_multiToMulti 2018-11-19 09:02:35 -08:00
counthookaction_string.go stringer: Regenerate files with latest version 2019-05-13 15:34:27 +01:00
hook_count.go backend/local: Fix incorrect destroy/update count on apply 2018-12-11 18:06:53 +00:00
hook_count_action.go Version tools per Go convention under tools.go 2019-10-17 22:23:39 +02:00
hook_count_test.go backend/local: Fix incorrect destroy/update count on apply 2018-12-11 18:06:53 +00:00
hook_state.go terraform: Ugly huge change to weave in new State and Plan types 2018-10-16 19:11:09 -07:00
hook_state_test.go terraform: Ugly huge change to weave in new State and Plan types 2018-10-16 19:11:09 -07:00
local_test.go backend/local 2017-01-26 14:33:49 -08:00
testing.go backend/local: refactor tests with modern state and default providers (#24524) 2020-04-06 09:24:23 -07:00