diff --git a/lambda.tf b/lambda.tf index dcca0e5..8c0d748 100644 --- a/lambda.tf +++ b/lambda.tf @@ -1,7 +1,7 @@ locals { source_code_repo_dir_path = "geff" runtime = "python3.8" - lambda_sg_ids = length(var.lambda_security_group_ids) == 0 ? [aws_security_group.geff_lambda_sg.0.id] : var.lambda_security_group_ids + lambda_sg_ids = var.deploy_lambda_in_vpc && length(var.lambda_security_group_ids) == 0 ? [aws_security_group.geff_lambda_sg.0.id] : var.lambda_security_group_ids } resource "aws_lambda_function" "geff_lambda" { diff --git a/output.tf b/output.tf index 0a3507e..7db2295 100644 --- a/output.tf +++ b/output.tf @@ -25,5 +25,5 @@ output "sns_topic_arn" { output "geff_lambda_sg_ids" { description = "Lambda SG IDs." - value = length(var.lambda_security_group_ids) == 0 ? [aws_security_group.geff_lambda_sg.0.id] : var.lambda_security_group_ids + value = var.deploy_lambda_in_vpc && length(var.lambda_security_group_ids) == 0 ? [aws_security_group.geff_lambda_sg.0.id] : var.lambda_security_group_ids }