Skip to content

Commit 27c84db

Browse files
authored
Fix KMS apply. Bump lambda versions (#27)
Terraform couldn't apply the stack because it couldn't determine if kms_key_id was null or not. I don't fully understand this but changing it from null fixes this case. Also, bump the lambda versions to latest and make the lock_versions script a self-contained uv script. No venv needed.
2 parents 958f638 + 7ec7543 commit 27c84db

File tree

8 files changed

+19
-15
lines changed

8 files changed

+19
-15
lines changed

lock_versions

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/env -S uv --quiet run --script
2+
# /// script
3+
# dependencies = [
4+
# "boto3",
5+
# ]
6+
# ///
7+
28
"""
39
This script locks specific versions of lambdas and containers as a part of the
410
release process of the terraform module.

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module "kms" {
22
source = "./modules/kms"
3-
count = var.kms_key_arn == null ? 1 : 0
3+
count = var.kms_key_arn == "" ? 1 : 0
44

55
deployment_name = var.deployment_name
66
additional_key_policies = var.additional_kms_key_policies
77
}
88

99
locals {
10-
kms_key_arn = var.kms_key_arn != null ? var.kms_key_arn : module.kms[0].key_arn
10+
kms_key_arn = var.kms_key_arn != "" ? var.kms_key_arn : module.kms[0].key_arn
1111
clickhouse_address = var.use_external_clickhouse_address != null ? var.use_external_clickhouse_address : (
1212
var.enable_clickhouse ? module.clickhouse[0].clickhouse_instance_private_ip : null
1313
)

mise.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
tflint = "latest"
33
pre-commit = "latest"
44
terraform = "1.10"
5+
uv = "latest"
56

67
[tasks]
78
lint = ["terraform fmt -recursive", "tflint --recursive"]

modules/brainstore/VERSIONS.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"brainstore": "efd5fa953283329dde40866e9006c869837b7e67",
2+
"brainstore": "d3c7e30e993b1dbb354ba894cde9ad14fd196b97",
33
"_tag": "latest",
4-
"_timestamp": "2025-03-14T15:45:57.352992"
4+
"_timestamp": "2025-03-18T11:25:34.153500"
55
}

modules/brainstore/iam.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ resource "aws_iam_role_policy" "brainstore_cloudwatch_logs_access" {
8585
}
8686

8787
resource "aws_iam_role_policy" "brainstore_kms_policy" {
88-
count = var.kms_key_arn != null ? 1 : 0
89-
9088
name = "${var.deployment_name}-brainstore-kms-policy"
9189
role = aws_iam_role.brainstore_ec2_role.id
9290

modules/brainstore/variables.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ variable "instance_key_pair_name" {
5050
variable "kms_key_arn" {
5151
type = string
5252
description = "The ARN of the KMS key to use for encrypting the Brainstore disks and S3 bucket. If not provided, AWS managed keys will be used."
53-
default = null
5453
}
5554

5655
variable "vpc_id" {

modules/services/VERSIONS.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"AIProxy": "lambda/AIProxy/versions/25fc7cbdb108be9db641ec47b7f5acab.zip",
3-
"APIHandler": "lambda/APIHandler/versions/b532daac63efc30982f34aca75f1880d.zip",
4-
"MigrateDatabaseFunction": "lambda/MigrateDatabaseFunction/versions/78d320c5049782073f58b5f1ba0fdac4.zip",
5-
"QuarantineWarmupFunction": "lambda/QuarantineWarmupFunction/versions/81d03621748d93167a2ad8ff78753191.zip",
6-
"CatchupETL": "lambda/CatchupETL/versions/9dddcd4d0f4d897d6edb3ac4d104c3c5.zip",
2+
"AIProxy": "lambda/AIProxy/versions/d3e1d5e1a6dc764705a199f318d0c8b9.zip",
3+
"APIHandler": "lambda/APIHandler/versions/a5c12700e46b9b3aaff10abfe94d2a72.zip",
4+
"MigrateDatabaseFunction": "lambda/MigrateDatabaseFunction/versions/187903b95e71a12a4a8218dffb23a730.zip",
5+
"QuarantineWarmupFunction": "lambda/QuarantineWarmupFunction/versions/38cfac7c3c8d1dde6ac8020c15faf93e.zip",
6+
"CatchupETL": "lambda/CatchupETL/versions/79f082e16ff2071e406caf6ff6a8c709.zip",
77
"_tag": "latest",
8-
"_timestamp": "2025-03-14T15:45:57.352992"
8+
"_timestamp": "2025-03-18T11:25:34.153500"
99
}

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ variable "deployment_name" {
3434
variable "kms_key_arn" {
3535
description = "Existing KMS key ARN to use for encrypting resources. If not provided, a new key will be created. DO NOT change this after deployment. If you do, it will attempt to destroy your DB and prior S3 objects will no longer be readable."
3636
type = string
37-
default = null
37+
default = ""
3838
}
3939

4040
variable "additional_kms_key_policies" {

0 commit comments

Comments
 (0)