Skip to content

Commit

Permalink
feat: Update Python lambda runtime from 3.8 to 3.11 (#225)
Browse files Browse the repository at this point in the history
* feat: Update Python lambda runtime from `3.8` to `3.11`

* fix: Update CI versions to support 3.11
  • Loading branch information
bryantbiggs authored Apr 22, 2024
1 parent 1f70e78 commit b4ef4e4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11

- name: Install pipenv
run: |
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Doing serverless with Terraform? Check out [serverless.tf framework](https://ser

## Supported Features

- AWS Lambda runtime Python 3.8
- AWS Lambda runtime Python 3.11
- Create new SNS topic or use existing one
- Support plaintext and encrypted version of Slack webhook URL
- Most of Slack message options are customizable
Expand All @@ -18,7 +18,6 @@ Doing serverless with Terraform? Check out [serverless.tf framework](https://ser
- AWS CloudWatch LogMetrics Alarms
- AWS GuardDuty Findings


## Usage

```hcl
Expand All @@ -38,11 +37,11 @@ module "notify_slack" {

[Terraform Cloud Agents](https://www.terraform.io/docs/cloud/workspaces/agent.html) are a paid feature, available as part of the Terraform Cloud for Business upgrade package.

This module requires Python 3.8. You can customize [tfc-agent](https://hub.docker.com/r/hashicorp/tfc-agent) to include Python using this sample `Dockerfile`:
This module requires Python 3.11. You can customize [tfc-agent](https://hub.docker.com/r/hashicorp/tfc-agent) to include Python using this sample `Dockerfile`:

```
```Dockerfile
FROM hashicorp/tfc-agent:latest
RUN apt-get -y update && apt-get -y install python3.8 python3-pip
RUN apt-get -y update && apt-get -y install python3.11 python3-pip
ENTRYPOINT ["/bin/tfc-agent"]
```

Expand Down
2 changes: 1 addition & 1 deletion functions/.pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 120
target-version = ['py38']
target-version = ['py311']
include = '\.pyi?$'
verbose = true
exclude = '''
Expand Down
6 changes: 3 additions & 3 deletions functions/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ name = "pypi"
[packages]

[dev-packages]
boto3 = "~=1.20"
botocore = "~=1.23"
boto3 = "~=1.34"
botocore = "~=1.34"
black = "*"
flake8 = "*"
isort = "*"
Expand All @@ -18,7 +18,7 @@ radon = "*"
snapshottest = "~=0.6"

[requires]
python_version = "3.8"
python_version = "3.11"

[scripts]
test = "python3 -m pytest --cov --cov-report=term"
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module "lambda" {
handler = "${local.lambda_handler}.lambda_handler"
source_path = var.lambda_source_path != null ? "${path.root}/${var.lambda_source_path}" : "${path.module}/functions/notify_slack.py"
recreate_missing_package = var.recreate_missing_package
runtime = "python3.8"
runtime = "python3.11"
architectures = var.architectures
timeout = 30
kms_key_arn = var.kms_key_arn
Expand Down

0 comments on commit b4ef4e4

Please sign in to comment.