1 Antwort
- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
4
you can use the filename parameter to specify a dummy source file for the function
like the following
resource "aws_lambda_function" "my_lambda" {
function_name = "my-lambda-function"
role = aws_iam_role.lambda_role.arn
handler = "index.handler"
runtime = "nodejs14.x"
filename = "/dev/null"
source_code_hash = "0" # Required to bypass source_code_hash validation when no source code is specified
}
Once you've created the Lambda function in your infrastructure repository, you can then reference it in your application repository using the function's ARN. You can use a data source to look up the ARN by function name:
data "aws_lambda_function" "my_lambda" {
function_name = "my-lambda-function"
}
resource "aws_lambda_alias" "my_alias" {
name = "my-lambda-alias"
function_name = data.aws_lambda_function.my_lambda.arn
function_version = "$LATEST"
}
hope this helps to you
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor 10 Monaten
- AWS OFFICIALAktualisiert vor 3 Jahren
- AWS OFFICIALAktualisiert vor 3 Jahren
- AWS OFFICIALAktualisiert vor 2 Jahren
Hi, I have tried this and it works if we do terraform plan, but its not working when applying it
│ Error: creating Lambda Function (): operation error Lambda: CreateFunction, https response error StatusCode: 400, RequestID: 00000000-0000-0000-0000-000000000, InvalidParameterValueException: Uploaded file must be a non-empty zip