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

Commit 9e2a7b6

Browse files
dylanmtaylornpalm
andauthored
feat: Support arm64 lambda functions (#2121)
* feat: Support arm64 lambda functions * chore: Default to existing behavior, update readme * chore: terraform fmt, add validation to lambda architecture, update description * feat: Add arm64 support to pool lambda * fix: Wrong variable name in the lambda function * fix: var.config.lambda_architecture instead of var.lambda_architecture in lambda pool * fix: It should have been lambda.architecture not lambda_architecture. * chore: Change default to x86_64 Co-authored-by: Niek Palm <[email protected]> * chore: Change default to x86_64 Co-authored-by: Niek Palm <[email protected]> * chore: Change default to x86_64 Co-authored-by: Niek Palm <[email protected]> * chore: Change default to x86_64 Co-authored-by: Niek Palm <[email protected]> Co-authored-by: Niek Palm <[email protected]>
1 parent 56b2c3a commit 9e2a7b6

File tree

13 files changed

+51
-0
lines changed

13 files changed

+51
-0
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ In case the setup does not work as intended follow the trace of events:
428428
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | Optional CMK Key ARN to be used for Parameter Store. This key must be in the current account. | `string` | `null` | no |
429429
| <a name="input_lambda_principals"></a> [lambda\_principals](#input\_lambda\_principals) | (Optional) add extra principals to the role created for execution of the lambda, e.g. for local testing. | <pre>list(object({<br> type = string<br> identifiers = list(string)<br> }))</pre> | `[]` | no |
430430
| <a name="input_lambda_runtime"></a> [lambda\_runtime](#input\_lambda\_runtime) | AWS Lambda runtime. | `string` | `"nodejs14.x"` | no |
431+
| <a name="input_lambda_architecture"></a> [lambda\_architecture](#input\_lambda\_architecture) | AWS Lambda architecture. | `string` | `"x86_64"` | no |
431432
| <a name="input_lambda_s3_bucket"></a> [lambda\_s3\_bucket](#input\_lambda\_s3\_bucket) | S3 bucket from which to specify lambda functions. This is an alternative to providing local files directly. | `any` | `null` | no |
432433
| <a name="input_lambda_security_group_ids"></a> [lambda\_security\_group\_ids](#input\_lambda\_security\_group\_ids) | List of security group IDs associated with the Lambda function. | `list(string)` | `[]` | no |
433434
| <a name="input_lambda_subnet_ids"></a> [lambda\_subnet\_ids](#input\_lambda\_subnet\_ids) | List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`. | `list(string)` | `[]` | no |

Diff for: main.tf

+3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ module "webhook" {
103103
webhook_lambda_s3_key = var.webhook_lambda_s3_key
104104
webhook_lambda_s3_object_version = var.webhook_lambda_s3_object_version
105105
lambda_runtime = var.lambda_runtime
106+
lambda_architecture = var.lambda_architecture
106107
lambda_zip = var.webhook_lambda_zip
107108
lambda_timeout = var.webhook_lambda_timeout
108109
logging_retention_in_days = var.logging_retention_in_days
@@ -169,6 +170,7 @@ module "runners" {
169170
runners_lambda_s3_key = var.runners_lambda_s3_key
170171
runners_lambda_s3_object_version = var.runners_lambda_s3_object_version
171172
lambda_runtime = var.lambda_runtime
173+
lambda_architecture = var.lambda_architecture
172174
lambda_zip = var.runners_lambda_zip
173175
lambda_timeout_scale_up = var.runners_scale_up_lambda_timeout
174176
lambda_timeout_scale_down = var.runners_scale_down_lambda_timeout
@@ -229,6 +231,7 @@ module "runner_binaries" {
229231
syncer_lambda_s3_key = var.syncer_lambda_s3_key
230232
syncer_lambda_s3_object_version = var.syncer_lambda_s3_object_version
231233
lambda_runtime = var.lambda_runtime
234+
lambda_architecture = var.lambda_architecture
232235
lambda_zip = var.runner_binaries_syncer_lambda_zip
233236
lambda_timeout = var.runner_binaries_syncer_lambda_timeout
234237
logging_retention_in_days = var.logging_retention_in_days

Diff for: modules/runner-binaries-syncer/runner-binaries-syncer.tf

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ resource "aws_lambda_function" "syncer" {
1919
runtime = var.lambda_runtime
2020
timeout = var.lambda_timeout
2121
memory_size = 256
22+
architectures = [var.lambda_architecture]
2223

2324
environment {
2425
variables = {

Diff for: modules/runner-binaries-syncer/variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,13 @@ variable "lambda_runtime" {
187187
type = string
188188
default = "nodejs14.x"
189189
}
190+
191+
variable "lambda_architecture" {
192+
description = "AWS Lambda architecture. Lambda functions using Graviton processors ('arm64') tend to have better price/performance than 'x86_64' functions. "
193+
type = string
194+
default = "x86_64"
195+
validation {
196+
condition = contains(["arm64", "x86_64"], var.lambda_architecture)
197+
error_message = "`lambda_architecture` value is not valid, valid values are: `arm64` and `x86_64`."
198+
}
199+
}

Diff for: modules/runners/pool.tf

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module "pool" {
2626
s3_object_version = var.runners_lambda_s3_object_version
2727
security_group_ids = var.lambda_security_group_ids
2828
subnet_ids = var.lambda_subnet_ids
29+
architecture = var.lambda_architecture
2930
runtime = var.lambda_runtime
3031
timeout = var.pool_lambda_timeout
3132
zip = local.lambda_zip

Diff for: modules/runners/pool/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ resource "aws_lambda_function" "pool" {
88
function_name = "${var.config.prefix}-pool"
99
role = aws_iam_role.pool.arn
1010
handler = "index.adjustPool"
11+
architectures = [var.config.lambda.architecture]
1112
runtime = var.config.lambda.runtime
1213
timeout = var.config.lambda.timeout
1314
reserved_concurrent_executions = var.config.lambda.reserved_concurrent_executions

Diff for: modules/runners/pool/variables.tf

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ variable "config" {
1111
s3_object_version = string
1212
security_group_ids = list(string)
1313
runtime = string
14+
architecture = string
1415
timeout = number
1516
zip = string
1617
subnet_ids = list(string)

Diff for: modules/runners/scale-down.tf

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ resource "aws_lambda_function" "scale_down" {
1818
timeout = var.lambda_timeout_scale_down
1919
tags = local.tags
2020
memory_size = 512
21+
architectures = [var.lambda_architecture]
2122

2223
environment {
2324
variables = {

Diff for: modules/runners/scale-up.tf

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ resource "aws_lambda_function" "scale_up" {
1212
reserved_concurrent_executions = var.scale_up_reserved_concurrent_executions
1313
memory_size = 512
1414
tags = local.tags
15+
architectures = [var.lambda_architecture]
1516

1617
environment {
1718
variables = {

Diff for: modules/runners/variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -551,3 +551,13 @@ variable "lambda_runtime" {
551551
type = string
552552
default = "nodejs14.x"
553553
}
554+
555+
variable "lambda_architecture" {
556+
description = "AWS Lambda architecture. Lambda functions using Graviton processors ('arm64') tend to have better price/performance than 'x86_64' functions. "
557+
type = string
558+
default = "x86_64"
559+
validation {
560+
condition = contains(["arm64", "x86_64"], var.lambda_architecture)
561+
error_message = "`lambda_architecture` value is not valid, valid values are: `arm64` and `x86_64`."
562+
}
563+
}

Diff for: modules/webhook/variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,13 @@ variable "lambda_runtime" {
162162
type = string
163163
default = "nodejs14.x"
164164
}
165+
166+
variable "lambda_architecture" {
167+
description = "AWS Lambda architecture. Lambda functions using Graviton processors ('arm64') tend to have better price/performance than 'x86_64' functions. "
168+
type = string
169+
default = "x86_64"
170+
validation {
171+
condition = contains(["arm64", "x86_64"], var.lambda_architecture)
172+
error_message = "`lambda_architecture` value is not valid, valid values are: `arm64` and `x86_64`."
173+
}
174+
}

Diff for: modules/webhook/webhook.tf

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ resource "aws_lambda_function" "webhook" {
99
handler = "index.githubWebhook"
1010
runtime = var.lambda_runtime
1111
timeout = var.lambda_timeout
12+
architectures = [var.lambda_architecture]
1213

1314
environment {
1415
variables = {

Diff for: variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -641,3 +641,13 @@ variable "lambda_runtime" {
641641
type = string
642642
default = "nodejs14.x"
643643
}
644+
645+
variable "lambda_architecture" {
646+
description = "AWS Lambda architecture. Lambda functions using Graviton processors ('arm64') tend to have better price/performance than 'x86_64' functions. "
647+
type = string
648+
default = "x86_64"
649+
validation {
650+
condition = contains(["arm64", "x86_64"], var.lambda_architecture)
651+
error_message = "`lambda_architecture` value is not valid, valid values are: `arm64` and `x86_64`."
652+
}
653+
}

0 commit comments

Comments
 (0)