Skip to content

Commit 2a72ece

Browse files
authored
chore: sync with template (#37)
## what - Updates the module with the recent config changes in [terraform-module-template](https://github.com/masterpointio/terraform-module-template) ## why - Housekeeping. ## references - [INT-66](https://www.notion.so/masterpoint/Keep-terraform-template-module-up-to-latest-good-practices-1dd859758a568002b398c2a0fc2cb67d?pvs=4) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Updated dependency and workflow management configurations for improved grouping, labeling, and automation of updates. - Upgraded versions for Trunk CLI and several linter plugins. - **Style** - Standardized comment formatting in workflow files. - **Documentation** - Updated the README by removing a reference in the acknowledgments section. - **Refactor** - Simplified the test workflow by consolidating multiple steps into a single composite action. - Enhanced the trunk upgrade workflow to support automatic merging of upgrade pull requests. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent e61db1e commit 2a72ece

File tree

7 files changed

+65
-79
lines changed

7 files changed

+65
-79
lines changed

.github/renovate.json5

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@
33
"config:best-practices",
44
"github>aquaproj/aqua-renovate-config#2.7.5"
55
],
6-
"schedule": [
7-
"after 9am on the first day of the month"
8-
],
9-
"assigneesFromCodeOwners": true,
10-
"dependencyDashboardAutoclose": true,
11-
"addLabels": [
12-
"auto-upgrade"
13-
],
146
"enabledManagers": [
15-
"terraform"
7+
"terraform",
8+
"github-actions"
169
],
1710
"terraform": {
1811
"ignorePaths": [
@@ -23,34 +16,49 @@
2316
"\\.tofu$"
2417
]
2518
},
19+
"schedule": [
20+
"after 9am on the first day of the month"
21+
],
22+
"assigneesFromCodeOwners": true,
23+
"dependencyDashboardAutoclose": true,
24+
"addLabels": ["{{manager}}"],
2625
"packageRules": [
2726
{
28-
"matchDepTypes": [
29-
"optionalDependencies"
30-
],
31-
// Allow auto merge if it's not a major version update
32-
"matchUpdateTypes": [
33-
"minor",
34-
"patch",
35-
"pin",
36-
"digest"
37-
],
38-
"automerge": true
27+
"matchManagers": ["github-actions"],
28+
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
29+
"automerge": true,
30+
"automergeType": "branch",
31+
"groupName": "github-actions-auto-upgrade",
32+
"addLabels": ["auto-upgrade"]
33+
},
34+
{
35+
"matchManagers": ["github-actions"],
36+
"matchUpdateTypes": ["major"],
37+
"groupName": "github-actions-needs-review",
38+
"addLabels": ["needs-review"]
39+
},
40+
{
41+
"matchManagers": ["terraform"],
42+
"groupName": "tf",
43+
"addLabels": ["needs-review"]
3944
},
4045
{
4146
"matchFileNames": ["**/*.tofu", "**/*.tf"],
4247
"matchDatasources": ["terraform-provider", "terraform-module"],
43-
"registryUrls": ["https://registry.opentofu.org"]
48+
"registryUrls": ["https://registry.opentofu.org"],
49+
"groupName": "tf"
4450
},
4551
{
4652
"matchFileNames": ["**/*.tofu"],
4753
"matchDepTypes": ["required_version"],
48-
"registryUrls": ["https://registry.opentofu.org"]
54+
"registryUrls": ["https://registry.opentofu.org"],
55+
"groupName": "tf"
4956
},
5057
{
5158
"matchFileNames": ["**/*.tf"],
5259
"matchDepTypes": ["required_version"],
53-
"registryUrls": ["https://registry.terraform.io"]
60+
"registryUrls": ["https://registry.terraform.io"],
61+
"groupName": "tf"
5462
}
5563
]
5664
}

.github/workflows/lint.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Lint
22

3+
concurrency:
4+
group: lint-${{ github.head_ref || github.run_id }}
5+
cancel-in-progress: true
6+
37
on: pull_request
48

59
permissions:
@@ -13,6 +17,13 @@ jobs:
1317
runs-on: ubuntu-latest
1418
steps:
1519
- name: Check out Git repository
16-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1721
- name: Trunk Check
18-
uses: trunk-io/trunk-action@4d5ecc89b2691705fd08c747c78652d2fc806a94 #v1.1.19
22+
uses: trunk-io/trunk-action@4d5ecc89b2691705fd08c747c78652d2fc806a94 # v1.1.19
23+
24+
conventional-title:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yaml

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ permissions:
1313
id-token: write
1414
pull-requests: read
1515

16-
env:
17-
AWS_REGION: us-east-1
18-
1916
jobs:
2017
tf-test:
2118
name: 🧪 ${{ matrix.tf }} test
@@ -24,46 +21,8 @@ jobs:
2421
matrix:
2522
tf: [tofu, terraform]
2623
steps:
27-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28-
29-
- name: Aqua Cache
30-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
31-
if: ${{ !github.event.act }} # Don't enable the cache step if we're using act for testing
24+
- uses: masterpointio/github-action-tf-test@c3b619f3bca9e4f482b9e0fb3166ab3f02d9d54c # v1.0.0
3225
with:
33-
path: ~/.local/share/aquaproj-aqua
34-
key: v1-aqua-installer-${{runner.os}}-${{runner.arch}}-${{hashFiles('aqua.yaml')}}
35-
restore-keys: |
36-
v1-aqua-installer-${{runner.os}}-${{runner.arch}}-
37-
38-
- name: Install Aqua
39-
uses: aquaproj/aqua-installer@5e54e5cee8a95ee2ce7c04cb993da6dfad13e59c # v3.2.1
40-
with:
41-
aqua_version: v2.48.1
42-
43-
- name: Aqua Install
44-
shell: bash
45-
run: aqua install --tags ${{ matrix.tf }}
46-
47-
- name: Check if TF AWS provider is used
48-
id: check_aws_provider
49-
run: |
50-
if grep -q "aws" $(find . -name "versions.tf" -o -name "versions.tofu" -type f); then
51-
echo "Found aws in versions.tf or versions.tofu files"
52-
echo "contains_hashicorp=true" >> $GITHUB_OUTPUT
53-
else
54-
echo "No versions.tf or versions.tofu files contain aws"
55-
echo "contains_hashicorp=false" >> $GITHUB_OUTPUT
56-
fi
57-
58-
# Assume into the `masterpoint-testing` AWS account with OIDC for testing ONLY if the AWS provider is used
59-
# Not needed for modules that don't use the AWS provider, for example, exclusive Spacelift modules
60-
- name: Configure AWS Credentials on `masterpoint-testing` AWS Account
61-
if: steps.check_aws_provider.outputs.contains_hashicorp == 'true'
62-
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
63-
with:
64-
role-to-assume: arn:aws:iam::115843287071:role/mp-ue1-testing-oidc-github
65-
role-session-name: GitHubActionsOIDC-MP-Infra-Repo
66-
aws-region: ${{ env.AWS_REGION }}
67-
68-
- run: ${{ matrix.tf }} init
69-
- run: ${{ matrix.tf }} test
26+
tf_type: ${{ matrix.tf }}
27+
aws_role_arn: ${{ vars.TF_TEST_AWS_ROLE_ARN }}
28+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/trunk-upgrade.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,17 @@ jobs:
2727
private_key: ${{ secrets.MP_BOT_APP_PRIVATE_KEY }}
2828

2929
- name: Upgrade
30+
id: trunk-upgrade
3031
uses: trunk-io/trunk-action/upgrade@4d5ecc89b2691705fd08c747c78652d2fc806a94 # v1.1.19
3132
with:
3233
github-token: ${{ steps.generate-token.outputs.token }}
3334
reviewers: "@masterpointio/masterpoint-internal"
3435
prefix: "chore: "
36+
37+
- name: Merge PR automatically
38+
if: steps.trunk-upgrade.outputs.pull-request-number != ''
39+
env:
40+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
41+
PR_NUMBER: ${{ steps.trunk-upgrade.outputs.pull-request-number }}
42+
run: |
43+
gh pr merge "$PR_NUMBER" --squash --auto --delete-branch

.trunk/trunk.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
33
version: 0.1
44
cli:
5-
version: 1.22.12
5+
version: 1.22.15
66
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
77
plugins:
88
sources:
@@ -20,17 +20,17 @@ lint:
2020
# Incompatible with some Terraform features: https://github.com/tenable/terrascan/issues/1331
2121
- terrascan
2222
enabled:
23-
- renovate@39.263.0
23+
- renovate@40.0.6
2424
- tofu@1.9.1
2525
- actionlint@1.7.7
26-
- checkov@3.2.412
26+
- checkov@3.2.420
2727
- git-diff-check
2828
- markdownlint@0.44.0
2929
- prettier@3.5.3
30-
- tflint@0.56.0
31-
- trivy@0.61.1
32-
- trufflehog@3.88.25
33-
- yamllint@1.37.0
30+
- tflint@0.57.0
31+
- trivy@0.62.1
32+
- trufflehog@3.88.29
33+
- yamllint@1.37.1
3434
ignore:
3535
- linters: [tofu]
3636
paths:

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2024 Masterpoint
190+
Copyright 2025 Masterpoint
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Big shout out to the following projects which this project uses/depends on/menti
2020
1. [cloudposse/terraform-aws-dynamic-subnets](https://github.com/cloudposse/terraform-aws-dynamic-subnets)
2121
1. [cloudposse/terraform-aws-kms-key](https://github.com/cloudposse/terraform-aws-kms-key)
2222
1. [cloudposse/terraform-aws-s3-bucket](https://github.com/cloudposse/terraform-aws-s3-bucket)
23-
1. Cloud Posse's Terratest Setup.
2423

2524
![SSM Agent Session Manager Example](https://i.imgur.com/lWcRiQf.png)
2625

0 commit comments

Comments
 (0)