-
-
Notifications
You must be signed in to change notification settings - Fork 748
Description
source_path only accepts a single string detailing a directory or filename. Docs detail that a list of strings or a list of maps are supported, but anything other than a string causes a failure.
Expected Behavior
Ability to specify a list of maps to describe what to include in the Lambda package.
Actual Behavior
Failure during external.archive_package step in package.tf; similar failure seen with github-tagged version.
Steps to repro
Run terraform apply with the following config
module "package" {
source = "git::https://github.com/terraform-aws-modules/terraform-aws-lambda.git?ref=v1.3.0"
create_function = false
create_role = false
publish = false
runtime = "python3.8"
source_path = [{
path = "${path.module}/../src",
patterns = [
"!.*/.*\\.txt", # Skip all txt files recursively
]
}]
# Store Package in S3
store_on_s3 = true
s3_bucket = data.aws_s3_bucket.lambda_store.id
build_in_docker = true
}
Where the src directory contains the contents of this repo's examples/fixtures/python3.8-app1 directory.
Failure observed:
Error: Incorrect attribute value type
on .terraform/modules/package/terraform-aws-lambda-1.3.0/package.tf line 9, in data "external" "archive_prepare":
...
Inappropriate value for attribute "query": element "source_path": string required.
Changing source_path = jsonencode(var.source_path) fixed that error, but examination of lambda.py:248 leads me to believe the functionality simply isn't present as the external process is only ever expecting a source_path to be a string detailing a pathname.
I'd be happy to look into extending lambda.py to accept additional options, but if it's something already being worked on, I'd just as soon not spend my time on it.