Skip to content

Commit dc35f6d

Browse files
Merge branch 'main' into trunk-io/update-trunk
2 parents 96c660f + c2cdfa3 commit dc35f6d

File tree

10 files changed

+113
-79
lines changed

10 files changed

+113
-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: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
pull_request:
7+
pull_request_target:
88

99
permissions:
1010
actions: read
@@ -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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ lint:
2020
# Incompatible with some Terraform features: https://github.com/tenable/terrascan/issues/1331
2121
- terrascan
2222
enabled:
23-
23+
2424
2525
26-
26+
2727
- git-diff-check
2828
2929
30-
- tflint@0.56.0
31-
- trivy@0.61.1
32-
33-
30+
- tflint@0.57.0
31+
- trivy@0.62.1
32+
33+
3434
ignore:
3535
- linters: [tofu]
3636
paths:

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## [1.4.0](https://github.com/masterpointio/terraform-aws-ssm-agent/compare/v1.3.0...v1.4.0) (2025-05-15)
4+
5+
6+
### Features
7+
8+
* allow configuring of additional security group rules ([#38](https://github.com/masterpointio/terraform-aws-ssm-agent/issues/38)) ([5f9e32d](https://github.com/masterpointio/terraform-aws-ssm-agent/commit/5f9e32deeaf207b4ebf7a8a7a924cf132d3fb44a))
9+
10+
11+
### Bug Fixes
12+
13+
* **gha:** tf test pr target ([#40](https://github.com/masterpointio/terraform-aws-ssm-agent/issues/40)) ([5a2e766](https://github.com/masterpointio/terraform-aws-ssm-agent/commit/5a2e766f9c92f096aa81ca35e22e5b22e80a7230))
14+
315
## [1.3.0](https://github.com/masterpointio/terraform-aws-ssm-agent/compare/1.2.1...v1.3.0) (2025-01-04)
416

517

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: 2 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

@@ -116,6 +115,7 @@ Use [the awesome `gossm` project](https://github.com/gjbae1212/gossm).
116115
| [aws_iam_role_policy_attachment.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
117116
| [aws_launch_template.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template) | resource |
118117
| [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
118+
| [aws_security_group_rule.additional](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
119119
| [aws_security_group_rule.allow_all_egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
120120
| [aws_ssm_document.session_logging](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_document) | resource |
121121
| [null_resource.validate_instance_type](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
@@ -131,6 +131,7 @@ Use [the awesome `gossm` project](https://github.com/gjbae1212/gossm).
131131
| Name | Description | Type | Default | Required |
132132
|------|-------------|------|---------|:--------:|
133133
| <a name="input_additional_security_group_ids"></a> [additional\_security\_group\_ids](#input\_additional\_security\_group\_ids) | Security groups that will be attached to the app instances | `list(string)` | `[]` | no |
134+
| <a name="input_additional_security_group_rules"></a> [additional\_security\_group\_rules](#input\_additional\_security\_group\_rules) | Additional security group rules that will be attached to the primary security group | <pre>map(object({<br/> type = string<br/> from_port = number<br/> to_port = number<br/> protocol = string<br/><br/> description = optional(string)<br/> cidr_blocks = optional(list(string))<br/> ipv6_cidr_blocks = optional(list(string))<br/> prefix_list_ids = optional(list(string))<br/> self = optional(bool)<br/> }))</pre> | `{}` | no |
134135
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.<br/>This is for some rare cases where resources want additional configuration of tags<br/>and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no |
135136
| <a name="input_ami"></a> [ami](#input\_ami) | The AMI to use for the SSM Agent EC2 Instance. If not provided, the latest Amazon Linux 2023 AMI will be used. Note: This will update periodically as AWS releases updates to their AL2023 AMI. Pin to a specific AMI if you would like to avoid these updates. | `string` | `""` | no |
136137
| <a name="input_architecture"></a> [architecture](#input\_architecture) | The architecture of the AMI (e.g., x86\_64, arm64) | `string` | `"arm64"` | no |

main.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,23 @@ resource "aws_security_group_rule" "allow_all_egress" {
159159
security_group_id = aws_security_group.default.id
160160
}
161161

162+
resource "aws_security_group_rule" "additional" {
163+
for_each = var.additional_security_group_rules
164+
165+
type = lookup(each.value, "type")
166+
from_port = lookup(each.value, "from_port")
167+
to_port = lookup(each.value, "to_port")
168+
protocol = lookup(each.value, "protocol")
169+
170+
description = lookup(each.value, "description", null)
171+
cidr_blocks = lookup(each.value, "cidr_blocks", null)
172+
ipv6_cidr_blocks = lookup(each.value, "ipv6_cidr_blocks", null)
173+
prefix_list_ids = lookup(each.value, "prefix_list_ids", null)
174+
self = lookup(each.value, "self", null)
175+
176+
security_group_id = aws_security_group.default.id
177+
}
178+
162179
#######################
163180
## SECURITY LOGGING ##
164181
#####################

variables.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ variable "additional_security_group_ids" {
6262
default = []
6363
}
6464

65+
variable "additional_security_group_rules" {
66+
description = "Additional security group rules that will be attached to the primary security group"
67+
type = map(object({
68+
type = string
69+
from_port = number
70+
to_port = number
71+
protocol = string
72+
73+
description = optional(string)
74+
cidr_blocks = optional(list(string))
75+
ipv6_cidr_blocks = optional(list(string))
76+
prefix_list_ids = optional(list(string))
77+
self = optional(bool)
78+
}))
79+
default = {}
80+
}
81+
6582
variable "monitoring_enabled" {
6683
description = "Enable detailed monitoring of instance"
6784
type = bool

0 commit comments

Comments
 (0)