Skip to content

Commit f5c072f

Browse files
author
Arnel Jan Sarmiento
committed
feat: Integrate Commitizen for standardized commit messages, update pre-commit hooks, and enhance CI workflows with new Terraform plan jobs for nonprod, prod, root, and sandbox environments. Update required Terraform version to 1.14.0 across modules and workspaces.
1 parent 756ca39 commit f5c072f

19 files changed

Lines changed: 128 additions & 103 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [main]
88

99
env:
10-
TF_VERSION: "~1.11"
10+
TF_VERSION: "1.14.8"
1111

1212
jobs:
1313
fmt:
@@ -58,92 +58,3 @@ jobs:
5858
- uses: gitleaks/gitleaks-action@v2
5959
env:
6060
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61-
62-
# Detect which workspaces have changed — used to gate plan jobs on PRs only
63-
changes:
64-
name: Detect changes
65-
runs-on: ubuntu-latest
66-
if: github.event_name == 'pull_request'
67-
outputs:
68-
root: ${{ steps.filter.outputs.root }}
69-
prod: ${{ steps.filter.outputs.prod }}
70-
nonprod: ${{ steps.filter.outputs.nonprod }}
71-
sandbox: ${{ steps.filter.outputs.sandbox }}
72-
steps:
73-
- uses: actions/checkout@v4
74-
- uses: dorny/paths-filter@v3
75-
id: filter
76-
with:
77-
filters: |
78-
root:
79-
- 'workspaces/root/**'
80-
- 'modules/**'
81-
prod:
82-
- 'workspaces/prod/**'
83-
- 'modules/**'
84-
nonprod:
85-
- 'workspaces/nonprod/**'
86-
- 'modules/**'
87-
sandbox:
88-
- 'workspaces/sandbox/**'
89-
- 'modules/**'
90-
91-
plan-root:
92-
name: Plan (root)
93-
runs-on: ubuntu-latest
94-
needs: changes
95-
if: needs.changes.outputs.root == 'true'
96-
env:
97-
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }}
98-
steps:
99-
- uses: actions/checkout@v4
100-
- uses: hashicorp/setup-terraform@v3
101-
with:
102-
terraform_version: ${{ env.TF_VERSION }}
103-
- run: terraform -chdir=workspaces/root init
104-
- run: terraform -chdir=workspaces/root plan -no-color
105-
106-
plan-prod:
107-
name: Plan (prod)
108-
runs-on: ubuntu-latest
109-
needs: changes
110-
if: needs.changes.outputs.prod == 'true'
111-
env:
112-
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }}
113-
steps:
114-
- uses: actions/checkout@v4
115-
- uses: hashicorp/setup-terraform@v3
116-
with:
117-
terraform_version: ${{ env.TF_VERSION }}
118-
- run: terraform -chdir=workspaces/prod init
119-
- run: terraform -chdir=workspaces/prod plan -no-color
120-
121-
plan-nonprod:
122-
name: Plan (nonprod)
123-
runs-on: ubuntu-latest
124-
needs: changes
125-
if: needs.changes.outputs.nonprod == 'true'
126-
env:
127-
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }}
128-
steps:
129-
- uses: actions/checkout@v4
130-
- uses: hashicorp/setup-terraform@v3
131-
with:
132-
terraform_version: ${{ env.TF_VERSION }}
133-
- run: terraform -chdir=workspaces/nonprod init
134-
- run: terraform -chdir=workspaces/nonprod plan -no-color
135-
136-
plan-sandbox:
137-
name: Plan (sandbox)
138-
runs-on: ubuntu-latest
139-
needs: changes
140-
if: needs.changes.outputs.sandbox == 'true'
141-
env:
142-
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }}
143-
steps:
144-
- uses: actions/checkout@v4
145-
- uses: hashicorp/setup-terraform@v3
146-
with:
147-
terraform_version: ${{ env.TF_VERSION }}
148-
- run: terraform -chdir=workspaces/sandbox init
149-
- run: terraform -chdir=workspaces/sandbox plan -no-color

.github/workflows/plan-nonprod.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Plan (nonprod)
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- "workspaces/nonprod/**"
8+
- "modules/**"
9+
10+
env:
11+
TF_VERSION: "1.14.8"
12+
13+
jobs:
14+
plan:
15+
name: Plan (nonprod)
16+
runs-on: ubuntu-latest
17+
env:
18+
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: hashicorp/setup-terraform@v3
22+
with:
23+
terraform_version: ${{ env.TF_VERSION }}
24+
- run: terraform -chdir=workspaces/nonprod init
25+
- run: terraform -chdir=workspaces/nonprod plan -no-color

.github/workflows/plan-prod.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Plan (prod)
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- "workspaces/prod/**"
8+
- "modules/**"
9+
10+
env:
11+
TF_VERSION: "1.14.8"
12+
13+
jobs:
14+
plan:
15+
name: Plan (prod)
16+
runs-on: ubuntu-latest
17+
env:
18+
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: hashicorp/setup-terraform@v3
22+
with:
23+
terraform_version: ${{ env.TF_VERSION }}
24+
- run: terraform -chdir=workspaces/prod init
25+
- run: terraform -chdir=workspaces/prod plan -no-color

.github/workflows/plan-root.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Plan (root)
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- "workspaces/root/**"
8+
- "modules/**"
9+
10+
env:
11+
TF_VERSION: "1.14.8"
12+
13+
jobs:
14+
plan:
15+
name: Plan (root)
16+
runs-on: ubuntu-latest
17+
env:
18+
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: hashicorp/setup-terraform@v3
22+
with:
23+
terraform_version: ${{ env.TF_VERSION }}
24+
- run: terraform -chdir=workspaces/root init
25+
- run: terraform -chdir=workspaces/root plan -no-color

.github/workflows/plan-sandbox.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Plan (sandbox)
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- "workspaces/sandbox/**"
8+
- "modules/**"
9+
10+
env:
11+
TF_VERSION: "1.14.8"
12+
13+
jobs:
14+
plan:
15+
name: Plan (sandbox)
16+
runs-on: ubuntu-latest
17+
env:
18+
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: hashicorp/setup-terraform@v3
22+
with:
23+
terraform_version: ${{ env.TF_VERSION }}
24+
- run: terraform -chdir=workspaces/sandbox init
25+
- run: terraform -chdir=workspaces/sandbox plan -no-color

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ repos:
1616
args: [--allow-missing-credentials]
1717
- id: detect-private-key
1818

19+
- repo: https://github.com/commitizen-tools/commitizen
20+
rev: v4.6.0
21+
hooks:
22+
- id: commitizen
23+
stages: [commit-msg]
24+
1925
- repo: https://github.com/gitleaks/gitleaks
2026
rev: v8.24.3
2127
hooks:

Justfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ workspaces := `ls -d workspaces/*/ | xargs -n1 basename | tr '\n' ' '`
33
# Install pre-commit hooks into git
44
install-hooks:
55
pre-commit install
6+
pre-commit install --hook-type commit-msg
67

78
# Run pre-commit hooks on all files
89
pre-commit:

modules/aws/budget/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.11.3"
2+
required_version = ">= 1.14.0"
33
required_providers {
44
aws = {
55
source = "hashicorp/aws"

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[tool.commitizen]
2+
name = "cz_conventional_commits"
3+
tag_format = "v$version"
4+
version_scheme = "semver"
5+
update_changelog_on_bump = false

workspaces/nonprod/backend.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.11.3"
2+
required_version = ">= 1.14.0"
33

44
required_providers {
55
aws = {

0 commit comments

Comments
 (0)