diff --git a/.changes/v1.16/BUG FIXES-20260414-120000.yaml b/.changes/v1.16/BUG FIXES-20260414-120000.yaml new file mode 100644 index 000000000000..af00dfd14d74 --- /dev/null +++ b/.changes/v1.16/BUG FIXES-20260414-120000.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: hide check-scoped data sources from plan output +time: 2026-04-14T12:00:00.000000-04:00 +custom: + Issue: "36536" diff --git a/internal/command/jsonformat/plan.go b/internal/command/jsonformat/plan.go index e1f54aa3457a..609e0d82d1c5 100644 --- a/internal/command/jsonformat/plan.go +++ b/internal/command/jsonformat/plan.go @@ -77,6 +77,11 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q // Don't render anything for deleted data sources. continue } + // Skip data sources that are reloaded only for check block verification + if action == plans.Read && diff.change.Mode == jsonstate.DataResourceMode && + diff.change.ActionReason == jsonplan.ResourceInstanceReadBecauseCheckNested { + continue + } changes = append(changes, diff) @@ -395,6 +400,13 @@ func renderHumanDiff(renderer Renderer, diff diff, cause string) (string, bool) // Skip resource changes that have nothing interesting to say. return "", false } + // Skip data sources that are reloaded only for check block verification + if diff.change.Mode == jsonstate.DataResourceMode && + diff.change.ActionReason == jsonplan.ResourceInstanceReadBecauseCheckNested && + action == plans.Read { + return "", false + } + var buf bytes.Buffer buf.WriteString(renderer.Colorize.Color(resourceChangeComment(diff.change, action, cause)))