Skip to content

feat: add list-outputs subcommand and --output-attribute flags - #126

Merged
samir-gandhi merged 5 commits into
mainfrom
polaris/outputs-feature
Jul 9, 2026
Merged

feat: add list-outputs subcommand and --output-attribute flags#126
samir-gandhi merged 5 commits into
mainfrom
polaris/outputs-feature

Conversation

@samir-gandhi

Copy link
Copy Markdown
Contributor

Summary

Adds three new capabilities to help users populate outputs.tf for child module consumption, enabling root modules to reference exported resources by attribute.

  • list-outputs subcommand: enumerates schema-driven resource_type.label.attr paths for all exported resources. Supports --depth (default 1), --include-resources, --exclude-resources, and --include-upstream. Paths are written to stdout so the full output is pipeable.
  • --output-attribute flag on export: repeatable flag accepting resource_type.label.attr paths with glob support in the label position (e.g. pingone_davinci_flow.*.id).
  • --output-attribute-file flag on export: reads paths from a newline-delimited file — designed to accept piped output from list-outputs directly.

Also adds the missing api_key.value computed attribute to pingone_davinci_application (found during UAT; tracked for broader audit in #125).

Typical workflow

# Discover available paths for DaVinci flows, keep only IDs
pingcli-terraformer list-outputs --include-resources "pingone_davinci_flow.*" ... \
  | grep '\.id$' > flow-outputs.txt

# Export with those outputs populated in outputs.tf
pingcli-terraformer export --output-attribute-file flow-outputs.txt --out ./output ...

Test plan

  • go test ./... passes (31 new unit tests across internal/schema, cmd)
  • go run ./tools/validate-definitions definitions/ passes
  • UAT against live PingOne NA environment — 10/10 tests pass (see UAT notes below)
  • No regression to existing export behaviour — outputs.tf remains empty when neither flag is supplied

UAT notes

One issue found and fixed during UAT: list-outputs was writing paths to stderr via logger.Message, making the output unpipeable. Fixed by writing paths directly to stdout. All 10 UAT scenarios passed after fix.

Validating tests

  • TestWalkAttributes — 11 cases covering depth, skip rules, container types, computed attrs
  • TestParseOutputPath — 7 cases covering valid/invalid path formats and glob preservation
  • TestCollectOutputPaths_* — 4 cases covering flags, file, merge/dedup, missing file
  • TestBuildOutputs_* — 8 cases covering exact match, glob, no-match warning, malformed path, nested attr, sort order
  • TestListOutputsCommand_* — 5 cases covering configuration, missing credentials, unknown flag
  • TestTfCommand_ListOutputsRouting — routing smoke test

🤖 Generated with Claude Code

samir-gandhi and others added 3 commits July 9, 2026 14:10
Adds three new capabilities to help users populate outputs.tf for child
module consumption:

- `list-outputs` subcommand: enumerates schema-driven attribute paths
  (resource_type.label.attr) for all exported resources. Supports
  --depth (default 1), --include-resources, --exclude-resources, and
  --include-upstream. Paths are written to stdout for piping.

- `--output-attribute` flag on export: repeatable flag accepting
  resource_type.label.attr paths with glob support in the label
  position (e.g. pingone_davinci_flow.*.id).

- `--output-attribute-file` flag on export: reads paths from a
  newline-delimited file (same format as --output-attribute), designed
  to accept piped output from list-outputs directly.

Also adds missing api_key.value computed attribute to the
pingone_davinci_application definition, found during UAT.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…orkflow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Regression Test Results

Matrix Entry Status Breaking Acceptable
default-hcl ❌ FAIL 1 0
default-tfjson ❌ FAIL 1 0
hcl-include-all ❌ FAIL 1 0
hcl-skip-deps ❌ FAIL 1 0
tfjson-skip-deps ❌ FAIL 1 0

❌ Regressions detected

One or more export configurations produced breaking changes.
Review the detailed reports in the workflow artifacts.

Breaking change details

default-hcl

block_mismatch: resource.pingone_davinci_application.pingcli__PingOne-0020-SSO-0020-Connection api_key enabled = true -> enabled = true
value = "5ee7e4b773b8ff5d76f16fadbaf4b58cd1f73c03f732be92121b2ebf677c9b027729a810199e3cb7d2f5e05670f612b2e0c0690ef4ab5804b1e069d9f42110d9e3977059ca6e99c4451e6cec98cca70353886e3e9e580decb52084f22442b94c1a8d04eb46af7be83706385b96e2fbf2451f4013e24fe144819b7eb25e536345"

default-tfjson

block_mismatch: pingone_davinci_application.pingcli__PingOne-0020-SSO-0020-Connection api_key {"enabled":true} -> {"enabled":true,"value":"5ee7e4b773b8ff5d76f16fadbaf4b58cd1f73c03f732be92121b2ebf677c9b027729a810199e3cb7d2f5e05670f612b2e0c0690ef4ab5804b1e069d9f42110d9e3977059ca6e99c4451e6cec98cca70353886e3e9e580decb52084f22442b94c1a8d04eb46af7be83706385b96e2fbf2451f4013e24fe144819b7eb25e536345"}

hcl-include-all

block_mismatch: resource.pingone_davinci_application.pingcli__PingOne-0020-SSO-0020-Connection api_key enabled = true -> enabled = true
value = "5ee7e4b773b8ff5d76f16fadbaf4b58cd1f73c03f732be92121b2ebf677c9b027729a810199e3cb7d2f5e05670f612b2e0c0690ef4ab5804b1e069d9f42110d9e3977059ca6e99c4451e6cec98cca70353886e3e9e580decb52084f22442b94c1a8d04eb46af7be83706385b96e2fbf2451f4013e24fe144819b7eb25e536345"

hcl-skip-deps

block_mismatch: resource.pingone_davinci_application.pingcli__PingOne-0020-SSO-0020-Connection api_key enabled = true -> enabled = true
value = "5ee7e4b773b8ff5d76f16fadbaf4b58cd1f73c03f732be92121b2ebf677c9b027729a810199e3cb7d2f5e05670f612b2e0c0690ef4ab5804b1e069d9f42110d9e3977059ca6e99c4451e6cec98cca70353886e3e9e580decb52084f22442b94c1a8d04eb46af7be83706385b96e2fbf2451f4013e24fe144819b7eb25e536345"

tfjson-skip-deps

block_mismatch: pingone_davinci_application.pingcli__PingOne-0020-SSO-0020-Connection api_key {"enabled":true} -> {"enabled":true,"value":"5ee7e4b773b8ff5d76f16fadbaf4b58cd1f73c03f732be92121b2ebf677c9b027729a810199e3cb7d2f5e05670f612b2e0c0690ef4ab5804b1e069d9f42110d9e3977059ca6e99c4451e6cec98cca70353886e3e9e580decb52084f22442b94c1a8d04eb46af7be83706385b96e2fbf2451f4013e24fe144819b7eb25e536345"}

Generated by regression workflow • View run

samir-gandhi and others added 2 commits July 9, 2026 14:32
The computed skip guard only applied at the top-level attribute loop.
Nested attributes (e.g. api_key.value) were written to HCL/tfjson even
when marked computed: true. Applied the same guard in nestedObjectTokens
(hcl) and renderNestedObject (tfjson).

Found during UAT of the outputs feature: api_key.value was being written
as a plaintext secret into pingone_davinci_application resource blocks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Regression Test Results

Matrix Entry Status Breaking Acceptable

✅ No regressions detected

All export configurations produced compatible output.


Generated by regression workflow • View run

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Regression Test Results

Matrix Entry Status Breaking Acceptable
default-hcl ✅ PASS 0 0
default-tfjson ✅ PASS 0 0
hcl-include-all ✅ PASS 0 0
hcl-skip-deps ✅ PASS 0 0
tfjson-skip-deps ✅ PASS 0 0

✅ No regressions detected

All export configurations produced compatible output.


Generated by regression workflow • View run

@samir-gandhi
samir-gandhi merged commit f3e42c7 into main Jul 9, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant