Skip to content

Update usage of checkout action to v4 #521

Update usage of checkout action to v4

Update usage of checkout action to v4 #521

Workflow file for this run

name: Test registry
on:
- pull_request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
registry_module:
runs-on: ubuntu-latest
name: Use registry module
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create dummy credential file
run: |
mkdir -p ${{ runner.temp }}/_github_home
cp tests/workflows/test-registry/terraformrc ${{ runner.temp }}/_github_home/.terraformrc
ls -la ${{ runner.temp }}
- name: Plan
uses: ./terraform-plan
env:
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }}
with:
path: tests/workflows/test-registry
label: test-registry registry_module
- name: Apply
uses: ./terraform-apply
id: output
with:
path: tests/workflows/test-registry
label: test-registry registry_module
env:
TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_API_TOKEN }}
- name: Verify outputs
run: |
if [[ "${{ steps.output.outputs.word }}" != "hello" ]]; then
echo "::error:: output not set correctly"
exit 1
fi
# Check that terraformrc is as before
diff tests/workflows/test-registry/terraformrc ${{ runner.temp }}/_github_home/.terraformrc
multiple_registry_module:
runs-on: ubuntu-latest
name: Multiple registries
env:
TERRAFORM_CLOUD_TOKENS: |
terraform.example.com = Registry doesn't exist
app.terraform.io = ${{ secrets.TF_API_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Plan
uses: ./terraform-plan
with:
path: tests/workflows/test-registry
label: test-registry multiple_registry_module
- name: Apply
uses: ./terraform-apply
id: output
with:
path: tests/workflows/test-registry
label: test-registry multiple_registry_module
- name: Verify outputs
run: |
if [[ "${{ steps.output.outputs.word }}" != "hello" ]]; then
echo "::error:: output not set correctly"
exit 1
fi
nonsense_credentials:
runs-on: ubuntu-latest
name: Nonsense cloud credentials
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Plan
uses: ./terraform-plan
id: plan
continue-on-error: true
env:
TERRAFORM_CLOUD_TOKENS: No thanks
with:
path: tests/workflows/test-registry
- name: Check failed
run: |
if [[ "${{ steps.plan.outcome }}" != "failure" ]]; then
echo "did not fail correctly with nonsense credentials"
exit 1
fi