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

Example package_with_pip_requirements_in_docker fails on Windows 10 #142

Open
sebastianmacarescu opened this issue Apr 9, 2021 · 8 comments

Comments

@sebastianmacarescu
Copy link

Description

Trying to deploy the example package_with_pip_requirements_in_docker using Windows fails
Error message:
zip: Error during zip archive creation Traceback (most recent call last): File ".terraform/modules/terraform-aws-redis-cleanup.redis_cleanup/package.py", line 1137, in build_command bpm.execute(build_plan, zs, query) File ".terraform/modules/terraform-aws-redis-cleanup.redis_cleanup/package.py", line 767, in execute with install_pip_requirements(query, pip_requirements) as rd: File "C:\Python3.7\lib\contextlib.py", line 112, in __enter__ return next(self.gen) File ".terraform/modules/terraform-aws-redis-cleanup.redis_cleanup/package.py", line 888, in install_pip_requirements chown_mask = '{}:{}'.format(os.getuid(), os.getgid()) AttributeError: module 'os' has no attribute 'getuid'

https://github.com/terraform-aws-modules/terraform-aws-lambda/blob/master/package.py#L888

According to this: https://docs.python.org/3.8/library/os.html#os.getgid
these 2 functions are available only on Linux. Basically if you run windows you can deploy only lambdas with non native python requirements.

Versions

  • Terraform: v0.13.6
  • Provider(s):
  • provider registry.terraform.io/-/aws v3.36.0
  • provider registry.terraform.io/hashicorp/aws v3.36.0
  • provider registry.terraform.io/hashicorp/external v2.1.0
  • provider registry.terraform.io/hashicorp/local v2.1.0
  • provider registry.terraform.io/hashicorp/null v3.1.0
  • provider registry.terraform.io/hashicorp/random v3.1.0
  • Module: 1.45.0

Reproduction

Just try to deploy like in package_with_pip_requirements_in_docker example from a windows 10 machine

Expected behavior

Use docker to compile python dependencies

Actual behavior

Fails

@antonbabenko
Copy link
Member

Thanks for the report, it is good to know that it doesn't work on Windows 10. I don't think we have ever run this module on Windows.

PR fixing this is very much welcome!

@sassdavid
Copy link

is there any kind of plan to support this?

@Macilias
Copy link

Same here:

│ Error: local-exec provisioner error
│
│   with module.transform-rolling-continuous-intraday-forecast.module.lambda.null_resource.archive[0],
│   on .terraform\modules\transform-rolling-continuous-intraday-forecast.lambda\package.tf line 67, in resource "null_resource" "archive":
│   67:   provisioner "local-exec" {
│
│ Error running command 'builds\ce92b03d4a0f1bd002555f03392d9f74b290af563877fcbde94e57c2fb7f0639.plan.json': exit status 1. Output: zip: creating
│ 'builds\ce92b03d4a0f1bd002555f03392d9f74b290af563877fcbde94e57c2fb7f0639.zip' archive
│ > docker images '--format={{.ID}}' public.ecr.aws/sam/build-python3.10
│ Installing python requirements: ./../../../../processing/transform-rolling-continuous-intraday-forecast/requirements.txt
│ > mktemp -d terraform-aws-lambda-XXXXXXXX # 'C:\Users\morit\AppData\Local\Temp\terraform-aws-lambda-oblqrfv3'
│ > cd 'C:\Users\morit\AppData\Local\Temp\terraform-aws-lambda-oblqrfv3'
│ zip: Error during zip archive creation
│ Traceback (most recent call last):
│   File "C:\Eigene Daten\Studium\TUM\4. Semester\Masterarbeit\suena\research-and-development\suena\terraform\environments\stage\2-data-fetcher\.terraform\modules\transform-rolling-continuous-intraday-forecast.lambda\package.py", line 1516, in build_command
│     bpm.execute(build_plan, zs, query)
│   File "C:\Eigene Daten\Studium\TUM\4. Semester\Masterarbeit\suena\research-and-development\suena\terraform\environments\stage\2-data-fetcher\.terraform\modules\transform-rolling-continuous-intraday-forecast.lambda\package.py", line 859, in execute
│     with install_pip_requirements(query, pip_requirements, tmp_dir) as rd:
│   File "C:\Users\morit\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 137, in __enter__
│     return next(self.gen)
│            ^^^^^^^^^^^^^^
│   File "C:\Eigene Daten\Studium\TUM\4. Semester\Masterarbeit\suena\research-and-development\suena\terraform\environments\stage\2-data-fetcher\.terraform\modules\transform-rolling-continuous-intraday-forecast.lambda\package.py", line 999, in install_pip_requirements
│     chown_mask = '{}:{}'.format(os.getuid(), os.getgid())
│                                 ^^^^^^^^^
│ AttributeError: module 'os' has no attribute 'getuid'

@Trickels
Copy link

I have als this problem. Could you please fix this bug?

@EAlf91
Copy link

EAlf91 commented Jan 12, 2024

same here unfortunately

@antonbabenko
Copy link
Member

PR fixing this is very much welcome!

Still waiting for the PR :)

@antonbabenko
Copy link
Member

PS: You should be using WSL

@Akatroj
Copy link

Akatroj commented Feb 25, 2024

terraform for aws lambda on windows is literally broken for 3 years and nobody cares.

I love open source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants