-
Notifications
You must be signed in to change notification settings - Fork 77
81 lines (73 loc) · 2.24 KB
/
terraform.yml
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
76
77
78
79
80
81
name: terraform-plan
# NOTE: won't have access to secrets on PR from forks.
on:
push:
branches:
- 'master'
tags:
- 'v*'
paths-ignore:
- 'README.md'
pull_request:
branches:
- 'master'
jobs:
run-terraform:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
use_vpc: ['false', 'true']
defaults:
run:
working-directory: terraform
permissions:
contents: read
id-token: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.3.7
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Plan
id: plan
run: |
terraform plan -no-color -input=false -refresh=false \
-var test_google_access_token="abcxyz" \
-var app_title="Custom CRMint Title" \
-var iap_allowed_users='["user@example.com"]' \
-var iap_support_email="user@example.com" \
-var notification_sender_email="user@example.com" \
-var project_id="my-gcp-project" \
-var report_usage_id="abc123" \
-var use_vpc="${{ matrix.use_vpc }}"
continue-on-error: false
- name: Save artifacts
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
mkdir -p ~/pr/terraform
echo ${{ steps.init.outcome }} > ~/pr/terraform/init_outcome
echo "Saved init outcome"
echo ${{ steps.validate.outcome }} > ~/pr/terraform/validate_outcome
echo "Saved validate outcome"
cat <<$EOF > ~/pr/terraform/validate_output
${{ steps.validate.outputs.stdout }}
$EOF
echo "Saved validate output"
echo ${{ steps.plan.outcome }} > ~/pr/terraform/plan_outcome
cat <<$EOF > ~/pr/terraform/plan_output
${{ steps.plan.outputs.stdout }}
$EOF
echo "Saved plan output"
shell: bash
- uses: actions/upload-artifact@v3
with:
name: pr
path: ~/pr/terraform/