Skip to content

Commit 55c421e

Browse files
feat: add cpu_options
1 parent 83cc3f2 commit 55c421e

File tree

6 files changed

+29
-0
lines changed

6 files changed

+29
-0
lines changed

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ module "runners" {
208208
runner_additional_security_group_ids = var.runner_additional_security_group_ids
209209
metadata_options = var.runner_metadata_options
210210
credit_specification = var.runner_credit_specification
211+
cpu_options = var.runner_cpu_options
211212

212213
enable_runner_binaries_syncer = var.enable_runner_binaries_syncer
213214
lambda_s3_bucket = var.lambda_s3_bucket

modules/multi-runner/runners.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ module "runners" {
5656
runner_additional_security_group_ids = try(coalescelist(each.value.runner_config.runner_additional_security_group_ids, var.runner_additional_security_group_ids), [])
5757
metadata_options = each.value.runner_config.runner_metadata_options
5858
credit_specification = each.value.runner_config.credit_specification
59+
cpu_options = each.value.runner_config.cpu_options
5960

6061
enable_runner_binaries_syncer = each.value.runner_config.enable_runner_binaries_syncer
6162
lambda_s3_bucket = var.lambda_s3_bucket

modules/multi-runner/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ variable "multi_runner_config" {
126126
idleCount = number
127127
evictionStrategy = optional(string, "oldest_first")
128128
})), [])
129+
cpu_options = optional(object({
130+
core_count = number
131+
threads_per_core = number
132+
}), null)
129133
runner_log_files = optional(list(object({
130134
log_group_name = string
131135
prefix_log_group = bool

modules/runners/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ resource "aws_launch_template" "runner" {
160160
}
161161
}
162162

163+
cpu_options {
164+
core_count = var.cpu_options != null ? var.cpu_options.core_count : null
165+
threads_per_core = var.cpu_options != null ? var.cpu_options.threads_per_core : null
166+
}
167+
163168
monitoring {
164169
enabled = var.enable_runner_detailed_monitoring
165170
}

modules/runners/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,15 @@ variable "credit_specification" {
662662
}
663663
}
664664

665+
variable "cpu_options" {
666+
description = "The CPU options for the instance. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template#cpu-options for details. Note that not all instance types support CPU options, see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html#instance-cpu-options"
667+
type = object({
668+
core_count = number
669+
threads_per_core = number
670+
})
671+
default = null
672+
}
673+
665674
variable "enable_jit_config" {
666675
description = "Overwrite the default behavior for JIT configuration. By default JIT configuration is enabled for ephemeral runners and disabled for non-ephemeral runners. In case of GHES check first if the JIT config API is avaialbe. In case you upgradeing from 3.x to 4.x you can set `enable_jit_config` to `false` to avoid a breaking change when having your own AMI."
667676
type = bool

variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,15 @@ variable "runner_credit_specification" {
873873
}
874874
}
875875

876+
variable "runner_cpu_options" {
877+
description = "TThe CPU options for the instance. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template#cpu-options for details. Note that not all instance types support CPU options, see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html#instance-cpu-options"
878+
type = object({
879+
core_count = number
880+
threads_per_core = number
881+
})
882+
default = null
883+
}
884+
876885
variable "enable_jit_config" {
877886
description = "Overwrite the default behavior for JIT configuration. By default JIT configuration is enabled for ephemeral runners and disabled for non-ephemeral runners. In case of GHES check first if the JIT config API is avaialbe. In case you upgradeing from 3.x to 4.x you can set `enable_jit_config` to `false` to avoid a breaking change when having your own AMI."
878887
type = bool

0 commit comments

Comments
 (0)