#24263·pulumi

`--diff` has no effect with `--output json`; structured output cannot show what changed

Author: flostadlerCreated Aug 11, 2026Updated Sep 16, 2026
Labelsarea/clipulumi/pulumi

--output json on up, preview, destroy, and refresh reports change counts, but not the changes themselves. --diff adds that detail to the human output, yet combining the two flags does nothing: the JSON stays a bare summary. The only structured way to see what changed is the raw engine event stream, which is large and exposes engine internals (diff vs. detailed diff, inputDiff, replacement modeling) that the regular output deliberately hides.

This matters for programmatic consumers, agents especially. A preview I ran produced a 46KB event stream; filtered to resource steps it's still 17KB, while a diff-carrying JSON summary of the same operation would be about 1.3KB. The summary-first shape is also the right workflow: get the overview (result, which resources changed), then ask for the diff of a specific resource.

Proposal: make --diff compose with --output json, and mirror it in pulumi stack history events. Changing the output format shouldn't change the information content.

For a property update, the human view today:

~ assumeRolePolicy  : (json) {
    ~ Statement: [
        ~ [0]: {
                  Action   : "sts:AssumeRole"
                + Condition: { + StringEquals: { + aws:SourceAccount: "123456789012" } }
                  Effect   : "Allow"
                ~ Principal: {
                    - Service: "lambda.amazonaws.com"
                    + Service: [ + [0]: "lambda.amazonaws.com"
                                 + [1]: "ecs-tasks.amazonaws.com" ]
                  }
              }
      ]
  }

The same information in the JSON output, roughly:

json
"assumeRolePolicy": {
  "kind": "update",
  "changed": {
    "Statement[0].Principal.Service": {
      "kind": "update",
      "old": "lambda.amazonaws.com",
      "new": ["lambda.amazonaws.com", "ecs-tasks.amazonaws.com"]
    },
    "Statement[0].Condition": {
      "kind": "add",
      "new": {"StringEquals": {"aws:SourceAccount": "123456789012"}}
    }
  }
}

Related: #22754 (universal structured output), #23965 (stack history events --summary).