Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source_path does not support fully-specified option set #12

Closed
tkalus opened this issue Jun 8, 2020 · 3 comments · Fixed by #25
Closed

source_path does not support fully-specified option set #12

tkalus opened this issue Jun 8, 2020 · 3 comments · Fixed by #25

Comments

@tkalus
Copy link

tkalus commented Jun 8, 2020

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.

@antonbabenko
Copy link
Member

Hi @tkalus !

You are right that this functionality is not there. We have been reworking & finishing it up after README was written (README Driven Development is action).

Thanks for proposing help with this, but we don't need it for this issue because it is almost done, and will be released later today or tomorrow.

@antonbabenko
Copy link
Member

v1.10.0 has been just released with rather complete support for source_path values and Python.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants