From ceec32410ff8ec1eedc7cb16e3fc8e06ed8d0dcb Mon Sep 17 00:00:00 2001 From: chenga Date: Sat, 22 Jun 2024 22:34:29 +0300 Subject: [PATCH] make sure HOME is set --- examples/basic-github-integration.tf | 1 - locals.tf | 2 ++ modules/lambda/lambda.tf | 2 +- multiple-lambdas-integration.tf | 4 ++-- single-lambda-integration.tf | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/basic-github-integration.tf b/examples/basic-github-integration.tf index d6978a8..c612262 100644 --- a/examples/basic-github-integration.tf +++ b/examples/basic-github-integration.tf @@ -27,6 +27,5 @@ module "spectral_lambda_integration" { SHOULD_SKIP_INGEST = false STRICT_MODE = false SPECTRAL_TAGS = "iac,base,audit" - HOME = "/tmp" } } \ No newline at end of file diff --git a/locals.tf b/locals.tf index 82dc2ca..0aea295 100644 --- a/locals.tf +++ b/locals.tf @@ -12,4 +12,6 @@ locals { } # Please do not change or replace the 'frontend' suffix since there a logic in the bot based in it api_triggered_function_name = local.single_lambda_integration ? local.resource_name_pattern : "${local.resource_name_pattern}-frontend" + # Merge user env vars with env vars which are not based on user input + env_vars = merge(var.env_vars, { HOME = "/tmp" }) } \ No newline at end of file diff --git a/modules/lambda/lambda.tf b/modules/lambda/lambda.tf index 7e29feb..b04cb9f 100644 --- a/modules/lambda/lambda.tf +++ b/modules/lambda/lambda.tf @@ -19,7 +19,7 @@ resource "aws_lambda_function" "spectral_scanner_lambda" { ) environment { - variables = var.env_vars + variables = local.env_vars } } diff --git a/multiple-lambdas-integration.tf b/multiple-lambdas-integration.tf index 902841e..ffec1e7 100644 --- a/multiple-lambdas-integration.tf +++ b/multiple-lambdas-integration.tf @@ -7,7 +7,7 @@ module "frontend_lambda_function" { integration_type = var.integration_type # Please do not change or replace the 'frontend' suffix since there a logic in the bot based in it resource_name_pattern = local.api_triggered_function_name - env_vars = var.env_vars + env_vars = local.env_vars logs_retention_in_days = var.lambda_logs_retention_in_days should_write_logs = var.lambda_enable_logs lambda_handler = local.frontend_lambda_handler @@ -29,7 +29,7 @@ module "backend_lambda_function" { integration_type = var.integration_type # Please do not change or replace the 'backend' suffix since there a logic in the bot based in it resource_name_pattern = "${local.resource_name_pattern}-backend" - env_vars = var.env_vars + env_vars = local.env_vars logs_retention_in_days = var.lambda_logs_retention_in_days should_write_logs = var.lambda_enable_logs lambda_handler = local.backend_lambda_handler diff --git a/single-lambda-integration.tf b/single-lambda-integration.tf index 0ab0bfd..e162e88 100644 --- a/single-lambda-integration.tf +++ b/single-lambda-integration.tf @@ -6,7 +6,7 @@ module "lambda_function" { environment = var.environment integration_type = var.integration_type resource_name_pattern = local.api_triggered_function_name - env_vars = var.env_vars + env_vars = local.env_vars logs_retention_in_days = var.lambda_logs_retention_in_days should_write_logs = var.lambda_enable_logs timeout = var.lambda_function_timeout