terraform/internal/command/views/json
Martin Atkins 6f84623cb6 terraform: Initial partial support for ephemeral values
This is a checkpoint commit on the path to supporting ephemeral values as
a cross-cutting concern in the Terraform language. An ephemeral value is
one that lives only in RAM during a single phase and so cannot persist
from the plan phase to the apply phase, or between consecutive plan/apply
rounds.

Terraform tracks whether each value is ephemeral using the cty "marks"
concept, thus achieving the same dynamic analysis as we already employ for
the concept of "sensitive values" that prevents displaying a value in the
user interface.

This commit is just a starting point which gets some of the basics into
place:
 - input variables and output values can both be statically declared as
   being ephemeral. Only ephemeral inputs/outputs can have ephemeral values
   assigned to them, and the recipient of the value sees it as ephemeral
   even if the assigned value was not already ephemeral.

   This creates a dynamic analysis cutoff point at module boundaries so
   that it's possible to determine in isolation whether a single module is
   using ephemeral values correctly, without having to test it in every
   possible calling context.
 - Managed and data resources cannot have ephemeral values assigned into
   their configurations because Terraform and providers both expect the
   resource attributes to persist between phases.
 - Ephemeral values _can_ be used in provider and provisioner
   configurations, because both of those effectively meet the definition
   of the new "ephemeral" concept despite it not previously having a name.
 - Ephemeral markings propagate through all of the built-in language
   features for dynamic analysis purposes, largely relying on cty's efforts
   to do that in similar vein as for sensitive marks. In particular,
   it's possible to define a local value whose expression produces
   an ephemeral result, and passing ephemeral values to functions should
   propagate the ephemeral mark to the results when appropriate. (I've not
   yet thoroughly reviewed all of the built-in functions for correct
   marks handling though, so there may be some gaps to address in later
   commits.)

The next step for this work will be to change the modules runtime to have
support for a workflow involving ephemeral _root_ input variables, where
their values must be re-supplied during the apply phase. That will then
achieve (in experimental capacity) the first goal of ephemeral values: to
be able to provide non-persistent settings such as time-limited API tokens
to use in provider configuration blocks.
2024-06-05 09:09:30 -07:00
..
testdata/diagnostic tfdiags: Treat unknown-related or sensitive-related messages differently 2022-06-23 13:52:23 -07:00
change.go Add removed block (#34251) 2023-11-29 11:58:28 +00:00
change_summary.go Rebrand Terraform Cloud to HCP Terraform 2024-04-23 16:12:59 -04:00
diagnostic.go terraform: Initial partial support for ephemeral values 2024-06-05 09:09:30 -07:00
diagnostic_test.go Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
function.go Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
function_test.go Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
hook.go Add removed block (#34251) 2023-11-29 11:58:28 +00:00
importing.go Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
message_types.go Implement TFC integration for private module registry test runs (#33710) 2023-09-14 09:01:25 +02:00
output.go Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
output_test.go Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
resource_addr.go Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
test.go Test framework will produce regular updates in -json mode (#33953) 2023-10-02 09:14:20 +02:00