forked from OP5dev/TF-via-PR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pr_merge_matrix.yaml
39 lines (31 loc) · 1.13 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
---
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 download repository artifact.
checks: write # Required to add status summary.
contents: read # Required to checkout repository.
pull-requests: write # Required to add PR 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@v11
with:
arg_chdir: directory/path
arg_command: ${{ github.event_name == 'merge_group' && 'apply' || 'plan' }}
arg_lock: ${{ github.event_name == 'merge_group' && 'true' || 'false' }}
arg_var_file: env/${{ matrix.deployment }}.tfvars
arg_workspace: ${{ matrix.deployment }}