-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
pr_merge_matrix.yaml
41 lines (33 loc) · 1.22 KB
/
pr_merge_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
---
name: Trigger on pull_request (plan) and merge_group (apply) events with OpenTofu in matrix strategy.
on:
pull_request:
merge_group:
jobs:
tf:
runs-on: ubuntu-latest
permissions:
actions: read # Required to identify workflow run.
checks: write # Required to add status summary.
contents: read # Required to checkout repository.
pull-requests: write # Required to add comment and label.
strategy:
fail-fast: false
matrix:
deployment: [dev, qa, prod]
environment: ${{ github.event_name == 'merge_group' && matrix.deployment || '' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup TF
uses: opentofu/setup-opentofu@v1
- name: Provision TF
uses: devsectop/tf-via-pr@v12
with:
command: ${{ github.event_name == 'merge_group' && 'apply' || 'plan' }}
arg-lock: ${{ github.event_name == 'merge_group' }}
arg-var-file: env/${{ matrix.deployment }}.tfvars
arg-workspace: ${{ matrix.deployment }}
working-directory: path/to/${{ matrix.deployment }}
plan-encrypt: ${{ secrets.PASSPHRASE }}
plan-parity: true