opentofu/internal/command/jsonplan
Alisdair McDiarmid 48d64eabb2 json-output: Extended detail for unknown outputs
Planned output changes are represented in the JSON output format using
the same change object as planned resource changes. This structure
includes an `after` value and a parallel `after_unknown` value, which
can be combined to determine which specific parts of a value are known
only at apply time.

Previously, structured output values would be marked in the JSON plan as
coarsely known or unknown, even if only some subset of the structure
will be known only at apply time. This simplification was unnecessary,
and this commit reuses the same logic for resource changes to give more
information to consumers of this format.

For example, consider this output:

    output "bar" {
      value = tolist([
        "hello",
        timestamp(),
        "world",
      ])
    }

The plan output for this output would be:

    + bar = [
        + "hello",
        + (known after apply),
        + "world",
      ]

For the same plan, the JSON output was previously:

    "bar": {
      "actions": [
        "create"
      ],
      "before": null,
      "after_unknown": true,
      "before_sensitive": false,
      "after_sensitive": false
    }

After this commit, the output is instead:

    "bar": {
      "actions": [
        "create"
      ],
      "before": null,
      "after": [
        "hello",
        null,
        "world"
      ],
      "after_unknown": [
        false,
        true,
        false
      ],
      "before_sensitive": false,
      "after_sensitive": false
    }
2022-06-13 14:06:03 -04:00
..
condition.go core: Store condition block results in plan 2022-04-04 15:36:29 -04:00
doc.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
module.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
plan_test.go jsonplan: Improve performance for deep objects 2022-02-18 17:00:18 -05:00
plan.go json-output: Extended detail for unknown outputs 2022-06-13 14:06:03 -04:00
resource.go json-output: Previous address for resource changes 2021-09-20 15:25:23 -04:00
values_test.go json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
values.go json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00