Hide outdated comments #665
Workflow file for this run
This file contains 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
name: Test terraform-output | |
on: | |
- pull_request | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
jobs: | |
terraform-output: | |
runs-on: ubuntu-latest | |
name: verify outputs | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get outputs | |
uses: ./terraform-output | |
id: terraform-output | |
with: | |
path: tests/workflows/test-output | |
- name: Print the outputs | |
run: | | |
echo "my_number = ${{ steps.terraform-output.outputs.my_number }}" | |
echo "my_sensitive_number = ${{ steps.terraform-output.outputs.my_sensitive_number }}" | |
echo "my_string = ${{ steps.terraform-output.outputs.my_string }}" | |
echo "my_sensitive_string = ${{ steps.terraform-output.outputs.my_sensitive_string }}" | |
echo "my_multiline_string = ${{ steps.terraform-output.outputs.my_multiline_string }}" | |
echo "my_sensitive_multiline_string = ${{ steps.terraform-output.outputs.my_sensitive_multiline_string }}" | |
echo "my_bool = ${{ steps.terraform-output.outputs.my_bool }}" | |
echo "my_sensitive_bool = ${{ steps.terraform-output.outputs.my_sensitive_bool }}" | |
- name: Verify outputs | |
env: | |
AWKWARD_STRING: ${{ steps.terraform-output.outputs.awkward_string }} | |
AWKWARD_OBJ: ${{ join(fromJson(steps.terraform-output.outputs.awkward_compound_output).nested.thevalue) }} | |
run: | | |
if [[ "${{ steps.terraform-output.outputs.my_number }}" != "5" ]]; then | |
echo "::error:: output my_number not set correctly" | |
exit 1 | |
fi | |
if [[ "${{ steps.terraform-output.outputs.my_sensitive_number }}" != "6" ]]; then | |
echo "::error:: output my_sensitive_number not set correctly" | |
exit 1 | |
fi | |
if [[ "${{ steps.terraform-output.outputs.my_string }}" != "hello" ]]; then | |
echo "::error:: output my_string not set correctly" | |
exit 1 | |
fi | |
if [[ "${{ steps.terraform-output.outputs.my_sensitive_string }}" != "password" ]]; then | |
echo "::error:: output my_sensitive_string not set correctly" | |
exit 1 | |
fi | |
if [[ "${{ steps.terraform-output.outputs.my_bool }}" != "true" ]]; then | |
echo "::error:: output my_bool not set correctly" | |
exit 1 | |
fi | |
if [[ "${{ steps.terraform-output.outputs.my_sensitive_bool }}" != "false" ]]; then | |
echo "::error:: output my_number not set correctly" | |
exit 1 | |
fi | |
if [[ "${{ fromJson(steps.terraform-output.outputs.my_object).first }}" != "one" ]]; then | |
echo "::error:: fromJson(my_object).first not set correctly" | |
exit 1 | |
fi | |
if [[ "${{ join(fromJson(steps.terraform-output.outputs.my_tuple)) }}" != "one,two" ]]; then | |
echo "::error:: join(fromJson(my_set)) not set correctly" | |
exit 1 | |
fi | |
if [[ "${{ contains(fromJson(steps.terraform-output.outputs.my_set), 'one') }}" != "true" ]]; then | |
echo "::error:: contains(fromJson(my_set)) not set correctly" | |
exit 1 | |
fi | |
if [[ "$AWKWARD_STRING" != "hello \"there\", here are some 'quotes'." ]]; then | |
echo "::error:: awkward_string not set correctly" | |
exit 1 | |
fi | |
if [[ "$AWKWARD_OBJ" != "hello \"there\", here are some 'quotes'." ]]; then | |
echo "::error:: fromJson(awkward_compound_output).nested.thevalue not set correctly" | |
exit 1 | |
fi | |
expected_sensitive_multiline="qowicznobnad | |
trewptonopce | |
zxicvbnoberg" | |
actual_sensitive_multiline="${{ steps.terraform-output.outputs.my_sensitive_multiline_string }}" | |
if [[ "$expected_sensitive_multiline" != "$actual_sensitive_multiline" ]]; then | |
echo "::error:: steps.terraform-output.outputs.my_sensitive_multiline_string not set correctly" | |
exit 1 | |
fi | |
expected_multiline="mcnbcvnxdgjt | |
iyriuytifdcv | |
pydrtdxfgcvj" | |
actual_multiline="${{ steps.terraform-output.outputs.my_multiline_string }}" | |
if [[ "$expected_multiline" != "$actual_multiline" ]]; then | |
echo "::error:: steps.terraform-output.outputs.my_multiline_string not set correctly" | |
exit 1 | |
fi |