opentofu/internal/command/testdata/show-json
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
..
basic-create json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
basic-delete json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
basic-update json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
conditions json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
drift jsonconfig: add implicitly created provider configs 2022-02-19 01:55:09 +09:00
module-depends-on jsonconfig: add implicitly created provider configs 2022-02-19 01:55:09 +09:00
modules json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
moved jsonconfig: add implicitly created provider configs 2022-02-19 01:55:09 +09:00
moved-drift jsonconfig: add implicitly created provider configs 2022-02-19 01:55:09 +09:00
multi-resource-update json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
nested-module-error Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
nested-modules jsonconfig: add implicitly created provider configs 2022-02-19 01:55:09 +09:00
provider-aliasing jsonconfig: Improve provider configuration output 2022-02-07 15:05:58 -05:00
provider-aliasing-conflict jsonconfig: fix provider mappings with same names 2022-02-19 00:44:48 +09:00
provider-aliasing-default jsonconfig: fix provider mappings with same names 2022-02-19 00:44:48 +09:00
provider-version json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
provider-version-no-config json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
requires-replace jsonconfig: add implicitly created provider configs 2022-02-19 01:55:09 +09:00
sensitive-values json-output: Add output type to JSON format 2022-04-27 13:30:15 -04:00
unknown-output json-output: Extended detail for unknown outputs 2022-06-13 14:06:03 -04:00