terraform/internal/command/testdata/show-json
Martin Atkins 884e1fb2a4 terraform: Plans can be "complete" and "applyable"
These ideas are both already implied by some logic elsewhere in the system,
but until now we didn't have the decision logic centralized in a single
place that could therefore evolve over time without necessarily always
updating every caller together.

We'll now have the modules runtime produce its own boolean ruling about
each characteristic, which callers can rely on for the mechanical
decision-making of whether to offer the user an "approve" prompt, and
whether to remind the user after apply that it was an incomplete plan
that will probably therefore need at least one more plan/apply round to
converge.

The "Applyable" flag directly replaces the previous method Plan.CanApply,
with equivalent logic. Making this a field instead of a method means that
we can freeze it as part of a saved plan, rather than recalculating it
when we reload the plan, and we can export the field value in our export
formats like JSON while ensuring it'll always be consistent with what
Terraform is using internally.

Callers can (and should) still use other context in the plan to return
more tailored messages for specific situations they already know about
that might be useful to users, but with these flags as a baseline callers
can now just fall back to a generic presentation when encountering a
situation they don't yet understand, rather than making the wrong decision
and causing something strange to happen. That is: a lack of awareness of
a new rule will now cause just a generic message in the UI, rather than
incorrect behavior.

This commit mostly just deals with populating the flags, and then all of
the direct consequences of that on our various tests. Further changes to
actually make use of these flags elsewhere in the system will follow in
later commits, both in this repository and in other repositories.
2024-02-09 09:24:27 -08:00
..
basic-create terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
basic-delete terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
basic-update terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
conditions terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
drift terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
module-depends-on terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
modules terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
moved terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
moved-drift terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
multi-resource-update terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
nested-module-error Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
nested-modules terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
plan-error terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
provider-aliasing terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
provider-aliasing-conflict terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
provider-aliasing-default terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
provider-version terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
provider-version-no-config terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
requires-replace terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
sensitive-values terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00
unknown-output terraform: Plans can be "complete" and "applyable" 2024-02-09 09:24:27 -08:00