-
-
Notifications
You must be signed in to change notification settings - Fork 159
69 lines (58 loc) · 2.06 KB
/
test-remote-state.yaml
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
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