forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopentofu-foundation-validate.yml
More file actions
68 lines (59 loc) · 2.45 KB
/
Copy pathopentofu-foundation-validate.yml
File metadata and controls
68 lines (59 loc) · 2.45 KB
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
name: OpenTofu Foundation Validation
on:
push:
branches: [main]
paths:
- ".github/scripts/check_opentofu_foundation.py"
- ".github/scripts/test_check_opentofu_foundation.py"
- ".github/workflows/opentofu-foundation-validate.yml"
- "infrastructure/opentofu/**"
pull_request:
branches: [main]
paths:
- ".github/scripts/check_opentofu_foundation.py"
- ".github/scripts/test_check_opentofu_foundation.py"
- ".github/workflows/opentofu-foundation-validate.yml"
- "infrastructure/opentofu/**"
permissions:
contents: read
concurrency:
group: opentofu-foundation-validate-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
validate-no-mutation-slice:
runs-on: ubuntu-latest
env:
TF_IN_AUTOMATION: "true"
steps:
- uses: actions/checkout@v7
- uses: opentofu/setup-opentofu@v2
with:
tofu_version: 1.12.4
tofu_wrapper: false
- name: Test foundation boundary checker
run: python3 .github/scripts/test_check_opentofu_foundation.py
- name: Check foundation source boundary
run: python3 .github/scripts/check_opentofu_foundation.py
- name: Validate source without a remote backend
run: |
export TF_DATA_DIR="${RUNNER_TEMP}/opentofu-foundation-validate-data"
tofu -chdir=infrastructure/opentofu/foundation init -backend=false -input=false -no-color
tofu -chdir=infrastructure/opentofu/foundation validate -no-color
- name: Generate and check an offline empty plan
run: |
OFFLINE_MODULE="${RUNNER_TEMP}/opentofu-foundation-offline-plan"
python3 .github/scripts/check_opentofu_foundation.py \
--prepare-offline-plan-module "$OFFLINE_MODULE"
export TF_DATA_DIR="${RUNNER_TEMP}/opentofu-foundation-plan-data"
tofu -chdir="$OFFLINE_MODULE" init -backend=false -input=false -no-color
tofu -chdir="$OFFLINE_MODULE" validate -no-color
tofu -chdir="$OFFLINE_MODULE" plan \
-input=false \
-lock=false \
-refresh=false \
-no-color \
-out="${RUNNER_TEMP}/foundation.tfplan"
tofu -chdir="$OFFLINE_MODULE" show \
-json "${RUNNER_TEMP}/foundation.tfplan" > "${RUNNER_TEMP}/foundation-plan.json"
python3 .github/scripts/check_opentofu_foundation.py \
--plan-json "${RUNNER_TEMP}/foundation-plan.json"