In our GitOps ecosystem we use Weaveworks FluxCD and Terraform Controller to manage AWS resources using Terraform code. Recently, we wanted to deploy a few Python Lambda functions using the same GitOps workflow. The Lambda function code was stored in a separate subdirectory alongside the Terraform code that provisions the Lambda function. I attempted various methods to copy the Python code from the subdirectory into the Lambda function, but none were successful. Could you provide a working example of how to achieve this please?
source = "terraform-aws-modules/lambda/aws"
publish = true
function_name = "my-test-lambda1"
description = "test lambda function"
handler = "index.lambda_handler"
runtime = "python3.8"
source_path = "../code/lambda.py"
tags = {
Name = "my-test-lambda1"
}
}
Error: exec: "python3": executable file not found in $PATH
Warning TFExecPlanFailed 10s tf-controller error running Plan: rpc error: code = Internal desc = exit status 1
Error: External Program Lookup Failed
with module.lambda_function.data.external.archive_prepare[0],
on .terraform/modules/lambda_function/package.tf line 10, in data "external" "archive_prepare":
10: program = [local.python, "${path.module}/package.py", "prepare"]