terraform-aws-modules / terraform-aws-lambda

Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless combinations 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws
Apache License 2.0
934 stars 692 forks source link

Creating Lambda function with container #647

Open praveenkrsha opened 1 day ago

praveenkrsha commented 1 day ago

Versions

Expected behavior

module "lambda" { for_each = var.lambda_configs

source = "terraform-aws-modules/lambda/aws" version = "7.14.0"

function_name = each.key package_type = "Image" image_uri = local.image_uris[each.key]

memory_size = each.value.memory_size timeout = each.value.timeout

Automatically create IAM role for Lambda function

role_name = data.aws_iam_role.lambda_exec_role.name

}

Actual behavior

│ Error: External Program Execution Failed │ │ with module.lambda["swat-terra-create-function-pks"].data.external.archive_prepare[0], │ on .terraform/modules/lambda/package.tf line 10, in data "external" "archive_prepare": │ 10: program = [local.python, "${path.module}/package.py", "prepare"] │ │ The data source received an unexpected error while attempting to execute │ the program. │ │ Program: /usr/bin/python3 │ Error Message: Could not locate source_path "null". Paths are relative to │ directory where terraform plan is being run │ ("/builds/swisscom/servicenow/iaws_iac/swisscom-terraform/perm-infra/modules/lambda") │ │ State: exit status 1 ╵ ╷ │ Error: External Program Execution Failed │ │ with module.lambda["swat-terra-create-test-function-pks"].data.external.archive_prepare[0], │ on .terraform/modules/lambda/package.tf line 10, in data "external" "archive_prepare": │ 10: program = [local.python, "${path.module}/package.py", "prepare"] │ │ The data source received an unexpected error while attempting to execute │ the program. │ │ Program: /usr/bin/python3 │ Error Message: Could not locate source_path "null". Paths are relative to │ directory where terraform plan is being run │ ("/builds/swisscom/servicenow/iaws_iac/swisscom-terraform/perm-infra/modules/lambda") │ │ State: exit status 1 ╵ Cleaning up project directory and file based variables 00:01 ERROR: Job failed: command terminated with exit code 1

Terminal Output Screenshot(s)

│ Error: External Program Execution Failed │ │ with module.lambda["swat-terra-create-function-pks"].data.external.archive_prepare[0], │ on .terraform/modules/lambda/package.tf line 10, in data "external" "archive_prepare": │ 10: program = [local.python, "${path.module}/package.py", "prepare"] │ │ The data source received an unexpected error while attempting to execute │ the program. │ │ Program: /usr/bin/python3 │ Error Message: Could not locate source_path "null". Paths are relative to │ directory where terraform plan is being run │ ("/builds/example/example/iaws_iac/example-terraform/perm-infra/modules/lambda") │ │ State: exit status 1 ╵ ╷ │ Error: External Program Execution Failed │ │ with module.lambda["swat-terra-create-test-function-pks"].data.external.archive_prepare[0], │ on .terraform/modules/lambda/package.tf line 10, in data "external" "archive_prepare": │ 10: program = [local.python, "${path.module}/package.py", "prepare"] │ │ The data source received an unexpected error while attempting to execute │ the program. │ │ Program: /usr/bin/python3 │ Error Message: Could not locate source_path "null". Paths are relative to │ directory where terraform plan is being run │ ("/builds/example/example/iaws_iac/example-terraform/perm-infra/modules/lambda") │ │ State: exit status 1 ╵ Cleaning up project directory and file based variables 00:01 ERROR: Job failed: command terminated with exit code 1

Additional context

mulvaney commented 8 hours ago

Try adding create_package = false so it skips creating the package.