Skip to content

Update usage of checkout action to v4 #661

Update usage of checkout action to v4

Update usage of checkout action to v4 #661

name: Test terraform-remote-state
on:
- pull_request
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-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- 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: 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_bool = ${{ steps.terraform-output.outputs.my_bool }}"
echo "my_sensitive_bool = ${{ steps.terraform-output.outputs.my_sensitive_bool }}"
- name: Verify outputs
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_sensitive_bool not set correctly"
exit 1
fi