Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit 9c2548d

Browse files
authored
feat: add option to overwrite / disable egress #748 (#1112)
* current value turned to default under new variable * added defaults to submodule as well
1 parent 5867e7c commit 9c2548d

File tree

4 files changed

+69
-5
lines changed

4 files changed

+69
-5
lines changed

Diff for: main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ module "runners" {
9797
runners_maximum_count = var.runners_maximum_count
9898
idle_config = var.idle_config
9999
enable_ssm_on_runners = var.enable_ssm_on_runners
100+
egress_rules = var.runner_egress_rules
100101
runner_additional_security_group_ids = var.runner_additional_security_group_ids
101102
volume_size = var.volume_size
102103

Diff for: modules/runners/main.tf

+16-5
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,23 @@ resource "aws_security_group" "runner_sg" {
128128

129129
vpc_id = var.vpc_id
130130

131-
egress {
132-
from_port = 0
133-
to_port = 0
134-
protocol = "-1"
135-
cidr_blocks = ["0.0.0.0/0"]
131+
dynamic "egress" {
132+
for_each = var.egress_rules
133+
iterator = each
134+
135+
content {
136+
cidr_blocks = each.value.cidr_blocks
137+
ipv6_cidr_blocks = each.value.ipv6_cidr_blocks
138+
prefix_list_ids = each.value.prefix_list_ids
139+
from_port = each.value.from_port
140+
protocol = each.value.protocol
141+
security_groups = each.value.security_groups
142+
self = each.value.self
143+
to_port = each.value.to_port
144+
description = each.value.description
145+
}
136146
}
147+
137148
tags = merge(
138149
local.tags,
139150
{

Diff for: modules/runners/variables.tf

+26
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,29 @@ variable "kms_key_arn" {
332332
type = string
333333
default = null
334334
}
335+
336+
variable "egress_rules" {
337+
description = "List of egress rules for the GitHub runner instances."
338+
type = list(object({
339+
cidr_blocks = list(string)
340+
ipv6_cidr_blocks = list(string)
341+
prefix_list_ids = list(string)
342+
from_port = number
343+
protocol = string
344+
security_groups = list(string)
345+
self = bool
346+
to_port = number
347+
description = string
348+
}))
349+
default = [{
350+
cidr_blocks = ["0.0.0.0/0"]
351+
ipv6_cidr_blocks = ["::/0"]
352+
prefix_list_ids = null
353+
from_port = 0
354+
protocol = "-1"
355+
security_groups = null
356+
self = null
357+
to_port = 0
358+
description = null
359+
}]
360+
}

Diff for: variables.tf

+26
Original file line numberDiff line numberDiff line change
@@ -360,3 +360,29 @@ variable "delay_webhook_event" {
360360
type = number
361361
default = 30
362362
}
363+
364+
variable "runner_egress_rules" {
365+
description = "List of egress rules for the GitHub runner instances."
366+
type = list(object({
367+
cidr_blocks = list(string)
368+
ipv6_cidr_blocks = list(string)
369+
prefix_list_ids = list(string)
370+
from_port = number
371+
protocol = string
372+
security_groups = list(string)
373+
self = bool
374+
to_port = number
375+
description = string
376+
}))
377+
default = [{
378+
cidr_blocks = ["0.0.0.0/0"]
379+
ipv6_cidr_blocks = ["::/0"]
380+
prefix_list_ids = null
381+
from_port = 0
382+
protocol = "-1"
383+
security_groups = null
384+
self = null
385+
to_port = 0
386+
description = null
387+
}]
388+
}

0 commit comments

Comments
 (0)