Skip to content

Commit f7792d1

Browse files
HenryNguyen5npalm
authored andcommitted
feat: Default to not attching AmazonSSMManagedInstanceCore to instances (#143)
* Default to not attching AmazonSSMManagedInstanceCore to instances * Remove instance_runner_session_manager_policy
1 parent 05b3d2b commit f7792d1

File tree

6 files changed

+14
-22
lines changed

6 files changed

+14
-22
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ No requirements.
317317
| vpc\_id | The VPC for security groups of the action runners. | `string` | n/a | yes |
318318
| webhook\_lambda\_timeout | Time out of the webhook lambda in seconds. | `number` | `10` | no |
319319
| webhook\_lambda\_zip | File location of the webhook lambda zip file. | `string` | `null` | no |
320-
320+
| enable\_ssm\_on\_runners | Enable to allow access the runner instances for debugging purposes via SSM. Note that this adds additional permissions to the runner instances. | `bool` | `false` | no |
321321
## Outputs
322322

323323
| Name | Description |

main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ module "runners" {
7676
runner_as_root = var.runner_as_root
7777
runners_maximum_count = var.runners_maximum_count
7878
idle_config = var.idle_config
79+
enable_ssm_on_runners = var.enable_ssm_on_runners
7980

8081
lambda_zip = var.runners_lambda_zip
8182
lambda_timeout_scale_up = var.runners_scale_up_lambda_timeout

modules/runners/policies-runner.tf

+1-6
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ resource "aws_iam_instance_profile" "runner" {
1414
path = local.instance_profile_path
1515
}
1616

17-
resource "aws_iam_role_policy" "runner_session_manager_policy" {
18-
name = "session-manager"
19-
role = aws_iam_role.runner.name
20-
policy = templatefile("${path.module}/policies/instance-session-manager-policy.json", {})
21-
}
22-
2317
resource "aws_iam_role_policy_attachment" "runner_session_manager_aws_managed" {
18+
count = var.enable_ssm_on_runners ? 1 : 0
2419
role = aws_iam_role.runner.name
2520
policy_arn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
2621
}

modules/runners/policies/instance-session-manager-policy.json

-15
This file was deleted.

modules/runners/variables.tf

+5
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,8 @@ variable "logging_retention_in_days" {
206206
type = number
207207
default = 7
208208
}
209+
210+
variable "enable_ssm_on_runners" {
211+
description = "Enable to allow access the runner instances for debugging purposes via SSM. Note that this adds additional permissions to the runner instances."
212+
type = bool
213+
}

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ variable "idle_config" {
175175
default = []
176176
}
177177

178+
variable "enable_ssm_on_runners" {
179+
description = "Enable to allow access the runner instances for debugging purposes via SSM. Note that this adds additional permissions to the runner instances."
180+
type = bool
181+
default = false
182+
}
183+
178184
variable "logging_retention_in_days" {
179185
description = "Specifies the number of days you want to retain log events for the lambda log group. Possible values are: 0, 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653."
180186
type = number

0 commit comments

Comments
 (0)