terraform-aws-modules/terraform-aws-lambda

Module 'os' has no attribute 'exists'

Closed this issue · 5 comments

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

⚠️ 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

  • Module version [Required]: 7.2.4

  • Terraform version:

Terraform v1.7.5
on linux_amd64

  • Provider version(s):
  • provider registry.terraform.io/hashicorp/archive v2.4.0
  • provider registry.terraform.io/hashicorp/external v2.3.3
  • provider registry.terraform.io/hashicorp/local v2.4.0
  • provider registry.terraform.io/hashicorp/null v3.2.2

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

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

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

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

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.