Skip to content

Commit cf4e3e3

Browse files
feat: add license_specification
1 parent 20e611e commit cf4e3e3

7 files changed

Lines changed: 28 additions & 4 deletions

File tree

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ module "runners" {
207207
credit_specification = var.runner_credit_specification
208208
cpu_options = var.runner_cpu_options
209209
placement = var.runner_placement
210+
license_specification = var.runner_license_specification
210211

211212
enable_runner_binaries_syncer = var.enable_runner_binaries_syncer
212213
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
credit_specification = each.value.runner_config.credit_specification
5757
cpu_options = each.value.runner_config.cpu_options
5858
placement = each.value.runner_config.placement
59+
license_specification = each.value.runner_config.license_specification
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ variable "multi_runner_config" {
147147
tenancy = optional(string)
148148
partition_number = optional(number)
149149
}), null)
150+
license_specification = optional(object({
151+
license_configuration_arn = string
152+
}), null)
150153
runner_log_files = optional(list(object({
151154
log_group_name = string
152155
prefix_log_group = bool

modules/runners/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ resource "aws_launch_template" "runner" {
190190
}
191191
}
192192

193+
dynamic "license_specification" {
194+
for_each = var.license_specification != null ? [var.license_specification] : []
195+
content {
196+
license_configuration_arn = license_specification.value.license_configuration_arn
197+
}
198+
}
199+
193200
monitoring {
194201
enabled = var.enable_runner_detailed_monitoring
195202
}

modules/runners/templates/user-data-osx.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#!/bin/bash -e
22

3-
exec > >(tee /var/log/user-data.log | logger -t user-data -s 2>/dev/console) 2>&1
4-
5-
# macOS user-data for GitHub Actions runners
6-
73
set +x
84

95
%{ if enable_debug_logging }

modules/runners/variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,14 @@ variable "placement" {
659659
default = null
660660
}
661661

662+
variable "license_specification" {
663+
description = "The license specifications for the instance. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template#license_specification for details."
664+
type = object({
665+
license_configuration_arn = string
666+
})
667+
default = null
668+
}
669+
662670
variable "enable_jit_config" {
663671
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 available. In case you are upgrading from 3.x to 4.x you can set `enable_jit_config` to `false` to avoid a breaking change when having your own AMI."
664672
type = bool

variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,14 @@ variable "runner_placement" {
890890
default = null
891891
}
892892

893+
variable "runner_license_specification" {
894+
description = "The license specifications for the instance. See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_template#license_specification for details."
895+
type = object({
896+
license_configuration_arn = string
897+
})
898+
default = null
899+
}
900+
893901
variable "enable_jit_config" {
894902
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 available. In case you are upgrading from 3.x to 4.x you can set `enable_jit_config` to `false` to avoid a breaking change when having your own AMI."
895903
type = bool

0 commit comments

Comments
 (0)