-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
tf_via_pr_input_matrix.yaml
46 lines (39 loc) · 1.48 KB
/
tf_via_pr_input_matrix.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
---
name: TF via PR Input Matrix Strategy
on:
pull_request:
types: [opened, reopened, synchronize, closed]
paths: ['**/*.tf*']
jobs:
tf:
runs-on: ubuntu-latest
if: github.event.action != 'closed' || github.event.pull_request.merged
strategy:
fail-fast: false
matrix:
deployment: [dev, stg, prd]
permissions:
actions: read # Required for workflow query and artifact download.
checks: write # Required for adding summary to check status.
contents: read # Required for repository checkout.
pull-requests: write # Required for commenting on PR.
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup TF
uses: hashicorp/setup-terraform@v3
- name: Provision TF
id: tf
uses: devsectop/tf-via-pr-comments@v10
env:
TF_VAR_PLACEHOLDER: value
with:
command_input: ${{ format('-tf={0} -chdir=sample/sample_bucket -backend-config=backend/{1}.tfvars', github.event.action != 'closed' && 'plan' || 'apply', matrix.deployment) }}
- name: Echo TF
run: |
echo "command: ${{ steps.tf.outputs.command }}"
echo "comment_id: ${{ steps.tf.outputs.comment_id }}"
echo "comment_summary: ${{ steps.tf.outputs.comment_summary }}"
echo "plan_id: ${{ steps.tf.outputs.plan_id }}"
echo "tf_fmt: ${{ steps.tf.outputs.tf_fmt }}"
echo "tf_output: ${{ steps.tf.outputs.tf_output }}"