hashicorp / hashicorp/tfc-workflows-tooling
Improve `workspace output list` command output for better GitHub Actions integration
- Dominant language
- Go
- Stars
- 58
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
Currently, the `workspace output list` command returns data in the following format:
```json
{
"outputs": [
{
"name": "key_a",
"value": "value_a"
}
]
}
```
While this structure is technically correct, it is not very convenient when integrating with **GitHub Actions** or other automation tools that expect direct key–value mappings. Accessing values requires additional parsing and looping, which adds unnecessary complexity in CI/CD pipelines.
**Proposed Enhancement:**
Add an additional field in the response that provides a direct mapping of outputs by their keys. For example:
```json
{
"outputs": [
{
"name": "key_a",
"value": "value_a"
}
],
"mapping": {
"key_a": "value_a"
}
}
```
**Benefits:**
* Makes it easier to consume outputs directly in GitHub Actions without extra parsing logic.
* Improves developer experience and reduces boilerplate code in workflows.
* Provides both structured (`outputs`) and convenient (`mapping`) representations in one response.
**Example Use Case in GitHub Actions:**
With the proposed change, instead of writing extra `jq` filters to extract values, developers can directly do:
```yaml
- name: Get output
run: echo "${{ steps.workspace.outputs.mapping.key_a }}"
```
This simplifies integration and makes workflows more readable.
**Acceptance Criteria:**
* The `workspace output list` command continues to return the current `outputs` array for backward compatibility.
* A new top-level `mapping` field is added with key–value pairs derived from the outputs.
* The new format is well-documented so users know how to leverage it in automation tools.
Contributor guide
Assessment
This issue has not been assessed yet.