Skip to content

Commit cfc7e8c

Browse files
authored
Allow operator to pass in a list of managed IAM policy ARNs for the runner role (#361)
* Allow a user to pass in a list of managed IAM policy ARNs, to be attached to the instance role * Update root module to allow passing in managed policies for runner role
1 parent c8076d7 commit cfc7e8c

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ module "runners" {
102102
userdata_post_install = var.userdata_post_install
103103

104104
create_service_linked_role_spot = var.create_service_linked_role_spot
105+
106+
runner_iam_role_managed_policy_arns = var.runner_iam_role_managed_policy_arns
105107
}
106108

107109
module "runner_binaries" {

modules/runners/policies-runner.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ resource "aws_iam_role_policy" "dist_bucket" {
3939
}
4040
)
4141
}
42+
43+
resource "aws_iam_role_policy_attachment" "managed_policies" {
44+
count = length(var.runner_iam_role_managed_policy_arns)
45+
role = aws_iam_role.runner.name
46+
policy_arn = element(var.runner_iam_role_managed_policy_arns, count.index)
47+
}

modules/runners/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,9 @@ variable "create_service_linked_role_spot" {
238238
type = bool
239239
default = false
240240
}
241+
242+
variable "runner_iam_role_managed_policy_arns" {
243+
description = "Attach AWS or customer-managed IAM policies (by ARN) to the runner IAM role"
244+
type = list(string)
245+
default = []
246+
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,9 @@ variable "create_service_linked_role_spot" {
256256
type = bool
257257
default = false
258258
}
259+
260+
variable "runner_iam_role_managed_policy_arns" {
261+
description = "Attach AWS or customer-managed IAM policies (by ARN) to the runner IAM role"
262+
type = list(string)
263+
default = []
264+
}

0 commit comments

Comments
 (0)