gruntwork-io / terragrunt-action

A GitHub Action for installing and running Terragrunt
Apache License 2.0
99 stars 38 forks source link

Add tg_output variable for JSON output #54

Open iisyos opened 5 months ago

iisyos commented 5 months ago

Description

This PR introduces a new output variable tg_output that contains the Terragrunt output in JSON format. This allows users to easily parse and extract specific values from the Terragrunt output using tools like jq within their GitHub Actions workflows.

Example usage:

- name: Extract test value
  id: extract_test
  run: |
    echo '${{ steps.terragrunt.outputs.tg_output }}'

This feature is useful when you need Terragrunt output values for the next steps in your workflow. It eliminates the need to hardcode resource names in template files, making your workflow more dynamic and flexible.

In the AWS provider, there are several situations where this feature can be particularly useful

Release Notes (draft)

Added / Removed / Updated [X].

Added tg_output variable containing Terragrunt output in JSON format.

Migration Guide

N/A

robcio-ops commented 4 months ago

@denis256 could you take a look on this? Output in json format would be very useful 😁

denis256 commented 4 months ago

Will be helpful to add tests that will track JSON output generation

zackpollard commented 3 months ago

Will be helpful to add tests that will track JSON output generation

Disregard my last message, I got most of the tests working locally. However, the tests currently aren't setup for testing the outputs from the action. How were you envisioning that working, the only way I really see it working is by inspecting the github-action-logs that are written to /tmp currently.