Skip to content

Commit 1ad68c9

Browse files
authored
feat: add ability to set Lambda architectures (#654)
Add an input that allows the user to configure the architectures of the Lambda function. Update the ECR policy to only keep the 10 most recently pushed images.
1 parent 36f5ce5 commit 1ad68c9

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

lambda_schedule/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ No requirements.
3838
| <a name="input_billing_tag_key"></a> [billing\_tag\_key](#input\_billing\_tag\_key) | (Optional, default 'CostCentre') The name of the billing tag | `string` | `"CostCentre"` | no |
3939
| <a name="input_billing_tag_value"></a> [billing\_tag\_value](#input\_billing\_tag\_value) | (Required) The value of the billing tag | `string` | n/a | yes |
4040
| <a name="input_create_ecr_repository"></a> [create\_ecr\_repository](#input\_create\_ecr\_repository) | (Optional, default true) Whether to create an ECR repository for the Lambda image | `bool` | `true` | no |
41+
| <a name="input_lambda_architectures"></a> [lambda\_architectures](#input\_lambda\_architectures) | (Optional, default ['x86\_64']) The architectures of the Lambda function | `list(string)` | <pre>[<br/> "x86_64"<br/>]</pre> | no |
4142
| <a name="input_lambda_ecr_arn"></a> [lambda\_ecr\_arn](#input\_lambda\_ecr\_arn) | (Optional, defaults to null) The ARN of the ECR repository containing the Lambda image | `string` | `null` | no |
4243
| <a name="input_lambda_environment_variables"></a> [lambda\_environment\_variables](#input\_lambda\_environment\_variables) | (Optional, defaults to empty map) Environment variables for the Lambda function | `map(string)` | `{}` | no |
4344
| <a name="input_lambda_image_tag"></a> [lambda\_image\_tag](#input\_lambda\_image\_tag) | (Optional, defaults to 'latest') The image tag to use for the Lambda function | `string` | `"latest"` | no |

lambda_schedule/ecr_lifecycle.json

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,15 @@
22
"rules": [
33
{
44
"rulePriority": 10,
5-
"description": "Keep last 10 git SHA tagged images",
5+
"description": "Keep most recent 10 images",
66
"selection": {
7-
"tagStatus": "tagged",
8-
"tagPrefixList": [
9-
"sha-"
10-
],
7+
"tagStatus": "any",
118
"countType": "imageCountMoreThan",
129
"countNumber": 10
1310
},
1411
"action": {
1512
"type": "expire"
1613
}
17-
},
18-
{
19-
"rulePriority": 20,
20-
"description": "Expire untagged images older than 7 days",
21-
"selection": {
22-
"tagStatus": "untagged",
23-
"countType": "sinceImagePushed",
24-
"countUnit": "days",
25-
"countNumber": 7
26-
},
27-
"action": {
28-
"type": "expire"
29-
}
3014
}
3115
]
3216
}

lambda_schedule/input.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ variable "create_ecr_repository" {
1515
default = true
1616
}
1717

18+
variable "lambda_architectures" {
19+
description = "(Optional, default ['x86_64']) The architectures of the Lambda function"
20+
type = list(string)
21+
default = ["x86_64"]
22+
}
23+
1824
variable "lambda_ecr_arn" {
1925
description = "(Optional, defaults to null) The ARN of the ECR repository containing the Lambda image"
2026
type = string

lambda_schedule/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module "this_lambda" {
1515

1616
timeout = var.lambda_timeout
1717
memory = var.lambda_memory
18+
architectures = var.lambda_architectures
1819
environment_variables = var.lambda_environment_variables
1920
vpc = var.lambda_vpc_config
2021
policies = local.policies

0 commit comments

Comments
 (0)