terraform/plans/planfile
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/test-config plans/planfile: Reading and writing the new plan format 2018-10-16 18:50:29 -07:00
config_snapshot.go plans/planfile: Reading and writing the new plan format 2018-10-16 18:50:29 -07:00
config_snapshot_test.go plans/planfile: Reading and writing the new plan format 2018-10-16 18:50:29 -07:00
doc.go plans/planfile: Reading and writing the new plan format 2018-10-16 18:50:29 -07:00
planfile_test.go plans: Track both the previous run and prior states in the plan 2021-05-05 15:11:05 -07:00
reader.go plans: Track both the previous run and prior states in the plan 2021-05-05 15:11:05 -07:00
tfplan.go plans: Plan.Mode is now Plan.UIMode 2021-04-30 10:30:56 -07:00
tfplan_test.go plans: Track an optional extra "reason" for some planned actions 2021-04-29 17:50:46 -07:00
writer.go plans: Track both the previous run and prior states in the plan 2021-05-05 15:11:05 -07:00