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

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

Closed
villekr opened this issue Jun 4, 2023 · 2 comments

Comments

@villekr
Copy link

villekr commented Jun 4, 2023

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"
  • [x ] ✋ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: 4.18.0

  • Terraform version:
    Terraform v1.4.6
    on darwin_arm64

  • Provider version(s):

  • provider registry.terraform.io/hashicorp/aws v5.1.0
  • provider registry.terraform.io/hashicorp/external v2.3.1
  • provider registry.terraform.io/hashicorp/local v2.4.0
  • provider registry.terraform.io/hashicorp/null v3.2.1
  • provider registry.terraform.io/hashicorp/random v3.5.1

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.
python-poetry/poetry#3472

@villekr
Copy link
Author

villekr commented Jun 5, 2023

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

  • For some reason my system poetry had fallen back to an ancient 1.1.12 version. Updated to latest poetry 1.5.1 and regenerated poetry.lock.
  • I then created lambda layer and then lambda function (python), which referenced to lambda layer.

Nice and easy once got it working.

@villekr villekr closed this as completed Jun 5, 2023
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

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 Jul 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant