forked from dflook/terraform-github-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (51 loc) · 2.22 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
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@v2
- 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_number not set correctly"
exit 1
fi
if [[ "${{ steps.terraform-output.outputs.my_string }}" != "hello" ]]; then
echo "::error:: output my_number not set correctly"
exit 1
fi
if [[ "${{ steps.terraform-output.outputs.my_sensitive_string }}" != "password" ]]; then
echo "::error:: output my_number not set correctly"
exit 1
fi
if [[ "${{ steps.terraform-output.outputs.my_bool }}" != "true" ]]; then
echo "::error:: output my_number not set correctly"
exit 1
fi
if [[ "${{ steps.terraform-output.outputs.my_sensitive_bool }}" != "false" ]]; then
echo "::error:: output my_number not set correctly"
exit 1
fi