Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added terraform output to summary #34

Merged
merged 88 commits into from
Jan 25, 2024
Merged

Added terraform output to summary #34

merged 88 commits into from
Jan 25, 2024

Conversation

goruha
Copy link
Member

@goruha goruha commented Jan 24, 2024

what

  • Add the ability to display terraform outputs after apply

@goruha goruha requested review from a team as code owners January 24, 2024 18:11
@goruha goruha requested review from Gowiem and srhopkins January 24, 2024 18:11
@goruha goruha requested a review from a team as a code owner January 24, 2024 21:09
action.yml Outdated Show resolved Hide resolved
action.yml Outdated
@@ -289,7 +289,10 @@ runs:
--output "${{ github.workspace }}/atmos-apply-summary.md" \
--log-level $([[ "${{ inputs.debug }}" == "true" ]] && echo "DEBUG" || echo "INFO") \
apply -- terraform apply ${{ steps.vars.outputs.plan_file }} || EXIT_CODE=$?


TERRAFORM_OUTPUTS=$(terraform output --json | jq -Mr 'to_entries | map(["|", .key, "|", if .value.sensitive then "\\<sensitive\\>" else .value.value end, "|"] | join(" ")) | if length > 0 then ["| name | value |", "|----|----|"] + . else ["No outputs"] end | join("\n")')
Copy link
Member

@osterman osterman Jan 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TERRAFORM_OUTPUTS=$(terraform output --json | jq -Mr 'to_entries | map(["|", .key, "|", if .value.sensitive then "\\<sensitive\\>" else .value.value end, "|"] | join(" ")) | if length > 0 then ["| name | value |", "|----|----|"] + . else ["No outputs"] end | join("\n")')
TERRAFORM_OUTPUTS=$(terraform output --json | jq -Mr 'to_entries | map(["|", .key, "|", if .value.sensitive then "![Sensitive](https://img.shields.io/badge/sensitive-c40000?style=for-the-badge)" else .value.value end, "|"] | join(" ")) | if length > 0 then ["| name | value |", "|:----|:----|"] + . else ["No outputs"] end | join("\n")')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my preference would be to encapsulate single-line outputs with inline code and multiline values with a

code block

As outputs are often maps, which would render better that way.

Also, I have concerns of the mileage we'll get using JQ for formatting. But if we can get what we need... that's okay.

Copy link
Member

@osterman osterman Jan 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name value
result WGAQulCR148
sensitive_value Sensitive

Or with HTML:

output value
result WGAQulCR148
sensitive_value
test
{
      "matchStringsStrategy": "combination",
      "datasourceTemplate": "helm",
      "versioningTemplate": "cargo",
      "rangeStrategy": "bump"
 }   

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@goruha goruha merged commit 1d38307 into main Jan 25, 2024
6 checks passed
@goruha goruha deleted the dev-1001-apply-output branch January 25, 2024 19:27
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.

2 participants