Skip to content

Commit 0e50aad

Browse files
author
thomas loubrieu
committed
add creation of the build directory
1 parent c98e6cd commit 0e50aad

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

terraform/lambda/main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@ resource "aws_cloudwatch_log_group" "lambda_logs" {
2222
tags = var.common_tags
2323
}
2424

25+
# Create build directory if it doesn't exist
26+
resource "null_resource" "create_build_dir" {
27+
provisioner "local-exec" {
28+
command = "mkdir -p ${path.module}/build"
29+
}
30+
}
31+
2532
resource "null_resource" "build_trigger" {
2633
triggers = {
2734
source_py_hash = filesha256(local.source_file)
2835
build_layer_exists = fileexists("${path.module}/build/${local.lambda_name}.zip") ? "yes" : "no"
2936
}
37+
38+
depends_on = [null_resource.create_build_dir]
3039
}
3140

3241
# Package the lambda source file as a zip
@@ -47,6 +56,8 @@ resource "null_resource" "prepare_layer" {
4756
provisioner "local-exec" {
4857
command = "rm -fr ${path.module}/build/layer/python && mkdir -p ${path.module}/build/layer/ && cp -r ${path.module}/src/layer ${path.module}/build/layer/python && pip install -r ${path.module}/build/layer/python/requirements.txt -t ${path.module}/build/layer/python"
4958
}
59+
60+
depends_on = [null_resource.create_build_dir]
5061
}
5162

5263
# Package the layer as a zip

terraform/main.tf

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,6 @@ module "lambda" {
4040

4141
}
4242

43-
# External IAM Policies Module
44-
# Depends on Lambda module (implicit via lambda_log_group_arn reference)
45-
# This ensures: 1. Lambda created -> 2. CloudWatch log group output -> 3. Policies created
46-
#module "external_policies" {
47-
# source = "./modules/external_policies"
48-
#
49-
# collection_name = var.collection_name
50-
# collection_arn = module.opensearch.collection_arn
51-
# aws_region = var.aws_region
52-
# account_id = data.aws_caller_identity.current.account_id
53-
# common_tags = var.common_tags
54-
# lambda_log_group_arn = module.lambda.lambda_log_group_arn
55-
#}
56-
5743
# API Gateway Module
5844
# Integrates with Lambda function for /credentials endpoint
5945
module "api_gateway" {
@@ -68,3 +54,5 @@ module "api_gateway" {
6854
aws_region = var.aws_region
6955
common_tags = var.common_tags
7056
}
57+
58+
module "registry-api"

0 commit comments

Comments
 (0)