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
885 stars 658 forks source link

Module 'os' has no attribute 'exists' #553

Closed petrzjunior closed 3 months ago

petrzjunior commented 3 months ago

Description

When using this module with file upload function, Python error is thrown:

  File "./terraform/.terraform/modules/lambda/package.py", line 317, in close
│     if not os.exists(self._tmp_filename):
│ AttributeError: module 'os' has no attribute 'exists'. Did you mean: '_exists'?

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

Terraform v1.7.5 on linux_amd64

Reproduction Code [Required]

Steps to reproduce the behavior:

module "lambda_nautilus_inspector_sbom_create" {
  source  = "terraform-aws-modules/lambda/aws"
  version = "7.2.4"

  function_name = "lambda"
  handler       = "test.handler"
  runtime       = "nodejs20.x"
  source_path   = "${path.module}/test.js"
}

Expected behavior

Call os.path.exists probably.

Actual behavior

Calls os.exists which does not exist in Python.

Terminal Output Screenshot(s)

Additional context

lociko commented 3 months ago

Added a PR: https://github.com/terraform-aws-modules/terraform-aws-lambda/pull/554/files

hugree commented 3 months ago

the fix looks good. how come the previous version did not get a PR? :)

MeMstudios commented 3 months ago

This needs to go into a release, correct? We're still pulling down the code with the error.

lociko commented 3 months ago

We can now close the issue as the release process has been completed.

github-actions[bot] commented 2 months 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.