Skip to content

Improve parsing of tf files #691

Improve parsing of tf files

Improve parsing of tf files #691

name: Test terraform-remote-state
on:
- pull_request
permissions:
contents: read
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
terraform-remote-state:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Get remote state
uses: ./terraform-remote-state
id: terraform-output
with:
backend_type: s3
backend_config: |
bucket=terraform-github-actions
key=terraform-remote-state
region=eu-west-2
- name: Verify outputs
env:
MY_NUMBER: ${{ steps.terraform-output.outputs.my_number }}
MY_SENSITIVE_NUMBER: ${{ steps.terraform-output.outputs.my_sensitive_number }}
MY_STRING: ${{ steps.terraform-output.outputs.my_string }}
MY_SENSITIVE_STRING: ${{ steps.terraform-output.outputs.my_sensitive_string }}
MY_BOOL: ${{ steps.terraform-output.outputs.my_bool }}
MY_SENSITIVE_BOOL: ${{ steps.terraform-output.outputs.my_sensitive_bool }}
run: |
if [[ "$MY_NUMBER" != "5" ]]; then
echo "::error:: output my_number not set correctly"
exit 1
fi
if [[ "$MY_SENSITIVE_NUMBER" != "6" ]]; then
echo "::error:: output my_sensitive_number not set correctly"
exit 1
fi
if [[ "$MY_STRING" != "hello" ]]; then
echo "::error:: output my_string not set correctly"
exit 1
fi
if [[ "$MY_SENSITIVE_STRING" != "password" ]]; then
echo "::error:: output my_sensitive_string not set correctly"
exit 1
fi
if [[ "$MY_BOOL" != "true" ]]; then
echo "::error:: output my_bool not set correctly"
exit 1
fi
if [[ "$MY_SENSITIVE_BOOL" != "false" ]]; then
echo "::error:: output my_sensitive_bool not set correctly"
exit 1
fi