Skip to content

Commit 2d93e54

Browse files
committed
ci: add terraform format check and test run workflow
1 parent cb6cb61 commit 2d93e54

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
on:
3+
push:
4+
exclude-branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
env:
11+
AWS_REGION: ${{ vars.AWS_REGION }}
12+
AWS_ENDPOINT_URL_S3: ${{ vars.AWS_ENDPOINT_URL_S3 }}
13+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
14+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
15+
GITHUB_OWNER: ${{ vars.GH_OWNER }}
16+
GITHUB_APP_ID: ${{ vars.GH_APP_ID }}
17+
GITHUB_APP_INSTALLATION_ID: ${{ vars.GH_APP_INSTALLATION_ID }}
18+
GITHUB_APP_PEM_FILE: ${{ secrets.GH_APP_PEM_FILE }}
19+
TF_WORKSPACE: ${{ vars.GH_OWNER }}
20+
TF_VAR_path: ${{ '../test.yaml' }}
21+
22+
jobs:
23+
terraform-qa:
24+
name: "Terraform QA"
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
shell: bash
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v5
33+
34+
- name: Setup Terraform with specified version
35+
uses: hashicorp/setup-terraform@v3
36+
with:
37+
terraform_version: 1.13.3
38+
39+
- name: Terraform init
40+
run: terraform -chdir=terraform init
41+
42+
- name: Terraform format check
43+
run: terraform -chdir=terraform fmt -check -recursive -no-color
44+
45+
- name: Terraform run tests
46+
run: terraform -chdir=terraform test -no-color

.github/workflows/terraform.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ jobs:
5656

5757
steps:
5858
- name: Checkout called repository
59-
uses: actions/checkout@v4
59+
uses: actions/checkout@v5
6060
with:
6161
repository: 'xebis/github-organization-as-code'
6262

6363
- name: Checkout caller YAML configuration
6464
if: github.repository != 'xebis/github-organization-as-code'
65-
uses: actions/checkout@v4
65+
uses: actions/checkout@v5
6666
with:
6767
path: iac
6868
sparse-checkout: ${{ inputs.path || 'test.yaml' }}
@@ -71,7 +71,7 @@ jobs:
7171
- name: Setup Terraform with specified version
7272
uses: hashicorp/setup-terraform@v3
7373
with:
74-
terraform_version: 1.11.0
74+
terraform_version: 1.13.3
7575

7676
- name: Terraform init
7777
id: init

0 commit comments

Comments
 (0)