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
909 stars 682 forks source link

poetry_install-option fails with ERROR: Hashes are required in --require-hashes mode #469

Closed villekr closed 1 year ago

villekr commented 1 year ago

Description

Deployment and deployed lambda function works as expected when I use 'source_path' with 'pip_requirements'. But with 'source_path' and 'poetry_install' I get the following error:

Collecting aioboto3==11.2.0
│   Using cached aioboto3-11.2.0-py3-none-any.whl (32 kB)
│ ERROR: Hashes are required in --require-hashes mode, but they are missing
│ from some requirements

pyproject.toml contains the following

[tool.poetry.dependencies]
python = "^3.10"
aioboto3 = "11.2.0"

Versions

Reproduction Code [Required]

My module definition is the following:

module "python_lambda_function" {
  source = "terraform-aws-modules/lambda/aws"

  function_name = join("-", [var.env, var.prefix, "lambda"])
  description   = "Python Lambda Function"

  handler = "lambda_function.lambda_handler"
  architectures = ["arm64"]
  runtime = "python3.10"
  timeout = "60"

  publish       = true

  # use Poetry and pyproject.toml
  source_path = [
    "../lang/python",
    {
      poetry_install = true
    }
  ]
  # use pip and requirements.txt
#  source_path = [
#    "../lang/python/lambda",
#    {
#      pip_requirements = "../lang/python/lambda/requirements.txt"
#    }
#  ]

  store_on_s3 = true
  s3_bucket   = aws_s3_bucket.this.bucket
}

Steps to reproduce the behavior:

No (but I'm using terragrunt for deployment) Yes 'terragrunt apply' fails ## Expected behavior

Actual behavior

Terminal Output Screenshot(s)

Additional context

Here it's stated that '--without-hashes' should be added to poetry export. https://github.com/python-poetry/poetry/issues/3472

villekr commented 1 year ago

After taking a more closer look to examples in repository I got my code also working. There were couple of reasons:

Nice and easy once got it working.

github-actions[bot] commented 1 year ago

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.