terraform-aws-lambda-builder icon indicating copy to clipboard operation
terraform-aws-lambda-builder copied to clipboard

upgrade to python 3

Open mmerickel opened this issue 2 years ago • 4 comments

Current module does not work any longer on macOS 12.3 which removed the python command. Need to update to use python3 which should work universally across most systems via PEP 394.

mmerickel avatar Apr 05 '22 03:04 mmerickel

I guess just as a quick followup I switched over to https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws/latest instead of this package and found that it was more up to date and feature compatible for my use cases incase it helps anyone else.

mmerickel avatar Apr 06 '22 21:04 mmerickel

Thanks, I'll have to read PEP 394 and see what makes sense. The actual Python code used in this module is compatible with Python 2 and 3 so I'd prefer to support both if it's not difficult.

The main reason one might use this module over https://registry.terraform.io/modules/terraform-aws-modules/lambda/aws/latest is that this module doesn't require any of the build toolchain (pip/npm/go/etc) or Docker to be available on the machine running Terraform. The Lambda package gets built inside a Lambda or CodeBuild environment.

raymondbutcher avatar Apr 07 '22 17:04 raymondbutcher

The actual Python code used in this module is compatible with Python 2 and 3 so I'd prefer to support both if it's not difficult.

Python 2 is very dead so I'd argue against trying to continue supporting it. Regardless, the pep basically calls out that python3 is the command to use for Python 3. Python 2 is not installed by default on most modern operating systems so just switching over to using python3 is the best answer. Alternatively you can try to detect the command but I'd push for just using the python3 command as it will work in the majority of scenarios.

mmerickel avatar Apr 20 '22 17:04 mmerickel

We just had this issue on Terraform Cloud. Fixed by changing python to python3 for the external scripts in a fork of this repo and on terraform-archive-stable.

Happy to raise PRs for the fixes, but I'm unsure if the module should retain backwards compatibility with the python 2 executable.

Thoughts?

jamespamplin avatar May 13 '22 07:05 jamespamplin