Skip to content

Update to support Terraform cloud with Terraform 1.6 #536

Update to support Terraform cloud with Terraform 1.6

Update to support Terraform cloud with Terraform 1.6 #536

Workflow file for this run

name: Test HTTP Credentials
on:
- pull_request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
git_http_full_path_credentials:
runs-on: ubuntu-latest
name: git+http full path creds
env:
TERRAFORM_HTTP_CREDENTIALS: |
github.com/dflook/hello=dflook:notapassword
github.com/hello=dflook:stillnotapassword
github.com/dflook/terraform-github-actions-dev.git=dflook:${{ secrets.USER_GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Apply
uses: ./terraform-apply
id: output
with:
path: tests/workflows/test-http
auto_approve: true
- name: Verify outputs
run: |
if [[ "${{ steps.output.outputs.git_https }}" != "hello" ]]; then
echo "::error:: output not set correctly"
exit 1
fi
git_http_partial_path_credentials:
runs-on: ubuntu-latest
name: git+http partial path creds
env:
TERRAFORM_HTTP_CREDENTIALS: |
github.com/dflook/hello=dflook:notapassword
github.com/hello=dflook:stillnotapassword
github.com/dflook=dflook:${{ secrets.USER_GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Apply
uses: ./terraform-apply
id: output
with:
path: tests/workflows/test-http
auto_approve: true
- name: Verify outputs
run: |
if [[ "${{ steps.output.outputs.git_https }}" != "hello" ]]; then
echo "::error:: output not set correctly"
exit 1
fi
git_http_no_path_credentials:
runs-on: ubuntu-latest
name: git+http no path
env:
TERRAFORM_HTTP_CREDENTIALS: |
github.com/dflook/hello=dflook:notapassword
github.com/hello=dflook:stillnotapassword
github.com=dflook:${{ secrets.USER_GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Apply
uses: ./terraform-apply
id: output
with:
path: tests/workflows/test-http
auto_approve: true
- name: Verify outputs
run: |
if [[ "${{ steps.output.outputs.git_https }}" != "hello" ]]; then
echo "::error:: output not set correctly"
exit 1
fi
git_no_credentials:
runs-on: ubuntu-latest
name: git+http no creds
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Apply
uses: ./terraform-apply
continue-on-error: true
id: apply
with:
path: tests/workflows/test-http
auto_approve: true
- name: Check failed
run: |
if [[ "${{ steps.apply.outcome }}" != "failure" ]]; then
echo "did not fail correctly with no http credentials"
exit 1
fi
http_credentials:
runs-on: ubuntu-latest
name: http module source
env:
TERRAFORM_HTTP_CREDENTIALS: |
5qcb7mjppk.execute-api.eu-west-2.amazonaws.com=dflook:hello
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create dummy credential file
run: |
mkdir -p ${{ runner.temp }}/_github_home
cp tests/workflows/test-http/http-module/netrc ${{ runner.temp }}/_github_home/.netrc
ls -la ${{ runner.temp }}
- name: Apply
uses: ./terraform-apply
id: output
with:
path: tests/workflows/test-http/http-module
auto_approve: true
- name: Verify outputs
run: |
if [[ "${{ steps.output.outputs.https }}" != "hello" ]]; then
echo "::error:: output not set correctly"
exit 1
fi
# Check the credential file is as before
diff tests/workflows/test-http/http-module/netrc ${{ runner.temp }}/_github_home/.netrc
http_no_credentials:
runs-on: ubuntu-latest
name: http module source with no credentials
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Apply
uses: ./terraform-apply
continue-on-error: true
id: apply
with:
path: tests/workflows/test-http/http-module
auto_approve: true
- name: Check failed
run: |
if [[ "${{ steps.apply.outcome }}" != "failure" ]]; then
echo "did not fail correctly with no http credentials"
exit 1
fi