diff --git a/changelog/pending/20221123--cli--dont-print-update-plan-message-with-json.yaml b/changelog/pending/20221123--cli--dont-print-update-plan-message-with-json.yaml new file mode 100644 index 000000000000..7f0d6e1d298b --- /dev/null +++ b/changelog/pending/20221123--cli--dont-print-update-plan-message-with-json.yaml @@ -0,0 +1,4 @@ +changes: +- type: fix + scope: cli + description: Don't print update plan message with --json. diff --git a/pkg/cmd/pulumi/preview.go b/pkg/cmd/pulumi/preview.go index 4e6e995729f8..1b22cd3e920b 100644 --- a/pkg/cmd/pulumi/preview.go +++ b/pkg/cmd/pulumi/preview.go @@ -261,14 +261,16 @@ func newPreviewCmd() *cobra.Command { return result.FromError(err) } - // Write out message on how to use the plan - var buf bytes.Buffer - fprintf(&buf, "Update plan written to '%s'", planFilePath) - fprintf( - &buf, - "\nRun `pulumi up --plan='%s'` to constrain the update to the operations planned by this preview", - planFilePath) - cmdutil.Diag().Infof(diag.RawMessage("" /*urn*/, buf.String())) + // Write out message on how to use the plan (if not writing out --json) + if !jsonDisplay { + var buf bytes.Buffer + fprintf(&buf, "Update plan written to '%s'", planFilePath) + fprintf( + &buf, + "\nRun `pulumi up --plan='%s'` to constrain the update to the operations planned by this preview", + planFilePath) + cmdutil.Diag().Infof(diag.RawMessage("" /*urn*/, buf.String())) + } } return nil }