-
-
Notifications
You must be signed in to change notification settings - Fork 169
75 lines (66 loc) · 1.76 KB
/
test-ssh.yaml
File metadata and controls
75 lines (66 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Test actions using SSH Keys
on:
- pull_request
permissions:
contents: read
jobs:
ssh_key:
runs-on: ubuntu-24.04
name: Git module source
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Plan
uses: ./terraform-plan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERRAFORM_SSH_KEY: ${{ secrets.TERRAFORM_SSH_KEY }}
with:
path: tests/workflows/test-ssh
label: test-ssh ssh_key
- name: Apply
uses: ./terraform-apply
id: output
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERRAFORM_SSH_KEY: ${{ secrets.TERRAFORM_SSH_KEY }}
with:
path: tests/workflows/test-ssh
label: test-ssh ssh_key
- name: Verify outputs
env:
WORD: ${{ steps.output.outputs.word }}
run: |
if [[ "$WORD" != "hello" ]]; then
echo "::error:: output not set correctly"
exit 1
fi
no_ssh_key:
runs-on: ubuntu-24.04
name: Git module source with no key
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Plan
uses: ./terraform-plan
continue-on-error: true
id: plan
with:
path: tests/workflows/test-ssh
label: test-ssh no_ssh_key
add_github_comment: false
- name: Check failed
env:
OUTCOME: ${{ steps.plan.outcome }}
run: |
if [[ "$OUTCOME" != "failure" ]]; then
echo "did not fail correctly with no SSH key"
exit 1
fi