feat: add list-outputs subcommand and --output-attribute flags - #126
Merged
Conversation
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>
Regression Test Results
❌ Regressions detectedOne or more export configurations produced breaking changes. Breaking change details
|
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>
Regression Test Results
✅ No regressions detectedAll export configurations produced compatible output. Generated by regression workflow • View run |
Regression Test Results
✅ No regressions detectedAll export configurations produced compatible output. Generated by regression workflow • View run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds three new capabilities to help users populate
outputs.tffor child module consumption, enabling root modules to reference exported resources by attribute.list-outputssubcommand: enumerates schema-drivenresource_type.label.attrpaths 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-attributeflag onexport: repeatable flag acceptingresource_type.label.attrpaths with glob support in the label position (e.g.pingone_davinci_flow.*.id).--output-attribute-fileflag onexport: reads paths from a newline-delimited file — designed to accept piped output fromlist-outputsdirectly.Also adds the missing
api_key.valuecomputed attribute topingone_davinci_application(found during UAT; tracked for broader audit in #125).Typical workflow
Test plan
go test ./...passes (31 new unit tests acrossinternal/schema,cmd)go run ./tools/validate-definitions definitions/passesoutputs.tfremains empty when neither flag is suppliedUAT notes
One issue found and fixed during UAT:
list-outputswas writing paths to stderr vialogger.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 attrsTestParseOutputPath— 7 cases covering valid/invalid path formats and glob preservationTestCollectOutputPaths_*— 4 cases covering flags, file, merge/dedup, missing fileTestBuildOutputs_*— 8 cases covering exact match, glob, no-match warning, malformed path, nested attr, sort orderTestListOutputsCommand_*— 5 cases covering configuration, missing credentials, unknown flagTestTfCommand_ListOutputsRouting— routing smoke test🤖 Generated with Claude Code